From: Jérôme Benoit Date: Mon, 21 Aug 2017 12:46:50 +0000 (+0200) Subject: Implement some basic debug printing function. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=658c6acc5900678d8f2a4a31acb407b027c90f4c;p=Project_algorithmic_C.git Implement some basic debug printing function. Signed-off-by: Jérôme Benoit --- diff --git a/Makefile b/Makefile index 2a3ae22..fd4ca9a 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,7 @@ endif # Putting header files in the source directory is not the purpose of this INCLUDES_PATH variable INCLUDES_PATH := $(INCLUDES_PATH) -I$(LIBRARY_PATH) -CFLAGS := $(CFLAGS) $(CFLAGS_LTO) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG) $(INCLUDES_PATH) +CFLAGS := -DBUILD_TYPE=$(BUILD_TYPE) $(CFLAGS) $(CFLAGS_LTO) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG) $(INCLUDES_PATH) LIBCFLAGS := -fPIC $(CFLAGS) LDFLAGS := $(LDFLAGS) $(LDFLAGS_LTO) $(LDFLAGS_GOLD) $(STRIP_FLAG) LIBLDFLAGS := $(SHLIBLDFLAG) $(LDFLAGS) diff --git a/lib/debug.c b/lib/debug.c index 6532079..e00ce9f 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -19,7 +19,6 @@ #include #include "othello.h" -#include "constants.h" #include "debug.h" void display_array(int base_y, int base_x, unsigned int pawn_array[board_size][board_size]) { @@ -33,6 +32,10 @@ void display_array(int base_y, int base_x, unsigned int pawn_array[board_size][b } } -/* void dbg_mvprintv(int y, int x, ) { - -} */ +#if BUILD_TYPE == debug +void dbg_mvprintv(int y, int x, char* debug_text) { + mvprintw(y, x, debug_text); +} +#else +void dbg_mvprintv(int y, int x, char* debug_text) { } +#endif diff --git a/lib/debug.h b/lib/debug.h index 8d4d3b9..e87809d 100644 --- a/lib/debug.h +++ b/lib/debug.h @@ -16,6 +16,13 @@ * ===================================================================================== */ +#ifndef DEBUG_H +#define DEBUG_H + #include +#include "constants.h" + void display_array(int base_y, int base_x, unsigned int pawn_array[board_size][board_size]); + +#endif /* DEBUG_H */