-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcdefdb-helper
executable file
·39 lines (31 loc) · 965 Bytes
/
cdefdb-helper
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
# Copyright (C) 2014-2015 Brian Downing. MIT License.
set -e
if [ -z "$1" ]; then
echo Usage: $0 '(cdef_bodies.c|-)' '<cc args...>' >&2
exit 1
fi
lj_cdefdb_dir=${LJ_CDEFDB_DIR:-$(luajit -e "print(require('cdefdb.config').dir)")}
file="$1"; shift
. "$lj_cdefdb_dir"/functions.sh
infile="/tmp/lj-cdefdb-helper$$.c"
trap "rm -f $infile" 0
cat >"$infile" <<EOF
typedef __builtin_va_list __gnuc_va_list;
typedef __gnuc_va_list va_list;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
typedef __SIZE_TYPE__ size_t;
typedef __WCHAR_TYPE__ wchar_t;
typedef __INT8_TYPE__ int8_t;
typedef __INT16_TYPE__ int16_t;
typedef __INT32_TYPE__ int32_t;
typedef __INT64_TYPE__ int64_t;
typedef __UINT8_TYPE__ uint8_t;
typedef __UINT16_TYPE__ uint16_t;
typedef __UINT32_TYPE__ uint32_t;
typedef __UINT64_TYPE__ uint64_t;
typedef __INTPTR_TYPE__ intptr_t;
typedef __UINTPTR_TYPE__ uintptr_t;
EOF
cat "$file" >>"$infile"
run_in_ljclang ../cdefdb-helper.lua "$infile" "$@"