1 # Icky intimate knowledge of MiG output.
3 BEGIN { print "/* This file is generated by shortcut.awk. */";
4 print "#include <mach-shortcuts-hidden.h>";
6 inproto=
0; proto=
""; arglist=
"";
9 $
1 ==
"LINTLIBRARY" { print "#include <mach.h>"; next }
11 $
1 ==
"weak_alias" { next }
13 # Copy the first line of the definition, but
14 # replace the function name (RPC) with CALL.
17 for (i =
1; i
< NF; ++i
) printf "%s ", $i
;
22 # Collect the lines of the prototype in PROTO, and extract the parameter
24 NF ==
1 && $
1 ==
")" { inproto=
0 }
25 inproto
{ proto = proto $
0;
27 gsub(/[^a
-zA
-Z0
-9_
,]/, "", arg
);
28 arglist = arglist arg
;
30 NF ==
1 && $
1 ==
"(" { inproto=
1 }
34 echo ==
1 { print $
0; }
36 /^
}$
/ && proto
!= "" \
39 print " kern_return_t err;";
40 print " extern kern_return_t " syscall
" (" proto
");";
41 print " extern kern_return_t " rpc
" (" proto
");";
42 print " err = " syscall
" (" arglist
");";
43 print " if (err == MACH_SEND_INTERRUPTED)";
44 print " err = " rpc
" (" arglist
");";
47 print "weak_alias (" call
", " alias
")";
48 print "libc_hidden_def (" call
")";
49 # Declare RPC so the weak_alias that follows will work.
50 print "extern __typeof (" call
") " rpc
";";