Debian Codegraph @

texk/web2c/luatexdir/luaffi/test_includes.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 makescip-shell system . . make. || exit
3 rmscip-shell system . . rm. -rf test_includes
4 mkdirscip-shell system . . mkdir. -p test_includes
5 for f in /usr/include/*.h
6 do
7 gccscip-shell system . . gcc. -E -c "${f}" > tmp 2>/dev/nullscip-shell filesystem . . `/dev/null`.
8 if [scip-shell system . . `[`. $? == 0 ]
9 then
10 echoscip-shell system . . echo. "${f}";
11 lua -e '
12 local str = io.read("*a")
13 -- remove preprocessor commands eg line directives
14 str = str:gsub("#[^\n]*", "")
15 -- remove inline function definitions and declarations
16 str = str:gsub("extern%s+__inline__", "static")
17 str = str:gsub("extern%s+__inline", "static")
18 str = str:gsub("static[^;(]+__attribute__%s*%b()", "static ")
19 str = str:gsub("static[^;(]+__attribute__%s*%b()", "static ")
20 str = str:gsub("static[^;(]+%b()%s*%b{}", "")
21 str = str:gsub("static[^;(]+%b()%s*;", "")
22 io.write(str)' > "test_includes/`basenamescip-shell system . . basename. $f`" < tmp
23 lua -e 'ffi = require("ffi"); ffi.cdef(io.read("*a"))' < "test_includes/`basenamescip-shell system . . basename. $f`"
24 fi
25 done