Copy-edit NEWS and fixup ChangeLog entries.
[glibc.git] / mach / shortcut.awk
blobea283d49ba695671fe924c9844577c4e6e1b94b2
1 # Icky intimate knowledge of MiG output.
3 BEGIN { print "/* This file is generated by shortcut.awk. */";
4 echo=1;
5 inproto=0; proto=""; arglist="";
8 $1 == "LINTLIBRARY" { print "#include <mach.h>"; next }
10 $1 == "weak_alias" { next }
12 # Copy the first line of the definition, but
13 # replace the function name (RPC) with CALL.
14 $NF == rpc \
16 for (i = 1; i < NF; ++i) printf "%s ", $i;
17 print call;
18 next;
21 # Collect the lines of the prototype in PROTO, and extract the parameter
22 # names into ARGLIST.
23 NF == 1 && $1 == ")" { inproto=0 }
24 inproto { proto = proto $0;
25 arg = $NF;
26 gsub(/[^a-zA-Z0-9_,]/, "", arg);
27 arglist = arglist arg;
29 NF == 1 && $1 == "(" { inproto=1 }
31 /^{$/ { echo=0; }
33 echo == 1 { print $0; }
35 /^}$/ && proto != "" \
37 print "{";
38 print " kern_return_t err;";
39 print " extern kern_return_t " syscall " (" proto ");";
40 print " extern kern_return_t " rpc " (" proto ");";
41 print " err = " syscall " (" arglist ");";
42 print " if (err == MACH_SEND_INTERRUPTED)";
43 print " err = " rpc " (" arglist ");";
44 print " return err;"
45 print "}";
46 print "weak_alias (" call ", " alias ")";
47 # Declare RPC so the weak_alias that follows will work.
48 print "extern __typeof (" call ") " rpc ";";
49 echo = 1;