[uim-commit] r1944 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Tue Nov 1 17:08:34 PST 2005
Author: yamaken
Date: 2005-11-01 17:08:31 -0800 (Tue, 01 Nov 2005)
New Revision: 1944
Modified:
branches/r5rs/sigscheme/main.c
Log:
* sigscheme/main.c
- (PROMPT_STR): New macro
- (SIOD_STRING): Rename to FEATURE_ID_SIOD
- (FEATURE_ID_SIOD): Renamed from SIOD_STRING to indicate logical
meaning
- (feature_id_siod): New static variable
- (repl):
* Remove comments for obvious operation
* Add initialization for feature_id_siod
- (repl_loop):
* Simplify and make logical meanings clear
* Replace printf() with SigScm_PortPrintf()
- (is_repl_prompt, is_repl_show_result): Simplify
Modified: branches/r5rs/sigscheme/main.c
===================================================================
--- branches/r5rs/sigscheme/main.c 2005-11-02 00:40:06 UTC (rev 1943)
+++ branches/r5rs/sigscheme/main.c 2005-11-02 01:08:31 UTC (rev 1944)
@@ -45,8 +45,10 @@
/*=======================================
File Local Macro Declarations
=======================================*/
+#define PROMPT_STR "sscm> "
+
#if SCM_COMPAT_SIOD
-#define SIOD_STRING "siod"
+#define FEATURE_ID_SIOD "siod"
#endif
/*=======================================
@@ -56,6 +58,7 @@
/*=======================================
Variable Declarations
=======================================*/
+static ScmObj feature_id_siod;
/*=======================================
File Local Function Declarations
@@ -75,15 +78,14 @@
#endif
#if !SCM_GCC4_READY_GC
- /* start protecting stack */
SigScm_GC_ProtectStack(&stack_start);
#endif
- /* goto repl loop */
+ feature_id_siod = Scm_NewStringCopying(FEATURE_ID_SIOD);
+
repl_loop();
#if !SCM_GCC4_READY_GC
- /* now no need to protect stack */
SigScm_GC_UnprotectStack(&stack_start);
#endif
}
@@ -96,7 +98,7 @@
int is_show_result = is_repl_show_result();
if (is_prompt)
- printf("sscm> ");
+ SigScm_PortPrintf(scm_current_output_port, PROMPT_STR);
while (s_exp = SigScm_Read(scm_current_input_port), !EOFP(s_exp)) {
#if SCM_USE_SRFI34
@@ -122,38 +124,33 @@
#else
SigScm_WriteToPort(scm_current_output_port, result);
#endif
- printf("\n");
+ /* FIXME: Make portable with SigScm_NewlineToPort() */
+ SigScm_PortPrintf(scm_current_output_port, "\n");
}
if (is_prompt)
- printf("sscm> ");
+ SigScm_PortPrintf(scm_current_output_port, PROMPT_STR);
}
}
static int is_repl_prompt(void)
{
- int ret = FALSE;
#if SCM_COMPAT_SIOD
- if (FALSEP(ScmOp_providedp(Scm_NewStringCopying(SIOD_STRING)))
- || SigScm_GetVerboseLevel() >= 2)
- ret = TRUE;
+ return (FALSEP(ScmOp_providedp(feature_id_siod))
+ || SigScm_GetVerboseLevel() >= 2);
#else
- ret = TRUE;
+ return TRUE;
#endif
- return ret;
}
static int is_repl_show_result(void)
{
- int ret = FALSE;
#if SCM_COMPAT_SIOD
- if (FALSEP(ScmOp_providedp(Scm_NewStringCopying(SIOD_STRING)))
- || SigScm_GetVerboseLevel() >= 1)
- ret = TRUE;
+ return (FALSEP(ScmOp_providedp(feature_id_siod))
+ || SigScm_GetVerboseLevel() >= 1);
#else
- ret = TRUE;
+ return TRUE;
#endif
- return ret;
}
int main(int argc, char **argv)
More information about the uim-commit
mailing list