1
0
Fork 0

Change headers so everything is included sequentially by Lth.h.

Context: Rename Lth_ContextResourceFind
stdlib: Fix Lth_isidenti
master
Marrub 2016-10-21 21:55:38 -04:00
parent 0592eca67f
commit d13f2f6fe4
18 changed files with 39 additions and 73 deletions

View File

@ -13,20 +13,34 @@
#ifndef lithos3__Lth_h
#define lithos3__Lth_h
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ACS_ZDoom.h>
#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

View File

@ -13,8 +13,6 @@
#ifndef lithos3__Lth_assert_h
#define lithos3__Lth_assert_h
#include <stdio.h>
#ifdef NDEBUG
#define Lth_assert(expression) ((void)0)
#else

View File

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

View File

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

View File

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

View File

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

View File

@ -16,11 +16,6 @@
#ifndef lithos3__Lth_hashmap_h
#define lithos3__Lth_hashmap_h
#include "Lth_assert.h"
#include "Lth_stdlib.h"
#include <stdlib.h>
// Type Definitions ----------------------------------------------------------|

View File

@ -13,10 +13,6 @@
#ifndef lithos3__Lth_hudmessage_h
#define lithos3__Lth_hudmessage_h
#include <ACS_ZDoom.h>
#include <stdio.h>
#include <stdarg.h>
#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();
}

View File

@ -13,10 +13,6 @@
#ifndef lithos3__Lth_linklist_h
#define lithos3__Lth_linklist_h
#include "Lth_assert.h"
#include <stddef.h>
#define Lth_ListForEach(tmpv, lst) \
for(Lth_LinkList *list = (lst); list; list = list->next) \
__with(tmpv = list->owner;)

View File

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

View File

@ -13,12 +13,8 @@
#ifndef lithos3__Lth_stdlib_h
#define lithos3__Lth_stdlib_h
#include <stdio.h>
#include <stdbool.h>
#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))

View File

@ -36,8 +36,6 @@ Lth_X(LnEnd ) // \n
#elif !defined(lithos3__Lth_token_h)
#define lithos3__Lth_token_h
#include <stdio.h>
#define Lth_TokenSet(out, tok) \
((out)->str = NULL, (out)->type = Lth_TOK_##tok)

View File

@ -13,10 +13,6 @@
#ifndef lithos3__Lth_tokenstream_h
#define lithos3__Lth_tokenstream_h
#include "Lth_token.h"
#include <stdbool.h>
// Type Definitions ----------------------------------------------------------|

View File

@ -13,8 +13,6 @@
#ifndef lithos3__Lth_window_h
#define lithos3__Lth_window_h
#include "Lth_control.h"
// Type Definitions ----------------------------------------------------------|

View File

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

View File

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

View File

@ -15,9 +15,7 @@
#include <stdlib.h>
//----------------------------------------------------------------------------|
// Extern Functions |
//
// Extern Functions ----------------------------------------------------------|
//
// Lth_FontNew

View File

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