From d13f2f6fe4c25fa18c317761b059bf7f38b5a251 Mon Sep 17 00:00:00 2001 From: Marrub Date: Fri, 21 Oct 2016 21:55:38 -0400 Subject: [PATCH] Change headers so everything is included sequentially by Lth.h. Context: Rename Lth_ContextResourceFind stdlib: Fix Lth_isidenti --- lithos_c/inc/Lth.h | 34 ++++++++++++++++++++++++---------- lithos_c/inc/Lth_assert.h | 2 -- lithos_c/inc/Lth_button.h | 4 +--- lithos_c/inc/Lth_callback.h | 2 -- lithos_c/inc/Lth_context.h | 9 +-------- lithos_c/inc/Lth_control.h | 5 ----- lithos_c/inc/Lth_hashmap.h | 5 ----- lithos_c/inc/Lth_hudmessage.h | 10 +++------- lithos_c/inc/Lth_linklist.h | 4 ---- lithos_c/inc/Lth_manifest.h | 3 --- lithos_c/inc/Lth_stdlib.h | 8 ++------ lithos_c/inc/Lth_token.h | 2 -- lithos_c/inc/Lth_tokenstream.h | 4 ---- lithos_c/inc/Lth_window.h | 2 -- lithos_c/src/button.c | 8 ++++---- lithos_c/src/context.c | 4 ++-- lithos_c/src/font.c | 4 +--- lithos_c/src/manifest.c | 2 +- 18 files changed, 39 insertions(+), 73 deletions(-) diff --git a/lithos_c/inc/Lth.h b/lithos_c/inc/Lth.h index aaf787a..b5117a6 100644 --- a/lithos_c/inc/Lth.h +++ b/lithos_c/inc/Lth.h @@ -13,20 +13,34 @@ #ifndef lithos3__Lth_h #define lithos3__Lth_h +#include +#include +#include +#include + +#include + +#include "Lth_types.h" #include "Lth_assert.h" -#include "Lth_button.h" -#include "Lth_callback.h" -#include "Lth_context.h" -#include "Lth_control.h" -#include "Lth_draw.h" -#include "Lth_font.h" -#include "Lth_hudmessage.h" -#include "Lth_linklist.h" -#include "Lth_manifest.h" #include "Lth_stdlib.h" + +#include "Lth_linklist.h" +#include "Lth_hashmap.h" + #include "Lth_token.h" #include "Lth_tokenstream.h" -#include "Lth_types.h" + +#include "Lth_callback.h" + +#include "Lth_manifest.h" +#include "Lth_font.h" + +#include "Lth_context.h" +#include "Lth_control.h" +#include "Lth_button.h" #include "Lth_window.h" +#include "Lth_hudmessage.h" +#include "Lth_draw.h" + #endif//lithos3__Lth_h diff --git a/lithos_c/inc/Lth_assert.h b/lithos_c/inc/Lth_assert.h index 5af3272..9093de2 100644 --- a/lithos_c/inc/Lth_assert.h +++ b/lithos_c/inc/Lth_assert.h @@ -13,8 +13,6 @@ #ifndef lithos3__Lth_assert_h #define lithos3__Lth_assert_h -#include - #ifdef NDEBUG #define Lth_assert(expression) ((void)0) #else diff --git a/lithos_c/inc/Lth_button.h b/lithos_c/inc/Lth_button.h index 6f27e57..81e843a 100644 --- a/lithos_c/inc/Lth_button.h +++ b/lithos_c/inc/Lth_button.h @@ -13,8 +13,6 @@ #ifndef lithos3__Lth_button_h #define lithos3__Lth_button_h -#include "Lth_control.h" - // Type Definitions ----------------------------------------------------------| @@ -44,6 +42,6 @@ typedef struct Lth_Button // Extern Functions ----------------------------------------------------------| Lth_Button *Lth_ButtonNew(char const *label); -void Lth_ButtonSetLabel(Lth_Button *ctrl, char const *title); +void Lth_ButtonSetLabel(Lth_Button *ctrl, char const *label); #endif//lithos3__Lth_button_h diff --git a/lithos_c/inc/Lth_callback.h b/lithos_c/inc/Lth_callback.h index b72758e..b709776 100644 --- a/lithos_c/inc/Lth_callback.h +++ b/lithos_c/inc/Lth_callback.h @@ -30,8 +30,6 @@ Lth_X(SIGUPDATE , update, void, struct Lth_Control *) #elif !defined(lithos3__Lth_callback_h) #define lithos3__Lth_callback_h -#include "Lth_types.h" - #define Lth_Callback(name) ((Lth_Callback_t)(name)) #define Lth_Call(name, ...) \ do \ diff --git a/lithos_c/inc/Lth_context.h b/lithos_c/inc/Lth_context.h index b4e2bec..1e71f21 100644 --- a/lithos_c/inc/Lth_context.h +++ b/lithos_c/inc/Lth_context.h @@ -13,13 +13,6 @@ #ifndef lithos3__Lth_context_h #define lithos3__Lth_context_h -#include "Lth_types.h" -#include "Lth_font.h" -#include "Lth_manifest.h" - -#define Lth_ContextResource(ctx, type, key) \ - ((type *)Lth_ContextResourceFind((ctx), (key))) - #define Lth_ContextManifestLoad_extern(ctx, ...) \ ( \ ((ctx)->rsrc ? (Lth_ResourceMapDestroy((ctx)->rsrc)) : (void)0), \ @@ -80,6 +73,6 @@ void Lth_ContextMap(Lth_Context *ctx, struct Lth_Window *window); void Lth_ContextClipPush(Lth_Context *ctx, int x, int y, int w, int h); void Lth_ContextClipPop(Lth_Context *ctx); -void *Lth_ContextResourceFind(Lth_Context *ctx, char const *key); +void *Lth_ContextResource(Lth_Context *ctx, char const *key); #endif//lithos3__Lth_context_h diff --git a/lithos_c/inc/Lth_control.h b/lithos_c/inc/Lth_control.h index ea9a474..6fc8e40 100644 --- a/lithos_c/inc/Lth_control.h +++ b/lithos_c/inc/Lth_control.h @@ -13,11 +13,6 @@ #ifndef lithos3__Lth_control_h #define lithos3__Lth_control_h -#include "Lth_callback.h" -#include "Lth_linklist.h" -#include "Lth_types.h" -#include "Lth_context.h" -#include "Lth_font.h" // Type Definitions ----------------------------------------------------------| diff --git a/lithos_c/inc/Lth_hashmap.h b/lithos_c/inc/Lth_hashmap.h index 500b89e..a3cc017 100644 --- a/lithos_c/inc/Lth_hashmap.h +++ b/lithos_c/inc/Lth_hashmap.h @@ -16,11 +16,6 @@ #ifndef lithos3__Lth_hashmap_h #define lithos3__Lth_hashmap_h -#include "Lth_assert.h" -#include "Lth_stdlib.h" - -#include - // Type Definitions ----------------------------------------------------------| diff --git a/lithos_c/inc/Lth_hudmessage.h b/lithos_c/inc/Lth_hudmessage.h index 95d90e7..513d04b 100644 --- a/lithos_c/inc/Lth_hudmessage.h +++ b/lithos_c/inc/Lth_hudmessage.h @@ -13,10 +13,6 @@ #ifndef lithos3__Lth_hudmessage_h #define lithos3__Lth_hudmessage_h -#include -#include -#include - #define Lth_HudMessageFont(font, ...) \ ( \ ACS_SetFont(font), \ @@ -93,13 +89,13 @@ static inline void Lth_HudMessage(char const *fmt, ...) { va_list vl; - + ACS_BeginPrint(); - + va_start(vl, fmt); __vnprintf(fmt, vl); va_end(vl); - + ACS_MoreHudMessage(); } diff --git a/lithos_c/inc/Lth_linklist.h b/lithos_c/inc/Lth_linklist.h index c060e28..4eaa595 100644 --- a/lithos_c/inc/Lth_linklist.h +++ b/lithos_c/inc/Lth_linklist.h @@ -13,10 +13,6 @@ #ifndef lithos3__Lth_linklist_h #define lithos3__Lth_linklist_h -#include "Lth_assert.h" - -#include - #define Lth_ListForEach(tmpv, lst) \ for(Lth_LinkList *list = (lst); list; list = list->next) \ __with(tmpv = list->owner;) diff --git a/lithos_c/inc/Lth_manifest.h b/lithos_c/inc/Lth_manifest.h index 7cdb870..9379c14 100644 --- a/lithos_c/inc/Lth_manifest.h +++ b/lithos_c/inc/Lth_manifest.h @@ -13,9 +13,6 @@ #ifndef lithos3__Lth_manifest_h #define lithos3__Lth_manifest_h -#include "Lth_hashmap.h" -#include "Lth_types.h" - #define Lth_ManifestNew(...) \ ((Lth_Manifest[]){ \ __VA_ARGS__, \ diff --git a/lithos_c/inc/Lth_stdlib.h b/lithos_c/inc/Lth_stdlib.h index 0615b14..3d470c4 100644 --- a/lithos_c/inc/Lth_stdlib.h +++ b/lithos_c/inc/Lth_stdlib.h @@ -13,12 +13,8 @@ #ifndef lithos3__Lth_stdlib_h #define lithos3__Lth_stdlib_h -#include -#include - -#define Lth_isidenti(ch) \ - (isalpha(ch) || isdigit(ch) || ch == '_' || ch == '$' || ch == '\'' || \ - ch >= 0x80) +#define Lth_isidenti(c) \ + (isalnum(c) || c == '_' || c == '$' || c == '\'' || c > 0x80) // Post-for. Sort of. #define Lth_pfor(cond, expr) while((cond) && ((expr), true)) diff --git a/lithos_c/inc/Lth_token.h b/lithos_c/inc/Lth_token.h index 121accc..2884b3d 100644 --- a/lithos_c/inc/Lth_token.h +++ b/lithos_c/inc/Lth_token.h @@ -36,8 +36,6 @@ Lth_X(LnEnd ) // \n #elif !defined(lithos3__Lth_token_h) #define lithos3__Lth_token_h -#include - #define Lth_TokenSet(out, tok) \ ((out)->str = NULL, (out)->type = Lth_TOK_##tok) diff --git a/lithos_c/inc/Lth_tokenstream.h b/lithos_c/inc/Lth_tokenstream.h index 9835cfe..15d6188 100644 --- a/lithos_c/inc/Lth_tokenstream.h +++ b/lithos_c/inc/Lth_tokenstream.h @@ -13,10 +13,6 @@ #ifndef lithos3__Lth_tokenstream_h #define lithos3__Lth_tokenstream_h -#include "Lth_token.h" - -#include - // Type Definitions ----------------------------------------------------------| diff --git a/lithos_c/inc/Lth_window.h b/lithos_c/inc/Lth_window.h index ec4ff70..1bfa328 100644 --- a/lithos_c/inc/Lth_window.h +++ b/lithos_c/inc/Lth_window.h @@ -13,8 +13,6 @@ #ifndef lithos3__Lth_window_h #define lithos3__Lth_window_h -#include "Lth_control.h" - // Type Definitions ----------------------------------------------------------| diff --git a/lithos_c/src/button.c b/lithos_c/src/button.c index e339296..2a79973 100644 --- a/lithos_c/src/button.c +++ b/lithos_c/src/button.c @@ -61,14 +61,14 @@ Lth_Button *Lth_ButtonNew(char const *label) // // Lth_ButtonSetLabel // -void Lth_ButtonSetLabel(Lth_Button *ctrl, char const *title) +void Lth_ButtonSetLabel(Lth_Button *ctrl, char const *label) { Lth_assert(ctrl != NULL); - if(title != NULL) - ctrl->label = Lth_strdup(title); + if(label != NULL) + ctrl->label = Lth_strdup(label); else - ctrl->label = Lth_strdup(""); + ctrl->label = Lth_strdup("Button"); } // EOF diff --git a/lithos_c/src/context.c b/lithos_c/src/context.c index 7bd9012..8e7d068 100644 --- a/lithos_c/src/context.c +++ b/lithos_c/src/context.c @@ -153,9 +153,9 @@ void Lth_ContextClipPop(Lth_Context *ctx) } // -// Lth_ContextResourceFind +// Lth_ContextResource // -void *Lth_ContextResourceFind(Lth_Context *ctx, char const *key) +void *Lth_ContextResource(Lth_Context *ctx, char const *key) { void *p = Lth_HashMapFind(&ctx->rsrc->map, key); if(p) return p; diff --git a/lithos_c/src/font.c b/lithos_c/src/font.c index 163c23a..7da4f96 100644 --- a/lithos_c/src/font.c +++ b/lithos_c/src/font.c @@ -15,9 +15,7 @@ #include -//----------------------------------------------------------------------------| -// Extern Functions | -// +// Extern Functions ----------------------------------------------------------| // // Lth_FontNew diff --git a/lithos_c/src/manifest.c b/lithos_c/src/manifest.c index 0b04d83..3bb629e 100644 --- a/lithos_c/src/manifest.c +++ b/lithos_c/src/manifest.c @@ -183,7 +183,7 @@ static void ManifestGetInitializer(ManifestState *repr, size_t key) break; case Lth_TOK_Identi: __with(char const *str = Lth_TokenStreamBump(repr->stream)->str;) - if(strcmp(str, "true") == 0) GenValueGetter(Integ, integ, 1); + if(strcmp(str, "true") == 0) GenValueGetter(Integ, integ, 1); else if(strcmp(str, "false") == 0) GenValueGetter(Integ, integ, 0); default: ManifestError(repr, "expected initializer");