aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-01-03 20:35:53 +1000
committerDavid Walter Seikel2016-01-03 20:35:53 +1000
commit72093df9fdf281ccd581baf5993bdc2ec6957342 (patch)
tree5e071b445f7a8713776df6defb794549d9d16b7f
parentRe-enable the web browser I had forgotten disabling. (diff)
downloadSledjHamr-72093df9fdf281ccd581baf5993bdc2ec6957342.zip
SledjHamr-72093df9fdf281ccd581baf5993bdc2ec6957342.tar.gz
SledjHamr-72093df9fdf281ccd581baf5993bdc2ec6957342.tar.bz2
SledjHamr-72093df9fdf281ccd581baf5993bdc2ec6957342.tar.xz
Clean up logging, removing most of the printf's.
Diffstat (limited to '')
-rw-r--r--src/LuaSL/LuaSL_main.c14
-rw-r--r--src/extantz/camera.c10
-rw-r--r--src/extantz/extantz.c6
-rw-r--r--src/extantz/gears.c5
-rw-r--r--src/libraries/LumbrJack.c2
-rw-r--r--src/libraries/Runnr.c60
-rw-r--r--src/libraries/SledjHamr.c68
-rw-r--r--src/love/love.c12
8 files changed, 86 insertions, 91 deletions
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c
index a412027..7e9d935 100644
--- a/src/LuaSL/LuaSL_main.c
+++ b/src/LuaSL/LuaSL_main.c
@@ -73,7 +73,7 @@ void send2server(script *me, const char *message)
73{ 73{
74 gameGlobals *ourGlobals = me->data; 74 gameGlobals *ourGlobals = me->data;
75 75
76//printf("GOT MESSAGE from script %s - '%s'\n", me->name, message); 76//PD("GOT MESSAGE from script %s - '%s'", me->name, message);
77 77
78 if (0 == strncmp(message, "llSleep(", 8)) 78 if (0 == strncmp(message, "llSleep(", 8))
79 ecore_timer_add(atof(&(message)[8]), _sleep_timer_cb, me); 79 ecore_timer_add(atof(&(message)[8]), _sleep_timer_cb, me);
@@ -223,7 +223,7 @@ static Eina_Bool parser(void *data, Connection *connection, char *SID, char *com
223 gameGlobals *ourGlobals = data; 223 gameGlobals *ourGlobals = data;
224 char buf[PATH_MAX]; 224 char buf[PATH_MAX];
225 225
226PW("COMMAND - %s", command); 226//PD("COMMAND - %s", command);
227 if (0 == strncmp(command, "compile(", 8)) 227 if (0 == strncmp(command, "compile(", 8))
228 { 228 {
229 char *temp; 229 char *temp;
@@ -244,7 +244,7 @@ PW("COMMAND - %s", command);
244 compiler->doConstants = FALSE; 244 compiler->doConstants = FALSE;
245 compiler->parser = (compileCb) compileLSL; 245 compiler->parser = (compileCb) compileLSL;
246 compiler->cb = _compileCb; 246 compiler->cb = _compileCb;
247PI("Compiling script %s", file); 247PD("Compiling script %s", file);
248 compileScript(compiler, COMPILE_THREADED); 248 compileScript(compiler, COMPILE_THREADED);
249 } 249 }
250 else if (0 == strncmp(command, "run(", 4)) 250 else if (0 == strncmp(command, "run(", 4))
@@ -266,14 +266,16 @@ PI("Compiling script %s", file);
266 me = getScript(SID); 266 me = getScript(SID);
267 if (me) 267 if (me)
268 { 268 {
269PI("Running script %s", me->fileName); 269PD("Running script %s", me->fileName);
270 runScript(me); 270 runScript(me);
271 releaseScript(me); 271 releaseScript(me);
272 } 272 }
273 else
274 PE("Failed to run script %s", me->fileName);
273 } 275 }
274 else if (0 == strcmp(command, "exit()")) 276 else if (0 == strcmp(command, "exit()"))
275 { 277 {
276 PD("Told to exit."); 278 PI("Told to exit.");
277 ecore_main_loop_quit(); 279 ecore_main_loop_quit();
278 } 280 }
279 else 281 else
@@ -319,7 +321,7 @@ int main(int argc, char **argv)
319 } 321 }
320 else if (ecore_con_init()) 322 else if (ecore_con_init())
321 { 323 {
322 PD("LuaSL is about to try creating a LuaSL server."); 324// PD("LuaSL is about to try creating a LuaSL server.");
323 if (openArms("LuaSL", ourGlobals.address, ourGlobals.port, &ourGlobals, NULL, NULL, NULL, parser)) 325 if (openArms("LuaSL", ourGlobals.address, ourGlobals.port, &ourGlobals, NULL, NULL, NULL, parser))
324 { 326 {
325 Eina_Iterator *scripts; 327 Eina_Iterator *scripts;
diff --git a/src/extantz/camera.c b/src/extantz/camera.c
index 4bcf64c..123285c 100644
--- a/src/extantz/camera.c
+++ b/src/extantz/camera.c
@@ -92,9 +92,9 @@ static void _on_camera_input_down(void *data, Evas *evas, Evas_Object *obj, void
92 else if (0 == strcmp(ev->key, "Home")) move->x = -2.0; 92 else if (0 == strcmp(ev->key, "Home")) move->x = -2.0;
93 else if (0 == strcmp(ev->key, "End")) move->x = 2.0; 93 else if (0 == strcmp(ev->key, "End")) move->x = 2.0;
94 else if (0 == strcmp(ev->key, "space")) move->jump = 1.0; 94 else if (0 == strcmp(ev->key, "space")) move->jump = 1.0;
95 else printf("Unexpected down keystroke - %s\n", ev->key); 95 else PW("Unexpected down keystroke - %s", ev->key);
96 } 96 }
97 else printf("Camera input not ready\n"); 97 else PE("Camera input not ready");
98} 98}
99 99
100/* SL / OS camera controls 100/* SL / OS camera controls
@@ -184,9 +184,9 @@ static void _on_camera_input_up(void *data, Evas *evas, Evas_Object *obj, void *
184 else if (0 == strcmp(ev->key, "Home")) move->x = 0.0; 184 else if (0 == strcmp(ev->key, "Home")) move->x = 0.0;
185 else if (0 == strcmp(ev->key, "End")) move->x = 0.0; 185 else if (0 == strcmp(ev->key, "End")) move->x = 0.0;
186 else if (0 == strcmp(ev->key, "space")) move->jump = 0.0; 186 else if (0 == strcmp(ev->key, "space")) move->jump = 0.0;
187 else printf("Unexpected up keystroke - %s\n", ev->key); 187 else PW("Unexpected up keystroke - %s", ev->key);
188 } 188 }
189 else printf("Camera input not ready\n"); 189 else PE("Camera input not ready");
190} 190}
191 191
192/* While it's true that image is an Elm image, seems this Elm input event callback doesn't work. 192/* While it's true that image is an Elm image, seems this Elm input event callback doesn't work.
@@ -212,7 +212,7 @@ static Eina_Bool _cb_event_GL(void *data, Evas_Object *obj, Evas_Object *src, Ev
212 } 212 }
213 213
214 default : 214 default :
215 printf("Unknown GL input event.\n"); 215 PE("Unknown GL input event.");
216 } 216 }
217 217
218 return processed; 218 return processed;
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c
index c2dadba..840dfec 100644
--- a/src/extantz/extantz.c
+++ b/src/extantz/extantz.c
@@ -42,7 +42,6 @@ static Eina_Bool clientParser(void *data, Connection *connection, char *SID, cha
42 || (0 == strncmp(command, "llSay(", 6)) 42 || (0 == strncmp(command, "llSay(", 6))
43 || (0 == strncmp(command, "llShout(", 8))) 43 || (0 == strncmp(command, "llShout(", 8)))
44 { 44 {
45
46 sprintf(buf, "%s: %s", SID, command); 45 sprintf(buf, "%s: %s", SID, command);
47 if (ourGlobals->purkle) 46 if (ourGlobals->purkle)
48 { 47 {
@@ -53,7 +52,7 @@ static Eina_Bool clientParser(void *data, Connection *connection, char *SID, cha
53 push_lua(ourGlobals->purkle->L, "@ ( $ )", _P, "append", buf, 0); 52 push_lua(ourGlobals->purkle->L, "@ ( $ )", _P, "append", buf, 0);
54 } 53 }
55 else 54 else
56 PW("No purkle to put - %s", buf); 55 PE("No purkle to put - %s", buf);
57 } 56 }
58 else if (0 == strncmp(command, "llDialog(", 9)) 57 else if (0 == strncmp(command, "llDialog(", 9))
59 { 58 {
@@ -69,7 +68,6 @@ static Eina_Bool clientParser(void *data, Connection *connection, char *SID, cha
69 } 68 }
70 else 69 else
71 PE("No LSLGuiMess to send - %s", command); 70 PE("No LSLGuiMess to send - %s", command);
72
73 } 71 }
74 else if (0 == strncmp(command, "loadSim(", 8)) 72 else if (0 == strncmp(command, "loadSim(", 8))
75 { 73 {
@@ -556,7 +554,7 @@ static Eina_Bool _makeLove(void *data)
556 ecore_job_add((Ecore_Cb) _makeFiles, ourGlobals); 554 ecore_job_add((Ecore_Cb) _makeFiles, ourGlobals);
557// ecore_timer_add(0.1, _makeFiles, ourGlobals); 555// ecore_timer_add(0.1, _makeFiles, ourGlobals);
558 556
559 PD("About to try connecting to a love server."); 557// PD("About to try connecting to a love server.");
560 reachOut("love", "./love", "127.0.0.1", 8211 + 1, ourGlobals, (Ecore_Event_Handler_Cb) _add, /*(Ecore_Event_Handler_Cb) _data*/ NULL, (Ecore_Event_Handler_Cb) _del, clientParser); 558 reachOut("love", "./love", "127.0.0.1", 8211 + 1, ourGlobals, (Ecore_Event_Handler_Cb) _add, /*(Ecore_Event_Handler_Cb) _data*/ NULL, (Ecore_Event_Handler_Cb) _del, clientParser);
561 559
562 return ECORE_CALLBACK_CANCEL; 560 return ECORE_CALLBACK_CANCEL;
diff --git a/src/extantz/gears.c b/src/extantz/gears.c
index 68f817e..9998357 100644
--- a/src/extantz/gears.c
+++ b/src/extantz/gears.c
@@ -279,8 +279,7 @@ static GLuint load_shader(GLData *gld, GLenum type, const char *shader_src)
279 if (info) 279 if (info)
280 { 280 {
281 gl->glGetShaderInfoLog(shader, len, NULL, info); 281 gl->glGetShaderInfoLog(shader, len, NULL, info);
282 printf("Error compiling shader:\n" 282 PE("Error compiling shader: %s", info);
283 "%s\n", info);
284 free(info); 283 free(info);
285 } 284 }
286 } 285 }
@@ -332,7 +331,7 @@ void gears_init(GLData *gld)
332 if (info) 331 if (info)
333 { 332 {
334 gld->glApi->glGetProgramInfoLog(gld->program, len, NULL, info); 333 gld->glApi->glGetProgramInfoLog(gld->program, len, NULL, info);
335 printf("Error linking program:\n%s\n", info); 334 PE("Error linking program: %s", info);
336 free(info); 335 free(info);
337 } 336 }
338 } 337 }
diff --git a/src/libraries/LumbrJack.c b/src/libraries/LumbrJack.c
index 8683357..3bb67e9 100644
--- a/src/libraries/LumbrJack.c
+++ b/src/libraries/LumbrJack.c
@@ -19,7 +19,7 @@ int HamrTime(char *argv0, void *main, int logDom)
19 19
20 if (!eina_init()) 20 if (!eina_init())
21 { 21 {
22 printf("Can't load eina library, nothing else will work!\n"); 22 fprintf(stderr, "Can't load eina library, nothing else will work!\n");
23 exit(0); 23 exit(0);
24 } 24 }
25 25
diff --git a/src/libraries/Runnr.c b/src/libraries/Runnr.c
index 5ec5a9c..04547b4 100644
--- a/src/libraries/Runnr.c
+++ b/src/libraries/Runnr.c
@@ -60,12 +60,12 @@ static int traceBack(lua_State *L)
60 lua_Debug ar; 60 lua_Debug ar;
61 int i, top = lua_gettop(L), b = 1; 61 int i, top = lua_gettop(L), b = 1;
62 62
63// printf("Stack is %d deep\n", top); 63// PI("Stack is %d deep", top);
64// for (i = 1; i <= top; i++) 64// for (i = 1; i <= top; i++)
65// dumpStack(L, i); 65// dumpStack(L, i);
66 66
67 if (top) 67 if (top)
68 printf("Lua error - %s\n", lua_tostring(L, 1)); 68 PE("Lua error - %s", lua_tostring(L, 1));
69 69
70 i = 0; 70 i = 0;
71 while (lua_getstack(L, i++, &ar)) 71 while (lua_getstack(L, i++, &ar))
@@ -74,15 +74,15 @@ static int traceBack(lua_State *L)
74 { 74 {
75 if (NULL == ar.name) 75 if (NULL == ar.name)
76 ar.name = "DUNNO"; 76 ar.name = "DUNNO";
77 printf(" Lua backtrace %d - %s %s %s @ %s : %d\n", i, ar.what, ar.namewhat, ar.name, ar.short_src, ar.currentline); 77 PE(" Lua backtrace %d - %s %s %s @ %s : %d", i, ar.what, ar.namewhat, ar.name, ar.short_src, ar.currentline);
78 b = 0; 78 b = 0;
79 } 79 }
80 else 80 else
81 printf(" Failed to get trace line!\n"); 81 PE(" Failed to get trace line!");
82 } 82 }
83 83
84 if (b) 84 if (b)
85 printf(" NO BACKTRACE!\n"); 85 PE(" NO BACKTRACE!");
86 86
87 return 0; 87 return 0;
88} 88}
@@ -99,7 +99,7 @@ static void printLuaError(int err, char *string, lua_State *L)
99 case LUA_ERRERR: err_type = "error handler"; break; 99 case LUA_ERRERR: err_type = "error handler"; break;
100 default: err_type = "unknown"; break; 100 default: err_type = "unknown"; break;
101 } 101 }
102 printf("Error running - %s, \n %s - %s\n", string, err_type, lua_tostring(L, -1)); 102 PW("Error running - %s, \n %s - %s", string, err_type, lua_tostring(L, -1));
103} 103}
104 104
105static int panics = 0; 105static int panics = 0;
@@ -109,9 +109,9 @@ static int _panic(lua_State *L) // Stack usage [-0, +0, m]
109 // of memory in the following lua_tostring() call. 109 // of memory in the following lua_tostring() call.
110 panics++; 110 panics++;
111 if (panics) 111 if (panics)
112 printf("Lua PANICS!!!!!"); 112 PE("Lua PANICS!!!!!");
113 else 113 else
114 printf("Lua PANIC!!!!!: %s", lua_tostring(L, -1)); // Stack usage [-0, +0, m] 114 PE("Lua PANIC!!!!!: %s", lua_tostring(L, -1)); // Stack usage [-0, +0, m]
115 // The docs say that this will cause an exit(EXIT_FAILURE) if we return, 115 // The docs say that this will cause an exit(EXIT_FAILURE) if we return,
116 // and that we we should long jump some where to avoid that. This is only 116 // and that we we should long jump some where to avoid that. This is only
117 // called for things not called from a protected environment. We always 117 // called for things not called from a protected environment. We always
@@ -147,7 +147,7 @@ void doLuaString(lua_State *L, char *string, char *module)
147 { 147 {
148 const char *err = lua_tostring(L, 1); 148 const char *err = lua_tostring(L, 1);
149 149
150 printf("Error parsing - %s, ERROR %s", string, err); 150 PE("Error parsing - %s, ERROR %s", string, err);
151 } 151 }
152 else 152 else
153 { 153 {
@@ -159,12 +159,12 @@ void doLuaString(lua_State *L, char *string, char *module)
159 // Consistancy would be good, just sayin'. 159 // Consistancy would be good, just sayin'.
160 if (0 == lua_setfenv(L, _A)) 160 if (0 == lua_setfenv(L, _A))
161 { 161 {
162 printf("Error setting environment for - %s", string); 162 PE("Error setting environment for - %s", string);
163 return; 163 return;
164 } 164 }
165 } 165 }
166 166
167//printf("doLuaString(%s)\n", string); 167//PD("doLuaString(%s)\", string);
168 if ((err = lua_pcall(L, 0, LUA_MULTRET, _T))) 168 if ((err = lua_pcall(L, 0, LUA_MULTRET, _T)))
169 printLuaError(err, string, L); 169 printLuaError(err, string, L);
170 } 170 }
@@ -174,7 +174,7 @@ static void _stopScript(script *s)
174{ 174{
175 scriptMessage *sm0, *sm1; 175 scriptMessage *sm0, *sm1;
176 176
177//printf("^^^^^^^^^^^^^^^^^^^_stop(, %s)\n", s->name); 177//PD("^^^^^^^^^^^^^^^^^^^_stop(, %s)", s->name);
178 if (s->L) lua_close(s->L); s->L = NULL; 178 if (s->L) lua_close(s->L); s->L = NULL;
179 if (s->timer) ecore_timer_del(s->timer); s->timer = NULL; 179 if (s->timer) ecore_timer_del(s->timer); s->timer = NULL;
180 EINA_CLIST_FOR_EACH_ENTRY_SAFE(sm0, sm1, &(s->messages), scriptMessage, node) 180 EINA_CLIST_FOR_EACH_ENTRY_SAFE(sm0, sm1, &(s->messages), scriptMessage, node)
@@ -210,7 +210,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
210 210
211 if (RUNNR_READY == s->status) 211 if (RUNNR_READY == s->status)
212 { 212 {
213//printf("_workerFunction() READY %s\n", s->name); 213//PD("_workerFunction() READY %s", s->name);
214 if ((msg = (scriptMessage *) eina_clist_head(&(s->messages)))) 214 if ((msg = (scriptMessage *) eina_clist_head(&(s->messages))))
215 { 215 {
216 eina_clist_remove(&(msg->node)); 216 eina_clist_remove(&(msg->node));
@@ -226,7 +226,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
226 { 226 {
227 int err; 227 int err;
228 228
229//printf("_workerFunction() STARTING %s\n", s->name); 229//PD("_workerFunction() STARTING %s", s->name);
230 s->status = RUNNR_RUNNING; 230 s->status = RUNNR_RUNNING;
231 s->L = luaL_newstate(); // Sets a standard allocator and panic function. 231 s->L = luaL_newstate(); // Sets a standard allocator and panic function.
232 232
@@ -243,7 +243,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
243 if (err != 0) 243 if (err != 0)
244 { 244 {
245 s->status = RUNNR_FINISHED; 245 s->status = RUNNR_FINISHED;
246 printf("Error loading compiled Lua %s.", s->binName); 246 PE("Error loading compiled Lua %s.", s->binName);
247 } 247 }
248 gettimeofday(&s->startTime, NULL); 248 gettimeofday(&s->startTime, NULL);
249 } 249 }
@@ -254,7 +254,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
254 { 254 {
255 int stat; 255 int stat;
256 256
257//printf("_workerFunction() RUNNING %s %s\n", s->name, message); 257//PD("_workerFunction() RUNNING %s %s", s->name, message);
258 // Resume running the script. 258 // Resume running the script.
259 // lua_resume() needs a Lua thread, and the initial Lua state is a thread. 259 // lua_resume() needs a Lua thread, and the initial Lua state is a thread.
260 // Other Lua threads have their own state, but share the environment with the initial state. 260 // Other Lua threads have their own state, but share the environment with the initial state.
@@ -270,7 +270,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
270 s->status = RUNNR_FINISHED; 270 s->status = RUNNR_FINISHED;
271 else if (stat != LUA_YIELD) 271 else if (stat != LUA_YIELD)
272 { 272 {
273 printf("lua_resume error at %s\n", s->name); 273 PE("lua_resume error at %s", s->name);
274 printLuaError(stat, s->name, s->L); 274 printLuaError(stat, s->name, s->L);
275 s->status = RUNNR_FINISHED; 275 s->status = RUNNR_FINISHED;
276 } 276 }
@@ -288,7 +288,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
288 // Start again from the top when Ecore_Thread has a spare thread ready, unless the script finished. 288 // Start again from the top when Ecore_Thread has a spare thread ready, unless the script finished.
289 if (RUNNR_FINISHED == s->status) 289 if (RUNNR_FINISHED == s->status)
290 { 290 {
291//printf("_workerFunction() FINISHED %s\n", s->name); 291//PD("_workerFunction() FINISHED %s", s->name);
292#if THREADIT 292#if THREADIT
293 ecore_thread_cancel(thread); 293 ecore_thread_cancel(thread);
294#else 294#else
@@ -297,7 +297,7 @@ static void _workerFunction(void *data, Ecore_Thread *thread)
297 } 297 }
298 else if (RUNNR_WAIT == s->status) 298 else if (RUNNR_WAIT == s->status)
299 { 299 {
300;//printf("_workerFunction() WAIT %s\n", s->name); 300;//PD("_workerFunction() WAIT %s", s->name);
301 } 301 }
302#if THREADIT 302#if THREADIT
303 else if (RUNNR_READY == s->status) 303 else if (RUNNR_READY == s->status)
@@ -323,7 +323,7 @@ static void _cancel(void *data, Ecore_Thread *thread)
323 s->status = RUNNR_FINISHED; 323 s->status = RUNNR_FINISHED;
324 eina_clist_remove(&(s->node)); 324 eina_clist_remove(&(s->node));
325 if (s->SID[0]) ecore_thread_global_data_del(s->SID); s->SID[0] = 0; 325 if (s->SID[0]) ecore_thread_global_data_del(s->SID); s->SID[0] = 0;
326//printf("^^^^^^^^^^^^^^^^^^^_del(, %s)\n", s->name); 326//PD("^^^^^^^^^^^^^^^^^^^_del(, %s)", s->name);
327 // TODO - Perhaps have our own deletion callback to pass back? 327 // TODO - Perhaps have our own deletion callback to pass back?
328 releaseScript(s); 328 releaseScript(s);
329#if THREADIT 329#if THREADIT
@@ -444,11 +444,11 @@ static void _compileThread(void *data, Ecore_Thread *thread)
444 compiler->bugCount++; 444 compiler->bugCount++;
445#if COMPILE_OUTPUT 445#if COMPILE_OUTPUT
446 if (LUA_ERRSYNTAX == err) 446 if (LUA_ERRSYNTAX == err)
447 printf("Lua syntax error in %s: %s\n", name, lua_tostring(L, -1)); 447 PI("Lua syntax error in %s: %s", name, lua_tostring(L, -1));
448 else if (LUA_ERRFILE == err) 448 else if (LUA_ERRFILE == err)
449 printf("Lua compile file error in %s: %s\n", name, lua_tostring(L, -1)); 449 PE("Lua compile file error in %s: %s", name, lua_tostring(L, -1));
450 else if (LUA_ERRMEM == err) 450 else if (LUA_ERRMEM == err)
451 printf("Lua compile memory allocation error in %s: %s\n", name, lua_tostring(L, -1)); 451 PC("Lua compile memory allocation error in %s: %s", name, lua_tostring(L, -1));
452#endif 452#endif
453 } 453 }
454 else 454 else
@@ -462,28 +462,28 @@ static void _compileThread(void *data, Ecore_Thread *thread)
462 if (err) 462 if (err)
463 { 463 {
464 compiler->bugCount++; 464 compiler->bugCount++;
465 printf("Lua compile file error writing to %s\n", name); 465 PE("Lua compile file error writing to %s", name);
466 } 466 }
467 fclose(out); 467 fclose(out);
468 } 468 }
469 else 469 else
470 { 470 {
471 compiler->bugCount++; 471 compiler->bugCount++;
472 printf("CRITICAL! Unable to open file %s for writing!\n", name); 472 PE("CRITICAL! Unable to open file %s for writing!", name);
473 } 473 }
474 } 474 }
475 } 475 }
476 else if (!compiler->doConstants) 476 else if (!compiler->doConstants)
477 { 477 {
478 compiler->bugCount++; 478 compiler->bugCount++;
479 printf("Can't create a new Lua state!\n"); 479 PC("Can't create a new Lua state!");
480 } 480 }
481 } 481 }
482 else 482 else
483 { 483 {
484 compiler->bugCount++; 484 compiler->bugCount++;
485#if COMPILE_OUTPUT 485#if COMPILE_OUTPUT
486 printf("Nothing for Lua to compile!\n"); 486 PW("Nothing for Lua to compile!");
487#endif 487#endif
488 } 488 }
489} 489}
@@ -544,8 +544,8 @@ void takeScript(script *s)
544{ 544{
545#if THREADIT 545#if THREADIT
546 Eina_Lock_Result result = eina_lock_take(&s->mutex); 546 Eina_Lock_Result result = eina_lock_take(&s->mutex);
547 if (EINA_LOCK_DEADLOCK == result) printf("Script %s IS DEADLOCKED!\n", s->name); 547 if (EINA_LOCK_DEADLOCK == result) PE("Script %s IS DEADLOCKED!", s->name);
548 if (EINA_LOCK_FAIL == result) printf("Script %s LOCK FAILED!\n", s->name); 548 if (EINA_LOCK_FAIL == result) PE("Script %s LOCK FAILED!", s->name);
549#endif 549#endif
550} 550}
551 551
@@ -861,7 +861,7 @@ int push_lua(lua_State *L, char *params, ...) // Stack usage [-0, +n, em]
861 { 861 {
862 if (table) q = _push_name(L, q, &i); // Stack usage [-0, +1, m] 862 if (table) q = _push_name(L, q, &i); // Stack usage [-0, +1, m]
863 char *t = va_arg(vl, char *); 863 char *t = va_arg(vl, char *);
864//printf("push_lua %s string %s\n", p, t); 864//PD("push_lua %s string %s", p, t);
865 lua_pushstring(L, t); // Stack usage [-0, +1, m] 865 lua_pushstring(L, t); // Stack usage [-0, +1, m]
866 break; 866 break;
867 } 867 }
diff --git a/src/libraries/SledjHamr.c b/src/libraries/SledjHamr.c
index 10eeca5..2fb9019 100644
--- a/src/libraries/SledjHamr.c
+++ b/src/libraries/SledjHamr.c
@@ -38,7 +38,7 @@ static boolean checkConnection(Connection *conn, char *func, connType wanted, bo
38 if ((conn->type != CT_CLIENT) && (conn->type != CT_SERVER)) 38 if ((conn->type != CT_CLIENT) && (conn->type != CT_SERVER))
39 { 39 {
40 result = FALSE; 40 result = FALSE;
41 printf("CONNECTION OBJECT in %s() is of unknown type %d\n", func, (int) conn->type); 41 PE("CONNECTION OBJECT in %s() is of unknown type %d", func, (int) conn->type);
42 } 42 }
43 else if (conn->type != wanted) 43 else if (conn->type != wanted)
44 { 44 {
@@ -47,43 +47,43 @@ static boolean checkConnection(Connection *conn, char *func, connType wanted, bo
47 { 47 {
48 case CT_CLIENT : 48 case CT_CLIENT :
49 if (conn->type == CT_SERVER) 49 if (conn->type == CT_SERVER)
50 printf("INVALID CONNECTION OBJECT in %s(), it might be a server object!\n", func); 50 PE("INVALID CONNECTION OBJECT in %s(), it might be a server object!", func);
51 else 51 else
52 printf("INVALID CONNECTION OBJECT in %s(), type is %d!\n", func, (int) conn->type); 52 PE("INVALID CONNECTION OBJECT in %s(), type is %d!", func, (int) conn->type);
53 if (conn->conn.client.myServer == NULL) 53 if (conn->conn.client.myServer == NULL)
54 printf("CONNECTION OBJECT in %s() is a local client, but should be a remote client mirror!\n", func); 54 PE("CONNECTION OBJECT in %s() is a local client, but should be a remote client mirror!", func);
55 break; 55 break;
56 56
57 case CT_SERVER : 57 case CT_SERVER :
58 if (conn->type == CT_CLIENT) 58 if (conn->type == CT_CLIENT)
59 printf("INVALID CONNECTION OBJECT in %s(), it might be a client object!\n", func); 59 PE("INVALID CONNECTION OBJECT in %s(), it might be a client object!", func);
60 else 60 else
61 printf("INVALID CONNECTION OBJECT in %s(), type is %d!\n", func, (int) conn->type); 61 PE("INVALID CONNECTION OBJECT in %s(), type is %d!", func, (int) conn->type);
62 if (isLocal) 62 if (isLocal)
63 { 63 {
64 if (conn->conn.server.clients == NULL) 64 if (conn->conn.server.clients == NULL)
65 printf("CONNECTION OBJECT in %s() is a remote server mirror, but should be a local server!\n", func); 65 PE("CONNECTION OBJECT in %s() is a remote server mirror, but should be a local server!", func);
66 } 66 }
67 else 67 else
68 { 68 {
69 if (conn->conn.server.clients != NULL) 69 if (conn->conn.server.clients != NULL)
70 printf("CONNECTION OBJECT in %s() is a local server, but should be a remote server mirror!\n", func); 70 PE("CONNECTION OBJECT in %s() is a local server, but should be a remote server mirror!", func);
71 } 71 }
72 break; 72 break;
73 73
74 default : 74 default :
75 printf("CONNECTION OBJECT in %s(), silly coder asked for an unknown type!""\n", func); 75 PE("CONNECTION OBJECT in %s(), silly coder asked for an unknown type!", func);
76 break; 76 break;
77 } 77 }
78 78
79 if (NULL == conn->name) 79 if (NULL == conn->name)
80 { 80 {
81 result = FALSE; 81 result = FALSE;
82 printf("CONNECTION OBJECT in %s() has no name!\n", func); 82 PE("CONNECTION OBJECT in %s() has no name!", func);
83 } 83 }
84 } 84 }
85 85
86//if (result) printf("%s(\"%s\")\n", func, conn->name); 86//if (result) PD("%s(\"%s\")", func, conn->name);
87 87
88 return result; 88 return result;
89} 89}
@@ -102,11 +102,11 @@ void sendBack(Connection *conn, const char *SID, const char *message, ...)
102 va_end(args); 102 va_end(args);
103 buf[length++] = '\n'; 103 buf[length++] = '\n';
104 buf[length] = '\0'; 104 buf[length] = '\0';
105// printf("sendBack(%s", buf); 105// PD("sendBack(%s", buf);
106// ecore_con_client_send(client, buf, length); 106// ecore_con_client_send(client, buf, length);
107// ecore_con_client_flush(client); 107// ecore_con_client_flush(client);
108//Connection *conn = ecore_con_client_data_get(client); 108//Connection *conn = ecore_con_client_data_get(client);
109if (conn) send2(conn, SID, buf); else printf("sendBack() can't find Connection!\n"); 109if (conn) send2(conn, SID, buf); else PE("sendBack() can't find Connection!");
110} 110}
111 111
112void sendForth(Connection *conn, const char *SID, const char *message, ...) 112void sendForth(Connection *conn, const char *SID, const char *message, ...)
@@ -123,11 +123,11 @@ void sendForth(Connection *conn, const char *SID, const char *message, ...)
123 va_end(args); 123 va_end(args);
124 buf[length++] = '\n'; 124 buf[length++] = '\n';
125 buf[length] = '\0'; 125 buf[length] = '\0';
126// printf("sendForth(%s", buf); 126// PD("sendForth(%s", buf);
127// ecore_con_server_send(server, buf, length); 127// ecore_con_server_send(server, buf, length);
128// ecore_con_server_flush(server); 128// ecore_con_server_flush(server);
129//Connection *conn = ecore_con_server_data_get(server); 129//Connection *conn = ecore_con_server_data_get(server);
130if (conn) send2(conn, SID, buf); else printf("sendForth() can't find Connection!\n"); 130if (conn) send2(conn, SID, buf); else PE("sendForth() can't find Connection!");
131} 131}
132 132
133void send2(Connection *conn, const char *SID, const char *message, ...) 133void send2(Connection *conn, const char *SID, const char *message, ...)
@@ -153,24 +153,24 @@ length = strlen(buf);
153 switch (conn->type) 153 switch (conn->type)
154 { 154 {
155 case CT_CLIENT : 155 case CT_CLIENT :
156// printf("vvv send2(%*s", length, buf); 156// PD("vvv send2(%*s", length, buf);
157 ecore_con_client_send(conn->conn.client.client, strndup(buf, length), length); 157 ecore_con_client_send(conn->conn.client.client, strndup(buf, length), length);
158 ecore_con_client_flush(conn->conn.client.client); 158 ecore_con_client_flush(conn->conn.client.client);
159 break; 159 break;
160 160
161 case CT_SERVER : 161 case CT_SERVER :
162// printf("^^^ send2(%*s", length, buf); 162// PD("^^^ send2(%*s", length, buf);
163 ecore_con_server_send(conn->conn.server.server, strndup(buf, length), length); 163 ecore_con_server_send(conn->conn.server.server, strndup(buf, length), length);
164 ecore_con_server_flush(conn->conn.server.server); 164 ecore_con_server_flush(conn->conn.server.server);
165 break; 165 break;
166 166
167 default : 167 default :
168 printf("send2() unable to send to partially bogus Connection object!\n"); 168 PE("send2() unable to send to partially bogus Connection object!");
169 break; 169 break;
170 } 170 }
171 } 171 }
172 else 172 else
173 printf("send2() unable to send to bogus Connection object!\n"); 173 PE("send2() unable to send to bogus Connection object!");
174} 174}
175 175
176static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, void *ev) 176static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, void *ev)
@@ -180,7 +180,6 @@ static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, voi
180 const char *command; 180 const char *command;
181 char *ext; 181 char *ext;
182 182
183//printf("parseStream(%s, \"%*s\")\n", conn->name, evSize, (char *) evData);
184 if (NULL == conn->stream) 183 if (NULL == conn->stream)
185 conn->stream = eina_strbuf_new(); 184 conn->stream = eina_strbuf_new();
186 185
@@ -202,7 +201,6 @@ static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, voi
202 if (ext) 201 if (ext)
203 { 202 {
204 streamParser func = eina_hash_find(conn->commands, command); 203 streamParser func = eina_hash_find(conn->commands, command);
205//printf("parseStream(%s>> %s\"\n", conn->name, command);
206 204
207// ext[0] = '\0'; 205// ext[0] = '\0';
208 // Need a callback if we can't find the command. 206 // Need a callback if we can't find the command.
@@ -211,7 +209,7 @@ static Eina_Bool parseStream(void *data, int type, void *evData, int evSize, voi
211 if (func) 209 if (func)
212 func(conn->pointer, conn, SID, (char *) command, ext + 1); 210 func(conn->pointer, conn, SID, (char *) command, ext + 1);
213 else 211 else
214 printf("parseStream() No function found for command %s!\n", command); 212 PE("parseStream() No function found for command %s!", command);
215 } 213 }
216 } 214 }
217 215
@@ -297,9 +295,9 @@ static Eina_Bool clientDel(void *data, int type, Ecore_Con_Event_Client_Del *ev)
297 // The "- 1" is coz this server is still counted. 295 // The "- 1" is coz this server is still counted.
298 clients = ecore_con_server_clients_get(conn->conn.server.server) - 1; 296 clients = ecore_con_server_clients_get(conn->conn.server.server) - 1;
299 if (0 == eina_list_count(clients)) 297 if (0 == eina_list_count(clients))
300 printf("No more clients for %s, exiting.\n", conn->name); 298 PI("No more clients for %s, exiting.", conn->name);
301 else 299 else
302 printf("Some (%d) more clients for %s, exiting anyway.\n", eina_list_count(clients), conn->name); 300 PW("Some (%d) more clients for %s, exiting anyway.", eina_list_count(clients), conn->name);
303 301
304 // TODO - the Connection free function should take care of all of this, and we should call it here. ish. 302 // TODO - the Connection free function should take care of all of this, and we should call it here. ish.
305 eina_clist_remove(conn->conn.client.server); 303 eina_clist_remove(conn->conn.client.server);
@@ -345,7 +343,7 @@ Connection *openArms(char *name, const char *address, int port, void *data, Ecor
345 ecore_con_server_client_limit_set(server, -1, 0); 343 ecore_con_server_client_limit_set(server, -1, 0);
346// ecore_con_server_timeout_set(server, 10); 344// ecore_con_server_timeout_set(server, 10);
347// ecore_con_server_client_limit_set(server, 3, 0); 345// ecore_con_server_client_limit_set(server, 3, 0);
348 printf("ACTUALLY created the %s server %s:%d.\n", name, address, port); 346 PI("ACTUALLY created the %s server %s:%d.", name, address, port);
349 } 347 }
350 else 348 else
351 { 349 {
@@ -368,9 +366,9 @@ static Eina_Bool serverAdd(void *data, int type, Ecore_Con_Event_Server_Add *ev)
368 conn->stage++; 366 conn->stage++;
369 367
370 if (conn->name) 368 if (conn->name)
371 printf("serverAdd()^^^^^^^^^^^^^^^^^^^^^^^Connected to %s server.\n", conn->name); 369 PI("serverAdd()^^^^^^^^^^^^^^^^^^^^^^^Connected to %s server.", conn->name);
372 else 370 else
373 printf("serverAdd()^^^^^^^^^^^^^^^^^^^^^^^Connected to UNKNOWN server.\n"); 371 PW("serverAdd()^^^^^^^^^^^^^^^^^^^^^^^Connected to UNKNOWN server.");
374 372
375 // In case the server crashed, clear out any waiting data. 373 // In case the server crashed, clear out any waiting data.
376 if (conn->stream) 374 if (conn->stream)
@@ -421,18 +419,16 @@ static Eina_Bool _reachOutTimer(void *data)
421 { 419 {
422 // TODO - Seems Ecore_con now has trouble with my try first, then start method, so start first, then try. Fix this, or do something else. 420 // TODO - Seems Ecore_con now has trouble with my try first, then start method, so start first, then try. Fix this, or do something else.
423 case -3 : 421 case -3 :
424 printf("Failed to connect to a %s server, starting our own.\n", conn->name); 422 PW("Failed to connect to a %s server, starting our own.", conn->name);
425 conn->conn.server.serverHandle = ecore_exe_pipe_run(conn->conn.server.serverCommand, ECORE_EXE_NONE /*| ECORE_EXE_TERM_WITH_PARENT*/, conn); 423 conn->conn.server.serverHandle = ecore_exe_pipe_run(conn->conn.server.serverCommand, ECORE_EXE_NONE /*| ECORE_EXE_TERM_WITH_PARENT*/, conn);
426 if (conn->conn.server.serverHandle) 424 if (conn->conn.server.serverHandle)
427 { 425 {
428 conn->conn.server.pid = ecore_exe_pid_get(conn->conn.server.serverHandle); 426 conn->conn.server.pid = ecore_exe_pid_get(conn->conn.server.serverHandle);
429 if (conn->conn.server.pid == -1) 427 if (conn->conn.server.pid == -1)
430 fprintf(stderr, "Could not retrive the PID!\n"); 428 PE("Could not retrive the PID!");
431 else
432 fprintf(stdout, "The child process has PID:%u\n", (unsigned int)conn->conn.server.pid);
433 } 429 }
434 else 430 else
435 fprintf(stderr, "Could not create server process %s!\n", conn->conn.server.serverCommand); 431 PE("Could not create server process %s!", conn->conn.server.serverCommand);
436 432
437 // TODO - There's also the question of what to do if the connection failed. 433 // TODO - There's also the question of what to do if the connection failed.
438 // Did the server crash, or was it just the connection? 434 // Did the server crash, or was it just the connection?
@@ -448,20 +444,20 @@ static Eina_Bool _reachOutTimer(void *data)
448 case -1 : // Give the server some time to start up. 444 case -1 : // Give the server some time to start up.
449 // Check if the server is still running here, if not, reset stage to previous -3 (taking into account the increment at the end). 445 // Check if the server is still running here, if not, reset stage to previous -3 (taking into account the increment at the end).
450 if (conn->conn.server.pid) 446 if (conn->conn.server.pid)
451 printf("Waiting for %s server to start from command \"%s\"\n", conn->name, conn->conn.server.serverCommand); 447 PI("Waiting for %s server to start from command \"%s\"", conn->name, conn->conn.server.serverCommand);
452 else 448 else
453 conn->stage = -4; 449 conn->stage = -4;
454 break; 450 break;
455 451
456 case 0 : 452 case 0 :
457 printf("Attempting to connect to the %s server %s:%d.\n", conn->name, conn->address, conn->port); 453 PI("Attempting to connect to the %s server %s:%d.", conn->name, conn->address, conn->port);
458 // This should only return NULL if something goes wrong with the setup, 454 // This should only return NULL if something goes wrong with the setup,
459 // you wont know if the connection worked until you get the add callback, 455 // you wont know if the connection worked until you get the add callback,
460 // or you get the del calback if it failed. 456 // or you get the del calback if it failed.
461 if ((server = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, conn->address, conn->port, conn))) 457 if ((server = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, conn->address, conn->port, conn)))
462 printf("MAYBE connecting to the %s server %s:%d.\n", conn->name, conn->address, conn->port); 458 PD("MAYBE connecting to the %s server %s:%d.", conn->name, conn->address, conn->port);
463 else 459 else
464 printf("FAILED to create the connection to the %s server %s:%d!\n", conn->name, conn->address, conn->port); 460 PE("FAILED to create the connection to the %s server %s:%d!", conn->name, conn->address, conn->port);
465 conn->conn.server.server = server; 461 conn->conn.server.server = server;
466 break; 462 break;
467 463
diff --git a/src/love/love.c b/src/love/love.c
index d8972d1..05f07db 100644
--- a/src/love/love.c
+++ b/src/love/love.c
@@ -197,7 +197,7 @@ static Eina_Bool LuaSLParser(void *data, Connection *conn, char *SID, char *comm
197 char buf[PATH_MAX]; 197 char buf[PATH_MAX];
198 LoveScript *me; 198 LoveScript *me;
199 199
200PW("COMMAND - %s - %s", SID, command); 200PD("COMMAND - %s - %s", SID, command);
201 me = eina_hash_find(ourGlobals->scripts, SID); 201 me = eina_hash_find(ourGlobals->scripts, SID);
202 if (0 == strncmp(command, "compilerWarning(", 16)) 202 if (0 == strncmp(command, "compilerWarning(", 16))
203 { 203 {
@@ -260,7 +260,7 @@ PW("COMMAND - %s - %s", SID, command);
260 if (compiledCount == scriptCount) 260 if (compiledCount == scriptCount)
261 { 261 {
262 float total = timeDiff(&now, &startTime); 262 float total = timeDiff(&now, &startTime);
263 PD("Compile speed scripts: %d time: %fs total: %f scripts per second", compiledCount, total, compiledCount / total); 263 PI("Compile speed scripts: %d time: %fs total: %f scripts per second", compiledCount, total, compiledCount / total);
264 } 264 }
265 } 265 }
266 } 266 }
@@ -274,10 +274,10 @@ PW("COMMAND - %s - %s", SID, command);
274 if (compiledCount == scriptCount) 274 if (compiledCount == scriptCount)
275 { 275 {
276 float total = timeDiff(&now, &startTime); 276 float total = timeDiff(&now, &startTime);
277 PD("Compile speed scripts: %d time: %fs total: %f scripts per second", compiledCount, total, compiledCount / total); 277 PI("Compile speed scripts: %d time: %fs total: %f scripts per second", compiledCount, total, compiledCount / total);
278 } 278 }
279 } 279 }
280 PD("About to run %s", me->fileName); 280//PD("About to run %s", me->fileName);
281 sendForth(ourGlobals->serverLuaSL, SID, "run(%s)", me->fileName); 281 sendForth(ourGlobals->serverLuaSL, SID, "run(%s)", me->fileName);
282 } 282 }
283 else 283 else
@@ -676,11 +676,11 @@ int main(int argc, char **argv)
676 edje_object_signal_callback_add(ourGlobals.edje, "*", "game_*", _edje_signal_cb, &ourGlobals); 676 edje_object_signal_callback_add(ourGlobals.edje, "*", "game_*", _edje_signal_cb, &ourGlobals);
677 } 677 }
678 678
679 PD("About to try connecting to a LuaSL server."); 679// PD("About to try connecting to a LuaSL server.");
680 // Try to connect to a local LuaSL server. 680 // Try to connect to a local LuaSL server.
681 reachOut("LuaSL", "./LuaSL", "127.0.0.1", ourGlobals.port, &ourGlobals, (Ecore_Event_Handler_Cb) _addLuaSL, /*(Ecore_Event_Handler_Cb) _dataLuaSL*/ NULL, (Ecore_Event_Handler_Cb) _delLuaSL, LuaSLParser); 681 reachOut("LuaSL", "./LuaSL", "127.0.0.1", ourGlobals.port, &ourGlobals, (Ecore_Event_Handler_Cb) _addLuaSL, /*(Ecore_Event_Handler_Cb) _dataLuaSL*/ NULL, (Ecore_Event_Handler_Cb) _delLuaSL, LuaSLParser);
682 682
683 PD("Love is about to try creating a love server."); 683// PD("Love is about to try creating a love server.");
684 if (openArms("love", ourGlobals.address, ourGlobals.port + 1, &ourGlobals, (Ecore_Event_Handler_Cb) _addClient, NULL, (Ecore_Event_Handler_Cb) _delClient, clientParser)) 684 if (openArms("love", ourGlobals.address, ourGlobals.port + 1, &ourGlobals, (Ecore_Event_Handler_Cb) _addClient, NULL, (Ecore_Event_Handler_Cb) _delClient, clientParser))
685 { 685 {
686 ecore_main_loop_begin(); 686 ecore_main_loop_begin();