[uim-commit] r983 - branches/r5rs/sigscheme
tkng at freedesktop.org
tkng at freedesktop.org
Wed Jul 20 05:55:16 EST 2005
Author: tkng
Date: 2005-07-19 12:55:02 -0700 (Tue, 19 Jul 2005)
New Revision: 983
Modified:
branches/r5rs/sigscheme/main.c
Log:
* sigscheme.c: main.c: Implemented simple repl for convenience.
-(repl): New function.
-(main): Call repl() if filename is not passed.
Modified: branches/r5rs/sigscheme/main.c
===================================================================
--- branches/r5rs/sigscheme/main.c 2005-07-19 19:28:09 UTC (rev 982)
+++ branches/r5rs/sigscheme/main.c 2005-07-19 19:55:02 UTC (rev 983)
@@ -52,6 +52,28 @@
File Local Function Declarations
=======================================*/
+/* Very simple repl, please rewrite. */
+static void repl(void)
+{
+ ScmObj stdin_port = Scm_NewPort(stdin, PORT_INPUT);
+ ScmObj stdout_port = Scm_NewPort(stdout, PORT_INPUT);
+ ScmObj s_exp, result;
+
+ printf("sscm>");
+
+ for( s_exp = SigScm_Read(stdin_port);
+ !EQ(s_exp, SCM_EOF);
+ s_exp = SigScm_Read(stdin_port))
+ {
+ result = ScmOp_eval(s_exp, SCM_NIL);
+ SigScm_DisplayToPort(stdout_port, result);
+ printf("\nsscm>");
+ }
+
+ ScmOp_close_input_port(stdin_port);
+ ScmOp_close_input_port(stdout_port);
+}
+
/*=======================================
Function Implementations
=======================================*/
@@ -61,13 +83,14 @@
SigScm_Initialize();
- if (argc < 2)
- SigScm_Error("usage : sscm <filename>\n");
+ if (argc < 2) {
+ repl();
+ /* SigScm_Error("usage : sscm <filename>\n"); */
+ } else {
+ SigScm_load(filename);
+ }
- SigScm_load(filename);
-
SigScm_Finalize();
-
return 0;
}
More information about the uim-commit
mailing list