Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test_includes.sh - github.com/facebook/luaffifb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f8bb1dc8d6ef09f632c997ac9472399df4b67e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
make || exit
rm -rf test_includes
mkdir -p test_includes
for f in /usr/include/*.h
do
  gcc -E -c "${f}" > tmp 2>/dev/null
  if [ $? == 0 ]
  then
    echo "${f}";
    lua -e '
      local str = io.read("*a")
      -- remove preprocessor commands eg line directives
      str = str:gsub("#[^\n]*", "")
      -- remove inline function definitions and declarations
      str = str:gsub("extern%s+__inline__", "static")
      str = str:gsub("extern%s+__inline", "static")
      str = str:gsub("static[^;(]+__attribute__%s*%b()", "static ")
      str = str:gsub("static[^;(]+__attribute__%s*%b()", "static ")
      str = str:gsub("static[^;(]+%b()%s*%b{}", "")
      str = str:gsub("static[^;(]+%b()%s*;", "")
      io.write(str)' > "test_includes/`basename $f`" < tmp
    lua -e 'ffi = require("ffi"); ffi.cdef(io.read("*a"))' < "test_includes/`basename $f`"
  fi
done