aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-08-28 07:16:46 +0200
committerTeddy Wing2018-08-28 07:16:46 +0200
commit98529aa0bc8d7188cb1ed577e06a576e4096319c (patch)
tree5d942e4786b8be0cc0ff0b1719c0f800d3dcb3f6
parentd610aab64b2505b2ee7cd37be5b3d1b8097c3a64 (diff)
downloaddome-key-map-98529aa0bc8d7188cb1ed577e06a576e4096319c.tar.bz2
cbindgen.toml: Prefix enum variants with enum name
For better namespacing and local context information. Thank goodness 'cbindgen' supports this.
-rw-r--r--cbindgen.toml3
-rw-r--r--dome_key_map.h10
-rw-r--r--includer.c2
3 files changed, 9 insertions, 6 deletions
diff --git a/cbindgen.toml b/cbindgen.toml
index e2a124a..e6404bd 100644
--- a/cbindgen.toml
+++ b/cbindgen.toml
@@ -12,3 +12,6 @@ item_types = ["constants", "globals", "enums", "structs", "unions", "typedefs",
[export.rename]
"run_key_action" = "hello_run"
+
+[enum]
+prefix_with_name = true
diff --git a/dome_key_map.h b/dome_key_map.h
index 647c6e5..6066da0 100644
--- a/dome_key_map.h
+++ b/dome_key_map.h
@@ -7,14 +7,14 @@
#include <stdbool.h>
typedef enum {
- Play,
- Up,
- Down,
+ HeadphoneButton_Play,
+ HeadphoneButton_Up,
+ HeadphoneButton_Down,
} HeadphoneButton;
typedef enum {
- Map,
- Command,
+ MapKind_Map,
+ MapKind_Command,
} MapKind;
typedef struct {
diff --git a/includer.c b/includer.c
index 9a02d22..92a48cd 100644
--- a/includer.c
+++ b/includer.c
@@ -4,7 +4,7 @@
#define SIZE 2
int main() {
- HeadphoneButton trigger[SIZE] = {Play, Down};
+ HeadphoneButton trigger[SIZE] = {HeadphoneButton_Play, HeadphoneButton_Down};
const CKeyActionResult *result = c_run_key_action(trigger, SIZE);
printf("%s", result->action);