diff --git a/common/GNUfiles.mk b/common/GNUfiles.mk index 14416f4e..58f901c6 100644 --- a/common/GNUfiles.mk +++ b/common/GNUfiles.mk @@ -3,6 +3,7 @@ CFILES += \ common/areaevents.c \ common/control.c \ + common/debug.c \ common/matrix.c \ common/shouldquit.c diff --git a/common/debug.c b/common/debug.c new file mode 100644 index 00000000..97280b47 --- /dev/null +++ b/common/debug.c @@ -0,0 +1,21 @@ +// 13 may 2016 +#include "../ui.h" +#include "uipriv.h" + +void _implbug(const char *file, const char *line, const char *func, const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + realbug(file, line, func, "POSSIBLE IMPLEMENTATION BUG; CONTACT ANDLABS:\n", format, ap); + va_end(ap); +} + +void _userbug(const char *file, const char *line, const char *func, const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + realbug(file, line, func, "You have a bug: ", format, ap); + va_end(ap); +} diff --git a/common/uipriv.h b/common/uipriv.h index a36be4eb..e39bcf86 100644 --- a/common/uipriv.h +++ b/common/uipriv.h @@ -3,6 +3,7 @@ extern "C" { #endif +#include #include "controlsigs.h" extern uiInitOptions options; @@ -12,6 +13,7 @@ extern void *uiAlloc(size_t, const char *); extern void *uiRealloc(void *, size_t, const char *); extern void uiFree(void *); +extern void realbug(const char *file, const char *line, const char *func, const char *prefix, const char *format, va_list ap); #define _ns2(s) #s #define _ns(s) _ns2(s) extern void _implbug(const char *file, const char *line, const char *func, const char *format, ...); diff --git a/darwin/GNUfiles.mk b/darwin/GNUfiles.mk index 85d89615..1ddbeebc 100644 --- a/darwin/GNUfiles.mk +++ b/darwin/GNUfiles.mk @@ -11,9 +11,9 @@ MFILES += \ darwin/combobox.m \ darwin/control.m \ darwin/datetimepicker.m \ + darwin/debug.m \ darwin/draw.m \ darwin/drawtext.m \ - darwin/debug.m \ darwin/entry.m \ darwin/fontbutton.m \ darwin/group.m \ diff --git a/darwin/debug.m b/darwin/debug.m index ec55a84b..87467add 100644 --- a/darwin/debug.m +++ b/darwin/debug.m @@ -3,7 +3,7 @@ // TODO don't halt on release builds -static void bug(const char *file, const char *line, const char *func, const char *prefix, const char *format, va_list ap) +void realbug(const char *file, const char *line, const char *func, const char *prefix, const char *format, va_list ap) { NSMutableString *str; NSString *formatted; @@ -17,21 +17,3 @@ static void bug(const char *file, const char *line, const char *func, const char [str release]; __builtin_trap(); } - -void _implbug(const char *file, const char *line, const char *func, const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - bug(file, line, func, "POSSIBLE IMPLEMENTATION BUG; CONTACT ANDLABS:\n", format, ap); - va_end(ap); -} - -void _userbug(const char *file, const char *line, const char *func, const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - bug(file, line, func, "You have a bug: ", format, ap); - va_end(ap); -}