Renamed the uiControl programmer errors to more clearly indicate they are uiControl programmer errors, and reworded their messages to put the function name first.

This commit is contained in:
Pietro Gagliardi 2019-06-09 13:32:31 -04:00
parent 0f41bb2188
commit 87a2195027
2 changed files with 25 additions and 25 deletions

View File

@ -58,7 +58,7 @@ uint32_t uiRegisterControlType(const char *name, uiControlVtable *vtable, uiCont
} }
#define checkMethod(method) \ #define checkMethod(method) \
if (vtable->method == NULL) { \ if (vtable->method == NULL) { \
uiprivProgrammerErrorRequiredMethodMissing(name, "uiControlVtable", #method, uiprivFunc); \ uiprivProgrammerErrorRequiredControlMethodMissing(name, "uiControlVtable", #method, uiprivFunc); \
return 0; \ return 0; \
} }
checkMethod(Init) checkMethod(Init)
@ -105,7 +105,7 @@ void *uiCheckControlType(void *c, uint32_t type)
key.id = cc->typeID; key.id = cc->typeID;
got = (struct controlType *) uiprivArrayBsearch(&controlTypes, &key, controlTypeCmp); got = (struct controlType *) uiprivArrayBsearch(&controlTypes, &key, controlTypeCmp);
if (got == NULL) { if (got == NULL) {
uiprivProgrammerErrorUnknownTypeUsed(cc->typeID, uiprivFunc); uiprivProgrammerErrorUnknownControlTypeUsed(cc->typeID, uiprivFunc);
return NULL; return NULL;
} }
@ -118,12 +118,12 @@ void *uiCheckControlType(void *c, uint32_t type)
key.id = type; key.id = type;
want = (struct controlType *) uiprivArrayBsearch(&controlTypes, &key, controlTypeCmp); want = (struct controlType *) uiprivArrayBsearch(&controlTypes, &key, controlTypeCmp);
if (want == NULL) { if (want == NULL) {
uiprivProgrammerErrorUnknownTypeRequested(type, uiprivFunc); uiprivProgrammerErrorUnknownControlTypeRequested(type, uiprivFunc);
return NULL; return NULL;
} }
if (cc->typeID != type) { if (cc->typeID != type) {
uiprivProgrammerErrorWrongType(got->name, want->name, uiprivFunc); uiprivProgrammerErrorWrongControlType(got->name, want->name, uiprivFunc);
return NULL; return NULL;
} }
return c; return c;
@ -147,7 +147,7 @@ uiControl *uiNewControl(uint32_t type, void *initData)
key.id = type; key.id = type;
ct = (struct controlType *) uiprivArrayBsearch(&controlTypes, &key, controlTypeCmp); ct = (struct controlType *) uiprivArrayBsearch(&controlTypes, &key, controlTypeCmp);
if (ct == NULL) { if (ct == NULL) {
uiprivProgrammerErrorUnknownTypeRequested(type, uiprivFunc); uiprivProgrammerErrorUnknownControlTypeRequested(type, uiprivFunc);
return NULL; return NULL;
} }

View File

@ -39,55 +39,55 @@
func) func)
#define uiprivProgrammerErrorRecursiveEventFire(func) \ #define uiprivProgrammerErrorRecursiveEventFire(func) \
uiprivProgrammerError("atteTODOmpt to fire a uiEvent while it is already being fired in %s()", \ uiprivProgrammerError("attempt to fire a uiEvent while it is already being fired in %s()", \
func) func)
#define uiprivProgrammerErrorFreeingInternalEvent(func) \ #define uiprivProgrammerErrorFreeingInternalEvent(func) \
uiprivProgrammerError("atteTODOmpt to free a libui-provided uiEvent", \ uiprivProgrammerError("attempt to free a libui-provided uiEvent", \
func) func)
#define uiprivProgrammerErrorFreeingEventInUse(func) \ #define uiprivProgrammerErrorFreeingEventInUse(func) \
uiprivProgrammerError("atteTODOmpt to free a uiEvent that still has handlers registered", \ uiprivProgrammerError("attempt to free a uiEvent that still has handlers registered", \
func) func)
#define uiprivProgrammerErrorInvalidatingGlobalEvent(func) \ #define uiprivProgrammerErrorInvalidatingGlobalEvent(func) \
uiprivProgrammerError("atteTODOmpt to call uiEventInvalidateSender() on a global uiEvent", \ uiprivProgrammerError("attempt to call uiEventInvalidateSender() on a global uiEvent", \
func) func)
// } // }
// controls { // controls {
#define uiprivProgrammerErrorRequiredMethodMissing(typeName, tableType, methodName, func) \ #define uiprivProgrammerErrorRequiredControlMethodMissing(typeName, tableType, methodName, func) \
uiprivProgrammerError("%s: required %s method %s() missing in %s()", \ uiprivProgrammerError("%s(): required %s method %s() missing for uiControl type %s", \
typeName, tableType, methodName, func) func, tableType, methodName, typeName)
#define uiprivProgrammerErrorNotAControl(func) \ #define uiprivProgrammerErrorNotAControl(func) \
uiprivProgrammerError("object passed in to %s() not a uiControl", \ uiprivProgrammerError("%s(): object passed in not a uiControl", \
func) func)
#define uiprivProgrammerErrorUnknownTypeUsed(type, func) \ #define uiprivProgrammerErrorUnknownControlTypeUsed(type, func) \
uiprivProgrammerError("unknown type %" PRIu32 " found in uiControl passed to %s(); this is likely not a real uiControl or some data is corrupt", \ uiprivProgrammerError("%s(): unknown uiControl type %" PRIu32 " found in uiControl (this is likely not a real uiControl or some data is corrupt)", \
type, func) func, type)
#define uiprivProgrammerErrorUnknownTypeRequested(type, func) \ #define uiprivProgrammerErrorUnknownControlTypeRequested(type, func) \
uiprivProgrammerError("unknown type %" PRIu32 " passed to %s()", \ uiprivProgrammerError("%s(): unknown uiControl type %" PRIu32 " requested", \
type, func) func, type)
#define uiprivProgrammerErrorWrongType(got, want, func) \ #define uiprivProgrammerErrorWrongControlType(got, want, func) \
uiprivProgrammerError("wrong type passed to %s(): got %s, want %s", \ uiprivProgrammerError("%s(): wrong uiControl type passed: got %s, want %s", \
func, got, want) func, got, want)
#define uiprivProgrammerErrorCannotCreateBaseControl(func) \ #define uiprivProgrammerErrorCannotCreateBaseControl(func) \
uiprivProgrammerError("canTODOnot create a uiControl of type uiControl in %s(); you must use a specific control type", \ uiprivProgrammerError("%s(): uiControlType() passed in when specific control type needed", \
func) func)
#define uiprivProgrammerErrorInvalidControlInitData(type, func) \ #define uiprivProgrammerErrorInvalidControlInitData(type, func) \
uiprivProgrammerError("invalid init data for %s in %s()", \ uiprivProgrammerError("%s(): invalid init data for %s", \
type, func) func, type)
#define uiprivProgrammerErrorControlHasParent(func) \ #define uiprivProgrammerErrorControlHasParent(func) \
uiprivProgrammerError("control passed to %s() (which requires a control without a parent) has a parent", \ uiprivProgrammerError("%s(): cannot be called on a control with has a parent", \
func) func)
// } // }