home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_1068 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  2.6 KB  |  160 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __license__ = 'GPL v3'
  5. __copyright__ = '2009, John Schember <john@nachtimwald.com>'
  6. __docformat__ = 'restructuredtext en'
  7. A_CHARS = range(160, 256) + range(130, 136) + range(138, 141) + range(145, 152) + range(153, 157) + [
  8.     159]
  9. Latin_ExtendedA = range(256, 260) + [
  10.     261,
  11.     263,
  12.     268,
  13.     269,
  14.     274,
  15.     275,
  16.     277,
  17.     279,
  18.     281,
  19.     283,
  20.     285,
  21.     287,
  22.     298,
  23.     299,
  24.     301,
  25.     303,
  26.     305,
  27.     321,
  28.     322,
  29.     324,
  30.     328] + range(331, 334) + [
  31.     335,
  32.     337,
  33.     341] + range(345, 348) + [
  34.     351,
  35.     355,
  36.     361,
  37.     363,
  38.     365,
  39.     375,
  40.     378,
  41.     381,
  42.     382]
  43. Latin_ExtendedB = [
  44.     447,
  45.     462,
  46.     464,
  47.     466,
  48.     468,
  49.     481,
  50.     483,
  51.     487,
  52.     491,
  53.     496,
  54.     519,
  55.     541,
  56.     551,
  57.     559,
  58.     563]
  59. IPA_Extensions = [
  60.     593,
  61.     593,
  62.     596,
  63.     601,
  64.     604,
  65.     613,
  66.     618,
  67.     626,
  68.     643,
  69.     649,
  70.     650,
  71.     652,
  72.     655,
  73.     658,
  74.     660,
  75.     668]
  76. Spacing_Modifier_Letters = [
  77.     702,
  78.     703,
  79.     711,
  80.     712,
  81.     716,
  82.     720,
  83.     728,
  84.     729]
  85. Greek_and_Coptic = range(913, 930) + range(931, 938) + range(945, 970) + [
  86.     977,
  87.     989]
  88. Hebrew = range(1488, 1515)
  89. Latin_Extended_Additional = [
  90.     7691,
  91.     7693,
  92.     7703,
  93.     7714,
  94.     7716,
  95.     7717,
  96.     7723,
  97.     7731,
  98.     7735,
  99.     7745,
  100.     7747,
  101.     7749,
  102.     7751,
  103.     7763] + range(7769, 7772) + [
  104.     7777,
  105.     7779,
  106.     7787,
  107.     7789,
  108.     7791,
  109.     7825,
  110.     7827,
  111.     7830,
  112.     7841,
  113.     7885,
  114.     7929]
  115. General_Punctuation = [
  116.     8209,
  117.     8248,
  118.     8253,
  119.     8258]
  120. Arrows = [
  121.     8592,
  122.     8594]
  123. Mathematical_Operators = [
  124.     8706,
  125.     8730,
  126.     8734,
  127.     8741,
  128.     8747,
  129.     8800,
  130.     8852,
  131.     8853,
  132.     8942]
  133. Enclosed_Alphanumerics = [
  134.     9418]
  135. Miscellaneous_Symbols = range(9756, 9793) + range(9794, 9800) + range(9824, 9828) + range(9837, 9840)
  136. Dingbats = [
  137.     10003,
  138.     10016]
  139. Private_Use_Area = range(57344, 57373) + range(57374, 57385) + range(57386, 57426)
  140. Alphabetic_Presentation_Forms = [
  141.     64258,
  142.     64298,
  143.     64299]
  144. U_CHARS = Latin_ExtendedA + Latin_ExtendedB + IPA_Extensions + Spacing_Modifier_Letters + Greek_and_Coptic + Hebrew + Latin_Extended_Additional + General_Punctuation + Arrows + Mathematical_Operators + Enclosed_Alphanumerics + Miscellaneous_Symbols + Dingbats + Private_Use_Area + Alphabetic_Presentation_Forms
  145.  
  146. def unipmlcode(char):
  147.     
  148.     try:
  149.         val = ord(char.encode('cp1252'))
  150.         if val in A_CHARS:
  151.             return '\\a%i' % val
  152.     except:
  153.         pass
  154.  
  155.     val = ord(char)
  156.     if val in U_CHARS:
  157.         return '\\U%04x'.upper() % val
  158.     return '?'
  159.  
  160.