Now those type definitions can be simply loaded without any error, e.g.
luajit daemon/lua/kres-gen.lua
That will be useful for checking them without regenerating them.
local ffi = require('ffi')
--[[ This file is generated by ./kres-gen.sh ]] ffi.cdef[[
+typedef long time_t;
+typedef long __time_t;
+typedef long __suseconds_t;
+struct timeval {
+ __time_t tv_sec;
+ __suseconds_t tv_usec;
+};
typedef struct knot_dump_style knot_dump_style_t;
extern const knot_dump_style_t KNOT_DUMP_STYLE_DEFAULT;
printf -- "local ffi = require('ffi')\n"
printf -- "--[[ This file is generated by ./kres-gen.sh ]] ffi.cdef[[\n"
+# Some system dependencies. TODO: this generated part isn't perfectly portable.
+${CDEFS} ${LIBKRES} types <<-EOF
+ typedef time_t
+ __time_t
+ __suseconds_t
+ struct timeval
+EOF
+
## Various types (mainly), from libknot and libkres
printf "
* Data structures
*/
-/* stdlib */
-typedef long time_t;
-struct timeval {
- time_t tv_sec;
- time_t tv_usec;
-};
struct sockaddr {
uint16_t sa_family;
uint8_t _stub[]; /* Do not touch */