Cleaned up the debugging functions slightly. Now to convert the other backends.

This commit is contained in:
Pietro Gagliardi 2016-05-13 20:20:15 -04:00
parent d52c92d2f8
commit 59eebb1e48
5 changed files with 26 additions and 20 deletions

View File

@ -3,6 +3,7 @@
CFILES += \
common/areaevents.c \
common/control.c \
common/debug.c \
common/matrix.c \
common/shouldquit.c

21
common/debug.c Normal file
View File

@ -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);
}

View File

@ -3,6 +3,7 @@
extern "C" {
#endif
#include <stdarg.h>
#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, ...);

View File

@ -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 \

View File

@ -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);
}