[uim-commit] r2913 - branches/r5rs/sigscheme/src
yamaken at freedesktop.org
yamaken at freedesktop.org
Sat Jan 14 08:32:42 PST 2006
Author: yamaken
Date: 2006-01-14 08:32:37 -0800 (Sat, 14 Jan 2006)
New Revision: 2913
Modified:
branches/r5rs/sigscheme/src/Makefile.am
branches/r5rs/sigscheme/src/main.c
branches/r5rs/sigscheme/src/sigscheme.c
branches/r5rs/sigscheme/src/sigschemefunctable.c
branches/r5rs/sigscheme/src/sigschemefunctable.h
branches/r5rs/sigscheme/src/sigschemeinternal.h
branches/r5rs/sigscheme/src/syntax.c
Log:
* sigscheme/src/sigschemeinternal.h
- (scm_sym_else, scm_sym_yields, SYM_ELSE, SYM_YIELDS): Removed
- (scm_init_syntax): New function decl
* sigscheme/src/sigscheme.c
- (scm_sym_else, scm_sym_yields): Move to syntax.c
- (scm_sym_define, scm_syn_lambda): Removed
- (scm_initialize_internal):
* Remove initialization for the variables
* Add scm_init_syntax() invocation
* Follow the renaming of r5rs_func_info_table
* sigscheme/src/syntax.c
- (sym_else, sym_yields):
* Moved from sigscheme.c
* Make static
* Strip scm_ prefix
- (scm_sym_define): Rename to sym_define
- (scm_syn_lambda): Rename to syn_lambda
- (sym_define, syn_lambda):
* Renamed from scm_*
* Make static
* Strip scm_ prefix
- (scm_init_syntax): New function
- (scm_s_cond_internal, scm_s_body): Follow the renamings
* sigscheme/src/main.c
- (repl_loop): Replace SYM_ELSE with scm_intern("else")
* sigscheme/src/sigschemefunctable.h
- (r5rs_func_info_table, r5rs_procedure_func_info_table): Rename
r5rs_func_info_table to r5rs_procedure_func_info_table
- (r5rs_syntax_func_info_table): New variable decl
* sigscheme/src/sigschemefunctable.c
* Remove sigschemefunctable-r5rs.c
* Add sigschemefunctable-r5rs-{syntax,procedure}.c
* sigscheme/src/Makefile.am
- (FUNC_TABLES):
* Remove sigschemefunctable-r5rs.c
* Add sigschemefunctable-r5rs-{syntax,procedure}.c
- Add rule for sigschemefunctable-r5rs-{syntax,procedure}.c
Modified: branches/r5rs/sigscheme/src/Makefile.am
===================================================================
--- branches/r5rs/sigscheme/src/Makefile.am 2006-01-14 15:41:58 UTC (rev 2912)
+++ branches/r5rs/sigscheme/src/Makefile.am 2006-01-14 16:32:37 UTC (rev 2913)
@@ -1,7 +1,8 @@
noinst_LTLIBRARIES = libsscm.la
FUNC_TABLES = \
- sigschemefunctable-r5rs.c \
+ sigschemefunctable-r5rs-syntax.c \
+ sigschemefunctable-r5rs-procedure.c \
sigschemefunctable-r5rs-deepcadrs.c \
sigschemefunctable-error.c \
sigschemefunctable-nonstd.c \
@@ -23,9 +24,11 @@
./script/functable-footer.txt
sigschemefunctable.c: $(FUNC_TABLES)
-sigschemefunctable-r5rs.c: sigscheme.c operations.c eval.c syntax.c io.c $(BUILD_FUNCTBL_SOURCES)
- $(BUILD_FUNCTBL) "r5rs_func_info_table" \
- sigscheme.c operations.c eval.c syntax.c io.c > $@
+sigschemefunctable-r5rs-syntax.c: syntax.c $(BUILD_FUNCTBL_SOURCES)
+ $(BUILD_FUNCTBL) "r5rs_syntax_func_info_table" $< > $@
+sigschemefunctable-r5rs-procedure.c: sigscheme.c operations.c eval.c io.c $(BUILD_FUNCTBL_SOURCES)
+ $(BUILD_FUNCTBL) "r5rs_procedure_func_info_table" \
+ sigscheme.c operations.c eval.c io.c > $@
sigschemefunctable-r5rs-deepcadrs.c: operations-r5rs-deepcadrs.c $(BUILD_FUNCTBL_SOURCES)
$(BUILD_FUNCTBL) "r5rs_deepcadrs_func_info_table" $< > $@
sigschemefunctable-error.c: error.c $(BUILD_FUNCTBL_SOURCES)
Modified: branches/r5rs/sigscheme/src/main.c
===================================================================
--- branches/r5rs/sigscheme/src/main.c 2006-01-14 15:41:58 UTC (rev 2912)
+++ branches/r5rs/sigscheme/src/main.c 2006-01-14 16:32:37 UTC (rev 2913)
@@ -106,7 +106,7 @@
/* prepare the constant part of the form to get the loop fast */
sym_guard = scm_intern("guard");
cond_catch = LIST_2(scm_intern("err"),
- LIST_3(SYM_ELSE,
+ LIST_3(scm_intern("else"),
LIST_2(scm_intern("%%inspect-error"),
scm_intern("err")),
LIST_2(SCM_SYM_QUOTE, err)));
Modified: branches/r5rs/sigscheme/src/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/src/sigscheme.c 2006-01-14 15:41:58 UTC (rev 2912)
+++ branches/r5rs/sigscheme/src/sigscheme.c 2006-01-14 16:32:37 UTC (rev 2913)
@@ -64,10 +64,7 @@
=======================================*/
ScmObj scm_sym_quote, scm_sym_quasiquote;
ScmObj scm_sym_unquote, scm_sym_unquote_splicing;
-ScmObj scm_sym_else, scm_sym_yields;
-extern ScmObj scm_sym_define, scm_syn_lambda;
-
/* canonical internal encoding for identifiers */
ScmCharCodec *scm_identifier_codec;
@@ -166,21 +163,17 @@
scm_sym_quasiquote = scm_intern("quasiquote");
scm_sym_unquote = scm_intern("unquote");
scm_sym_unquote_splicing = scm_intern("unquote-splicing");
- scm_sym_else = scm_intern("else");
- scm_sym_yields = scm_intern("=>");
-#if SCM_STRICT_ARGCHECK
- /* syntax.c */
- scm_sym_define = scm_intern("define");
-#endif
-
scm_gc_protect_with_init(&features, SCM_NULL);
/*=======================================================================
Register Built-in Functions
=======================================================================*/
- /* R5RS Functions */
- REGISTER_FUNC_TABLE(r5rs_func_info_table);
+ /* R5RS Syntaxes */
+ scm_init_syntax();
+
+ /* R5RS Procedures */
+ REGISTER_FUNC_TABLE(r5rs_procedure_func_info_table);
scm_define_alias("integer?", "number?");
#if SCM_USE_DEEP_CADRS
@@ -192,14 +185,6 @@
#endif
/*=======================================================================
- Predefined Objects
- =======================================================================*/
-#if SCM_STRICT_ARGCHECK
- scm_syn_lambda
- = scm_symbol_value(scm_intern("lambda"), SCM_INTERACTION_ENV);
-#endif
-
- /*=======================================================================
Fixing up
=======================================================================*/
/* to evaluate SigScheme-dependent codes conditionally */
Modified: branches/r5rs/sigscheme/src/sigschemefunctable.c
===================================================================
--- branches/r5rs/sigscheme/src/sigschemefunctable.c 2006-01-14 15:41:58 UTC (rev 2912)
+++ branches/r5rs/sigscheme/src/sigschemefunctable.c 2006-01-14 16:32:37 UTC (rev 2913)
@@ -53,7 +53,8 @@
/*=======================================
Builtin Function Tables
=======================================*/
-#include "sigschemefunctable-r5rs.c"
+#include "sigschemefunctable-r5rs-syntax.c"
+#include "sigschemefunctable-r5rs-procedure.c"
#include "sigschemefunctable-error.c"
#if SCM_USE_DEEP_CADRS
Modified: branches/r5rs/sigscheme/src/sigschemefunctable.h
===================================================================
--- branches/r5rs/sigscheme/src/sigschemefunctable.h 2006-01-14 15:41:58 UTC (rev 2912)
+++ branches/r5rs/sigscheme/src/sigschemefunctable.h 2006-01-14 16:32:37 UTC (rev 2913)
@@ -68,7 +68,8 @@
/*=======================================
Variable Declarations
=======================================*/
-extern struct builtin_func_info r5rs_func_info_table[];
+extern struct builtin_func_info r5rs_syntax_func_info_table[];
+extern struct builtin_func_info r5rs_procedure_func_info_table[];
#if SCM_USE_DEEP_CADRS
extern struct builtin_func_info r5rs_deepcadrs_func_info_table[];
Modified: branches/r5rs/sigscheme/src/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/src/sigschemeinternal.h 2006-01-14 15:41:58 UTC (rev 2912)
+++ branches/r5rs/sigscheme/src/sigschemeinternal.h 2006-01-14 16:32:37 UTC (rev 2913)
@@ -62,7 +62,6 @@
Variable Declarations
=======================================*/
/* sigscheme.c */
-extern ScmObj scm_sym_else, scm_sym_yields;
extern ScmCharCodec *scm_identifier_codec;
/* io.c */
@@ -139,8 +138,6 @@
#define SYM_QUASIQUOTE SCM_SYM_QUASIQUOTE
#define SYM_UNQUOTE SCM_SYM_UNQUOTE
#define SYM_UNQUOTE_SPLICING SCM_SYM_UNQUOTE_SPLICING
-#define SYM_ELSE scm_sym_else
-#define SYM_YIELDS scm_sym_yields
#define EQ SCM_EQ
#define NULLP SCM_NULLP
@@ -496,6 +493,7 @@
ScmObj scm_eval(ScmObj obj, ScmObj env);
/* syntax.c */
+void scm_init_syntax(void);
ScmObj scm_s_body(ScmObj body, ScmEvalState *eval_state);
ScmObj scm_s_cond_internal(ScmObj args, ScmObj case_key,
ScmEvalState *eval_state);
Modified: branches/r5rs/sigscheme/src/syntax.c
===================================================================
--- branches/r5rs/sigscheme/src/syntax.c 2006-01-14 15:41:58 UTC (rev 2912)
+++ branches/r5rs/sigscheme/src/syntax.c 2006-01-14 16:32:37 UTC (rev 2913)
@@ -55,8 +55,9 @@
/*=======================================
Variable Declarations
=======================================*/
+static ScmObj sym_else, sym_yields;
#if SCM_STRICT_ARGCHECK
-ScmObj scm_sym_define, scm_syn_lambda;
+static ScmObj sym_define, syn_lambda;
#endif
/*=======================================
@@ -71,6 +72,19 @@
/*=======================================
Function Implementations
=======================================*/
+void
+scm_init_syntax(void)
+{
+ REGISTER_FUNC_TABLE(r5rs_syntax_func_info_table);
+
+ sym_else = scm_intern("else");
+ sym_yields = scm_intern("=>");
+#if SCM_STRICT_ARGCHECK
+ sym_define = scm_intern("define");
+ syn_lambda = scm_symbol_value(scm_intern("lambda"), SCM_INTERACTION_ENV);
+#endif
+}
+
/*===========================================================================
Utilities: Sequential Datum Translators
===========================================================================*/
@@ -491,7 +505,7 @@
test = CAR(clause);
exps = CDR(clause);
- if (EQ(test, SYM_ELSE)) {
+ if (EQ(test, sym_else)) {
ASSERT_NO_MORE_ARG(args);
} else {
if (VALIDP(case_key)) {
@@ -509,7 +523,7 @@
* result.
*/
if (NULLP(exps)) {
- if (EQ(test, SYM_ELSE)) {
+ if (EQ(test, sym_else)) {
ERR_OBJ("bad clause: else with no expressions", clause);
} else {
eval_state->ret_type = SCM_RETTYPE_AS_IS;
@@ -533,8 +547,8 @@
* of the <test> and the value returned by this procedure is
* returned by the cond expression.
*/
- if (EQ(SYM_YIELDS, CAR(exps)) && CONSP(CDR(exps))
- && !EQ(test, SYM_ELSE))
+ if (EQ(sym_yields, CAR(exps)) && CONSP(CDR(exps))
+ && !EQ(test, sym_else))
{
if (!NULLP(CDDR(exps)))
ERR_OBJ("bad clause", clause);
@@ -659,7 +673,7 @@
SCM_QUEUE_POINT_TO(def_expq, def_exps);
while (CONSP(body)) {
exp = CAR(body);
- if (!CONSP(exp) || (sym = POP(exp), !EQ(sym, scm_sym_define)))
+ if (!CONSP(exp) || (sym = POP(exp), !EQ(sym, sym_define)))
break;
POP(body);
@@ -677,7 +691,7 @@
ENSURE_SYMBOL(sym);
var = sym;
- exp = CONS(scm_syn_lambda, CONS(lambda_formals, lambda_body));
+ exp = CONS(syn_lambda, CONS(lambda_formals, lambda_body));
} else {
ERR_OBJ("syntax error", var);
}
@@ -702,11 +716,11 @@
/* eval rest of the body */
if (CONSP(body)) {
FOR_EACH_BUTLAST (exp, body) {
- if (EQ(CAR(exp), scm_sym_define))
+ if (EQ(CAR(exp), sym_define))
ERR_OBJ(ERRMSG_NON_BEGINNING_INTERNAL_DEFINITION, exp);
EVAL(exp, env);
}
- if (EQ(CAR(exp), scm_sym_define))
+ if (EQ(CAR(exp), sym_define))
ERR_OBJ(ERRMSG_NON_BEGINNING_INTERNAL_DEFINITION, exp);
} else {
eval_state->ret_type = SCM_RETTYPE_AS_IS;
More information about the uim-commit
mailing list