[uim-commit] r1816 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Wed Oct 5 18:30:11 PDT 2005
Author: yamaken
Date: 2005-10-05 18:30:09 -0700 (Wed, 05 Oct 2005)
New Revision: 1816
Modified:
branches/r5rs/sigscheme/datas.c
branches/r5rs/sigscheme/operations.c
branches/r5rs/sigscheme/sigscheme.c
branches/r5rs/sigscheme/sigschemeinternal.h
branches/r5rs/sigscheme/sigschemetype.h
Log:
* sigscheme/sigschemetype.h
- (SCM_MAKE_VALUEPACKET): New macro
* sigscheme/sigschemeinternal.h
- (SigScm_null_values): Modify the comment
* sigscheme/operations.c
- (ScmOp_values, ScmOp_call_with_values): Simplify and eliminate #if
SCM_USE_VALUECONS condition
* sigscheme/sigscheme.c
- (SigScm_null_values): Move to datas.c
- (SigScm_InitStorage): Move SigScm_null_values initilization to
SigScm_InitStorage of datas.c
* sigscheme/datas.c
- (SigScm_null_values): Moved from sigscheme.c
- (SigScm_InitStorage): Moved SigScm_null_values initilization from
SigScm_Initialize_internal() of sigscheme.c
Modified: branches/r5rs/sigscheme/datas.c
===================================================================
--- branches/r5rs/sigscheme/datas.c 2005-10-06 01:07:06 UTC (rev 1815)
+++ branches/r5rs/sigscheme/datas.c 2005-10-06 01:30:09 UTC (rev 1816)
@@ -168,6 +168,11 @@
static jmp_buf save_regs_buf;
ScmObj *scm_stack_start_pointer = NULL;
+/* multiple values */
+#if SCM_USE_VALUECONS
+ScmObj SigScm_null_values;
+#endif
+
/* dynamic extent */
static ScmObj current_dynamic_extent = NULL;
@@ -257,6 +262,15 @@
initialize_special_constants();
allocate_heap(&scm_heaps, scm_heap_num, SCM_HEAP_SIZE, &scm_freelist);
+#if SCM_USE_VALUECONS
+ /*
+ * To keep storage model abstract, the cell is allocated from a heap
+ * instead of directly construct ScmCell
+ */
+ SigScm_null_values = CONS(SCM_NULL, SCM_NULL);
+ SCM_ENTYPE_VALUEPACKET(SigScm_null_values);
+ SigScm_GC_Protect(&SigScm_null_values);
+#endif
initialize_dynamic_extent();
initialize_continuation_env();
initialize_symbol_hash();
Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c 2005-10-06 01:07:06 UTC (rev 1815)
+++ branches/r5rs/sigscheme/operations.c 2005-10-06 01:30:09 UTC (rev 1816)
@@ -1819,17 +1819,8 @@
if (CONSP(args) && NULLP(CDR(args)))
return CAR(args);
-#if SCM_USE_VALUECONS
- if (NULLP(args)) {
- return SigScm_null_values;
- } else {
- SCM_ENTYPE_VALUEPACKET(args);
- return args;
- }
-#else
/* Otherwise, we'll return the values in a packet. */
- return Scm_NewValuePacket(args);
-#endif
+ return SCM_MAKE_VALUEPACKET(args);
}
ScmObj ScmOp_call_with_values(ScmObj producer, ScmObj consumer,
@@ -1843,16 +1834,6 @@
vals = Scm_call(producer, SCM_NULL);
-#if SCM_USE_VALUECONS
- if (SCM_NULLVALUESP(vals)) {
- vals = SCM_NULL;
- } else if (VALUEPACKETP(vals)) {
- SCM_ENTYPE_CONS(vals);
- } else {
- /* got back a single value */
- vals = CONS(vals, SCM_NULL);
- }
-#else
if (!VALUEPACKETP(vals)) {
/* got back a single value */
vals = CONS(vals, SCM_NULL);
@@ -1860,7 +1841,6 @@
/* extract */
vals = SCM_VALUEPACKET_VALUES(vals);
}
-#endif
return Scm_tailcall(consumer, vals, eval_state);
}
Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c 2005-10-06 01:07:06 UTC (rev 1815)
+++ branches/r5rs/sigscheme/sigscheme.c 2005-10-06 01:30:09 UTC (rev 1816)
@@ -57,10 +57,6 @@
Variable Declarations
=======================================*/
ScmObj SigScm_quote, SigScm_quasiquote, SigScm_unquote, SigScm_unquote_splicing;
-#if SCM_USE_VALUECONS
-ScmObj SigScm_null_values;
-#endif
-
#if SCM_COMPAT_SIOD
static ScmObj scm_return_value = NULL;
#endif
@@ -157,17 +153,6 @@
SCM_SYMBOL_SET_VCELL(Scm_Intern("=>"), SCM_TRUE);
#endif
-#if SCM_USE_VALUECONS
- /* FIXME: hide into datas.c */
- /*
- * To keep storage model abstract, the cell is allocated from a heap
- * instead of directly construct ScmCell
- */
- SigScm_null_values = CONS(SCM_NULL, SCM_NULL);
- SCM_ENTYPE_VALUEPACKET(SigScm_null_values);
- SigScm_GC_Protect(&SigScm_null_values);
-#endif
-
#if SCM_USE_NONSTD_FEATURES
SigScm_features = Scm_Intern("*features*");
SCM_SYMBOL_SET_VCELL(SigScm_features, SCM_NULL);
Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h 2005-10-06 01:07:06 UTC (rev 1815)
+++ branches/r5rs/sigscheme/sigschemeinternal.h 2005-10-06 01:30:09 UTC (rev 1816)
@@ -74,7 +74,7 @@
extern ScmObj scm_current_output_port;
extern ScmObj SigScm_features;
-/* sigscheme.c */
+/* datas.c */
#if SCM_USE_VALUECONS
extern ScmObj SigScm_null_values;
#endif
Modified: branches/r5rs/sigscheme/sigschemetype.h
===================================================================
--- branches/r5rs/sigscheme/sigschemetype.h 2005-10-06 01:07:06 UTC (rev 1815)
+++ branches/r5rs/sigscheme/sigschemetype.h 2005-10-06 01:30:09 UTC (rev 1816)
@@ -377,6 +377,8 @@
#define SCM_VALUEPACKETP(a) (SCM_TYPE(a) == ScmValuePacket)
#define SCM_NULLVALUESP(a) (EQ(a, SigScm_null_values))
#define SCM_ENTYPE_VALUEPACKET(a) (SCM_ENTYPE((a), ScmValuePacket))
+#define SCM_MAKE_VALUEPACKET(vals) (NULLP(vals) ? SigScm_null_values : \
+ (SCM_ENTYPE_VALUEPACKET(vals), (vals)))
#define SCM_VALUEPACKET_VALUES(a) ((SCM_NULLVALUESP(a)) ? SCM_NULL : \
(SCM_ENTYPE_CONS(a), (a)))
#define SCM_VALUECONS_CAR(a) (SCM_AS_VALUEPACKET(a)->obj.cons.car)
@@ -384,6 +386,7 @@
#else /* SCM_USE_VALUECONS */
#define SCM_VALUEPACKETP(a) (SCM_TYPE(a) == ScmValuePacket)
#define SCM_ENTYPE_VALUEPACKET(a) (SCM_ENTYPE((a), ScmValuePacket))
+#define SCM_MAKE_VALUEPACKET(vals) (Scm_NewValuePacket(vals))
#define SCM_VALUEPACKET_VALUES(a) (SCM_AS_VALUEPACKET(a)->obj.value_pack.values)
#define SCM_VALUEPACKET_SET_VALUES(a, v) (SCM_VALUEPACKET_VALUES(a) = (v))
#endif /* SCM_USE_VALUECONS */
More information about the uim-commit
mailing list