1 # Icky intimate knowledge of MiG output.
3 BEGIN { print "/* This file is generated by shortcut.awk. */";
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.
16 for (i =
1; i
< NF; ++i
) printf "%s ", $i
;
21 # Collect the lines of the prototype in PROTO, and extract the parameter
23 NF ==
1 && $
1 ==
")" { inproto=
0 }
24 inproto
{ proto = proto $
0;
26 gsub(/[^a
-zA
-Z0
-9_
,]/, "", arg
);
27 arglist = arglist arg
;
29 NF ==
1 && $
1 ==
"(" { inproto=
1 }
33 echo ==
1 { print $
0; }
35 /^
}$
/ && proto
!= "" \
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
");";
46 print "weak_alias (" call
", " alias
")";
47 # Declare RPC so the weak_alias that follows will work.
48 print "extern __typeof (" call
") " rpc
";";