]>
Commit | Line | Data |
---|---|---|
28f540f4 RM |
1 | # Icky intimate knowledge of MiG output. |
2 | ||
3 | BEGIN { print "/* This file is generated by shortcut.awk. */"; | |
c1b7586c | 4 | print "#include <mach-shortcuts-hidden.h>"; |
28f540f4 RM |
5 | echo=1; |
6 | inproto=0; proto=""; arglist=""; | |
7 | } | |
8 | ||
9 | $1 == "LINTLIBRARY" { print "#include <mach.h>"; next } | |
10 | ||
820e7d0b RM |
11 | $1 == "weak_alias" { next } |
12 | ||
28f540f4 RM |
13 | # Copy the first line of the definition, but |
14 | # replace the function name (RPC) with CALL. | |
15 | $NF == rpc \ | |
16 | { | |
17 | for (i = 1; i < NF; ++i) printf "%s ", $i; | |
18 | print call; | |
19 | next; | |
20 | } | |
21 | ||
22 | # Collect the lines of the prototype in PROTO, and extract the parameter | |
23 | # names into ARGLIST. | |
24 | NF == 1 && $1 == ")" { inproto=0 } | |
25 | inproto { proto = proto $0; | |
26 | arg = $NF; | |
27 | gsub(/[^a-zA-Z0-9_,]/, "", arg); | |
28 | arglist = arglist arg; | |
29 | } | |
30 | NF == 1 && $1 == "(" { inproto=1 } | |
31 | ||
32 | /^{$/ { echo=0; } | |
33 | ||
34 | echo == 1 { print $0; } | |
35 | ||
9ce8b3c8 | 36 | /^}$/ && proto != "" \ |
28f540f4 RM |
37 | { |
38 | print "{"; | |
39 | print " kern_return_t err;"; | |
40 | print " extern kern_return_t " syscall " (" proto ");"; | |
958f803f | 41 | print " extern kern_return_t " rpc " (" proto ");"; |
28f540f4 RM |
42 | print " err = " syscall " (" arglist ");"; |
43 | print " if (err == MACH_SEND_INTERRUPTED)"; | |
44 | print " err = " rpc " (" arglist ");"; | |
45 | print " return err;" | |
46 | print "}"; | |
958f803f | 47 | print "weak_alias (" call ", " alias ")"; |
c1b7586c | 48 | print "libc_hidden_def (" call ")"; |
958f803f RM |
49 | # Declare RPC so the weak_alias that follows will work. |
50 | print "extern __typeof (" call ") " rpc ";"; | |
28f540f4 RM |
51 | echo = 1; |
52 | } |