Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.2 KiB

  1. #!/usr/bin/perl
  2. #
  3. # unicodepartition_extract.pl
  4. #
  5. # [email protected]
  6. # June 16, 1998
  7. #
  8. # Generates a 64K line output of the form HHHH NNNN, where HHHH is the Unicode
  9. # codepoint in hex, and HHHH is the partition name. The input file is the
  10. # spec HTML file as prepared by michelsu. As of this writing, this file can
  11. # be located at http://ie/specs/secure/trident/text/unicode_partitions.htm
  12. #
  13. # The output of this script file can be analyzed by the associate script
  14. # unicodepartition_analyze.pl. This script will indicate what codepoints are
  15. # multiply defined, and which are not covered.
  16. #
  17. $in = 0;
  18. do
  19. {
  20. $pat = substr <>, 0, 6;
  21. } until $pat eq "<h3>1.";
  22. while (<>)
  23. {
  24. $omit = 0;
  25. if (/^<p class=\"partition\"/)
  26. {
  27. $in = 1;
  28. if (/>(\w{4,4}) ([0-9a-fA-F]{4,4})-([0-9a-fA-F]{4,4})/)
  29. {
  30. $tag = $1;
  31. $rmin = hex($2);
  32. $rmax = hex($3);
  33. }
  34. elsif (/>(\w{4,4}) ([0-9a-fA-F]{4,4})/)
  35. {
  36. $tag = $1;
  37. $rmin = $rmax = hex($2);
  38. }
  39. else
  40. {
  41. $omit = 1;
  42. }
  43. }
  44. elsif ($in)
  45. {
  46. if (/^&nbsp/)
  47. {
  48. if (/nbsp; +([0-9a-fA-F]{4,4})-([0-9a-fA-F]{4,4})/)
  49. {
  50. $rmin = hex($1);
  51. $rmax = hex($2);
  52. }
  53. elsif (/nbsp; +([0-9a-fA-F]{4,4})/)
  54. {
  55. $rmin = $rmax = hex($1);
  56. }
  57. else
  58. {
  59. $omit = 1;
  60. }
  61. }
  62. else
  63. {
  64. if (/^(\w{4,4}) +([0-9a-fA-F]{4,4})-([0-9a-fA-F]{4,4})/)
  65. {
  66. $tag = $1;
  67. $rmin = hex($2);
  68. $rmax = hex($3);
  69. }
  70. elsif (/^(\w{4,4}) +([0-9a-fA-F]{4,4})[ &<]/)
  71. {
  72. $tag = $1;
  73. $rmin = $rmax = hex($2);
  74. }
  75. else
  76. {
  77. $omit = 1;
  78. }
  79. }
  80. }
  81. if ($in && !$omit)
  82. {
  83. for ($r=$rmin; $r<=$rmax; $r+=1)
  84. {
  85. printf("%04x %s\n", $r, $tag);
  86. }
  87. }
  88. $in = 0 if (/\/p>[ \t]*$/);
  89. }