From fdfa8f9ba55edb798cc6ae820b8c732b96f31808 Mon Sep 17 00:00:00 2001 From: bigfoot547 Date: Mon, 27 Nov 2023 23:50:21 -0600 Subject: add some scrolling code and debug stuf --- src/ui/debug.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/ui/debug.c') diff --git a/src/ui/debug.c b/src/ui/debug.c index 6e404a3..5623b97 100644 --- a/src/ui/debug.c +++ b/src/ui/debug.c @@ -51,6 +51,28 @@ struct ui_window_root *ui__check_cast_to_root(void *obj, const char *file, const UMPS__DEBUG_DO_ERROR(obj, file, func, line, UI__WINDOW_TYPE_ROOT); } +int ui__debug_nc_check_int(int in, const char *call, const char *file, const char *func, int line) +{ + if (in == ERR) { + fprintf(stderr, "!!!!!\n!!!!!\n!!!!! UMPS checked ncurses call \"%s\" failed (returned ERR) at %s:%d %s !!!!!\n!!!!!\n!!!!!\n", + call, file, line, func); + umps_trap; + } + + return in; +} + +WINDOW *ui__debug_nc_check_ptr(WINDOW *ptr, const char *call, const char *file, const char *func, int line) +{ + if (ptr == NULL) { + fprintf(stderr, "!!!!!\n!!!!!\n!!!!! UMPS checked ncurses call \"%s\" failed (returned NULL) at %s:%d %s !!!!!\n!!!!!\n!!!!!\n", + call, file, line, func); + umps_trap; + } + + return ptr; +} + #else /* the file must have a declaration */ -- cgit v1.2.3-70-g09d2