1995-02-18 01:27:10 +00:00
|
|
|
# Icky intimate knowledge of MiG output.
|
|
|
|
|
|
|
|
BEGIN { print "/* This file is generated by shortcut.awk. */";
|
2018-06-16 00:19:47 +00:00
|
|
|
print "#include <mach-shortcuts-hidden.h>";
|
1995-02-18 01:27:10 +00:00
|
|
|
echo=1;
|
|
|
|
inproto=0; proto=""; arglist="";
|
|
|
|
}
|
|
|
|
|
|
|
|
$1 == "LINTLIBRARY" { print "#include <mach.h>"; next }
|
|
|
|
|
2005-08-08 20:52:23 +00:00
|
|
|
$1 == "weak_alias" { next }
|
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
# Copy the first line of the definition, but
|
|
|
|
# replace the function name (RPC) with CALL.
|
|
|
|
$NF == rpc \
|
|
|
|
{
|
|
|
|
for (i = 1; i < NF; ++i) printf "%s ", $i;
|
|
|
|
print call;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Collect the lines of the prototype in PROTO, and extract the parameter
|
|
|
|
# names into ARGLIST.
|
|
|
|
NF == 1 && $1 == ")" { inproto=0 }
|
|
|
|
inproto { proto = proto $0;
|
|
|
|
arg = $NF;
|
|
|
|
gsub(/[^a-zA-Z0-9_,]/, "", arg);
|
|
|
|
arglist = arglist arg;
|
|
|
|
}
|
|
|
|
NF == 1 && $1 == "(" { inproto=1 }
|
|
|
|
|
|
|
|
/^{$/ { echo=0; }
|
|
|
|
|
|
|
|
echo == 1 { print $0; }
|
|
|
|
|
2002-02-18 01:50:52 +00:00
|
|
|
/^}$/ && proto != "" \
|
1995-02-18 01:27:10 +00:00
|
|
|
{
|
|
|
|
print "{";
|
|
|
|
print " kern_return_t err;";
|
|
|
|
print " extern kern_return_t " syscall " (" proto ");";
|
1995-07-26 07:10:58 +00:00
|
|
|
print " extern kern_return_t " rpc " (" proto ");";
|
1995-02-18 01:27:10 +00:00
|
|
|
print " err = " syscall " (" arglist ");";
|
|
|
|
print " if (err == MACH_SEND_INTERRUPTED)";
|
|
|
|
print " err = " rpc " (" arglist ");";
|
|
|
|
print " return err;"
|
|
|
|
print "}";
|
1995-07-26 07:10:58 +00:00
|
|
|
print "weak_alias (" call ", " alias ")";
|
2018-06-16 00:19:47 +00:00
|
|
|
print "libc_hidden_def (" call ")";
|
1995-07-26 07:10:58 +00:00
|
|
|
# Declare RPC so the weak_alias that follows will work.
|
|
|
|
print "extern __typeof (" call ") " rpc ";";
|
1995-02-18 01:27:10 +00:00
|
|
|
echo = 1;
|
|
|
|
}
|