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.

75 lines
1.9 KiB

  1. ### vadimg: this AWK script constructs function prototypes for
  2. ### winuser.h, wingdi.h, and winbase.h.
  3. BEGIN {
  4. fAPI = 0;
  5. fRet = 0;
  6. szRet = "";
  7. }
  8. {
  9. if ($1 == "WINUSERAPI" || $1 == "WINGDIAPI" || $1 == "WINBASEAPI") {
  10. fAPI = 1;
  11. }
  12. if (fAPI) {
  13. if (index($0, ");") != 0) {
  14. fAPI = 0;
  15. }
  16. fArg = 0;
  17. szArg = "";
  18. for(i = 1; i <= NF; i++) {
  19. if ($i == "WINAPI" || $i == "WINAPIV") {
  20. continue;
  21. }
  22. if ($i == "WINUSERAPI" || $i == "WINGDIAPI" || $i == "WINBASEAPI") {
  23. fRet = 1;
  24. continue;
  25. }
  26. if (fRet) {
  27. szRet = $i;
  28. fRet = 0;
  29. continue;
  30. }
  31. if (index($i, "(") != 0) {
  32. sub(/\);/, "", $i);
  33. n = split($i, szrg, /\(/);
  34. if (n == 1) {
  35. printf "%s %s ", szrg[1], szRet;
  36. } else {
  37. if (gsub(/\,/, "", szrg[2]) == 0) {
  38. i++;
  39. }
  40. printf "%s %s %s ", szrg[1], szRet, szrg[2];
  41. }
  42. continue;
  43. }
  44. if (tolower($i) == "const" || $i == "*") {
  45. continue;
  46. }
  47. if (index($i, ",") != 0 || index($i, ")") != 0 || i == NF) {
  48. if (fArg) {
  49. printf "%s ", szArg;
  50. fArg = 0;
  51. } else {
  52. sub(/\);/, "", $i);
  53. sub(/\,/, "", $i);
  54. printf "%s ", $i;
  55. }
  56. } else {
  57. szArg = $i;
  58. fArg = 1;
  59. }
  60. }
  61. if (!fAPI) {
  62. printf "\n";
  63. }
  64. }
  65. }