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.

122 lines
3.1 KiB

  1. ##
  2. ## Copyright (c) 2000, Intel Corporation
  3. ## All rights reserved.
  4. ##
  5. ## WARRANTY DISCLAIMER
  6. ##
  7. ## THESE MATERIALS ARE PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  8. ## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  9. ## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  10. ## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
  11. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  12. ## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13. ## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  14. ## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  15. ## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
  16. ## NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE
  17. ## MATERIALS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  18. ##
  19. ## Intel Corporation is the author of the Materials, and requests that all
  20. ## problem reports or change requests be submitted to it directly at
  21. ## http://developer.intel.com/opensource.
  22. ##
  23. #/usr/local/bin/perl -w
  24. $GenDir = shift(@ARGV);
  25. $EmdbDir = shift(@ARGV);
  26. $emdb_inst_num = 0;
  27. open(EMDB, "$EmdbDir/emdb.txt") || die "Can't open emdb.txt\n";
  28. while (<EMDB>)
  29. {
  30. $emdb_inst_num++ if (/^EM_/);
  31. if (/^#/ && /EMDB/ && /Revision:\s*(\d+\.\d+)\s*\$/)
  32. {
  33. $emdb_ver_str = "/*** EMDB version: $1 ***/\n";
  34. }
  35. }
  36. die "Error: No version number found in emdb.txt database\n" if (!$emdb_ver_str);
  37. open(OUT, ">$GenDir/inst_ids.h") || die "Can't open inst_ids.h\n";
  38. open(TAB, "$GenDir/inst_emdb.tab") || die "Can't open inst_emdb.tab\n";
  39. select(OUT);
  40. open(MESSG,"../copyright/external/c_file") || die "Can't open c_file\n";
  41. print <MESSG>;
  42. print "#ifndef _INST_ID_H\n";
  43. print "#define _INST_ID_H\n\n";
  44. print $emdb_ver_str."\n";
  45. print "#ifndef __cplusplus\n\n"; ### C-code enumeration
  46. print "typedef enum Inst_id_e\n";
  47. print "\{\n";
  48. print "EM_INST_NONE = 0,\n";
  49. @inst_lines = <TAB>;
  50. $_ = $inst_lines[0];
  51. /(\w+),/;
  52. $first_id = $1;
  53. print "$first_id = EM_INST_NONE,\n";
  54. for ($i=1; $i<=$#inst_lines; $i++)
  55. {
  56. print "EM_EMDB_INST_LAST = $inst_lines[$emdb_inst_num-1]" if ($i == $emdb_inst_num);
  57. print $inst_lines[$i];
  58. }
  59. print "EM_INST_LAST\n";
  60. print "\} Inst_id_t;\n\n";
  61. print "#else \/* C++ code *\/\n\n";
  62. ### create two equal-sized enumerations
  63. print "typedef unsigned Inst_id_t;\n\n";
  64. print "typedef enum Inst_id_e\n";
  65. print "\{\n";
  66. print "EM_INST_NONE = 0,\n";
  67. print "$first_id = EM_INST_NONE,\n";
  68. $num1 = $#inst_lines>>1;
  69. for ($i=1; $i<$num1; $i++)
  70. {
  71. print "EM_EMDB_INST_LAST = $inst_lines[$emdb_inst_num-1]" if ($i == $emdb_inst_num);
  72. print $inst_lines[$i];
  73. }
  74. print "EM_INST1_LAST\n";
  75. print "\} Inst_id_t1;\n\n";
  76. print "typedef enum Inst_id_e2\n";
  77. print "\{\n";
  78. $inst_lines[$num1] =~ /(\w+),/;
  79. print "$1 = EM_INST1_LAST,\n";
  80. for ($i=$num1+1; $i<=$#inst_lines; $i++)
  81. {
  82. print "EM_EMDB_INST_LAST = $inst_lines[$emdb_inst_num-1]" if ($i == $emdb_inst_num);
  83. print $inst_lines[$i];
  84. }
  85. print "EM_INST_LAST\n";
  86. print "\} Inst_id_t2;\n\n";
  87. print "#endif\n\n";
  88. print "#endif /* _INST_ID_H */\n\n";