From f9f50f67005617e352eff23468b5798f3c0d647c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 26 Aug 2018 09:27:00 +0200 Subject: cocoa_bridge(run_key_action): Add newline to end of test map group I keep forgetting to add the newline at the end, darn. Wasted a few minutes of my time, but so cool that it's finally working now! The C program now correctly prints the corresponding map. Here's a diff of print debug statements I used to diagnose the problem: diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs index fe65533..9690fe4 100644 --- a/src/cocoa_bridge.rs +++ b/src/cocoa_bridge.rs @@ -68,12 +68,14 @@ pub extern "C" fn c_run_key_action( Some(k) => { match k.action { Some(a) => { + println!("all good"); CKeyActionResult { action: a.as_ptr(), kind: &k.kind, } }, None => { + println!("Action null"); CKeyActionResult { action: ptr::null(), kind: &k.kind, @@ -82,6 +84,7 @@ pub extern "C" fn c_run_key_action( } }, None => { + println!("All null"); CKeyActionResult { action: ptr::null(), kind: ptr::null(), @@ -98,11 +101,17 @@ pub extern "C" fn run_key_action( ) -> Option { let sample_maps = "map k map j -map works!"; +map works! +"; + + println!("{:?}", trigger); + assert!(trigger == &[HeadphoneButton::Play, HeadphoneButton::Down]); // Figure out how to persist this without re-parsing let map_group = MapGroup::parse(sample_maps).unwrap(); + println!("{:?}", map_group.maps); + let map = map_group.maps.get(trigger); let mode = map_group.modes.get(trigger); --- src/cocoa_bridge.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs index fe65533..1f0b693 100644 --- a/src/cocoa_bridge.rs +++ b/src/cocoa_bridge.rs @@ -98,7 +98,8 @@ pub extern "C" fn run_key_action( ) -> Option { let sample_maps = "map k map j -map works!"; +map works! +"; // Figure out how to persist this without re-parsing let map_group = MapGroup::parse(sample_maps).unwrap(); -- cgit v1.2.3