diff options
author | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
commit | 5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch) | |
tree | 4470480d904b65cf14ca524f96f79eca818c3eaf /REORG.TODO/mach/shortcut.awk | |
parent | 199fc19d3aaaf57944ef036e15904febe877fc93 (diff) | |
download | glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.gz glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.xz glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.zip |
Prepare for radical source tree reorganization. zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage directory, REORG.TODO, except for files that will certainly still exist in their current form at top level when we're done (COPYING, COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which are moved to the new directory OldChangeLogs, instead), and the generated file INSTALL (which is just deleted; in the new order, there will be no generated files checked into version control).
Diffstat (limited to 'REORG.TODO/mach/shortcut.awk')
-rw-r--r-- | REORG.TODO/mach/shortcut.awk | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/REORG.TODO/mach/shortcut.awk b/REORG.TODO/mach/shortcut.awk new file mode 100644 index 0000000000..ea283d49ba --- /dev/null +++ b/REORG.TODO/mach/shortcut.awk @@ -0,0 +1,50 @@ +# Icky intimate knowledge of MiG output. + +BEGIN { print "/* This file is generated by shortcut.awk. */"; + echo=1; + inproto=0; proto=""; arglist=""; + } + +$1 == "LINTLIBRARY" { print "#include <mach.h>"; next } + +$1 == "weak_alias" { next } + +# 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; } + +/^}$/ && proto != "" \ + { + print "{"; + print " kern_return_t err;"; + print " extern kern_return_t " syscall " (" proto ");"; + print " extern kern_return_t " rpc " (" proto ");"; + print " err = " syscall " (" arglist ");"; + print " if (err == MACH_SEND_INTERRUPTED)"; + print " err = " rpc " (" arglist ");"; + print " return err;" + print "}"; + print "weak_alias (" call ", " alias ")"; + # Declare RPC so the weak_alias that follows will work. + print "extern __typeof (" call ") " rpc ";"; + echo = 1; + } |