Author: yamakenz
Date: Thu Jul 12 14:21:16 2007
New Revision: 4713
Added:
sigscheme-trunk/lib/srfi-55.scm
sigscheme-trunk/src/module-srfi55.c
sigscheme-trunk/test/test-srfi55.scm
Modified:
sigscheme-trunk/NEWS
sigscheme-trunk/QALog
sigscheme-trunk/README
sigscheme-trunk/configure.in
sigscheme-trunk/doc/spec.txt
sigscheme-trunk/lib/Makefile.am
sigscheme-trunk/src/Makefile.am
sigscheme-trunk/src/module-sscm-ext.c
sigscheme-trunk/src/module.c
sigscheme-trunk/src/sigscheme.c
sigscheme-trunk/src/sigscheme.h
sigscheme-trunk/src/sigschemeinternal.h
sigscheme-trunk/test/Makefile.am
Log:
* This commit add SRFI-55
* src/sigscheme.h
- (scm_require_module, scm_p_require_module, scm_p_scmlibdir,
scm_s_srfi55_require_extension): New function decl
* src/sigschemeinternal.h
- (scm_initialize_srfi55): New function decl
* src/module.c
- (module_info_table): Add "srfi-55"
- (scm_s_use): Simplify with scm_p_require_module()
- (scm_require_module_internal): New static function
- (scm_require_module, scm_p_require_module): New function
* src/module-srfi55.c
- New file
- (l_sym_require_extension): New static variable
- (scm_initialize_srfi55, scm_s_srfi55_require_extension): New function
* src/module-sscm-ext.c
- (scm_p_scmlibdir): New function
* src/sigscheme.c
- (scm_initialize_internal): Enable SRFI-55 by default
* src/Makefile.am
- (FUNC_TABLES): Add functable-srfi55.c
- (libsscm_sources): Add module-srfi55.c
* lib/srfi-55.scm
- New file
- (%require-extension-alist): New variable
- (%require-extension-handler-srfi, %require-sysfile, %require-extension):
New procedure
* lib/Makefile.am
- (dist_scmlib_DATA): Add srfi-55.scm
* test/test-srfi55.scm
- New file
- Add tests for require-extension
* test/Makefile.am
- (sscm_tests): Add test-srfi55.scm
* configure.in
- Add SRFI-55 configuration
* doc/spec.txt
* QALog
* README
* NEWS
- Update
Modified: sigscheme-trunk/NEWS
==============================================================================
--- sigscheme-trunk/NEWS (original)
+++ sigscheme-trunk/NEWS Thu Jul 12 14:21:16 2007
@@ -3,8 +3,15 @@
* New features
+ - SRFI-1 List Library
+
+ - SRFI-55 require-extension
+
- New syntax let-optionals* compatible with Gauche for optional argument
processing
+
+ - %%require-module and scm_require_module(). 'use' and scm_use() have been
+ deprecated and will be removed in SigScheme 0.9
- New character codec procedures %%current-char-codec,
%%set-current-char-codec! and with-char-codec
Modified: sigscheme-trunk/QALog
==============================================================================
--- sigscheme-trunk/QALog (original)
+++ sigscheme-trunk/QALog Thu Jul 12 14:21:16 2007
@@ -274,6 +274,7 @@
yyyy yyy srfi module-srfi34.c
yyyy yyy srfi module-srfi38.c
yyyy yyy srfi module-srfi48.c
+yyyy yy srfi module-srfi55.c
yyyyyyyy srfi module-srfi60.c
y yy y opt module-sscm-ext.c
y yy y opt module-siod.c
@@ -1012,6 +1013,17 @@
normal case tests: [EMAIL PROTECTED]
corner case tests: [EMAIL PROTECTED]
+file: module-srfi55.c
+category: srfi
+spec by eyes: [EMAIL PROTECTED]
+spec by tests: [EMAIL PROTECTED]
+general review: [EMAIL PROTECTED]
+64-bit by eyes: [EMAIL PROTECTED]
+64-bit by tests:
+coding style: [EMAIL PROTECTED]
+normal case tests: [EMAIL PROTECTED]
+corner case tests:
+
file: module-srfi60.c
category: srfi
spec by eyes: [EMAIL PROTECTED]
@@ -1081,6 +1093,11 @@
Log
---
+2007-07-13 YamaKen <yamaken AT bp.iij4u.or.jp>
+ * module-srfi55.c
+ * srfi-55.scm
+ - QA done @r4713 with test-srfi55.scm
+
2007-07-01 YamaKen <yamaken AT bp.iij4u.or.jp>
* module-srfi1.c
- QA done @r4643 with test-srfi1-another.scm, test-srfi1.scm and
Modified: sigscheme-trunk/README
==============================================================================
--- sigscheme-trunk/README (original)
+++ sigscheme-trunk/README Thu Jul 12 14:21:16 2007
@@ -28,15 +28,17 @@
- Conforms to R5RS basically (not fully)
- R5RS hygienic macros (experimental)
- Supports Following SRFIs
- - SRFI-2 : And-let*
+ - SRFI-1 : List Library
+ - SRFI-2 : AND-LET*: an AND with local bindings, a guarded LET* special form
- SRFI-6 : Basic String Ports
- - SRFI-8 : Receive
+ - SRFI-8 : receive: Binding to multiple values
- SRFI-22 : Running Scheme Scripts on Unix (partial)
- SRFI-23 : Error Reporting Mechanism
- SRFI-28 : Basic Format Strings
- SRFI-34 : Exception Handling for Programs
- SRFI-38 : External Representation for Data with Shared Structure (partial)
- SRFI-48 : Intermediate Format Strings
+ - SRFI-55 : require-extension
- SRFI-60 : Integer as Bits (partial)
- R6RS: R6RS characters (partial and preliminary)
- Multibyte character encodings support
Modified: sigscheme-trunk/configure.in
==============================================================================
--- sigscheme-trunk/configure.in (original)
+++ sigscheme-trunk/configure.in Thu Jul 12 14:21:16 2007
@@ -491,6 +491,7 @@
use_srfi34=yes
use_srfi38=yes
use_srfi48=yes
+ use_srfi55=yes
use_srfi60=yes
use_sscm_extensions=yes
use_sscm_format_extension=yes
@@ -509,6 +510,7 @@
use_srfi34=no
use_srfi38=no
use_srfi48=no
+ use_srfi55=no
use_srfi60=no
use_sscm_extensions=no
use_sscm_format_extension=no
@@ -527,6 +529,7 @@
use_srfi34=no
use_srfi38=no
use_srfi48=no
+ use_srfi55=no
use_srfi60=no
use_sscm_extensions=yes
use_sscm_format_extension=no
@@ -545,6 +548,7 @@
use_srfi34=yes
use_srfi38=yes
use_srfi48=yes
+ use_srfi55=yes
use_srfi60=yes
use_sscm_extensions=yes
use_sscm_format_extension=yes
@@ -655,6 +659,7 @@
AX_FEATURE_ARG_Y(srfi34, [SRFI-34 exception handling for programs])
AX_FEATURE_ARG_Y(srfi38, [SRFI-38 'write/ss' ('read/ss' is not
provided)])
AX_FEATURE_ARG_Y(srfi48, [SRFI-48 'format' (superset of SRFI-28)])
+AX_FEATURE_ARG_Y(srfi55, [SRFI-55 'require-extension'])
AX_FEATURE_ARG_Y(srfi60, [SRFI-60 integers as bits (partial)])
# R6RS features (preliminary)
@@ -711,13 +716,14 @@
string_procedure: string char
reader: port
writer: port raw_c_format
-load: port reader
+load: port reader string
sscm_extensions: load
eval_c_string: reader srfi6
srfi1: continuation deep_cadrs load sscm_extensions srfi8 srfi23
srfi6: port string
srfi34: continuation srfi23
srfi38: writer
+srfi55: load sscm_extensions
srfi60: int
r6rs_named_chars: char
r6rs_chars: char utf8 reader r6rs_named_chars
@@ -870,6 +876,7 @@
AX_FEATURE_DEFINE(srfi34)
AX_FEATURE_DEFINE(srfi38)
AX_FEATURE_DEFINE(srfi48)
+AX_FEATURE_DEFINE(srfi55)
AX_FEATURE_DEFINE(srfi60)
# R6RS features (preliminary)
@@ -945,6 +952,7 @@
AC_SUBST(use_srfi34)
AC_SUBST(use_srfi38)
AC_SUBST(use_srfi48)
+AC_SUBST(use_srfi55)
AC_SUBST(use_srfi60)
AC_SUBST(use_r6rs_chars)
AC_SUBST(use_r6rs_named_chars)
@@ -1098,6 +1106,7 @@
SRFI-34: $use_srfi34
SRFI-38: $use_srfi38
SRFI-48: $use_srfi48
+SRFI-55: $use_srfi55
SRFI-60: $use_srfi60
[R6RS features (preliminary)]
Modified: sigscheme-trunk/doc/spec.txt
==============================================================================
--- sigscheme-trunk/doc/spec.txt (original)
+++ sigscheme-trunk/doc/spec.txt Thu Jul 12 14:21:16 2007
@@ -428,10 +428,29 @@
SRFI-1 List Library
~~~~~~~~~~~~~~~~~~~~
-Although a C implementation `module-srfi1.c` is existing, it is still broken
-and should not use for production codes. To get SRFI-1 working with SigScheme,
-use SLIB version of the library (will be made available after some
-preparations).
+Fully supported.
+
+It is based on the reference implementation of SRFI-1. Some procedures are
+replaced with efficient C implementation. And bugs in `delete-duplicates!`,
+`lset-xor`, `lset-xor!` and `list=` of the reference implementation are fixed.
+
+
+SRFI-2 AND-LET*
+~~~~~~~~~~~~~~~
+
+Fully supported.
+
+
+SRFI-6 Basic String Ports
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Fully supported.
+
+
+SRFI-8 receive
+~~~~~~~~~~~~~~
+
+Fully supported.
SRFI-22 Running Scheme Scripts on Unix
@@ -453,6 +472,8 @@
SRFI-23 Error Reporting Mechanism
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Fully supported.
+
If srfi-34 is provided, the `error` procedure throws a SigScheme-specific error
object in cooperate with "SRFI-34 Exception Handling for Programs". Otherwise
it simply calls scm_fatal_error(). Since the error objects are represented as a
@@ -484,8 +505,10 @@
SRFI-28 Basic Format Strings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-SigScheme fully supports SRFI-28. A directive-less tilde at end of a format
-string causes an error as same as the reference implementation of SRFI-28.
+Fully supported.
+
+A directive-less tilde at end of a format string causes an error as same as the
+reference implementation of SRFI-28.
.SigScheme
================================================================
@@ -493,6 +516,12 @@
(format "a~") ==> error
================================================================
+SRFI-34 Exception Handling for Programs
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Fully supported.
+
+
SRFI-38 External Representation for Data with Shared Structure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -515,7 +544,7 @@
SRFI-48 Intermediate Format Strings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-SigScheme fully supports SRFI-48.
+Fully supported.
The 'd' part of '~w,dF' directive is acceptable, but completely ignored on
output format. Since SigScheme only supports integer currently, number is
@@ -549,6 +578,12 @@
(format "~") ==> error
(format "a~") ==> error
================================================================
+
+
+SRFI-55 require-extension
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Fully supported.
SRFI-60 Integer as Bits
Modified: sigscheme-trunk/lib/Makefile.am
==============================================================================
--- sigscheme-trunk/lib/Makefile.am (original)
+++ sigscheme-trunk/lib/Makefile.am Thu Jul 12 14:21:16 2007
@@ -1,6 +1,6 @@
EXTRA_DIST = slib.scm
-dist_scmlib_DATA = sigscheme-init.scm srfi-1.scm
+dist_scmlib_DATA = sigscheme-init.scm srfi-1.scm srfi-55.scm
# Install into master package's pkgdatadir if --with-master-pkg is specified
# e.g.)
Added: sigscheme-trunk/lib/srfi-55.scm
==============================================================================
--- (empty file)
+++ sigscheme-trunk/lib/srfi-55.scm Thu Jul 12 14:21:16 2007
@@ -0,0 +1,36 @@
+(define %require-extension-handler-srfi
+ (lambda numbers
+ (for-each (lambda (n)
+ (let ((srfi-n (string-append "srfi-" (number->string n))))
+ (or (%%require-module srfi-n)
+ (%require-sysfile srfi-n))))
+ numbers)))
+
+;; Be quasiquote free to allow --disable-quasiquote
+(define %require-extension-alist
+ (list
+ (cons 'srfi %require-extension-handler-srfi)))
+
+(define %require-sysfile
+ (lambda (ext-id)
+ (or (provided? ext-id)
+ (let* ((file (string-append ext-id ".scm"))
+ (path (string-append (%%scmlibdir) "/" file)))
+ (load path)
+ (provide ext-id)))))
+
+(define %require-extension
+ (lambda clauses
+ (for-each (lambda (clause)
+ (let* ((id (car clause))
+ (args (cdr clause))
+ (id-str (symbol->string id))
+ (default-handler (lambda ()
+ (or (%%require-module id-str)
+ (%require-sysfile id-str))))
+ (handler (cond
+ ((assq id %require-extension-alist) => cdr)
+ (else
+ default-handler))))
+ (apply handler args)))
+ clauses)))
Modified: sigscheme-trunk/src/Makefile.am
==============================================================================
--- sigscheme-trunk/src/Makefile.am (original)
+++ sigscheme-trunk/src/Makefile.am Thu Jul 12 14:21:16 2007
@@ -44,6 +44,7 @@
functable-srfi34.c \
functable-srfi38.c \
functable-srfi48.c \
+ functable-srfi55.c \
functable-srfi60.c
if MAINTAINER_MODE
@@ -110,6 +111,8 @@
$(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi38" $<
functable-srfi48.c: module-srfi48.c $(BUILD_FUNCTBL_DEPS)
$(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi48" $<
+functable-srfi55.c: module-srfi55.c $(BUILD_FUNCTBL_DEPS)
+ $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi55" $<
functable-srfi60.c: module-srfi60.c $(BUILD_FUNCTBL_DEPS)
$(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi60" $<
endif
@@ -330,6 +333,9 @@
endif
if USE_SRFI48
libsscm_sources += module-srfi48.c
+endif
+if USE_SRFI55
+ libsscm_sources += module-srfi55.c
endif
if USE_SRFI60
libsscm_sources += module-srfi60.c
Added: sigscheme-trunk/src/module-srfi55.c
==============================================================================
--- (empty file)
+++ sigscheme-trunk/src/module-srfi55.c Thu Jul 12 14:21:16 2007
@@ -0,0 +1,97 @@
+/*===========================================================================
+ * Filename : module-srfi55.c
+ * About : require-extension
+ *
+ * Copyright (c) 2007 SigScheme Project <uim-en AT googlegroups.com>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of authors nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+ * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+===========================================================================*/
+
+#include <config.h>
+
+#include "sigscheme.h"
+#include "sigschemeinternal.h"
+
+/*=======================================
+ File Local Macro Definitions
+=======================================*/
+
+/*=======================================
+ File Local Type Definitions
+=======================================*/
+
+/*=======================================
+ Variable Definitions
+=======================================*/
+#include "functable-srfi55.c"
+
+SCM_GLOBAL_VARS_BEGIN(static_srfi55);
+#define static
+static ScmObj l_sym_require_extension;
+#undef static
+SCM_GLOBAL_VARS_END(static_srfi55);
+#define l_sym_require_extension SCM_GLOBAL_VAR(static_srfi55, \
+ l_sym_require_extension)
+SCM_DEFINE_STATIC_VARS(static_srfi55);
+
+/*=======================================
+ File Local Function Declarations
+=======================================*/
+
+/*=======================================
+ Function Definitions
+=======================================*/
+SCM_EXPORT void
+scm_initialize_srfi55(void)
+{
+ scm_register_funcs(scm_functable_srfi55);
+
+ l_sym_require_extension = scm_intern("%require-extension");
+
+ scm_require_module("sscm-ext"); /* for 'provided?' and 'provide' */
+ scm_load(SCM_PREPEND_SCMLIBDIR("srfi-55.scm"));
+}
+
+SCM_EXPORT ScmObj
+scm_s_srfi55_require_extension(ScmObj clauses, ScmObj env)
+{
+ ScmObj proc;
+ DECLARE_FUNCTION("require-extension", syntax_variadic_0);
+
+ /*=======================================================================
+ (require-extension <clause> ...)
+
+ <clause> ::= (<extension-identifier>)
+ | (<extension-identifier> <extension-argument> ...)
+ <extension-identifier> ::= <symbol>
+ <extension-argument> ::= <any Scheme value>
+ =======================================================================*/
+ proc = scm_symbol_value(l_sym_require_extension, SCM_INTERACTION_ENV);
+
+ return scm_call(proc, clauses);
+}
Modified: sigscheme-trunk/src/module-sscm-ext.c
==============================================================================
--- sigscheme-trunk/src/module-sscm-ext.c (original)
+++ sigscheme-trunk/src/module-sscm-ext.c Thu Jul 12 14:21:16 2007
@@ -108,6 +108,14 @@
}
SCM_EXPORT ScmObj
+scm_p_scmlibdir(void)
+{
+ DECLARE_FUNCTION("%%scmlibdir", procedure_fixed_0);
+
+ return CONST_STRING(SCMLIBDIR);
+}
+
+SCM_EXPORT ScmObj
scm_p_current_environment(ScmEvalState *eval_state)
{
DECLARE_FUNCTION("%%current-environment", procedure_fixed_tailrec_0);
Modified: sigscheme-trunk/src/module.c
==============================================================================
--- sigscheme-trunk/src/module.c (original)
+++ sigscheme-trunk/src/module.c Thu Jul 12 14:21:16 2007
@@ -101,6 +101,9 @@
#if SCM_USE_SRFI48
{"srfi-48", scm_initialize_srfi48, NULL},
#endif
+#if SCM_USE_SRFI55
+ {"srfi-55", scm_initialize_srfi55, NULL},
+#endif
#if SCM_USE_SRFI60
{"srfi-60", scm_initialize_srfi60, NULL},
#endif
@@ -115,6 +118,7 @@
=======================================*/
static const struct scm_module_info *lookup_module_info(const char *feature);
static void *scm_use_internal(const char *feature);
+static void *scm_require_module_internal(const char *name);
/*=======================================
Function Definitions
@@ -173,6 +177,7 @@
return TRUEP(scm_p_member(feature, l_features));
}
+#if 1 /* 'use' is deprecated and will be removed in SigScheme 0.9 */
SCM_EXPORT scm_bool
scm_use(const char *feature)
{
@@ -190,34 +195,56 @@
return (void *)(uintptr_t)TRUEP(ok);
}
+SCM_EXPORT ScmObj
+scm_s_use(ScmObj feature, ScmObj env)
+{
+ const char *c_feature_str;
+ DECLARE_FUNCTION("use", syntax_fixed_1);
+
+ ENSURE_SYMBOL(feature);
+
+ c_feature_str = SCM_SYMBOL_NAME(feature);
+ return scm_p_require_module(CONST_STRING(c_feature_str));
+}
+#endif /* deprecated */
+
+SCM_EXPORT scm_bool
+scm_require_module(const char *name)
+{
+ return
scm_call_with_gc_ready_stack((ScmGCGateFunc)scm_require_module_internal, (void
*)name) ? scm_true : scm_false;
+}
+
+static void *
+scm_require_module_internal(const char *name)
+{
+ ScmObj ok;
+
+ SCM_ASSERT(name);
+
+ ok = scm_p_require_module(CONST_STRING(name));
+ return (void *)(uintptr_t)TRUEP(ok);
+}
+
/*
* TODO:
- * - Make the interface and semantics of 'use' similar to other Scheme
- * implementations such as Gauche. This is important to make *.scm file
- * portable
- * - Make a *.scm file loadable via this interface (if necessary to make
- * similar to other Scheme implementations), and make consistent with
- * 'require'
* - Make the 'module' concept similar to other Scheme implementations and R6RS
* - Make the module_info_table dynamically registerable for dynamic loadable
* objects (if necessary)
*/
SCM_EXPORT ScmObj
-scm_s_use(ScmObj feature, ScmObj env)
+scm_p_require_module(ScmObj name)
{
const struct scm_module_info *mod;
- ScmObj feature_str;
- const char *c_feature_str;
- DECLARE_FUNCTION("use", syntax_fixed_1);
+ const char *c_name;
+ DECLARE_FUNCTION("%%require-module", procedure_fixed_1);
- ENSURE_SYMBOL(feature);
+ ENSURE_STRING(name);
- c_feature_str = SCM_SYMBOL_NAME(feature);
- if ((mod = lookup_module_info(c_feature_str))) {
- feature_str = CONST_STRING(c_feature_str);
- if (!scm_providedp(feature_str)) {
+ c_name = SCM_STRING_STR(name);
+ if ((mod = lookup_module_info(c_name))) {
+ if (!scm_providedp(name)) {
(*mod->initializer)();
- scm_provide(feature_str);
+ scm_provide(name);
}
return SCM_TRUE;
}
Modified: sigscheme-trunk/src/sigscheme.c
==============================================================================
--- sigscheme-trunk/src/sigscheme.c (original)
+++ sigscheme-trunk/src/sigscheme.c Thu Jul 12 14:21:16 2007
@@ -343,6 +343,11 @@
scm_load(SCM_PREPEND_SCMLIBDIR("sigscheme-init.scm"));
#endif
+ /* require-extension is enabled by default */
+#if SCM_USE_SRFI55
+ scm_require_module("srfi-55");
+#endif
+
return NULL;
}
Modified: sigscheme-trunk/src/sigscheme.h
==============================================================================
--- sigscheme-trunk/src/sigscheme.h (original)
+++ sigscheme-trunk/src/sigscheme.h Thu Jul 12 14:21:16 2007
@@ -1250,8 +1250,12 @@
/* module.c */
SCM_EXPORT void scm_provide(ScmObj feature);
SCM_EXPORT scm_bool scm_providedp(ScmObj feature);
+#if 1 /* 'use' is deprecated and will be removed in SigScheme 0.9 */
SCM_EXPORT scm_bool scm_use(const char *feature);
SCM_EXPORT ScmObj scm_s_use(ScmObj feature, ScmObj env);
+#endif
+SCM_EXPORT scm_bool scm_require_module(const char *name);
+SCM_EXPORT ScmObj scm_p_require_module(ScmObj name);
SCM_EXPORT ScmObj scm_register_func(const char *name, ScmFuncType func,
enum ScmFuncTypeCode type);
SCM_EXPORT void scm_register_funcs(const struct scm_func_registration_info
*table);
@@ -1642,6 +1646,7 @@
#if SCM_USE_SSCM_EXTENSIONS
SCM_EXPORT void scm_require(const char *filename);
SCM_EXPORT ScmObj scm_p_symbol_boundp(ScmObj sym, ScmObj rest);
+SCM_EXPORT ScmObj scm_p_scmlibdir(void);
SCM_EXPORT ScmObj scm_p_current_environment(ScmEvalState *eval_state);
SCM_EXPORT ScmObj scm_p_current_char_codec(void);
SCM_EXPORT ScmObj scm_p_set_current_char_codecx(ScmObj encoding);
@@ -1731,6 +1736,11 @@
#if SCM_USE_SRFI48
SCM_EXPORT ScmObj scm_p_srfi48_format(ScmObj fmt_or_port, ScmObj rest);
SCM_EXPORT ScmObj scm_p_formatplus(ScmObj fmt_or_port, ScmObj rest);
+#endif
+
+/* module-srfi55.c */
+#if SCM_USE_SRFI55
+SCM_EXPORT ScmObj scm_s_srfi55_require_extension(ScmObj clauses, ScmObj env);
#endif
/* module-srfi60.c */
Modified: sigscheme-trunk/src/sigschemeinternal.h
==============================================================================
--- sigscheme-trunk/src/sigschemeinternal.h (original)
+++ sigscheme-trunk/src/sigschemeinternal.h Thu Jul 12 14:21:16 2007
@@ -840,6 +840,11 @@
SCM_EXPORT void scm_initialize_srfi48(void);
#endif
+/* module-srfi55.c */
+#if SCM_USE_SRFI55
+SCM_EXPORT void scm_initialize_srfi55(void);
+#endif
+
/* module-srfi60.c */
#if SCM_USE_SRFI60
SCM_EXPORT void scm_initialize_srfi60(void);
Modified: sigscheme-trunk/test/Makefile.am
==============================================================================
--- sigscheme-trunk/test/Makefile.am (original)
+++ sigscheme-trunk/test/Makefile.am Thu Jul 12 14:21:16 2007
@@ -50,6 +50,7 @@
test-srfi34-2.scm \
test-srfi38.scm \
test-srfi48.scm \
+ test-srfi55.scm \
test-srfi60.scm \
test-sscm-ext.scm \
test-string-cmp.scm \
Added: sigscheme-trunk/test/test-srfi55.scm
==============================================================================
--- (empty file)
+++ sigscheme-trunk/test/test-srfi55.scm Thu Jul 12 14:21:16 2007
@@ -0,0 +1,68 @@
+;; Filename : test-srfi55.scm
+;; About : unit test for SRFI-55
+;;
+;; Copyright (c) 2007 SigScheme Project <uim-en AT googlegroups.com>
+;;
+;; All rights reserved.
+;;
+;; Redistribution and use in source and binary forms, with or without
+;; modification, are permitted provided that the following conditions
+;; are met:
+;;
+;; 1. Redistributions of source code must retain the above copyright
+;; notice, this list of conditions and the following disclaimer.
+;; 2. Redistributions in binary form must reproduce the above copyright
+;; notice, this list of conditions and the following disclaimer in the
+;; documentation and/or other materials provided with the distribution.
+;; 3. Neither the name of authors nor the names of its contributors
+;; may be used to endorse or promote products derived from this software
+;; without specific prior written permission.
+;;
+;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+;; IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+;; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+;; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+;; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+;; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+(load "./test/unittest.scm")
+
+;; SRFI-55 is enabled by default if exists.
+(if (not (provided? "srfi-55"))
+ (test-skip "SRFI-55 is not enabled"))
+
+(define tn test-name)
+
+(tn "require-extension")
+;; sscm-ext is enabled by default for SRFI-55
+(assert-true (tn) (provided? "sscm-ext"))
+(require-extension (sscm-ext))
+(assert-true (tn) (provided? "sscm-ext"))
+
+(tn "require-extension SRFIs")
+(assert-false (tn) (provided? "srfi-1"))
+(assert-false (tn) (provided? "srfi-2"))
+(assert-false (tn) (provided? "srfi-48"))
+(assert-false (tn) (provided? "srfi-60"))
+(require-extension (srfi 1 48 2 60))
+(assert-true (tn) (provided? "srfi-1"))
+(assert-true (tn) (provided? "srfi-2"))
+(assert-true (tn) (provided? "srfi-48"))
+(assert-true (tn) (provided? "srfi-60"))
+;; mixed
+(require-extension (sscm-ext) (srfi 1 8 2 60) (sscm-ext) (srfi 23))
+(assert-true (tn) (provided? "srfi-1"))
+(assert-true (tn) (provided? "srfi-2"))
+(assert-true (tn) (provided? "srfi-8"))
+(assert-true (tn) (provided? "srfi-23"))
+(assert-true (tn) (provided? "srfi-48"))
+(assert-true (tn) (provided? "srfi-60"))
+(assert-true (tn) (provided? "sscm-ext"))
+
+
+(total-report)