From 076af0f0145b7f924eb32be010311545d039850f Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 26 Aug 2018 08:34:44 +0200 Subject: Link library with a test C program Make a test `includer.c` program that includes the Rust library and calls our `c_run_key_action()` to see if it actually works. Currently it doesn't, we get `(null)` printed to stdout. Add a Makefile with the build command for the C program. cbindgen.toml: Remove `KeyActionResult` from exported types, as the `Option` field it contains caused `gcc` to complain. cocoa_bridge.rs: * Comment out all 'cocoa' crate related code as the 'cocoa' code was interfering with GCC compilation as a result of my not linking to Cocoa frameworks. * Add a new test map definition that corresponds with the one we look for in `includer.c`. parser.rs: Add `#[repr(C)]` to `MapKind` because it needs to be exported in the library and generated into our C header file. --- dome_key_map.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'dome_key_map.h') diff --git a/dome_key_map.h b/dome_key_map.h index 1206d1d..647c6e5 100644 --- a/dome_key_map.h +++ b/dome_key_map.h @@ -12,18 +12,14 @@ typedef enum { Down, } HeadphoneButton; -typedef struct MapKind MapKind; - -typedef struct Option_CString Option_CString; +typedef enum { + Map, + Command, +} MapKind; typedef struct { const char *action; const MapKind *kind; } CKeyActionResult; -typedef struct { - Option_CString action; - MapKind kind; -} KeyActionResult; - const CKeyActionResult *c_run_key_action(const HeadphoneButton *trigger, size_t length); -- cgit v1.2.3