Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/embryo
Dir : e17/libs/embryo/src/bin
Modified Files:
embryo_main.c
Log Message:
instruction limiter on the amx lets u limit function runs in instruction count
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/embryo/src/bin/embryo_main.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- embryo_main.c 15 Oct 2004 15:12:05 -0000 1.8
+++ embryo_main.c 19 Oct 2004 09:36:35 -0000 1.9
@@ -209,6 +209,7 @@
int r = EMBRYO_PROGRAM_OK;
int err;
int args = 0;
+ int instruct = 0;
char *file = NULL;
char *func = NULL;
@@ -273,23 +274,36 @@
}
}
r = EMBRYO_PROGRAM_OK;
+ fn = EMBRYO_FUNCTION_MAIN;
if (func)
{
fn = embryo_program_function_find(ep, func);
- if (fn != EMBRYO_FUNCTION_NONE)
- {
- while ((r = embryo_program_run(ep, fn)) == EMBRYO_PROGRAM_SLEEP);
- }
- else
+ if (fn == EMBRYO_FUNCTION_NONE)
{
printf("Unable to find public function %s()\n"
"Executing main() instead\n", func);
- while ((r = embryo_program_run(ep, EMBRYO_FUNCTION_MAIN)) ==
EMBRYO_PROGRAM_SLEEP);
+ fn = EMBRYO_FUNCTION_MAIN;
}
}
- else
+ embryo_program_max_cycle_run_set(ep, 100000000);
+ for (;;)
{
- while ((r = embryo_program_run(ep, EMBRYO_FUNCTION_MAIN)) ==
EMBRYO_PROGRAM_SLEEP);
+ r = embryo_program_run(ep, fn);
+ if (r == EMBRYO_PROGRAM_SLEEP)
+ {
+ fn = EMBRYO_FUNCTION_CONT;
+ printf("SLEEP INSTRUCTION!\n");
+ continue;
+ }
+ else if (r == EMBRYO_PROGRAM_TOOLONG)
+ {
+ fn = EMBRYO_FUNCTION_CONT;
+ instruct++;
+ printf("Executed %i00 million instructions!\n", instruct);
+ continue;
+ }
+ else
+ break;
}
embryo_program_vm_pop(ep);
if (r == EMBRYO_PROGRAM_FAIL)
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs