diff options
author | David Walter Seikel | 2014-05-05 15:08:55 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-05 15:08:55 +1000 |
commit | 334ba10e01c98b8d0ad2901b9ceafa45071050b9 (patch) | |
tree | 3fe60c140f14336ecd314b07d4a528bc7289ba78 /src/LuaSL | |
parent | Prepare for using GuiLua from extantz, but not going through with it just yet... (diff) | |
download | SledjHamr-334ba10e01c98b8d0ad2901b9ceafa45071050b9.zip SledjHamr-334ba10e01c98b8d0ad2901b9ceafa45071050b9.tar.gz SledjHamr-334ba10e01c98b8d0ad2901b9ceafa45071050b9.tar.bz2 SledjHamr-334ba10e01c98b8d0ad2901b9ceafa45071050b9.tar.xz |
Make logDom a stand alone, plus related fix ups and some clean ups.
Diffstat (limited to 'src/LuaSL')
-rw-r--r-- | src/LuaSL/LuaSL_LSL_tree.h | 2 | ||||
-rw-r--r-- | src/LuaSL/LuaSL_compile.c | 6 | ||||
-rw-r--r-- | src/LuaSL/LuaSL_lemon_yaccer.y | 8 | ||||
-rw-r--r-- | src/LuaSL/LuaSL_main.c | 17 | ||||
-rw-r--r-- | src/LuaSL/LuaSL_test.c | 15 |
5 files changed, 22 insertions, 26 deletions
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; | |||
42 | 42 | ||
43 | extern LSL_Token **tokens; | 43 | extern LSL_Token **tokens; |
44 | extern int lowestToken; | 44 | extern int lowestToken; |
45 | extern int logDom; // Our logging domain. | ||
46 | |||
45 | 47 | ||
46 | typedef int LSL_Type; | 48 | typedef int LSL_Type; |
47 | 49 | ||
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 | |||
991 | 991 | ||
992 | 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) | 992 | 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) |
993 | { | 993 | { |
994 | gameGlobals *ourGlobals = compiler->game; | 994 | // gameGlobals *ourGlobals = compiler->game; |
995 | LSL_Statement *stat = calloc(1, sizeof(LSL_Statement)); | 995 | LSL_Statement *stat = calloc(1, sizeof(LSL_Statement)); |
996 | boolean justOne = FALSE; | 996 | boolean justOne = FALSE; |
997 | 997 | ||
@@ -1112,17 +1112,17 @@ LSL_Leaf *addStatement(LuaSL_compiler *compiler, LSL_Leaf *lval, LSL_Leaf *flow, | |||
1112 | } | 1112 | } |
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | #if LUASL_DIFF_CHECK | ||
1116 | if (justOne && (flow)) | 1115 | if (justOne && (flow)) |
1117 | { | 1116 | { |
1117 | #if LUASL_DIFF_CHECK | ||
1118 | stat->ignorable = calloc(2, sizeof(Eina_Strbuf *)); | 1118 | stat->ignorable = calloc(2, sizeof(Eina_Strbuf *)); |
1119 | if (stat->ignorable) | 1119 | if (stat->ignorable) |
1120 | { | 1120 | { |
1121 | stat->ignorable[1] = flow->ignorable; | 1121 | stat->ignorable[1] = flow->ignorable; |
1122 | flow->ignorable = NULL; | 1122 | flow->ignorable = NULL; |
1123 | } | 1123 | } |
1124 | } | ||
1125 | #endif | 1124 | #endif |
1125 | } | ||
1126 | 1126 | ||
1127 | if (lval) | 1127 | if (lval) |
1128 | { | 1128 | { |
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; } | |||
222 | 222 | ||
223 | %parse_accept | 223 | %parse_accept |
224 | { | 224 | { |
225 | // gameGlobals *ourGlobals = compiler->game; | ||
226 | |||
227 | // PI("Parsing complete."); | 225 | // PI("Parsing complete."); |
228 | } | 226 | } |
229 | 227 | ||
230 | %parse_failure | 228 | %parse_failure |
231 | { | 229 | { |
232 | gameGlobals *ourGlobals = compiler->game; | ||
233 | |||
234 | compiler->script.bugCount++; | 230 | compiler->script.bugCount++; |
235 | PE("Giving up. Parser is hopelessly lost!"); | 231 | PE("Giving up. Parser is hopelessly lost!"); |
236 | } | 232 | } |
237 | 233 | ||
238 | %stack_overflow | 234 | %stack_overflow |
239 | { | 235 | { |
240 | gameGlobals *ourGlobals = compiler->game; | ||
241 | |||
242 | compiler->script.bugCount++; | 236 | compiler->script.bugCount++; |
243 | PE("Giving up. Parser stack overflow @ line %d, column %d!", yypMinor->yy0->line, yypMinor->yy0->column); // Gotta love consistancy, if it ever happens. | 237 | PE("Giving up. Parser stack overflow @ line %d, column %d!", yypMinor->yy0->line, yypMinor->yy0->column); // Gotta love consistancy, if it ever happens. |
244 | } | 238 | } |
245 | 239 | ||
246 | %syntax_error | 240 | %syntax_error |
247 | { | 241 | { |
248 | gameGlobals *ourGlobals = compiler->game; | ||
249 | |||
250 | compiler->script.bugCount++; | 242 | compiler->script.bugCount++; |
251 | PE("Syntax error @ line %d, column %d!", yyminor.yy0->line, yyminor.yy0->column); | 243 | PE("Syntax error @ line %d, column %d!", yyminor.yy0->line, yyminor.yy0->column); |
252 | } | 244 | } |
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 @@ | |||
2 | #include "LuaSL.h" | 2 | #include "LuaSL.h" |
3 | 3 | ||
4 | 4 | ||
5 | int logDom; // Our logging domain. | ||
5 | static int CPUs = 4; | 6 | static int CPUs = 4; |
6 | static Eina_Strbuf *clientStream; | 7 | static Eina_Strbuf *clientStream; |
7 | 8 | ||
@@ -43,7 +44,7 @@ static script *findThem(gameGlobals *ourGlobals, const char *base, const char *t | |||
43 | 44 | ||
44 | static void resetScript(script *victim) | 45 | static void resetScript(script *victim) |
45 | { | 46 | { |
46 | gameGlobals *ourGlobals = victim->game; | 47 | // gameGlobals *ourGlobals = victim->game; |
47 | 48 | ||
48 | PD("Resetting %s", victim->fileName); | 49 | PD("Resetting %s", victim->fileName); |
49 | // TODO - now what? | 50 | // TODO - now what? |
@@ -206,7 +207,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D | |||
206 | 207 | ||
207 | static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) | 208 | static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) |
208 | { | 209 | { |
209 | gameGlobals *ourGlobals = data; | 210 | // gameGlobals *ourGlobals = data; |
210 | 211 | ||
211 | if (ev->client) | 212 | if (ev->client) |
212 | { | 213 | { |
@@ -228,7 +229,7 @@ int main(int argc, char **argv) | |||
228 | 229 | ||
229 | if (eina_init()) | 230 | if (eina_init()) |
230 | { | 231 | { |
231 | ourGlobals.logDom = loggingStartup("LuaSL", ourGlobals.logDom); | 232 | logDom = loggingStartup("LuaSL", logDom); |
232 | ourGlobals.scripts = eina_hash_string_superfast_new(NULL); | 233 | ourGlobals.scripts = eina_hash_string_superfast_new(NULL); |
233 | ourGlobals.names = eina_hash_string_superfast_new(NULL); | 234 | ourGlobals.names = eina_hash_string_superfast_new(NULL); |
234 | if (ecore_con_init()) | 235 | if (ecore_con_init()) |
@@ -256,7 +257,7 @@ int main(int argc, char **argv) | |||
256 | for (i = 0; i < CPUs; i++) | 257 | for (i = 0; i < CPUs; i++) |
257 | { | 258 | { |
258 | if ( sched_create_worker( ) != LUAPROC_SCHED_OK ) | 259 | if ( sched_create_worker( ) != LUAPROC_SCHED_OK ) |
259 | PEm("Error creating luaproc worker thread."); | 260 | PE("Error creating luaproc worker thread."); |
260 | } | 261 | } |
261 | ecore_main_loop_begin(); | 262 | ecore_main_loop_begin(); |
262 | 263 | ||
@@ -265,18 +266,18 @@ int main(int argc, char **argv) | |||
265 | edje_shutdown(); | 266 | edje_shutdown(); |
266 | } | 267 | } |
267 | else | 268 | else |
268 | PCm("Failed to init edje!"); | 269 | PC("Failed to init edje!"); |
269 | } | 270 | } |
270 | else | 271 | else |
271 | PCm("Failed to add server!"); | 272 | PC("Failed to add server!"); |
272 | ecore_con_shutdown(); | 273 | ecore_con_shutdown(); |
273 | } | 274 | } |
274 | else | 275 | else |
275 | PCm("Failed to init ecore_con!"); | 276 | PC("Failed to init ecore_con!"); |
276 | ecore_shutdown(); | 277 | ecore_shutdown(); |
277 | } | 278 | } |
278 | else | 279 | else |
279 | PCm("Failed to init ecore!"); | 280 | PC("Failed to init ecore!"); |
280 | } | 281 | } |
281 | else | 282 | else |
282 | fprintf(stderr, "Failed to init eina!"); | 283 | 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 @@ | |||
2 | #include "LuaSL.h" | 2 | #include "LuaSL.h" |
3 | 3 | ||
4 | 4 | ||
5 | int logDom; // Our logging domain. | ||
5 | static Eina_Strbuf *clientStream; | 6 | static Eina_Strbuf *clientStream; |
6 | static int scriptCount = 0; | 7 | static int scriptCount = 0; |
7 | static int compiledCount = 0; | 8 | static int compiledCount = 0; |
@@ -313,7 +314,7 @@ int main(int argc, char **argv) | |||
313 | 314 | ||
314 | if (eina_init()) | 315 | if (eina_init()) |
315 | { | 316 | { |
316 | ourGlobals.logDom = loggingStartup("LuaSL_test", ourGlobals.logDom); | 317 | logDom = loggingStartup("LuaSL_test", logDom); |
317 | ourGlobals.scripts = eina_hash_string_superfast_new(NULL); | 318 | ourGlobals.scripts = eina_hash_string_superfast_new(NULL); |
318 | 319 | ||
319 | if (ecore_con_init()) | 320 | if (ecore_con_init()) |
@@ -373,7 +374,7 @@ int main(int argc, char **argv) | |||
373 | ourGlobals.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); | 374 | ourGlobals.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); |
374 | if (!ourGlobals.ee) | 375 | if (!ourGlobals.ee) |
375 | { | 376 | { |
376 | PEm("You got to have at least one evas engine built and linked up to ecore-evas for this example to run properly."); | 377 | PE("You got to have at least one evas engine built and linked up to ecore-evas for this example to run properly."); |
377 | edje_shutdown(); | 378 | edje_shutdown(); |
378 | ecore_evas_shutdown(); | 379 | ecore_evas_shutdown(); |
379 | return -1; | 380 | return -1; |
@@ -397,7 +398,7 @@ int main(int argc, char **argv) | |||
397 | { | 398 | { |
398 | int err = edje_object_load_error_get(ourGlobals.edje); | 399 | int err = edje_object_load_error_get(ourGlobals.edje); |
399 | const char *errmsg = edje_load_error_str(err); | 400 | const char *errmsg = edje_load_error_str(err); |
400 | PEm("Could not load '%s' from %s: %s\n", group, buf, errmsg); | 401 | PE("Could not load '%s' from %s: %s\n", group, buf, errmsg); |
401 | 402 | ||
402 | evas_object_del(ourGlobals.edje); | 403 | evas_object_del(ourGlobals.edje); |
403 | ecore_evas_free(ourGlobals.ee); | 404 | ecore_evas_free(ourGlobals.ee); |
@@ -447,18 +448,18 @@ int main(int argc, char **argv) | |||
447 | edje_shutdown(); | 448 | edje_shutdown(); |
448 | } | 449 | } |
449 | else | 450 | else |
450 | PCm("Failed to init edje!"); | 451 | PC("Failed to init edje!"); |
451 | ecore_evas_shutdown(); | 452 | ecore_evas_shutdown(); |
452 | } | 453 | } |
453 | else | 454 | else |
454 | PCm("Failed to init ecore_evas!"); | 455 | PC("Failed to init ecore_evas!"); |
455 | } | 456 | } |
456 | else | 457 | else |
457 | PCm("Failed to connect to server!"); | 458 | PC("Failed to connect to server!"); |
458 | ecore_con_shutdown(); | 459 | ecore_con_shutdown(); |
459 | } | 460 | } |
460 | else | 461 | else |
461 | PCm("Failed to init ecore_con!"); | 462 | PC("Failed to init ecore_con!"); |
462 | } | 463 | } |
463 | else | 464 | else |
464 | fprintf(stderr, "Failed to init eina!"); | 465 | fprintf(stderr, "Failed to init eina!"); |