aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--LuaSL/src/LuaSL_main.c45
2 files changed, 40 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 14a7253..132c17f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
1*.backup 1*.backup
2*.edj 2*.edj
3*.o 3*.o
4*.out
4*.output 5*.output
5*.diff 6*.diff
6*.lsl.lua 7*.lsl.lua
diff --git a/LuaSL/src/LuaSL_main.c b/LuaSL/src/LuaSL_main.c
index f14a8d0..47e4881 100644
--- a/LuaSL/src/LuaSL_main.c
+++ b/LuaSL/src/LuaSL_main.c
@@ -2,6 +2,7 @@
2 2
3static int scriptCount; 3static int scriptCount;
4 4
5#if 0
5static const char *names[] = 6static const char *names[] =
6{ 7{
7 "bub1", "sh1", 8 "bub1", "sh1",
@@ -66,6 +67,7 @@ _on_delete(Ecore_Evas *ee __UNUSED__)
66{ 67{
67 ecore_main_loop_quit(); 68 ecore_main_loop_quit();
68} 69}
70#endif
69 71
70void dirList_cb(const char *name, const char *path, void *data) 72void dirList_cb(const char *name, const char *path, void *data)
71{ 73{
@@ -88,6 +90,22 @@ void dirList_cb(const char *name, const char *path, void *data)
88 } 90 }
89} 91}
90 92
93void dirListLua_cb(const char *name, const char *path, void *data)
94{
95 char buf[PATH_MAX];
96 char *ext = rindex(name, '.');
97
98 if (ext)
99 {
100 if (0 == strcmp(ext, ".lua"))
101 {
102 scriptCount++;
103 snprintf(buf, sizeof(buf), "luac %s/%s 2>/dev/null", path, name);
104 system(buf);
105 }
106 }
107}
108
91int 109int
92main(int argc, char **argv) 110main(int argc, char **argv)
93{ 111{
@@ -104,20 +122,21 @@ main(int argc, char **argv)
104 } 122 }
105 123
106 memset(&game, 0, sizeof(gameGlobals)); 124 memset(&game, 0, sizeof(gameGlobals));
107 // Since we increment at the begining, we need to pre decrement this so it starts at 0.
108 125
109 loggingStartup(&game); 126 loggingStartup(&game);
110 127
111// else if ((game.config) && (game.data)) 128// else if ((game.config) && (game.data))
112 { 129 {
113 char buf[PATH_MAX]; 130 char buf[PATH_MAX];
131 unsigned int lslCount;
132 struct timeval lastTime2;
133 struct timeval thisTime2;
134 float diff0, diff;
135#if 0
136 unsigned int i;
114 char *group = "main"; 137 char *group = "main";
115 Evas_Object *bub, *sh; 138 Evas_Object *bub, *sh;
116 Ecore_Animator *ani; 139 Ecore_Animator *ani;
117 unsigned int i;
118 struct timeval lastTime2;
119 struct timeval thisTime2;
120 float diff;
121 140
122 /* this will give you a window with an Evas canvas under the first engine available */ 141 /* this will give you a window with an Evas canvas under the first engine available */
123 game.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); 142 game.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
@@ -184,6 +203,7 @@ main(int argc, char **argv)
184 // Setup our callbacks. 203 // Setup our callbacks.
185 ecore_evas_callback_delete_request_set(game.ee, _on_delete); 204 ecore_evas_callback_delete_request_set(game.ee, _on_delete);
186 edje_object_signal_callback_add(game.edje, "*", "game_*", _edje_signal_cb, &game); 205 edje_object_signal_callback_add(game.edje, "*", "game_*", _edje_signal_cb, &game);
206#endif
187 207
188 // Do the compiles. 208 // Do the compiles.
189 scriptCount = 0; 209 scriptCount = 0;
@@ -192,12 +212,25 @@ main(int argc, char **argv)
192 snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR); 212 snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR);
193 eina_file_dir_list(buf, EINA_TRUE, dirList_cb, &game); 213 eina_file_dir_list(buf, EINA_TRUE, dirList_cb, &game);
194 diff = timeDiff(&thisTime2, &lastTime2); 214 diff = timeDiff(&thisTime2, &lastTime2);
195 printf("Compiling %d scripts took %f seconds, that's %f scripts per second. B-).\n", scriptCount, diff, scriptCount / diff); 215 printf("Compiling %d scripts took %f seconds, that's %f scripts per second.\n", scriptCount, diff, scriptCount / diff);
216
217 lslCount = scriptCount;
218 diff0 = diff;
219 scriptCount = 0;
220 gettimeofday(&lastTime2, 0);
221 snprintf(buf, sizeof(buf), "%s/testLua", PACKAGE_DATA_DIR);
222 eina_file_dir_list(buf, EINA_TRUE, dirListLua_cb, &game);
223 diff = timeDiff(&thisTime2, &lastTime2);
224 printf("Compiling %d Lua scripts took %f seconds, that's %f scripts per second. B-).\n", scriptCount, diff, scriptCount / diff);
225
226 printf("Combined estimate of compiling speed is %f scripts per second.\n", 1 / ((diff0 / lslCount) + (diff / scriptCount)));
196 227
197// ecore_main_loop_begin(); 228// ecore_main_loop_begin();
198 229
230#if 0
199 ecore_animator_del(ani); 231 ecore_animator_del(ani);
200 ecore_evas_free(game.ee); 232 ecore_evas_free(game.ee);
233#endif
201 edje_shutdown(); 234 edje_shutdown();
202 ecore_evas_shutdown(); 235 ecore_evas_shutdown();
203 } 236 }