[uim-commit] r1703 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Fri Sep 30 10:03:02 PDT 2005
Author: yamaken
Date: 2005-09-30 10:02:59 -0700 (Fri, 30 Sep 2005)
New Revision: 1703
Modified:
branches/r5rs/sigscheme/datas.c
branches/r5rs/sigscheme/sigscheme.c
branches/r5rs/sigscheme/sigschemeinternal.h
branches/r5rs/sigscheme/sigschemetype.h
Log:
* sigscheme/sigschemetype.h
- (SCM_ETC_SET_IMPL): Move to datas.c
- (SigScm_quote, SigScm_quasiquote, SigScm_unquote,
SigScm_unquote_splicing): Move to sigschemeinternal.h
* sigscheme/sigschemeinternal.h
- (SigScm_quote, SigScm_quasiquote, SigScm_unquote,
SigScm_unquote_splicing): Moved from sigschemetype.h
* sigscheme/datas.c
- (SCM_ETC_SET_IMPL): Moved from sigschemetype.h SigScm_null,
- (SigScm_true, SigScm_false, SigScm_eof, SigScm_unbound,
SigScm_undef, SigScm_null_impl, SigScm_true_impl,
SigScm_false_impl, SigScm_eof_impl, SigScm_unbound_impl,
SigScm_undef_impl): Moved from sigscheme.c
- (initialize_special_constants): New static functions
- (SigScm_InitStorage): Invoke initialize_special_constants()
* sigscheme/sigscheme.c
- (SigScm_true, SigScm_false, SigScm_eof, SigScm_unbound,
SigScm_undef, SigScm_null_impl, SigScm_true_impl,
SigScm_false_impl, SigScm_eof_impl, SigScm_unbound_impl,
SigScm_undef_impl): Move to datas.c
- (SigScm_Initialize_internal): Move special constants
initialization to initialize_special_constants() of datas.c
Modified: branches/r5rs/sigscheme/datas.c
===================================================================
--- branches/r5rs/sigscheme/datas.c 2005-09-30 16:06:03 UTC (rev 1702)
+++ branches/r5rs/sigscheme/datas.c 2005-09-30 17:02:59 UTC (rev 1703)
@@ -135,6 +135,13 @@
#define SCM_MARK_CORRUPTED(a) ((unsigned)SCM_MARK_VALUE(a) > (unsigned)scm_cur_marker)
#endif
+/* special constants initialization */
+#define SCM_ETC_SET_IMPL(a, impl) \
+ do { \
+ (a) = &(impl); \
+ SCM_ENTYPE((a), ScmEtc); \
+ } while(0)
+
/*=======================================
Variable Declarations
=======================================*/
@@ -155,9 +162,16 @@
ScmObj scm_return_value = NULL;
#endif
+ScmObj SigScm_null, SigScm_true, SigScm_false, SigScm_eof;
+ScmObj SigScm_unbound, SigScm_undef;
+
+static ScmObjInternal SigScm_null_impl, SigScm_true_impl, SigScm_false_impl, SigScm_eof_impl;
+static ScmObjInternal SigScm_unbound_impl, SigScm_undef_impl;
+
/*=======================================
File Local Function Declarations
=======================================*/
+static void initialize_special_constants(void);
static void *malloc_aligned(size_t size);
static void allocate_heap(ScmObjHeap **heaps, int num_heap, int HEAP_SIZE, ScmObj *freelist);
@@ -195,10 +209,29 @@
/*=======================================
Function Implementations
=======================================*/
+/*
+ * To keep storage representation abstract, the special constants
+ * initialization is encapsulated in this file. Upper layers must only use
+ * abstract interfaces such as SCM_NULL and SCM_NULLP().
+ */
+static void initialize_special_constants(void)
+{
+ SCM_ETC_SET_IMPL(SigScm_null, SigScm_null_impl );
+ SCM_ETC_SET_IMPL(SigScm_true, SigScm_true_impl );
+ SCM_ETC_SET_IMPL(SigScm_false, SigScm_false_impl );
+ SCM_ETC_SET_IMPL(SigScm_eof, SigScm_eof_impl );
+ SCM_ETC_SET_IMPL(SigScm_unbound, SigScm_unbound_impl);
+ SCM_ETC_SET_IMPL(SigScm_undef, SigScm_undef_impl );
+#if SCM_COMPAT_SIOD_BUGS
+ SigScm_false = SigScm_null;
+#endif
+}
+
void SigScm_InitStorage(void)
{
- allocate_heap(&scm_heaps, scm_heap_num, SCM_HEAP_SIZE, &scm_freelist);
- initialize_symbol_hash();
+ initialize_special_constants();
+ allocate_heap(&scm_heaps, scm_heap_num, SCM_HEAP_SIZE, &scm_freelist);
+ initialize_symbol_hash();
}
void SigScm_FinalizeStorage(void)
Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c 2005-09-30 16:06:03 UTC (rev 1702)
+++ branches/r5rs/sigscheme/sigscheme.c 2005-09-30 17:02:59 UTC (rev 1703)
@@ -52,6 +52,10 @@
/*=======================================
Variable Declarations
=======================================*/
+ScmObj SigScm_quote, SigScm_quasiquote, SigScm_unquote, SigScm_unquote_splicing;
+#if SCM_USE_VALUECONS
+ScmObj SigScm_null_values;
+#endif
/*=======================================
File Local Function Declarations
@@ -64,16 +68,6 @@
static int Scm_RegisterFunc(const char *name, ScmFuncType func, enum ScmFuncTypeCode type);
-ScmObj SigScm_null, SigScm_true, SigScm_false, SigScm_eof;
-ScmObj SigScm_quote, SigScm_quasiquote, SigScm_unquote, SigScm_unquote_splicing;
-ScmObj SigScm_unbound, SigScm_undef;
-#if SCM_USE_VALUECONS
-ScmObj SigScm_null_values;
-#endif
-
-static ScmObjInternal SigScm_null_impl, SigScm_true_impl, SigScm_false_impl, SigScm_eof_impl;
-static ScmObjInternal SigScm_unbound_impl, SigScm_undef_impl;
-
/*=======================================
Function Implementations
=======================================*/
@@ -96,20 +90,6 @@
| SigScm_PredefinedDebugCategories());
/*=======================================================================
- Etc Variable Initialization
- =======================================================================*/
- SCM_ETC_SET_IMPL(SigScm_null, SigScm_null_impl );
- SCM_ETC_SET_IMPL(SigScm_true, SigScm_true_impl );
- SCM_ETC_SET_IMPL(SigScm_false, SigScm_false_impl );
- SCM_ETC_SET_IMPL(SigScm_eof, SigScm_eof_impl );
- SCM_ETC_SET_IMPL(SigScm_unbound, SigScm_unbound_impl);
- SCM_ETC_SET_IMPL(SigScm_undef, SigScm_undef_impl );
-
-#if SCM_COMPAT_SIOD_BUGS
- SigScm_false = SigScm_null;
-#endif
-
- /*=======================================================================
Externed Variable Initialization
=======================================================================*/
scm_continuation_thrown_obj = SCM_NULL;
Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h 2005-09-30 16:06:03 UTC (rev 1702)
+++ branches/r5rs/sigscheme/sigschemeinternal.h 2005-09-30 17:02:59 UTC (rev 1703)
@@ -82,6 +82,8 @@
#if SCM_USE_VALUECONS
extern ScmObj SigScm_null_values;
#endif
+extern ScmObj SigScm_quote, SigScm_quasiquote, SigScm_unquote;
+extern ScmObj SigScm_unquote_splicing;
/*=======================================
Modified: branches/r5rs/sigscheme/sigschemetype.h
===================================================================
--- branches/r5rs/sigscheme/sigschemetype.h 2005-09-30 16:06:03 UTC (rev 1702)
+++ branches/r5rs/sigscheme/sigschemetype.h 2005-09-30 17:02:59 UTC (rev 1703)
@@ -402,11 +402,6 @@
Etcetra Variables (Special Constants like SCM_NULL)
============================================================================*/
#define SCM_ETCP(a) (SCM_TYPE(a) == ScmEtc)
-#define SCM_ETC_SET_IMPL(a, impl) \
- do { \
- (a) = &(impl); \
- SCM_ENTYPE((a), ScmEtc); \
- } while(0)
/*============================================================================
C Pointer Object
@@ -466,7 +461,6 @@
* above. They safely hides the internal model against such change.
*/
extern ScmObj SigScm_null, SigScm_true, SigScm_false, SigScm_eof;
-extern ScmObj SigScm_quote, SigScm_quasiquote, SigScm_unquote, SigScm_unquote_splicing;
extern ScmObj SigScm_unbound, SigScm_undef;
#endif /* __SIGSCMTYPE_H */
More information about the uim-commit
mailing list