From 8b1533db1a9d9af1801221d8b31bb5a700ae928d Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 3 Aug 2017 12:25:56 -0400 Subject: [PATCH 1/1] Improve debugging. --- main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 17a5e43..9cb0497 100644 --- a/main.c +++ b/main.c @@ -1059,10 +1059,18 @@ Lclearobj: return false; #ifdef GDEBUG - printf("Preserve: type1 = %u, id1 = %ld, type2 = %u, id2 = %ld\n", - preserve.word[0].type, preserve.word[0].id, preserve.word[1].type, preserve.word[1].id); - printf("Command: type1 = %u, id1 = %ld, type2 = %u, id2 = %ld\n", - command.word[0].type, command.word[0].id, command.word[1].type, command.word[1].id); + /* Needs to stay synced with enum word_type_t */ + const char *types[] = {"NO_WORD_TYPE", "MOTION", "OBJECT", "ACTION", "NUMERIC"}; + printf("Preserve: type1 = %s, id1 = %ld, type2 = %s, id2 = %ld\n", + types[preserve.word[0].type], + preserve.word[0].id, + types[preserve.word[1].type], + preserve.word[1].id); + printf("Command: type1 = %s, id1 = %ld, type2 = %s, id2 = %ld\n", + types[command.word[0].type], + command.word[0].id, + types[command.word[1].type], + command.word[1].id); #endif /* Handle of objectless action followed by actionless object */ -- 2.31.1