diff options
author | David Walter Seikel | 2014-05-20 23:34:25 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-20 23:34:25 +1000 |
commit | 909fd6e2c4369020707782e20656069fbb3030d1 (patch) | |
tree | 15590f94950be42916fff1b3ba00124bce157751 | |
parent | The results of a session with valgrind. (diff) | |
download | SledjHamr-909fd6e2c4369020707782e20656069fbb3030d1.zip SledjHamr-909fd6e2c4369020707782e20656069fbb3030d1.tar.gz SledjHamr-909fd6e2c4369020707782e20656069fbb3030d1.tar.bz2 SledjHamr-909fd6e2c4369020707782e20656069fbb3030d1.tar.xz |
Found a way to deal with the PACKAGE_* stuff outside of Elm. It's undocumented.
-rw-r--r-- | src/GuiLua/GuiLua.c | 10 | ||||
-rw-r--r-- | src/GuiLua/GuiLua.h | 1 | ||||
-rw-r--r-- | src/GuiLua/skang.c | 6 | ||||
-rw-r--r-- | src/GuiLua/test_c.c | 3 | ||||
-rw-r--r-- | src/LuaSL/LuaSL.h | 1 | ||||
-rw-r--r-- | src/LuaSL/LuaSL_compile.c | 4 | ||||
-rw-r--r-- | src/LuaSL/LuaSL_main.c | 26 | ||||
-rwxr-xr-x | src/LuaSL/build.lua | 7 | ||||
-rw-r--r-- | src/extantz/Evas_3D_demo.c | 8 | ||||
-rw-r--r-- | src/extantz/ephysics_demo.c | 4 | ||||
-rw-r--r-- | src/extantz/extantz.c | 27 | ||||
-rw-r--r-- | src/extantz/extantz.h | 1 | ||||
-rw-r--r-- | src/extantz/woMan.c | 6 | ||||
-rw-r--r-- | src/libraries/LumbrJack.c | 81 | ||||
-rw-r--r-- | src/libraries/LumbrJack.h | 19 | ||||
-rw-r--r-- | src/libraries/SledjHamr.h | 8 | ||||
-rwxr-xr-x | src/libraries/build.lua | 11 | ||||
-rw-r--r-- | src/libraries/winFang.c | 40 | ||||
-rw-r--r-- | src/libraries/winFang.h | 11 | ||||
-rwxr-xr-x | src/love/build.lua | 6 | ||||
-rw-r--r-- | src/love/love.c | 17 | ||||
-rw-r--r-- | src/purkle/purkle.c | 2 |
22 files changed, 149 insertions, 150 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c index 5815b45..1ffbc0f 100644 --- a/src/GuiLua/GuiLua.c +++ b/src/GuiLua/GuiLua.c | |||
@@ -142,12 +142,10 @@ and ordinary elementary widgets. Proper introspection can come later. | |||
142 | */ | 142 | */ |
143 | 143 | ||
144 | 144 | ||
145 | #include "LumbrJack.h" | ||
146 | #include "GuiLua.h" | 145 | #include "GuiLua.h" |
147 | #include "Runnr.h" | 146 | #include "Runnr.h" |
148 | 147 | ||
149 | 148 | ||
150 | static int logDom; // Our logging domain. | ||
151 | const char *glName = "ourGuiLua"; | 149 | const char *glName = "ourGuiLua"; |
152 | 150 | ||
153 | /* Sooo, how to do this - | 151 | /* Sooo, how to do this - |
@@ -373,7 +371,6 @@ int luaopen_GuiLua(lua_State *L) | |||
373 | 371 | ||
374 | printf("**********************require GuiLua\n"); | 372 | printf("**********************require GuiLua\n"); |
375 | // In theory this function only ever gets called once. | 373 | // In theory this function only ever gets called once. |
376 | logDom = loggingStartup("GuiLua", logDom); | ||
377 | 374 | ||
378 | elm_policy_set(ELM_POLICY_EXIT, ELM_POLICY_EXIT_NONE); | 375 | elm_policy_set(ELM_POLICY_EXIT, ELM_POLICY_EXIT_NONE); |
379 | elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_NONE); | 376 | elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_NONE); |
@@ -474,18 +471,13 @@ GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent, EPhysics_World *world) | |||
474 | PE("Error running - skang.loopWindow()"); | 471 | PE("Error running - skang.loopWindow()"); |
475 | GuiLuaDel(result); | 472 | GuiLuaDel(result); |
476 | result = NULL; | 473 | result = NULL; |
477 | if (logDom >= 0) | ||
478 | { | ||
479 | eina_log_domain_unregister(logDom); | ||
480 | logDom = -1; | ||
481 | } | ||
482 | 474 | ||
483 | // This shuts down Elementary, but keeps the main loop running until all ecore_evas are freed. | 475 | // This shuts down Elementary, but keeps the main loop running until all ecore_evas are freed. |
484 | elm_shutdown(); | 476 | elm_shutdown(); |
485 | } | 477 | } |
486 | } | 478 | } |
487 | else | 479 | else |
488 | fprintf(stderr, "Failed to start Lua!\n"); | 480 | PE("Failed to start Lua!"); |
489 | 481 | ||
490 | return result; | 482 | return result; |
491 | } | 483 | } |
diff --git a/src/GuiLua/GuiLua.h b/src/GuiLua/GuiLua.h index d82d244..216ce8a 100644 --- a/src/GuiLua/GuiLua.h +++ b/src/GuiLua/GuiLua.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _GUILUA_H_ | 2 | #define _GUILUA_H_ |
3 | 3 | ||
4 | 4 | ||
5 | #include "LumbrJack.h" | ||
5 | #include "Runnr.h" | 6 | #include "Runnr.h" |
6 | #include "winFang.h" | 7 | #include "winFang.h" |
7 | 8 | ||
diff --git a/src/GuiLua/skang.c b/src/GuiLua/skang.c index c116f30..3aee0e2 100644 --- a/src/GuiLua/skang.c +++ b/src/GuiLua/skang.c | |||
@@ -1,11 +1,13 @@ | |||
1 | #include "SledjHamr.h" | ||
2 | #include "GuiLua.h" | 1 | #include "GuiLua.h" |
3 | 2 | ||
4 | 3 | ||
4 | int logDom = -1; | ||
5 | |||
5 | EAPI_MAIN int elm_main(int argc, char **argv) | 6 | EAPI_MAIN int elm_main(int argc, char **argv) |
6 | { | 7 | { |
7 | HamrTime(elm_main, "GuiLua"); | 8 | logDom = HamrTime(argv[0], elm_main, logDom); |
8 | GuiLuaDo(argc, argv, NULL, NULL); | 9 | GuiLuaDo(argc, argv, NULL, NULL); |
10 | pantsOff(logDom); | ||
9 | 11 | ||
10 | return 0; | 12 | return 0; |
11 | } | 13 | } |
diff --git a/src/GuiLua/test_c.c b/src/GuiLua/test_c.c index e85814b..ed680b0 100644 --- a/src/GuiLua/test_c.c +++ b/src/GuiLua/test_c.c | |||
@@ -10,7 +10,6 @@ http://lua-users.org/lists/lua-l/2008-01/msg00671.html | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | 12 | ||
13 | //#include "LumbrJack.h" | ||
14 | #include "Runnr.h" | 13 | #include "Runnr.h" |
15 | #include "GuiLua.h" | 14 | #include "GuiLua.h" |
16 | 15 | ||
@@ -23,7 +22,7 @@ static int cfunc (lua_State *L) | |||
23 | double arg1 = luaL_checknumber(L, 1); | 22 | double arg1 = luaL_checknumber(L, 1); |
24 | const char *arg2 = luaL_checkstring(L, 2); | 23 | const char *arg2 = luaL_checkstring(L, 2); |
25 | 24 | ||
26 | printf("Inside %s.cfunc(%f, %s)\n", ourName, arg1, arg2); | 25 | PI("Inside %s.cfunc(%f, %s)\n", ourName, arg1, arg2); |
27 | return 0; | 26 | return 0; |
28 | } | 27 | } |
29 | 28 | ||
diff --git a/src/LuaSL/LuaSL.h b/src/LuaSL/LuaSL.h index d43d6cd..299477b 100644 --- a/src/LuaSL/LuaSL.h +++ b/src/LuaSL/LuaSL.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifdef HAVE_CONFIG_H | 1 | #ifdef HAVE_CONFIG_H |
2 | #include "config.h" | 2 | #include "config.h" |
3 | #else | 3 | #else |
4 | //#define PACKAGE_EXAMPLES_DIR "." | ||
5 | #define __UNUSED__ | 4 | #define __UNUSED__ |
6 | #endif | 5 | #endif |
7 | 6 | ||
diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c index 4fe5671..afe7ec0 100644 --- a/src/LuaSL/LuaSL_compile.c +++ b/src/LuaSL/LuaSL_compile.c | |||
@@ -2194,9 +2194,9 @@ boolean compilerSetup(gameGlobals *ourGlobals) | |||
2194 | } | 2194 | } |
2195 | 2195 | ||
2196 | // Compile the constants. | 2196 | // Compile the constants. |
2197 | snprintf(buf, sizeof(buf), "lua -e 'require(\"LSL\").gimmeLSL()' > %s/constants.lsl", PACKAGE_LIB_DIR); | 2197 | snprintf(buf, sizeof(buf), "lua -e 'require(\"LSL\").gimmeLSL()' > %s/constants.lsl", prefix_lib_get()); |
2198 | system(buf); | 2198 | system(buf); |
2199 | snprintf(buf, sizeof(buf), "%s/constants.lsl", PACKAGE_LIB_DIR); | 2199 | snprintf(buf, sizeof(buf), "%s/constants.lsl", prefix_lib_get()); |
2200 | compileLSL(ourGlobals, NULL, "FAKE_SID", buf, TRUE); | 2200 | compileLSL(ourGlobals, NULL, "FAKE_SID", buf, TRUE); |
2201 | 2201 | ||
2202 | return TRUE; | 2202 | return TRUE; |
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c index 32ed090..2c40348 100644 --- a/src/LuaSL/LuaSL_main.c +++ b/src/LuaSL/LuaSL_main.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include "SledjHamr.h" | 4 | #include "SledjHamr.h" |
5 | 5 | ||
6 | 6 | ||
7 | int logDom; // Our logging domain. | 7 | int logDom = -1; // Our logging domain. |
8 | static int CPUs = 4; | 8 | static int CPUs = 4; |
9 | static Eina_Strbuf *clientStream; | 9 | static Eina_Strbuf *clientStream; |
10 | 10 | ||
@@ -61,7 +61,7 @@ static void resetScript(script *victim) | |||
61 | gettimeofday(&me->startTime, NULL); | 61 | gettimeofday(&me->startTime, NULL); |
62 | strncpy(me->SID, victim->SID, sizeof(me->SID)); | 62 | strncpy(me->SID, victim->SID, sizeof(me->SID)); |
63 | strncpy(me->fileName, victim->fileName, sizeof(me->fileName)); | 63 | strncpy(me->fileName, victim->fileName, sizeof(me->fileName)); |
64 | me->name = &me->fileName[sizeof(PACKAGE_DATA_DIR)]; | 64 | me->name = &me->fileName[strlen(prefix_data_get())]; |
65 | me->game = ourGlobals; | 65 | me->game = ourGlobals; |
66 | me->client = victim->client; | 66 | me->client = victim->client; |
67 | eina_hash_add(ourGlobals->scripts, me->SID, me); | 67 | eina_hash_add(ourGlobals->scripts, me->SID, me); |
@@ -205,7 +205,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D | |||
205 | temp++; | 205 | temp++; |
206 | temp[0] = '\0'; | 206 | temp[0] = '\0'; |
207 | 207 | ||
208 | name = &file[sizeof(PACKAGE_DATA_DIR)]; | 208 | name = &file[strlen(prefix_data_get())]; |
209 | PD("Compiling %s, %s.", SID, name); | 209 | PD("Compiling %s, %s.", SID, name); |
210 | if (compileLSL(ourGlobals, ev->client, SID, file, FALSE)) | 210 | if (compileLSL(ourGlobals, ev->client, SID, file, FALSE)) |
211 | { | 211 | { |
@@ -214,7 +214,7 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D | |||
214 | gettimeofday(&me->startTime, NULL); | 214 | gettimeofday(&me->startTime, NULL); |
215 | strncpy(me->SID, SID, sizeof(me->SID)); | 215 | strncpy(me->SID, SID, sizeof(me->SID)); |
216 | strncpy(me->fileName, file, sizeof(me->fileName)); | 216 | strncpy(me->fileName, file, sizeof(me->fileName)); |
217 | me->name = &me->fileName[sizeof(PACKAGE_DATA_DIR)]; | 217 | me->name = &me->fileName[strlen(prefix_data_get())]; |
218 | me->game = ourGlobals; | 218 | me->game = ourGlobals; |
219 | me->client = ev->client; | 219 | me->client = ev->client; |
220 | eina_hash_add(ourGlobals->scripts, me->SID, me); | 220 | eina_hash_add(ourGlobals->scripts, me->SID, me); |
@@ -275,30 +275,15 @@ static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_De | |||
275 | int main(int argc, char **argv) | 275 | int main(int argc, char **argv) |
276 | { | 276 | { |
277 | gameGlobals ourGlobals; | 277 | gameGlobals ourGlobals; |
278 | char *env, cwd[PATH_MAX], temp[PATH_MAX * 2]; | ||
279 | int result = EXIT_FAILURE; | 278 | int result = EXIT_FAILURE; |
280 | 279 | ||
281 | // Sigh, Elm has this great thing for dealing with bin, lib, and data directories, but this is not an Elm app, | ||
282 | // And Elm is too heavy for just that little bit. | ||
283 | // So just duplicate a bit of what we need here. Sorta. | ||
284 | getcwd(cwd, PATH_MAX); | ||
285 | env = getenv("LUA_CPATH"); | ||
286 | if (!env) env = ""; | ||
287 | sprintf(temp, "%s;%s/lib?.so;%s/?.so;%s/?.so", env, PACKAGE_LIB_DIR, PACKAGE_LIB_DIR, cwd); | ||
288 | setenv("LUA_CPATH", temp, 1); | ||
289 | |||
290 | env = getenv("LUA_PATH"); | ||
291 | if (!env) env = ""; | ||
292 | sprintf(temp, "%s;%s/?.lua;%s/?.lua", env, PACKAGE_LIB_DIR, cwd); | ||
293 | setenv("LUA_PATH", temp, 1); | ||
294 | |||
295 | memset(&ourGlobals, 0, sizeof(gameGlobals)); | 280 | memset(&ourGlobals, 0, sizeof(gameGlobals)); |
296 | ourGlobals.address = "127.0.0.1"; | 281 | ourGlobals.address = "127.0.0.1"; |
297 | ourGlobals.port = 8211; | 282 | ourGlobals.port = 8211; |
298 | 283 | ||
299 | if (eina_init()) | 284 | if (eina_init()) |
300 | { | 285 | { |
301 | logDom = loggingStartup("LuaSL", logDom); | 286 | logDom = HamrTime(argv[0], main, logDom); |
302 | ourGlobals.scripts = eina_hash_string_superfast_new(NULL); | 287 | ourGlobals.scripts = eina_hash_string_superfast_new(NULL); |
303 | ourGlobals.names = eina_hash_string_superfast_new(NULL); | 288 | ourGlobals.names = eina_hash_string_superfast_new(NULL); |
304 | if (ecore_init()) | 289 | if (ecore_init()) |
@@ -356,6 +341,7 @@ int main(int argc, char **argv) | |||
356 | } | 341 | } |
357 | else | 342 | else |
358 | PC("Failed to init ecore!"); | 343 | PC("Failed to init ecore!"); |
344 | pantsOff(logDom); | ||
359 | } | 345 | } |
360 | else | 346 | else |
361 | fprintf(stderr, "Failed to init eina!"); | 347 | fprintf(stderr, "Failed to init eina!"); |
diff --git a/src/LuaSL/build.lua b/src/LuaSL/build.lua index 084a39c..de16c2b 100755 --- a/src/LuaSL/build.lua +++ b/src/LuaSL/build.lua | |||
@@ -19,11 +19,4 @@ removeFiles(dir, {'../../LuaSL', '*.o', '*.output', '*.backup', 'LuaSL_lexer.h', | |||
19 | -- Run lemon first, flex depends on it to define the symbol values. | 19 | -- Run lemon first, flex depends on it to define the symbol values. |
20 | runCommand('lemon', dir, '../../libraries/lemon/lemon -s -T../../libraries/lemon/lempar.c LuaSL_lemon_yaccer.y') | 20 | runCommand('lemon', dir, '../../libraries/lemon/lemon -s -T../../libraries/lemon/lempar.c LuaSL_lemon_yaccer.y') |
21 | runCommand('flex', dir, 'flex -C --outfile=LuaSL_lexer.c --header-file=LuaSL_lexer.h LuaSL_lexer.l') | 21 | runCommand('flex', dir, 'flex -C --outfile=LuaSL_lexer.c --header-file=LuaSL_lexer.h LuaSL_lexer.l') |
22 | |||
23 | -- While SledHamr.c does this, we can't use that here, coz LuaSL is not an Elm app. | ||
24 | CFLAGS = CFLAGS .. ' -DPACKAGE_BIN_DIR=\\"' .. bin_d .. '\\"' | ||
25 | CFLAGS = CFLAGS .. ' -DPACKAGE_LIB_DIR=\\"' .. lib_d .. '\\"' | ||
26 | CFLAGS = CFLAGS .. ' -DPACKAGE_DATA_DIR=\\"' .. data_d .. '\\"' | ||
27 | CFLAGS = CFLAGS .. ' -DPACKAGE_LOCALE_DIR=\\"' .. locale_d .. '\\"' | ||
28 | |||
29 | compileFiles('../../LuaSL', dir, {'LuaSL_main', 'LuaSL_compile', 'LuaSL_threads', 'LuaSL_lexer', 'LuaSL_lemon_yaccer'}, '') | 22 | compileFiles('../../LuaSL', dir, {'LuaSL_main', 'LuaSL_compile', 'LuaSL_threads', 'LuaSL_lexer', 'LuaSL_lemon_yaccer'}, '') |
diff --git a/src/extantz/Evas_3D_demo.c b/src/extantz/Evas_3D_demo.c index 3dda9ef..6cb673b 100644 --- a/src/extantz/Evas_3D_demo.c +++ b/src/extantz/Evas_3D_demo.c | |||
@@ -286,7 +286,7 @@ static void _cube_setup(globals *ourGlobals, Scene_Data *scene) | |||
286 | evas_3d_texture_data_set(EVAS_3D_COLOR_FORMAT_RGBA, EVAS_3D_PIXEL_FORMAT_8888, 4, 4, &pixels1[0]) | 286 | evas_3d_texture_data_set(EVAS_3D_COLOR_FORMAT_RGBA, EVAS_3D_PIXEL_FORMAT_8888, 4, 4, &pixels1[0]) |
287 | ); | 287 | ); |
288 | 288 | ||
289 | snprintf(buf, sizeof(buf), "%s/normal_lego.png", elm_app_data_dir_get()); | 289 | snprintf(buf, sizeof(buf), "%s/normal_lego.png", prefix_data_get()); |
290 | scene->texture_normal = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas, | 290 | scene->texture_normal = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas, |
291 | evas_3d_texture_file_set(buf, NULL) | 291 | evas_3d_texture_file_set(buf, NULL) |
292 | ); | 292 | ); |
@@ -354,7 +354,7 @@ static void _sonic_setup(globals *ourGlobals, Scene_Data *scene) | |||
354 | char buf[PATH_MAX]; | 354 | char buf[PATH_MAX]; |
355 | 355 | ||
356 | // Setup an MD2 mesh. | 356 | // Setup an MD2 mesh. |
357 | snprintf(buf, sizeof(buf), "%s/sonic.png", elm_app_data_dir_get()); | 357 | snprintf(buf, sizeof(buf), "%s/sonic.png", prefix_data_get()); |
358 | scene->texture2 = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas, | 358 | scene->texture2 = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas, |
359 | evas_3d_texture_file_set(buf, NULL), | 359 | evas_3d_texture_file_set(buf, NULL), |
360 | evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST, EVAS_3D_TEXTURE_FILTER_NEAREST), | 360 | evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_NEAREST, EVAS_3D_TEXTURE_FILTER_NEAREST), |
@@ -375,7 +375,7 @@ static void _sonic_setup(globals *ourGlobals, Scene_Data *scene) | |||
375 | evas_3d_material_shininess_set(50.0) | 375 | evas_3d_material_shininess_set(50.0) |
376 | ); | 376 | ); |
377 | 377 | ||
378 | snprintf(buf, sizeof(buf), "%s/sonic.md2", elm_app_data_dir_get()); | 378 | snprintf(buf, sizeof(buf), "%s/sonic.md2", prefix_data_get()); |
379 | scene->mesh2 = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas, | 379 | scene->mesh2 = eo_add(EVAS_3D_MESH_CLASS, ourGlobals->evas, |
380 | evas_3d_mesh_file_set(EVAS_3D_MESH_FILE_TYPE_MD2, buf, NULL), | 380 | evas_3d_mesh_file_set(EVAS_3D_MESH_FILE_TYPE_MD2, buf, NULL), |
381 | evas_3d_mesh_frame_material_set(0, scene->material2), | 381 | evas_3d_mesh_frame_material_set(0, scene->material2), |
@@ -397,7 +397,7 @@ static void _earth_setup(globals *ourGlobals, Scene_Data *scene) | |||
397 | char buf[PATH_MAX]; | 397 | char buf[PATH_MAX]; |
398 | 398 | ||
399 | // Setup earth material. | 399 | // Setup earth material. |
400 | snprintf(buf, sizeof(buf), "%s/EarthDiffuse.png", elm_app_data_dir_get()); | 400 | snprintf(buf, sizeof(buf), "%s/EarthDiffuse.png", prefix_data_get()); |
401 | scene->texture_diffuse = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas, | 401 | scene->texture_diffuse = eo_add(EVAS_3D_TEXTURE_CLASS, ourGlobals->evas, |
402 | evas_3d_texture_file_set(buf, NULL), | 402 | evas_3d_texture_file_set(buf, NULL), |
403 | evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_LINEAR, EVAS_3D_TEXTURE_FILTER_LINEAR) | 403 | evas_3d_texture_filter_set(EVAS_3D_TEXTURE_FILTER_LINEAR, EVAS_3D_TEXTURE_FILTER_LINEAR) |
diff --git a/src/extantz/ephysics_demo.c b/src/extantz/ephysics_demo.c index a0bf4d0..89dda99 100644 --- a/src/extantz/ephysics_demo.c +++ b/src/extantz/ephysics_demo.c | |||
@@ -32,7 +32,7 @@ EPhysics_World *ephysicsAdd(globals *ourGlobals) | |||
32 | ephysics_body_restitution_set(boundary, 1); | 32 | ephysics_body_restitution_set(boundary, 1); |
33 | ephysics_body_friction_set(boundary, 0); | 33 | ephysics_body_friction_set(boundary, 0); |
34 | 34 | ||
35 | sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME); | 35 | sprintf(buf, "%s/%s.edj", prefix_data_get(), EPHYSICS_TEST_THEME); |
36 | box1 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win, | 36 | box1 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win, |
37 | elm_obj_image_file_set(buf, "blue-cube"), | 37 | elm_obj_image_file_set(buf, "blue-cube"), |
38 | evas_obj_size_set(70, 70), | 38 | evas_obj_size_set(70, 70), |
@@ -49,7 +49,7 @@ EPhysics_World *ephysicsAdd(globals *ourGlobals) | |||
49 | ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1); | 49 | ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1); |
50 | eo_unref(box1); | 50 | eo_unref(box1); |
51 | 51 | ||
52 | sprintf(buf, "%s/%s.edj", elm_app_data_dir_get(), EPHYSICS_TEST_THEME); | 52 | sprintf(buf, "%s/%s.edj", prefix_data_get(), EPHYSICS_TEST_THEME); |
53 | box2 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win, | 53 | box2 = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals->win, |
54 | elm_obj_image_file_set(buf, "purple-cube"), | 54 | elm_obj_image_file_set(buf, "purple-cube"), |
55 | evas_obj_size_set(70, 70), | 55 | evas_obj_size_set(70, 70), |
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index fa38251..a27118b 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -2,14 +2,13 @@ | |||
2 | 2 | ||
3 | #include "extantz.h" | 3 | #include "extantz.h" |
4 | #include "SledjHamr.h" | 4 | #include "SledjHamr.h" |
5 | #include "LumbrJack.h" | ||
6 | 5 | ||
7 | 6 | ||
8 | static void _onWorldClick(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo); | 7 | static void _onWorldClick(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo); |
9 | static void on_pixels(void *data, Evas_Object *obj); | 8 | static void on_pixels(void *data, Evas_Object *obj); |
10 | 9 | ||
11 | 10 | ||
12 | static int logDom; // Our logging domain. | 11 | int logDom = -1; // Our logging domain. |
13 | globals ourGlobals; | 12 | globals ourGlobals; |
14 | static Eina_Strbuf *serverStream; | 13 | static Eina_Strbuf *serverStream; |
15 | 14 | ||
@@ -120,7 +119,7 @@ static Eina_Bool _del(void *data, int type, Ecore_Con_Event_Server_Del *ev) | |||
120 | PW("Failed to connect to a world server, starting our own."); | 119 | PW("Failed to connect to a world server, starting our own."); |
121 | 120 | ||
122 | // TODO - Should use Ecore_Exe for this sort of thing. | 121 | // TODO - Should use Ecore_Exe for this sort of thing. |
123 | sprintf(buf, "%s/love &", elm_app_bin_dir_get()); | 122 | sprintf(buf, "%s/love &", prefix_bin_get()); |
124 | system(buf); | 123 | system(buf); |
125 | count = 0; | 124 | count = 0; |
126 | } | 125 | } |
@@ -555,6 +554,8 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
555 | char buf[PATH_MAX * 2]; | 554 | char buf[PATH_MAX * 2]; |
556 | // Eina_Bool gotWebKit = elm_need_web(); // Initialise ewebkit if it exists, or return EINA_FALSE if it don't. | 555 | // Eina_Bool gotWebKit = elm_need_web(); // Initialise ewebkit if it exists, or return EINA_FALSE if it don't. |
557 | 556 | ||
557 | logDom = HamrTime(argv[0], elm_main, logDom); | ||
558 | |||
558 | /* Set the locale according to the system pref. | 559 | /* Set the locale according to the system pref. |
559 | * If you don't do so the file selector will order the files list in | 560 | * If you don't do so the file selector will order the files list in |
560 | * a case sensitive manner | 561 | * a case sensitive manner |
@@ -564,13 +565,6 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
564 | elm_need_ethumb(); | 565 | elm_need_ethumb(); |
565 | elm_need_efreet(); | 566 | elm_need_efreet(); |
566 | 567 | ||
567 | HamrTime(elm_main, "extantz"); | ||
568 | fprintf(stdout, "prefix was set to: %s\n", elm_app_prefix_dir_get()); | ||
569 | fprintf(stdout, "data directory is: %s\n", elm_app_data_dir_get()); | ||
570 | fprintf(stdout, "library directory is: %s\n", elm_app_lib_dir_get()); | ||
571 | fprintf(stdout, "locale directory is: %s\n", elm_app_locale_dir_get()); | ||
572 | |||
573 | logDom = loggingStartup("extantz", logDom); | ||
574 | ourGlobals.running = 1; | 568 | ourGlobals.running = 1; |
575 | 569 | ||
576 | 570 | ||
@@ -643,7 +637,7 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
643 | 637 | ||
644 | // Override the background image | 638 | // Override the background image |
645 | #if 1 | 639 | #if 1 |
646 | snprintf(buf, sizeof(buf), "%s/sky_03.jpg", elm_app_data_dir_get()); | 640 | snprintf(buf, sizeof(buf), "%s/sky_03.jpg", prefix_data_get()); |
647 | ourGlobals.mainWindow->bg = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals.mainWindow->win, | 641 | ourGlobals.mainWindow->bg = eo_add(ELM_OBJ_IMAGE_CLASS, ourGlobals.mainWindow->win, |
648 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 642 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
649 | elm_obj_image_fill_outside_set(EINA_TRUE), | 643 | elm_obj_image_fill_outside_set(EINA_TRUE), |
@@ -652,7 +646,7 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
652 | ); | 646 | ); |
653 | elm_win_resize_object_add(ourGlobals.mainWindow->win, ourGlobals.mainWindow->bg); | 647 | elm_win_resize_object_add(ourGlobals.mainWindow->win, ourGlobals.mainWindow->bg); |
654 | #else | 648 | #else |
655 | snprintf(buf, sizeof(buf), "%s/sky_03.jpg", elm_app_data_dir_get()); | 649 | snprintf(buf, sizeof(buf), "%s/sky_03.jpg", prefix_data_get()); |
656 | eo_do(ourGlobals.mainWindow->bg, | 650 | eo_do(ourGlobals.mainWindow->bg, |
657 | elm_obj_image_file_set(buf, NULL), | 651 | elm_obj_image_file_set(buf, NULL), |
658 | evas_obj_color_set(255, 255, 255, 255) | 652 | evas_obj_color_set(255, 255, 255, 255) |
@@ -673,7 +667,7 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
673 | woMan_add(&ourGlobals); | 667 | woMan_add(&ourGlobals); |
674 | ourGlobals.purkle = GuiLuaLoad("purkle", ourGlobals.mainWindow, ourGlobals.world); | 668 | ourGlobals.purkle = GuiLuaLoad("purkle", ourGlobals.mainWindow, ourGlobals.world); |
675 | ourGlobals.LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals.mainWindow, ourGlobals.world); | 669 | ourGlobals.LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals.mainWindow, ourGlobals.world); |
676 | ourGlobals.files = filesAdd(&ourGlobals, (char *) elm_app_data_dir_get(), EINA_TRUE, EINA_FALSE); | 670 | ourGlobals.files = filesAdd(&ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE); |
677 | 671 | ||
678 | // Try to connect to the love server we started before. | 672 | // Try to connect to the love server we started before. |
679 | serverStream = eina_strbuf_new(); | 673 | serverStream = eina_strbuf_new(); |
@@ -701,11 +695,8 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
701 | winFangDel(ourGlobals.mainWindow); | 695 | winFangDel(ourGlobals.mainWindow); |
702 | } | 696 | } |
703 | 697 | ||
704 | if (logDom >= 0) | 698 | pantsOff(logDom); |
705 | { | 699 | logDom = -1; |
706 | eina_log_domain_unregister(logDom); | ||
707 | logDom = -1; | ||
708 | } | ||
709 | 700 | ||
710 | elm_shutdown(); | 701 | elm_shutdown(); |
711 | 702 | ||
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h index a41f4e0..ca62bdc 100644 --- a/src/extantz/extantz.h +++ b/src/extantz/extantz.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #define DO_GEARS 0 | 6 | #define DO_GEARS 0 |
7 | 7 | ||
8 | 8 | ||
9 | #include "LumbrJack.h" | ||
9 | #include "winFang.h" | 10 | #include "winFang.h" |
10 | #include "GuiLua.h" | 11 | #include "GuiLua.h" |
11 | #include "scenri.h" | 12 | #include "scenri.h" |
diff --git a/src/extantz/woMan.c b/src/extantz/woMan.c index ef10631..09e7e2d 100644 --- a/src/extantz/woMan.c +++ b/src/extantz/woMan.c | |||
@@ -35,8 +35,8 @@ static Elm_Genlist_Item_Class *grid_gic = NULL; | |||
35 | static Elm_Genlist_Item_Class *account_gic = NULL; | 35 | static Elm_Genlist_Item_Class *account_gic = NULL; |
36 | static Elm_Genlist_Item_Class *viewer_gic = NULL; | 36 | static Elm_Genlist_Item_Class *viewer_gic = NULL; |
37 | 37 | ||
38 | //static const char *img1 = PACKAGE_DATA_DIR "plant_01.jpg"; | 38 | //static const char *img1 = "plant_01.jpg"; |
39 | //static const char *img2 = PACKAGE_DATA_DIR "sky_01.jpg"; | 39 | //static const char *img2 = "sky_01.jpg"; |
40 | static const char *img3 = "rock_01.jpg"; | 40 | static const char *img3 = "rock_01.jpg"; |
41 | 41 | ||
42 | 42 | ||
@@ -264,7 +264,7 @@ winFang *woMan_add(globals *ourGlobals) | |||
264 | evas_object_size_hint_align_set(nf, EVAS_HINT_FILL, EVAS_HINT_FILL); | 264 | evas_object_size_hint_align_set(nf, EVAS_HINT_FILL, EVAS_HINT_FILL); |
265 | evas_object_show(nf); | 265 | evas_object_show(nf); |
266 | 266 | ||
267 | sprintf(buf, "%s/%s", elm_app_data_dir_get(), img3); | 267 | sprintf(buf, "%s/%s", prefix_data_get(), img3); |
268 | tab = viewerList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Viewers", _promote, tab_it); | 268 | tab = viewerList; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Viewers", _promote, tab_it); |
269 | // TODO - This strdup leaks, but this is just temporary test code anyway, it will go away. | 269 | // TODO - This strdup leaks, but this is just temporary test code anyway, it will go away. |
270 | tab = _content_image_new(me->win, strdup(buf)); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Landmarks", _promote, tab_it); | 270 | tab = _content_image_new(me->win, strdup(buf)); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_enabled_set(tab_it, EINA_FALSE, EINA_TRUE); elm_toolbar_item_append(tb, NULL, "Landmarks", _promote, tab_it); |
diff --git a/src/libraries/LumbrJack.c b/src/libraries/LumbrJack.c index 8d08622..56d4c50 100644 --- a/src/libraries/LumbrJack.c +++ b/src/libraries/LumbrJack.c | |||
@@ -4,11 +4,82 @@ | |||
4 | 4 | ||
5 | 5 | ||
6 | #include "LumbrJack.h" | 6 | #include "LumbrJack.h" |
7 | #include <unistd.h> | ||
7 | 8 | ||
8 | 9 | ||
9 | static char dateTime[DATE_TIME_LEN]; | 10 | static char dateTime[DATE_TIME_LEN]; |
11 | static Eina_Prefix *prefix = NULL; | ||
10 | 12 | ||
11 | static void _ggg_log_print_cb(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args) | 13 | |
14 | int HamrTime(char *argv0, void *main, int logDom) | ||
15 | { | ||
16 | Eina_Array *path; | ||
17 | char *env, name[PATH_MAX], cwd[PATH_MAX], temp[PATH_MAX * 2]; | ||
18 | int i, len = strlen(argv0); | ||
19 | |||
20 | if (!eina_init()) | ||
21 | { | ||
22 | printf("Can't load eina library, nothing else will work!\n"); | ||
23 | exit(0); | ||
24 | } | ||
25 | |||
26 | // Coz eina_file_split splits the string in place, instead of making a copy first. | ||
27 | snprintf(temp, sizeof(temp), "%s", argv0); | ||
28 | path = eina_file_split(temp); | ||
29 | snprintf(name, sizeof(name), "%s", (char *) eina_array_data_get(path, eina_array_count(path) - 1)); | ||
30 | logDom = loggingStartup(name, logDom); | ||
31 | eina_array_free(path); | ||
32 | |||
33 | temp[len] = 0; | ||
34 | cwd[len] = 0; | ||
35 | for (i = 0; i < len; i++) | ||
36 | { | ||
37 | temp[i] = toupper(name[i]); | ||
38 | cwd[i] = tolower(name[i]); | ||
39 | } | ||
40 | |||
41 | if (!(prefix = eina_prefix_new(argv0, main, temp, cwd, "checkme.txt", PACKAGE_BIN_DIR, PACKAGE_LIB_DIR, PACKAGE_DATA_DIR, PACKAGE_LOCALE_DIR))) | ||
42 | { | ||
43 | PC("Can't find application prefix!"); | ||
44 | } | ||
45 | |||
46 | PD("%s is installed in %s", name, eina_prefix_get(prefix)); | ||
47 | PD("The binaries are in %s", eina_prefix_bin_get(prefix)); | ||
48 | PD("The data files are in %s", eina_prefix_data_get(prefix)); | ||
49 | PD("The libraries are in %s", eina_prefix_lib_get(prefix)); | ||
50 | PD("The locale files are in %s", eina_prefix_locale_get(prefix)); | ||
51 | |||
52 | getcwd(cwd, PATH_MAX); | ||
53 | env = getenv("LUA_CPATH"); | ||
54 | if (!env) env = ""; | ||
55 | sprintf(temp, "%s;%s/lib?.so;%s/?.so;%s/?.so", env, eina_prefix_lib_get(prefix), eina_prefix_lib_get(prefix), cwd); | ||
56 | setenv("LUA_CPATH", temp, 1); | ||
57 | |||
58 | env = getenv("LUA_PATH"); | ||
59 | if (!env) env = ""; | ||
60 | sprintf(temp, "%s;%s/?.lua;%s/?.lua", env, eina_prefix_lib_get(prefix), cwd); | ||
61 | setenv("LUA_PATH", temp, 1); | ||
62 | |||
63 | return logDom; | ||
64 | } | ||
65 | |||
66 | const char *prefix_get() {return eina_prefix_get(prefix);} | ||
67 | const char *prefix_bin_get() {return eina_prefix_bin_get(prefix);} | ||
68 | const char *prefix_data_get() {return eina_prefix_data_get(prefix);} | ||
69 | const char *prefix_lib_get() {return eina_prefix_lib_get(prefix);} | ||
70 | const char *prefix_locale_get() {return eina_prefix_locale_get(prefix);} | ||
71 | |||
72 | void pantsOff(int logDom) | ||
73 | { | ||
74 | if (logDom >= 0) | ||
75 | eina_log_domain_unregister(logDom); | ||
76 | |||
77 | eina_prefix_free(prefix); | ||
78 | |||
79 | eina_shutdown(); | ||
80 | } | ||
81 | |||
82 | static void _logPrint(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args) | ||
12 | { | 83 | { |
13 | FILE *f = data; | 84 | FILE *f = data; |
14 | char dt[DATE_TIME_LEN + 1]; | 85 | char dt[DATE_TIME_LEN + 1]; |
@@ -31,9 +102,11 @@ static void _ggg_log_print_cb(const Eina_Log_Domain *d, Eina_Log_Level level, co | |||
31 | 102 | ||
32 | int loggingStartup(char *name, int logDom) | 103 | int loggingStartup(char *name, int logDom) |
33 | { | 104 | { |
105 | eina_log_threads_enable(); | ||
106 | |||
34 | if (logDom < 0) | 107 | if (logDom < 0) |
35 | { | 108 | { |
36 | logDom = eina_log_domain_register(name, NULL); | 109 | logDom = eina_log_domain_register(name, EINA_COLOR_ORANGE); |
37 | if (logDom < 0) | 110 | if (logDom < 0) |
38 | { | 111 | { |
39 | EINA_LOG_CRIT("could not register log domain '%s'", name); | 112 | EINA_LOG_CRIT("could not register log domain '%s'", name); |
@@ -42,7 +115,7 @@ int loggingStartup(char *name, int logDom) | |||
42 | } | 115 | } |
43 | eina_log_level_set(EINA_LOG_LEVEL_DBG); | 116 | eina_log_level_set(EINA_LOG_LEVEL_DBG); |
44 | eina_log_domain_level_set(name, EINA_LOG_LEVEL_DBG); | 117 | eina_log_domain_level_set(name, EINA_LOG_LEVEL_DBG); |
45 | eina_log_print_cb_set(_ggg_log_print_cb, stderr); | 118 | eina_log_print_cb_set(_logPrint, stderr); |
46 | 119 | ||
47 | // Shut up the excess debugging shit from EFL. | 120 | // Shut up the excess debugging shit from EFL. |
48 | eina_log_domain_level_set("eo", EINA_LOG_LEVEL_WARN); | 121 | eina_log_domain_level_set("eo", EINA_LOG_LEVEL_WARN); |
@@ -83,7 +156,7 @@ char *getDateTime(struct tm **nowOut, char *dateOut, time_t *timeOut) | |||
83 | *timeOut = szClock; | 156 | *timeOut = szClock; |
84 | 157 | ||
85 | // format | 158 | // format |
86 | strftime(date, DATE_TIME_LEN, "%d/%m/%Y %H:%M:%S\r", newTime); | 159 | strftime(date, DATE_TIME_LEN, "%Y-%m-%d %H:%M:%S\r", newTime); |
87 | return (dateTime); | 160 | return (dateTime); |
88 | } | 161 | } |
89 | 162 | ||
diff --git a/src/libraries/LumbrJack.h b/src/libraries/LumbrJack.h index 1912bef..74249ed 100644 --- a/src/libraries/LumbrJack.h +++ b/src/libraries/LumbrJack.h | |||
@@ -2,6 +2,15 @@ | |||
2 | #define _LUMBRJACK_H_ | 2 | #define _LUMBRJACK_H_ |
3 | 3 | ||
4 | 4 | ||
5 | #define EFL_API_OVERRIDE 1 | ||
6 | /* Enable access to unstable EFL API that are still in beta */ | ||
7 | #define EFL_BETA_API_SUPPORT 1 | ||
8 | /* Enable access to unstable EFL EO API. */ | ||
9 | #define EFL_EO_API_SUPPORT 1 | ||
10 | |||
11 | #define ARRAY_LENGTH(array) (sizeof(array) / sizeof(*array)) | ||
12 | |||
13 | |||
5 | #include <stdio.h> | 14 | #include <stdio.h> |
6 | #include <ctype.h> | 15 | #include <ctype.h> |
7 | 16 | ||
@@ -31,6 +40,16 @@ typedef enum | |||
31 | #endif | 40 | #endif |
32 | 41 | ||
33 | 42 | ||
43 | extern int logDom; | ||
44 | |||
45 | int HamrTime(char *argv0, void *main, int logDom); | ||
46 | const char *prefix_get(void); | ||
47 | const char *prefix_bin_get(void); | ||
48 | const char *prefix_data_get(void); | ||
49 | const char *prefix_lib_get(void); | ||
50 | const char *prefix_locale_get(void); | ||
51 | void pantsOff(int logDom); | ||
52 | |||
34 | int loggingStartup(char *name, int logDom); | 53 | int loggingStartup(char *name, int logDom); |
35 | char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); | 54 | char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); |
36 | float timeDiff(struct timeval *now, struct timeval *then); | 55 | float timeDiff(struct timeval *now, struct timeval *then); |
diff --git a/src/libraries/SledjHamr.h b/src/libraries/SledjHamr.h index 6c63bcc..7ce32b9 100644 --- a/src/libraries/SledjHamr.h +++ b/src/libraries/SledjHamr.h | |||
@@ -2,20 +2,12 @@ | |||
2 | #define _SLEDJHAMR_H_ | 2 | #define _SLEDJHAMR_H_ |
3 | 3 | ||
4 | 4 | ||
5 | #define EFL_API_OVERRIDE 1 | ||
6 | /* Enable access to unstable EFL API that are still in beta */ | ||
7 | #define EFL_BETA_API_SUPPORT 1 | ||
8 | /* Enable access to unstable EFL EO API. */ | ||
9 | #define EFL_EO_API_SUPPORT 1 | ||
10 | |||
11 | #include <stdlib.h> | 5 | #include <stdlib.h> |
12 | 6 | ||
13 | #include <Ecore.h> | 7 | #include <Ecore.h> |
14 | #include <Ecore_Con.h> | 8 | #include <Ecore_Con.h> |
15 | 9 | ||
16 | 10 | ||
17 | #define ARRAY_LENGTH(array) (sizeof(array) / sizeof(*array)) | ||
18 | |||
19 | Ecore_Con_Server *reachOut(char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del); | 11 | Ecore_Con_Server *reachOut(char *address, int port, void *data, Ecore_Event_Handler_Cb _add, Ecore_Event_Handler_Cb _data, Ecore_Event_Handler_Cb _del); |
20 | void sendBack(Ecore_Con_Client *client, const char *SID, const char *message, ...); | 12 | void sendBack(Ecore_Con_Client *client, const char *SID, const char *message, ...); |
21 | void sendForth(Ecore_Con_Server *server, const char *SID, const char *message, ...); | 13 | void sendForth(Ecore_Con_Server *server, const char *SID, const char *message, ...); |
diff --git a/src/libraries/build.lua b/src/libraries/build.lua index 45c436d..76e9d94 100755 --- a/src/libraries/build.lua +++ b/src/libraries/build.lua | |||
@@ -13,6 +13,12 @@ if 'nil' == type(dir) then | |||
13 | dir = workingDir | 13 | dir = workingDir |
14 | end | 14 | end |
15 | 15 | ||
16 | -- For EFL apps, these are all centrally controlled in libLumbrJack. | ||
17 | CFLAGS = CFLAGS .. ' -DPACKAGE_BIN_DIR=\\"' .. bin_d .. '\\"' | ||
18 | CFLAGS = CFLAGS .. ' -DPACKAGE_LIB_DIR=\\"' .. lib_d .. '\\"' | ||
19 | CFLAGS = CFLAGS .. ' -DPACKAGE_DATA_DIR=\\"' .. data_d .. '\\"' | ||
20 | CFLAGS = CFLAGS .. ' -DPACKAGE_LOCALE_DIR=\\"' .. locale_d .. '\\"' | ||
21 | |||
16 | LDFLAGS = '-L ' .. dir .. ' ' .. LDFLAGS | 22 | LDFLAGS = '-L ' .. dir .. ' ' .. LDFLAGS |
17 | 23 | ||
18 | removeFiles(dir, {'LumbrJack.o', lib_d .. '/libLumbrJack.so', 'Runnr.o', lib_d .. '/libRunnr.so', 'SledjHamr.o', lib_d .. '/libSledjHamr.so', '../../media/winFang.edj', 'winFang.o', lib_d .. '/libwinFang.so'}) | 24 | removeFiles(dir, {'LumbrJack.o', lib_d .. '/libLumbrJack.so', 'Runnr.o', lib_d .. '/libRunnr.so', 'SledjHamr.o', lib_d .. '/libSledjHamr.so', '../../media/winFang.edj', 'winFang.o', lib_d .. '/libwinFang.so'}) |
@@ -23,11 +29,6 @@ runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libLumbrJack.so | |||
23 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c Runnr.c') | 29 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c Runnr.c') |
24 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libRunnr.so -o ' .. lib_d .. '/libRunnr.so Runnr.o') | 30 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libRunnr.so -o ' .. lib_d .. '/libRunnr.so Runnr.o') |
25 | 31 | ||
26 | -- For Elm apps, these are all centrally controlled in libSledjHamr. | ||
27 | CFLAGS = CFLAGS .. ' -DPACKAGE_BIN_DIR=\\"' .. bin_d .. '\\"' | ||
28 | CFLAGS = CFLAGS .. ' -DPACKAGE_LIB_DIR=\\"' .. lib_d .. '\\"' | ||
29 | CFLAGS = CFLAGS .. ' -DPACKAGE_DATA_DIR=\\"' .. data_d .. '\\"' | ||
30 | CFLAGS = CFLAGS .. ' -DPACKAGE_LOCALE_DIR=\\"' .. locale_d .. '\\"' | ||
31 | 32 | ||
32 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c SledjHamr.c') | 33 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -fPIC -c SledjHamr.c') |
33 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libSledjHamr.so -o ' .. lib_d .. '/libSledjHamr.so SledjHamr.o') | 34 | runCommand(nil, dir, 'gcc ' .. CFLAGS .. ' -shared -Wl,-soname,libSledjHamr.so -o ' .. lib_d .. '/libSledjHamr.so SledjHamr.o') |
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c index bfd9327..9319a18 100644 --- a/src/libraries/winFang.c +++ b/src/libraries/winFang.c | |||
@@ -1,41 +1,7 @@ | |||
1 | #include "LumbrJack.h" | ||
1 | #include "winFang.h" | 2 | #include "winFang.h" |
2 | 3 | ||
3 | 4 | ||
4 | void HamrTime(void *elm_main, char *domain) | ||
5 | { | ||
6 | char *env, cwd[PATH_MAX], temp[PATH_MAX * 2]; | ||
7 | |||
8 | elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR); | ||
9 | elm_app_compile_data_dir_set(PACKAGE_DATA_DIR); | ||
10 | elm_app_compile_lib_dir_set(PACKAGE_LIB_DIR); | ||
11 | elm_app_compile_locale_set(PACKAGE_LOCALE_DIR); | ||
12 | // Do this after the above calls, but before changing the working directory, or screwing with argv[0]. | ||
13 | // It tries to set up the package paths depending on where the executable is, so things are relocatable. | ||
14 | // First argument is the elm_main() function that Elementary starts us from. | ||
15 | // Second argument should be a lower case string used as the "domain", which is different from the log domain. | ||
16 | // It's used lower case as part of the data directory path. | ||
17 | // So, if prefix is /usr/local, then the system data dir is /usr/local/share, | ||
18 | // and this apps data dir is /usr/local/share/"domain". | ||
19 | // It's used upper case as part of environment variables to override directory paths at run time. | ||
20 | // So "DOMAIN"_PREFIX, "DOMAIN"_BIN_DIR, "DOMAIN"_LIB_DIR, "DOMAIN"_DATA_DIR, and "DOMAIN"_LOCALE_DIR | ||
21 | // Third argument is the name of a file it can check for to make sure it found the correct path. | ||
22 | // This file is looked for in the data dir. | ||
23 | elm_app_info_set(elm_main, domain, "checkme.txt"); | ||
24 | // Once this is all setup, the code can do - | ||
25 | // elm_app_prefix_dir_get(); // or bin, lib, data, locale. | ||
26 | |||
27 | getcwd(cwd, PATH_MAX); | ||
28 | env = getenv("LUA_CPATH"); | ||
29 | if (!env) env = ""; | ||
30 | sprintf(temp, "%s;%s/lib?.so;%s/?.so;%s/?.so", env, elm_app_lib_dir_get(), elm_app_lib_dir_get(), cwd); | ||
31 | setenv("LUA_CPATH", temp, 1); | ||
32 | |||
33 | env = getenv("LUA_PATH"); | ||
34 | if (!env) env = ""; | ||
35 | sprintf(temp, "%s;%s/?.lua;%s/?.lua", env, elm_app_lib_dir_get(), cwd); | ||
36 | setenv("LUA_PATH", temp, 1); | ||
37 | } | ||
38 | |||
39 | static void _checkWindowBounds(winFang *win, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) | 5 | static void _checkWindowBounds(winFang *win, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) |
40 | { | 6 | { |
41 | Evas_Object *test; | 7 | Evas_Object *test; |
@@ -244,7 +210,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
244 | x = 0; y = 0; | 210 | x = 0; y = 0; |
245 | } | 211 | } |
246 | 212 | ||
247 | snprintf(buf, sizeof(buf), "%s/winFang.edj", elm_app_data_dir_get()); | 213 | snprintf(buf, sizeof(buf), "%s/winFang.edj", prefix_data_get()); |
248 | result->layout = eo_add(ELM_OBJ_LAYOUT_CLASS, obj, | 214 | result->layout = eo_add(ELM_OBJ_LAYOUT_CLASS, obj, |
249 | evas_obj_size_set(w, h), | 215 | evas_obj_size_set(w, h), |
250 | evas_obj_position_set(x, y), | 216 | evas_obj_position_set(x, y), |
@@ -275,7 +241,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
275 | eo_unref(obj); | 241 | eo_unref(obj); |
276 | 242 | ||
277 | // Create corner handles. | 243 | // Create corner handles. |
278 | snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get()); | 244 | snprintf(buf, sizeof(buf), "%s/pt.png", prefix_data_get()); |
279 | for (i = 0; i < 4; i++) | 245 | for (i = 0; i < 4; i++) |
280 | { | 246 | { |
281 | int cx = result->x, cy = result->y; | 247 | int cx = result->x, cy = result->y; |
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h index f3f4170..7a84a7e 100644 --- a/src/libraries/winFang.h +++ b/src/libraries/winFang.h | |||
@@ -2,15 +2,6 @@ | |||
2 | #define _WINFANG_H_ | 2 | #define _WINFANG_H_ |
3 | 3 | ||
4 | 4 | ||
5 | #define EFL_API_OVERRIDE 1 | ||
6 | /* Enable access to unstable EFL API that are still in beta */ | ||
7 | #define EFL_BETA_API_SUPPORT 1 | ||
8 | /* Enable access to unstable EFL EO API. */ | ||
9 | #define EFL_EO_API_SUPPORT 1 | ||
10 | |||
11 | #define ARRAY_LENGTH(array) (sizeof(array) / sizeof(*array)) | ||
12 | |||
13 | |||
14 | #include <Eo.h> | 5 | #include <Eo.h> |
15 | #include <Eina.h> | 6 | #include <Eina.h> |
16 | #include <Evas.h> | 7 | #include <Evas.h> |
@@ -89,8 +80,6 @@ typedef struct _Widget | |||
89 | Evas_Smart_Cb on_del; | 80 | Evas_Smart_Cb on_del; |
90 | } Widget; | 81 | } Widget; |
91 | 82 | ||
92 | void HamrTime(void *elm_main, char *domain); | ||
93 | |||
94 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world); | 83 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world); |
95 | void winFangHide(winFang *win); | 84 | void winFangHide(winFang *win); |
96 | void winFangShow(winFang *win); | 85 | void winFangShow(winFang *win); |
diff --git a/src/love/build.lua b/src/love/build.lua index f4ae37f..5ecca31 100755 --- a/src/love/build.lua +++ b/src/love/build.lua | |||
@@ -18,10 +18,4 @@ removeFiles(dir, {'../../love', '*.o', '../../media/love.edj'}) | |||
18 | 18 | ||
19 | runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' love.edc ../../media/love.edj') | 19 | runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' love.edc ../../media/love.edj') |
20 | 20 | ||
21 | -- While SledHamr.c does this, we can't use that here, coz love is not an Elm app. | ||
22 | CFLAGS = CFLAGS .. ' -DPACKAGE_BIN_DIR=\\"' .. bin_d .. '\\"' | ||
23 | CFLAGS = CFLAGS .. ' -DPACKAGE_LIB_DIR=\\"' .. lib_d .. '\\"' | ||
24 | CFLAGS = CFLAGS .. ' -DPACKAGE_DATA_DIR=\\"' .. data_d .. '\\"' | ||
25 | CFLAGS = CFLAGS .. ' -DPACKAGE_LOCALE_DIR=\\"' .. locale_d .. '\\"' | ||
26 | |||
27 | compileFiles('../../love', dir, {'love'}, '') | 21 | compileFiles('../../love', dir, {'love'}, '') |
diff --git a/src/love/love.c b/src/love/love.c index 0e4ac40..1f885bc 100644 --- a/src/love/love.c +++ b/src/love/love.c | |||
@@ -55,7 +55,7 @@ typedef struct _script | |||
55 | } script; | 55 | } script; |
56 | 56 | ||
57 | 57 | ||
58 | int logDom; // Our logging domain. | 58 | int logDom = -1; // Our logging domain. |
59 | //static int CPUs = 4; | 59 | //static int CPUs = 4; |
60 | static Eina_Strbuf *LuaSLStream; | 60 | static Eina_Strbuf *LuaSLStream; |
61 | static Eina_Strbuf *clientStream; | 61 | static Eina_Strbuf *clientStream; |
@@ -166,7 +166,7 @@ static Eina_Bool _addLuaSL(void *data, int type, Ecore_Con_Event_Server_Add *ev) | |||
166 | 166 | ||
167 | // Compile and run scripts. | 167 | // Compile and run scripts. |
168 | gettimeofday(&startTime, NULL); | 168 | gettimeofday(&startTime, NULL); |
169 | snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR); | 169 | snprintf(buf, sizeof(buf), "%s/Test sim/objects", prefix_data_get()); |
170 | eina_file_dir_list(buf, EINA_TRUE, dirList_compile, data); | 170 | eina_file_dir_list(buf, EINA_TRUE, dirList_compile, data); |
171 | 171 | ||
172 | return ECORE_CALLBACK_RENEW; | 172 | return ECORE_CALLBACK_RENEW; |
@@ -413,7 +413,7 @@ static Eina_Bool _dataLuaSL(void *data, int type, Ecore_Con_Event_Server_Data *e | |||
413 | temp++; | 413 | temp++; |
414 | temp[0] = '\0'; | 414 | temp[0] = '\0'; |
415 | lineNo = atoi(line); | 415 | lineNo = atoi(line); |
416 | snprintf(key, sizeof(key), "%s/Test sim/objects/onefang%%27s%%20test%%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/%s", PACKAGE_DATA_DIR, notecard); | 416 | snprintf(key, sizeof(key), "%s/Test sim/objects/onefang%%27s%%20test%%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/%s", prefix_data_get(), notecard); |
417 | 417 | ||
418 | fd = open(key, O_RDONLY); | 418 | fd = open(key, O_RDONLY); |
419 | if (-1 != fd) | 419 | if (-1 != fd) |
@@ -493,7 +493,7 @@ static Eina_Bool _delLuaSL(void *data, int type, Ecore_Con_Event_Server_Del *ev) | |||
493 | char buf[PATH_MAX]; | 493 | char buf[PATH_MAX]; |
494 | 494 | ||
495 | PW("Failed to connect to a script server, starting our own."); | 495 | PW("Failed to connect to a script server, starting our own."); |
496 | sprintf(buf, "%s/LuaSL &", PACKAGE_BIN_DIR); | 496 | sprintf(buf, "%s/LuaSL &", prefix_bin_get()); |
497 | system(buf); | 497 | system(buf); |
498 | count = 0; | 498 | count = 0; |
499 | } | 499 | } |
@@ -618,7 +618,7 @@ int main(int argc, char **argv) | |||
618 | 618 | ||
619 | if (eina_init()) | 619 | if (eina_init()) |
620 | { | 620 | { |
621 | logDom = loggingStartup("love", logDom); | 621 | logDom = HamrTime(argv[0], main, logDom); |
622 | ourGlobals.scripts = eina_hash_string_superfast_new(NULL); | 622 | ourGlobals.scripts = eina_hash_string_superfast_new(NULL); |
623 | 623 | ||
624 | if (ecore_con_init()) | 624 | if (ecore_con_init()) |
@@ -703,7 +703,7 @@ int main(int argc, char **argv) | |||
703 | evas_object_focus_set(ourGlobals.bg, EINA_TRUE); | 703 | evas_object_focus_set(ourGlobals.bg, EINA_TRUE); |
704 | 704 | ||
705 | ourGlobals.edje = edje_object_add(ourGlobals.canvas); | 705 | ourGlobals.edje = edje_object_add(ourGlobals.canvas); |
706 | snprintf(buf, sizeof(buf), "%s/%s.edj", PACKAGE_DATA_DIR, "love"); | 706 | snprintf(buf, sizeof(buf), "%s/%s.edj", prefix_data_get(), "love"); |
707 | if (!edje_object_file_set(ourGlobals.edje, buf, group)) | 707 | if (!edje_object_file_set(ourGlobals.edje, buf, group)) |
708 | { | 708 | { |
709 | int err = edje_object_load_error_get(ourGlobals.edje); | 709 | int err = edje_object_load_error_get(ourGlobals.edje); |
@@ -720,7 +720,7 @@ int main(int argc, char **argv) | |||
720 | evas_object_resize(ourGlobals.edje, WIDTH, HEIGHT); | 720 | evas_object_resize(ourGlobals.edje, WIDTH, HEIGHT); |
721 | evas_object_show(ourGlobals.edje); | 721 | evas_object_show(ourGlobals.edje); |
722 | 722 | ||
723 | snprintf(buf, sizeof(buf), "%s/bubble_sh.png", PACKAGE_DATA_DIR); | 723 | snprintf(buf, sizeof(buf), "%s/bubble_sh.png", prefix_data_get()); |
724 | for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) | 724 | for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) |
725 | { | 725 | { |
726 | sh = evas_object_image_filled_add(ourGlobals.canvas); | 726 | sh = evas_object_image_filled_add(ourGlobals.canvas); |
@@ -730,7 +730,7 @@ int main(int argc, char **argv) | |||
730 | evas_object_data_set(ourGlobals.bg, names[(i * 2) + 1], sh); | 730 | evas_object_data_set(ourGlobals.bg, names[(i * 2) + 1], sh); |
731 | } | 731 | } |
732 | 732 | ||
733 | snprintf(buf, sizeof(buf), "%s/bubble.png", PACKAGE_DATA_DIR); | 733 | snprintf(buf, sizeof(buf), "%s/bubble.png", prefix_data_get()); |
734 | for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) | 734 | for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++) |
735 | { | 735 | { |
736 | bub = evas_object_image_filled_add(ourGlobals.canvas); | 736 | bub = evas_object_image_filled_add(ourGlobals.canvas); |
@@ -779,6 +779,7 @@ int main(int argc, char **argv) | |||
779 | PC("Failed to init ecore_con!"); | 779 | PC("Failed to init ecore_con!"); |
780 | 780 | ||
781 | eina_hash_free(ourGlobals.scripts); | 781 | eina_hash_free(ourGlobals.scripts); |
782 | pantsOff(logDom); | ||
782 | } | 783 | } |
783 | else | 784 | else |
784 | fprintf(stderr, "Failed to init eina!"); | 785 | fprintf(stderr, "Failed to init eina!"); |
diff --git a/src/purkle/purkle.c b/src/purkle/purkle.c index 444a77a..ec8997b 100644 --- a/src/purkle/purkle.c +++ b/src/purkle/purkle.c | |||
@@ -61,7 +61,7 @@ static int say(lua_State *L) | |||
61 | if (server) | 61 | if (server) |
62 | sendForth(server, id, buf); | 62 | sendForth(server, id, buf); |
63 | else | 63 | else |
64 | printf("PURKLE NOT SAY, no where to send %s", buf); | 64 | PW("PURKLE NOT SAY, no where to send %s", buf); |
65 | } | 65 | } |
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |