[uim-commit] r1250 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Sun Aug 21 09:04:23 EST 2005
Author: yamaken
Date: 2005-08-20 16:04:20 -0700 (Sat, 20 Aug 2005)
New Revision: 1250
Modified:
branches/r5rs/sigscheme/datas.c
branches/r5rs/sigscheme/eval.c
branches/r5rs/sigscheme/io.c
branches/r5rs/sigscheme/operations.c
branches/r5rs/sigscheme/sigscheme.c
branches/r5rs/sigscheme/sigscheme.h
Log:
* This commit encloses non-standard features into #if sections
appropriately. This is useful for learning what is R5RS compatible
by the code, search for de facto standard to replace the
non-standard part, and so on.
* sigscheme/sigscheme.h
- (SCM_USE_NONSTD_FEATURES, SCM_COMPAT_SIOD, SCM_STRICT_R5RS): New
macro to configure features of the interpreter
- (Scm_NewCPointer, Scm_NewCFuncPointer, Scm_GetCPointer,
Scm_GetCFuncPointer, ScmOp_print, ScmOp_require, ScmOp_provide,
ScmOp_providedp, ScmOp_file_existsp, ScmOp_delete_file): Enclose
into #if SCM_USE_NONSTD_FEATURES
- (Scm_return_value, ScmOp_symbol_boundp, ScmOp_symbol_value,
ScmOp_set_symbol_value, ScmOp_bit_and, ScmOp_bit_or,
ScmOp_bit_xor, ScmOp_bit_not, ScmOp_the_environment,
ScmOp_closure_code): Enclose into #if SCM_COMPAT_SIOD
* sigscheme/sigscheme.c
- (SigScm_Initialize): Enclose some code fragments into #if
SCM_USE_NONSTD_FEATURES and #if SCM_COMPAT_SIOD
* sigscheme/io.c
- (ScmOp_print, ScmOp_require): Enclose into #if SCM_USE_NONSTD_FEATURES
* sigscheme/operations.c
- (ScmOp_car, ScmOp_cdr): Replace #ifdef SCM_STRICT_R5RS with #if
!SCM_COMPAT_SIOD appropriately
* sigscheme/eval.c
- (ScmOp_symbol_boundp, ScmOp_symbol_value, ScmOp_set_symbol_value,
ScmOp_bit_and, ScmOp_bit_or, ScmOp_bit_xor, ScmOp_bit_not,
ScmOp_the_environment, ScmOp_closure_code): Enclose into #if
SCM_COMPAT_SIOD
* sigscheme/datas.c
- (scm_return_value, Scm_return_value): Enclose into #if
SCM_COMPAT_SIOD
- (Scm_eval_c_string): Enclose scm_return_value handling into #if
SCM_COMPAT_SIOD
- (Scm_NewCPointer, Scm_NewCFuncPointer, Scm_GetCPointer,
Scm_GetCFuncPointer): Enclose into #if SCM_USE_NONSTD_FEATURES
Modified: branches/r5rs/sigscheme/datas.c
===================================================================
--- branches/r5rs/sigscheme/datas.c 2005-08-20 22:11:18 UTC (rev 1249)
+++ branches/r5rs/sigscheme/datas.c 2005-08-20 23:04:20 UTC (rev 1250)
@@ -137,7 +137,9 @@
static ScmObj *symbol_hash = NULL;
static gc_protected_obj *protected_obj_list = NULL;
+#if SCM_COMPAT_SIOD
ScmObj scm_return_value = NULL;
+#endif
/*=======================================
File Local Function Declarations
@@ -778,6 +780,7 @@
return packet;
}
+#if SCM_USE_NONSTD_FEATURES
ScmObj Scm_NewCPointer(void *data)
{
ScmObj obj = SCM_NIL;
@@ -799,6 +802,7 @@
return obj;
}
+#endif
/*
* Symbol Name Hash Related Functions
@@ -891,6 +895,7 @@
return ret;
}
+#if SCM_USE_NONSTD_FEATURES
void* Scm_GetCPointer(ScmObj c_ptr)
{
if (!SCM_C_POINTERP(c_ptr))
@@ -906,6 +911,7 @@
return SCM_C_FUNCPOINTER_FUNC(c_funcptr);
}
+#endif
ScmObj Scm_eval_c_string(const char *exp)
{
@@ -921,7 +927,9 @@
ret = SigScm_Read(str_port);
ret = ScmOp_eval(ret, SCM_NIL);
+#if SCM_COMPAT_SIOD
scm_return_value = ret;
+#endif
/* now no need to protect stack */
SigScm_gc_unprotect_stack(&stack_start);
@@ -929,7 +937,9 @@
return ret;
}
+#if SCM_COMPAT_SIOD
ScmObj Scm_return_value(void)
{
return scm_return_value;
}
+#endif
Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c 2005-08-20 22:11:18 UTC (rev 1249)
+++ branches/r5rs/sigscheme/eval.c 2005-08-20 23:04:20 UTC (rev 1250)
@@ -1679,6 +1679,7 @@
return SCM_NIL;
}
+#if SCM_COMPAT_SIOD
/*=======================================
SIOD compatible procedures
@@ -1762,3 +1763,4 @@
return SCM_CLOSURE_EXP(closure);
}
+#endif
Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c 2005-08-20 22:11:18 UTC (rev 1249)
+++ branches/r5rs/sigscheme/io.c 2005-08-20 23:04:20 UTC (rev 1250)
@@ -63,8 +63,10 @@
File Local Function Declarations
=======================================*/
static char* create_valid_path(const char *c_filename);
+#if SCM_USE_NONSTD_FEATURES
static ScmObj create_loaded_str(ScmObj filename);
static int file_existsp(const char *filepath);
+#endif
/*=======================================
Function Implementations
@@ -373,6 +375,7 @@
return SCM_UNDEF;
}
+#if SCM_USE_NONSTD_FEATURES
ScmObj ScmOp_print(ScmObj arg, ScmObj env)
{
ScmObj obj = SCM_NIL;
@@ -397,6 +400,7 @@
return SCM_UNDEF;
}
+#endif
ScmObj ScmOp_newline(ScmObj arg, ScmObj env)
{
@@ -526,6 +530,7 @@
return SCM_TRUE;
}
+#if SCM_USE_NONSTD_FEATURES
ScmObj ScmOp_require(ScmObj filename)
{
ScmObj stack_start;
@@ -620,3 +625,4 @@
fclose(f);
return 1;
}
+#endif
Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c 2005-08-20 22:11:18 UTC (rev 1249)
+++ branches/r5rs/sigscheme/operations.c 2005-08-20 23:04:20 UTC (rev 1250)
@@ -757,7 +757,7 @@
* in many places. So, I decided to change ScmOp_car to SIOD like behavior.
*
*/
-#ifdef SCM_STRICT_R5RS
+#if !SCM_COMPAT_SIOD
if (SCM_NULLP(obj))
SigScm_Error("car : empty list\n");
#endif
@@ -779,7 +779,7 @@
* in many places. So, I decided to change ScmOp_car to SIOD like behavior.
*
*/
-#ifdef SCM_STRICT_R5RS
+#if !SCM_COMPAT_SIOD
if (SCM_NULLP(obj))
SigScm_Error("cdr : empty list\n");
#endif
Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c 2005-08-20 22:11:18 UTC (rev 1249)
+++ branches/r5rs/sigscheme/sigscheme.c 2005-08-20 23:04:20 UTC (rev 1250)
@@ -100,7 +100,9 @@
SigScm_quasiquote = Scm_Intern("quasiquote");
SigScm_unquote = Scm_Intern("unquote");
SigScm_unquote_splicing = Scm_Intern("unquote-splicing");
+#if SCM_USE_NONSTD_FEATURES
SigScm_features = Scm_Intern("*features*");
+#endif
/*=======================================================================
Export Scheme Special Symbols
=======================================================================*/
@@ -271,15 +273,19 @@
Scm_RegisterFunc1("eof-object?" , ScmOp_eof_objectp);
Scm_RegisterFuncL("write" , ScmOp_write);
Scm_RegisterFuncL("display" , ScmOp_display);
+#if SCM_USE_NONSTD_FEATURES
Scm_RegisterFuncL("print" , ScmOp_print);
+#endif
Scm_RegisterFuncL("newline" , ScmOp_newline);
Scm_RegisterFuncL("write-char" , ScmOp_write_char);
Scm_RegisterFunc1("load" , ScmOp_load);
+#if SCM_USE_NONSTD_FEATURES
Scm_RegisterFunc1("require" , ScmOp_require);
Scm_RegisterFunc1("provide" , ScmOp_provide);
Scm_RegisterFunc1("provided?" , ScmOp_providedp);
Scm_RegisterFunc1("file-exists?" , ScmOp_file_existsp);
Scm_RegisterFunc1("delete-file" , ScmOp_delete_file);
+#endif
/*=======================================================================
Current Input & Output Initialization
=======================================================================*/
@@ -309,6 +315,7 @@
Scm_RegisterFuncR("receive" , ScmOp_SRFI_8_receive);
#endif
+#if SCM_COMPAT_SIOD
/*=======================================================================
SIOD Compatible Variables and Procedures
=======================================================================*/
@@ -325,6 +332,7 @@
/* datas.c */
extern ScmObj scm_return_value;
scm_return_value = SCM_NIL;
+#endif
stack_start_pointer = NULL;
}
Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h 2005-08-20 22:11:18 UTC (rev 1249)
+++ branches/r5rs/sigscheme/sigscheme.h 2005-08-20 23:04:20 UTC (rev 1250)
@@ -89,6 +89,9 @@
#define USE_EUCJP 1
#define USE_SRFI1 0
#define USE_SRFI8 1
+#define SCM_USE_NONSTD_FEATURES 1
+#define SCM_COMPAT_SIOD 1
+#define SCM_STRICT_R5RS 0
#define CHECK_1_ARG(arg) \
(SCM_NULLP(arg))
@@ -147,15 +150,21 @@
ScmObj Scm_NewStringPort(const char *str); /* input only? */
ScmObj Scm_NewContinuation(void);
ScmObj Scm_NewValuePacket(ScmObj values);
+#if SCM_USE_NONSTD_FEATURES
ScmObj Scm_NewCPointer(void *data);
ScmObj Scm_NewCFuncPointer(C_FUNC func);
+#endif
ScmObj Scm_Intern(const char *name);
int Scm_GetInt(ScmObj num);
char* Scm_GetString(ScmObj str);
+#if SCM_USE_NONSTD_FEATURES
void* Scm_GetCPointer(ScmObj c_ptr);
C_FUNC Scm_GetCFuncPointer(ScmObj c_funcptr);
+#endif
ScmObj Scm_eval_c_string(const char *exp);
+#if SCM_COMPAT_SIOD
ScmObj Scm_return_value(void);
+#endif
/* eval.c */
ScmObj ScmOp_eval(ScmObj obj, ScmObj env);
@@ -180,6 +189,7 @@
ScmObj ScmExp_define(ScmObj arg, ScmObj *envp, int *tail_flag);
ScmObj ScmOp_scheme_report_environment(ScmObj version);
ScmObj ScmOp_null_environment(ScmObj version);
+#if SCM_COMPAT_SIOD
/* SIOD compatible functions */
ScmObj ScmOp_symbol_boundp(ScmObj obj);
ScmObj ScmOp_symbol_value(ScmObj var);
@@ -190,6 +200,7 @@
ScmObj ScmOp_bit_not(ScmObj obj);
ScmObj ScmOp_the_environment(ScmObj arg, ScmObj env);
ScmObj ScmOp_closure_code(ScmObj closure);
+#endif
/* operations.c */
ScmObj ScmOp_eqvp(ScmObj obj1, ScmObj obj2);
@@ -338,17 +349,21 @@
ScmObj ScmOp_char_readyp(ScmObj arg, ScmObj env);
ScmObj ScmOp_write(ScmObj arg, ScmObj env);
ScmObj ScmOp_display(ScmObj arg, ScmObj env);
+#if SCM_USE_NONSTD_FEATURES
ScmObj ScmOp_print(ScmObj arg, ScmObj env);
+#endif
ScmObj ScmOp_newline(ScmObj arg, ScmObj env);
ScmObj ScmOp_write_char(ScmObj arg, ScmObj env);
ScmObj SigScm_load(const char *c_filename);
ScmObj ScmOp_load(ScmObj filename);
+#if SCM_USE_NONSTD_FEATURES
ScmObj ScmOp_require(ScmObj filename);
ScmObj ScmOp_provide(ScmObj feature);
ScmObj ScmOp_providedp(ScmObj feature);
ScmObj ScmOp_file_existsp(ScmObj filepath);
ScmObj ScmOp_delete_file(ScmObj filepath);
+#endif
/* encoding.c */
int SigScm_default_encoding_strlen(const char *str);
More information about the uim-commit
mailing list