I've been working on making the interpreter embeddable and controllable
from the Android user interface. To do this, I need to be able to
initialise the interpreter without actually entering the main loop. I did
this by splitting the main loop from the rest of the initialisation.
I've attached a patch for this. Please consider its inclusion. It doesn't
change any functionality except for creating a new function.
Regards,
Elias
Index: src/main.cc
===================================================================
--- src/main.cc (revision 311)
+++ src/main.cc (working copy)
@@ -263,7 +263,7 @@
}
//-----------------------------------------------------------------------------
int
-main(int argc, const char * _argv[])
+init_apl(int argc, const char * _argv[])
{
{
// make curses happy
@@ -412,6 +412,18 @@
}
}
+ return 0;
+}
+//-----------------------------------------------------------------------------
+
+int main(int argc, const char *argv[])
+{
+ int ret = init_apl(argc, argv);
+ if(ret != 0)
+ {
+ exit(ret);
+ }
+
for (;;)
{
Token t = Workspace::immediate_execution(
@@ -419,6 +431,5 @@
if (t.get_tag() == TOK_OFF) Command::cmd_OFF(0);
}
- /* not reached */
+ return 0;
}
-//-----------------------------------------------------------------------------