Source code of Windows XP (NT5)
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.

123 lines
4.3 KiB

  1. # bldfiles.pl written by v-michka, 15 Dec 2000
  2. # Copyright (c) 2000-2001, Microsoft Corporation All rights reserved.
  3. #
  4. # This Perl script will take api.lst, the list of APIs to wrap, and it
  5. # will build the Unicode list of files, the fixaw-generated list, and
  6. # the DEF file. This allow new APIs to be added by making one change in
  7. # api.lst and calling it a day.
  8. #
  9. # NOTE: It has been a while since I have built a Perl script, do not make fun of it!
  10. # declares for local variables
  11. local( $stLine );
  12. local( $stWLine );
  13. local( $stALine );
  14. local( $stAWLine );
  15. local( $dllIdx );
  16. local( $stDllName );
  17. local( $stDllMap );
  18. local( $stFuncMap );
  19. local( $iUndecorated );
  20. local( $stBuildDir );
  21. $stBuildDir = "obj\\i386\\";
  22. # Open the api list file and read it in
  23. open (SRC, "api.lst") || die( "Can't open 'api.lst'\n" );
  24. # Open all the files we will be writing out
  25. unlink ("unicows.lst");
  26. open (hUni, ">" . $stBuildDir . "unicows.lst") || die( "Can't open 'unicows.lst'\n" );
  27. unlink ("fixaw.h");
  28. open (hFix, ">" . $stBuildDir . "fixaw.h") || die( "Can't open 'fixaw.h'\n" );
  29. unlink ("unicows.def");
  30. open (hDef, ">unicows.def") || die( "Can't open 'unicows.def'\n" );
  31. # heeder for the DEF file
  32. print hDef "EXPORTS\n";
  33. $dllIdx = -1;
  34. # Read it in
  35. while (<SRC>)
  36. {
  37. $stLine = $_;
  38. if (substr($stLine,0,1) eq ";")
  39. {
  40. # comment line: must be a dll name
  41. $dllIdx = $dllIdx + 1;
  42. $stDllName = substr($stLine,1);
  43. $stDllName =~ tr/\n/ /;
  44. }
  45. else
  46. {
  47. #non-comment line: by convention, this is a function name in "funcname, argcount" format
  48. # find out if this is a non-thunking call. "index" returns -1 if the string is not found
  49. # the stUndecorated var is a <cr> delimited list of undecorated functions
  50. $stUndecorated = "CallWindowProcA\n";
  51. $stUndecorated = $stUndecorated . "DdeConnect\n";
  52. $stUndecorated = $stUndecorated . "DdeConnectList\n";
  53. $stUndecorated = $stUndecorated . "DdeQueryConvInfo\n";
  54. $stUndecorated = $stUndecorated . "EnumClipboardFormats\n";
  55. $stUndecorated = $stUndecorated . "EnableWindow\n";
  56. $stUndecorated = $stUndecorated . "EnumPropsA\n";
  57. $stUndecorated = $stUndecorated . "EnumPropsExA\n";
  58. $stUndecorated = $stUndecorated . "FreeContextBuffer\n";
  59. $stUndecorated = $stUndecorated . "GetClipboardData\n";
  60. $stUndecorated = $stUndecorated . "GetCPInfo\n";
  61. $stUndecorated = $stUndecorated . "GetMessageA\n";
  62. $stUndecorated = $stUndecorated . "GetProcAddress\n";
  63. $stUndecorated = $stUndecorated . "GetPropA\n";
  64. $stUndecorated = $stUndecorated . "GetWindowLongA\n";
  65. $stUndecorated = $stUndecorated . "IsClipboardFormatAvailable\n";
  66. $stUndecorated = $stUndecorated . "IsDialogMessageA\n";
  67. $stUndecorated = $stUndecorated . "IsValidCodePage\n";
  68. $stUndecorated = $stUndecorated . "IsTextUnicode\n";
  69. $stUndecorated = $stUndecorated . "IsWindowUnicode\n";
  70. $stUndecorated = $stUndecorated . "RemovePropA\n";
  71. $stUndecorated = $stUndecorated . "SetPropA\n";
  72. $stUndecorated = $stUndecorated . "SetWindowLongA\n";
  73. $stUndecorated = $stUndecorated . "SHChangeNotify\n";
  74. $stUndecorated = $stUndecorated . "WideCharToMultiByte\n";
  75. $stUndecorated = $stUndecorated . "MultiByteToWideChar\n";
  76. if(index($stUndecorated, $stLine) != -1)
  77. {
  78. # Handle NON-thunking calls that are wrapped
  79. # print to unicows.lst
  80. print hUni $stLine;
  81. # munge and print to unicows.def
  82. $stLine =~ tr/\n//d;
  83. print hDef $stLine . "=Godot" . $stLine . " PRIVATE\n";
  84. }
  85. else
  86. {
  87. #Handle thunking calls that are wrapped
  88. # print to unicows.lst
  89. $stWLine = $stLine;
  90. $stWLine =~ tr/\n/W/;
  91. print hUni $stWLine . "\n";
  92. # munge and print to unicows.lst
  93. $stALine = $stLine;
  94. $stALine =~ tr/\n/A/;
  95. $stAWLine = $stLine;
  96. $stAWLine =~ tr/\n/W/;
  97. print hFix "#define " . $stAWLine . "A " . $stALine . "\n";
  98. # munge and print to unicows.def
  99. print hDef $stWLine . "=Godot" . $stWLine . " PRIVATE\n";
  100. }
  101. }
  102. }
  103. # close all the files up now
  104. close (SRC);
  105. close (hUni);
  106. close (hFix);
  107. close (hDef);