summaryrefslogtreecommitdiffstats
path: root/private/sdktools/apimon/winapi.awk
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/sdktools/apimon/winapi.awk
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/sdktools/apimon/winapi.awk')
-rw-r--r--private/sdktools/apimon/winapi.awk75
1 files changed, 75 insertions, 0 deletions
diff --git a/private/sdktools/apimon/winapi.awk b/private/sdktools/apimon/winapi.awk
new file mode 100644
index 000000000..7c760c341
--- /dev/null
+++ b/private/sdktools/apimon/winapi.awk
@@ -0,0 +1,75 @@
+### vadimg: this AWK script constructs function prototypes for
+### winuser.h, wingdi.h, and winbase.h.
+BEGIN {
+ fAPI = 0;
+ fRet = 0;
+ szRet = "";
+}
+{
+ if ($1 == "WINUSERAPI" || $1 == "WINGDIAPI" || $1 == "WINBASEAPI") {
+ fAPI = 1;
+ }
+
+ if (fAPI) {
+ if (index($0, ");") != 0) {
+ fAPI = 0;
+ }
+
+ fArg = 0;
+ szArg = "";
+
+ for(i = 1; i <= NF; i++) {
+ if ($i == "WINAPI" || $i == "WINAPIV") {
+ continue;
+ }
+
+ if ($i == "WINUSERAPI" || $i == "WINGDIAPI" || $i == "WINBASEAPI") {
+ fRet = 1;
+ continue;
+ }
+
+ if (fRet) {
+ szRet = $i;
+ fRet = 0;
+ continue;
+ }
+
+ if (index($i, "(") != 0) {
+ sub(/\);/, "", $i);
+
+ n = split($i, szrg, /\(/);
+ if (n == 1) {
+ printf "%s %s ", szrg[1], szRet;
+ } else {
+ if (gsub(/\,/, "", szrg[2]) == 0) {
+ i++;
+ }
+ printf "%s %s %s ", szrg[1], szRet, szrg[2];
+ }
+ continue;
+ }
+
+ if (tolower($i) == "const" || $i == "*") {
+ continue;
+ }
+
+ if (index($i, ",") != 0 || index($i, ")") != 0 || i == NF) {
+ if (fArg) {
+ printf "%s ", szArg;
+ fArg = 0;
+ } else {
+ sub(/\);/, "", $i);
+ sub(/\,/, "", $i);
+ printf "%s ", $i;
+ }
+ } else {
+ szArg = $i;
+ fArg = 1;
+ }
+ }
+
+ if (!fAPI) {
+ printf "\n";
+ }
+ }
+}