From 334ba10e01c98b8d0ad2901b9ceafa45071050b9 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 5 May 2014 15:08:55 +1000 Subject: Make logDom a stand alone, plus related fix ups and some clean ups. --- src/LuaSL/LuaSL_LSL_tree.h | 2 ++ src/LuaSL/LuaSL_compile.c | 6 +++--- src/LuaSL/LuaSL_lemon_yaccer.y | 8 -------- src/LuaSL/LuaSL_main.c | 17 +++++++++-------- src/LuaSL/LuaSL_test.c | 15 ++++++++------- 5 files changed, 22 insertions(+), 26 deletions(-) (limited to 'src/LuaSL') diff --git a/src/LuaSL/LuaSL_LSL_tree.h b/src/LuaSL/LuaSL_LSL_tree.h index 5415228..1021be8 100644 --- a/src/LuaSL/LuaSL_LSL_tree.h +++ b/src/LuaSL/LuaSL_LSL_tree.h @@ -42,6 +42,8 @@ typedef struct _LSL_Script LSL_Script; extern LSL_Token **tokens; extern int lowestToken; +extern int logDom; // Our logging domain. + typedef int LSL_Type; diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c index f32e0c0..3265acf 100644 --- a/src/LuaSL/LuaSL_compile.c +++ b/src/LuaSL/LuaSL_compile.c @@ -991,7 +991,7 @@ LSL_Leaf *addFor(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, LSL_L LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, LSL_Leaf *left, LSL_Leaf *expr, LSL_Leaf *right, LSL_Leaf *block, LSL_Leaf *identifier) { - gameGlobals *ourGlobals = compiler->game; +// gameGlobals *ourGlobals = compiler->game; LSL_Statement *stat = calloc(1, sizeof(LSL_Statement)); boolean justOne = FALSE; @@ -1112,17 +1112,17 @@ LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, } } -#if LUASL_DIFF_CHECK if (justOne && (flow)) { +#if LUASL_DIFF_CHECK stat->ignorable = calloc(2, sizeof(Eina_Strbuf *)); if (stat->ignorable) { stat->ignorable[1] = flow->ignorable; flow->ignorable = NULL; } - } #endif + } if (lval) { diff --git a/src/LuaSL/LuaSL_lemon_yaccer.y b/src/LuaSL/LuaSL_lemon_yaccer.y index 182789f..72c4479 100644 --- a/src/LuaSL/LuaSL_lemon_yaccer.y +++ b/src/LuaSL/LuaSL_lemon_yaccer.y @@ -222,31 +222,23 @@ expr(A) ::= LSL_STRING(B). { B->basicType = OT_string; A = B; } %parse_accept { -// gameGlobals *ourGlobals = compiler->game; - // PI("Parsing complete."); } %parse_failure { - gameGlobals *ourGlobals = compiler->game; - compiler->script.bugCount++; PE("Giving up. Parser is hopelessly lost!"); } %stack_overflow { - gameGlobals *ourGlobals = compiler->game; - compiler->script.bugCount++; PE("Giving up. Parser stack overflow @ line %d, column %d!", yypMinor->yy0->line, yypMinor->yy0->column); // Gotta love consistancy, if it ever happens. } %syntax_error { - gameGlobals *ourGlobals = compiler->game; - compiler->script.bugCount++; PE("Syntax error @ line %d, column %d!", yyminor.yy0->line, yyminor.yy0->column); } diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c index 0a40712..f4c94ac 100644 --- a/src/LuaSL/LuaSL_main.c +++ b/src/LuaSL/LuaSL_main.c @@ -2,6 +2,7 @@ #include "LuaSL.h" +int logDom; // Our logging domain. static int CPUs = 4; static Eina_Strbuf *clientStream; @@ -43,7 +44,7 @@ static script *findThem(gameGlobals *ourGlobals, const char *base, const char *t static void resetScript(script *victim) { - gameGlobals *ourGlobals = victim->game; +// gameGlobals *ourGlobals = victim->game; PD("Resetting %s", victim->fileName); // TODO - now what? @@ -206,7 +207,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) { - gameGlobals *ourGlobals = data; +// gameGlobals *ourGlobals = data; if (ev->client) { @@ -228,7 +229,7 @@ int main(int argc, char **argv) if (eina_init()) { - ourGlobals.logDom = loggingStartup("LuaSL", ourGlobals.logDom); + logDom = loggingStartup("LuaSL", logDom); ourGlobals.scripts = eina_hash_string_superfast_new(NULL); ourGlobals.names = eina_hash_string_superfast_new(NULL); if (ecore_con_init()) @@ -256,7 +257,7 @@ int main(int argc, char **argv) for (i = 0; i < CPUs; i++) { if ( sched_create_worker( ) != LUAPROC_SCHED_OK ) - PEm("Error creating luaproc worker thread."); + PE("Error creating luaproc worker thread."); } ecore_main_loop_begin(); @@ -265,18 +266,18 @@ int main(int argc, char **argv) edje_shutdown(); } else - PCm("Failed to init edje!"); + PC("Failed to init edje!"); } else - PCm("Failed to add server!"); + PC("Failed to add server!"); ecore_con_shutdown(); } else - PCm("Failed to init ecore_con!"); + PC("Failed to init ecore_con!"); ecore_shutdown(); } else - PCm("Failed to init ecore!"); + PC("Failed to init ecore!"); } else fprintf(stderr, "Failed to init eina!"); diff --git a/src/LuaSL/LuaSL_test.c b/src/LuaSL/LuaSL_test.c index 27b9626..8fc86c0 100644 --- a/src/LuaSL/LuaSL_test.c +++ b/src/LuaSL/LuaSL_test.c @@ -2,6 +2,7 @@ #include "LuaSL.h" +int logDom; // Our logging domain. static Eina_Strbuf *clientStream; static int scriptCount = 0; static int compiledCount = 0; @@ -313,7 +314,7 @@ int main(int argc, char **argv) if (eina_init()) { - ourGlobals.logDom = loggingStartup("LuaSL_test", ourGlobals.logDom); + logDom = loggingStartup("LuaSL_test", logDom); ourGlobals.scripts = eina_hash_string_superfast_new(NULL); if (ecore_con_init()) @@ -373,7 +374,7 @@ int main(int argc, char **argv) ourGlobals.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); if (!ourGlobals.ee) { - PEm("You got to have at least one evas engine built and linked up to ecore-evas for this example to run properly."); + PE("You got to have at least one evas engine built and linked up to ecore-evas for this example to run properly."); edje_shutdown(); ecore_evas_shutdown(); return -1; @@ -397,7 +398,7 @@ int main(int argc, char **argv) { int err = edje_object_load_error_get(ourGlobals.edje); const char *errmsg = edje_load_error_str(err); - PEm("Could not load '%s' from %s: %s\n", group, buf, errmsg); + PE("Could not load '%s' from %s: %s\n", group, buf, errmsg); evas_object_del(ourGlobals.edje); ecore_evas_free(ourGlobals.ee); @@ -447,18 +448,18 @@ int main(int argc, char **argv) edje_shutdown(); } else - PCm("Failed to init edje!"); + PC("Failed to init edje!"); ecore_evas_shutdown(); } else - PCm("Failed to init ecore_evas!"); + PC("Failed to init ecore_evas!"); } else - PCm("Failed to connect to server!"); + PC("Failed to connect to server!"); ecore_con_shutdown(); } else - PCm("Failed to init ecore_con!"); + PC("Failed to init ecore_con!"); } else fprintf(stderr, "Failed to init eina!"); -- cgit v1.1