From 87a2195027aba198dae5831de4396629e612fe1d Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 9 Jun 2019 13:32:31 -0400 Subject: [PATCH] Renamed the uiControl programmer errors to more clearly indicate they are uiControl programmer errors, and reworded their messages to put the function name first. --- common/controls.c | 10 +++++----- common/programmererrors.h | 40 +++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/common/controls.c b/common/controls.c index 6142d4a4..4b4384a8 100644 --- a/common/controls.c +++ b/common/controls.c @@ -58,7 +58,7 @@ uint32_t uiRegisterControlType(const char *name, uiControlVtable *vtable, uiCont } #define checkMethod(method) \ if (vtable->method == NULL) { \ - uiprivProgrammerErrorRequiredMethodMissing(name, "uiControlVtable", #method, uiprivFunc); \ + uiprivProgrammerErrorRequiredControlMethodMissing(name, "uiControlVtable", #method, uiprivFunc); \ return 0; \ } checkMethod(Init) @@ -105,7 +105,7 @@ void *uiCheckControlType(void *c, uint32_t type) key.id = cc->typeID; got = (struct controlType *) uiprivArrayBsearch(&controlTypes, &key, controlTypeCmp); if (got == NULL) { - uiprivProgrammerErrorUnknownTypeUsed(cc->typeID, uiprivFunc); + uiprivProgrammerErrorUnknownControlTypeUsed(cc->typeID, uiprivFunc); return NULL; } @@ -118,12 +118,12 @@ void *uiCheckControlType(void *c, uint32_t type) key.id = type; want = (struct controlType *) uiprivArrayBsearch(&controlTypes, &key, controlTypeCmp); if (want == NULL) { - uiprivProgrammerErrorUnknownTypeRequested(type, uiprivFunc); + uiprivProgrammerErrorUnknownControlTypeRequested(type, uiprivFunc); return NULL; } if (cc->typeID != type) { - uiprivProgrammerErrorWrongType(got->name, want->name, uiprivFunc); + uiprivProgrammerErrorWrongControlType(got->name, want->name, uiprivFunc); return NULL; } return c; @@ -147,7 +147,7 @@ uiControl *uiNewControl(uint32_t type, void *initData) key.id = type; ct = (struct controlType *) uiprivArrayBsearch(&controlTypes, &key, controlTypeCmp); if (ct == NULL) { - uiprivProgrammerErrorUnknownTypeRequested(type, uiprivFunc); + uiprivProgrammerErrorUnknownControlTypeRequested(type, uiprivFunc); return NULL; } diff --git a/common/programmererrors.h b/common/programmererrors.h index fc066f5e..f69b3419 100644 --- a/common/programmererrors.h +++ b/common/programmererrors.h @@ -39,55 +39,55 @@ 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) #define uiprivProgrammerErrorFreeingInternalEvent(func) \ - uiprivProgrammerError("atteTODOmpt to free a libui-provided uiEvent", \ + uiprivProgrammerError("attempt to free a libui-provided uiEvent", \ 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) #define uiprivProgrammerErrorInvalidatingGlobalEvent(func) \ - uiprivProgrammerError("atteTODOmpt to call uiEventInvalidateSender() on a global uiEvent", \ + uiprivProgrammerError("attempt to call uiEventInvalidateSender() on a global uiEvent", \ func) // } // controls { -#define uiprivProgrammerErrorRequiredMethodMissing(typeName, tableType, methodName, func) \ - uiprivProgrammerError("%s: required %s method %s() missing in %s()", \ - typeName, tableType, methodName, func) +#define uiprivProgrammerErrorRequiredControlMethodMissing(typeName, tableType, methodName, func) \ + uiprivProgrammerError("%s(): required %s method %s() missing for uiControl type %s", \ + func, tableType, methodName, typeName) #define uiprivProgrammerErrorNotAControl(func) \ - uiprivProgrammerError("object passed in to %s() not a uiControl", \ + uiprivProgrammerError("%s(): object passed in not a uiControl", \ func) -#define uiprivProgrammerErrorUnknownTypeUsed(type, func) \ - uiprivProgrammerError("unknown type %" PRIu32 " found in uiControl passed to %s(); this is likely not a real uiControl or some data is corrupt", \ - type, func) +#define uiprivProgrammerErrorUnknownControlTypeUsed(type, func) \ + uiprivProgrammerError("%s(): unknown uiControl type %" PRIu32 " found in uiControl (this is likely not a real uiControl or some data is corrupt)", \ + func, type) -#define uiprivProgrammerErrorUnknownTypeRequested(type, func) \ - uiprivProgrammerError("unknown type %" PRIu32 " passed to %s()", \ - type, func) +#define uiprivProgrammerErrorUnknownControlTypeRequested(type, func) \ + uiprivProgrammerError("%s(): unknown uiControl type %" PRIu32 " requested", \ + func, type) -#define uiprivProgrammerErrorWrongType(got, want, func) \ - uiprivProgrammerError("wrong type passed to %s(): got %s, want %s", \ +#define uiprivProgrammerErrorWrongControlType(got, want, func) \ + uiprivProgrammerError("%s(): wrong uiControl type passed: got %s, want %s", \ func, got, want) #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) #define uiprivProgrammerErrorInvalidControlInitData(type, func) \ - uiprivProgrammerError("invalid init data for %s in %s()", \ - type, func) + uiprivProgrammerError("%s(): invalid init data for %s", \ + func, type) #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) // }