s/rXXX/uXXX/g

This commit is contained in:
Yuichi Nishiwaki 2015-06-10 01:06:56 +09:00
parent 015971ffc4
commit 454146ab52
11 changed files with 117 additions and 117 deletions

View File

@ -195,7 +195,7 @@ pic_init_bool(pic_state *pic)
pic_defun(pic, "eqv?", pic_bool_eqv_p);
pic_defun(pic, "equal?", pic_bool_equal_p);
pic_defun_vm(pic, "not", pic->rNOT, pic_bool_not);
pic_defun_vm(pic, "not", pic->uNOT, pic_bool_not);
pic_defun(pic, "boolean?", pic_bool_boolean_p);
pic_defun(pic, "boolean=?", pic_bool_boolean_eq_p);

View File

@ -331,7 +331,7 @@ analyze_procedure(analyze_state *state, pic_value name, pic_value formals, pic_v
: pic_false_value();
/* To know what kind of local variables are defined, analyze body at first. */
body = analyze(state, pic_cons(pic, pic_obj_value(pic->rBEGIN), body_exprs), true);
body = analyze(state, pic_cons(pic, pic_obj_value(pic->uBEGIN), body_exprs), true);
analyze_deferred(state);
@ -399,7 +399,7 @@ analyze_define(analyze_state *state, pic_value obj)
if (pic_pair_p(pic_list_ref(pic, obj, 2))
&& pic_sym_p(pic_list_ref(pic, pic_list_ref(pic, obj, 2), 0))
&& pic_sym_ptr(pic_list_ref(pic, pic_list_ref(pic, obj, 2), 0)) == pic->rLAMBDA) {
&& pic_sym_ptr(pic_list_ref(pic, pic_list_ref(pic, obj, 2), 0)) == pic->uLAMBDA) {
pic_value formals, body_exprs;
formals = pic_list_ref(pic, pic_list_ref(pic, obj, 2), 1);
@ -698,88 +698,88 @@ analyze_node(analyze_state *state, pic_value obj, bool tailpos)
if (pic_sym_p(proc)) {
pic_sym *sym = pic_sym_ptr(proc);
if (sym == pic->rDEFINE) {
if (sym == pic->uDEFINE) {
return analyze_define(state, obj);
}
else if (sym == pic->rLAMBDA) {
else if (sym == pic->uLAMBDA) {
return analyze_lambda(state, obj);
}
else if (sym == pic->rIF) {
else if (sym == pic->uIF) {
return analyze_if(state, obj, tailpos);
}
else if (sym == pic->rBEGIN) {
else if (sym == pic->uBEGIN) {
return analyze_begin(state, obj, tailpos);
}
else if (sym == pic->rSETBANG) {
else if (sym == pic->uSETBANG) {
return analyze_set(state, obj);
}
else if (sym == pic->rQUOTE) {
else if (sym == pic->uQUOTE) {
return analyze_quote(state, obj);
}
else if (sym == pic->rCONS) {
else if (sym == pic->uCONS) {
ARGC_ASSERT(2, "cons");
return CONSTRUCT_OP2(pic->sCONS);
}
else if (sym == pic->rCAR) {
else if (sym == pic->uCAR) {
ARGC_ASSERT(1, "car");
return CONSTRUCT_OP1(pic->sCAR);
}
else if (sym == pic->rCDR) {
else if (sym == pic->uCDR) {
ARGC_ASSERT(1, "cdr");
return CONSTRUCT_OP1(pic->sCDR);
}
else if (sym == pic->rNILP) {
else if (sym == pic->uNILP) {
ARGC_ASSERT(1, "nil?");
return CONSTRUCT_OP1(pic->sNILP);
}
else if (sym == pic->rSYMBOLP) {
else if (sym == pic->uSYMBOLP) {
ARGC_ASSERT(1, "symbol?");
return CONSTRUCT_OP1(pic->sSYMBOLP);
}
else if (sym == pic->rPAIRP) {
else if (sym == pic->uPAIRP) {
ARGC_ASSERT(1, "pair?");
return CONSTRUCT_OP1(pic->sPAIRP);
}
else if (sym == pic->rADD) {
else if (sym == pic->uADD) {
return analyze_add(state, obj, tailpos);
}
else if (sym == pic->rSUB) {
else if (sym == pic->uSUB) {
return analyze_sub(state, obj);
}
else if (sym == pic->rMUL) {
else if (sym == pic->uMUL) {
return analyze_mul(state, obj, tailpos);
}
else if (sym == pic->rDIV) {
else if (sym == pic->uDIV) {
return analyze_div(state, obj);
}
else if (sym == pic->rEQ) {
else if (sym == pic->uEQ) {
ARGC_ASSERT_WITH_FALLBACK(2);
return CONSTRUCT_OP2(pic->sEQ);
}
else if (sym == pic->rLT) {
else if (sym == pic->uLT) {
ARGC_ASSERT_WITH_FALLBACK(2);
return CONSTRUCT_OP2(pic->sLT);
}
else if (sym == pic->rLE) {
else if (sym == pic->uLE) {
ARGC_ASSERT_WITH_FALLBACK(2);
return CONSTRUCT_OP2(pic->sLE);
}
else if (sym == pic->rGT) {
else if (sym == pic->uGT) {
ARGC_ASSERT_WITH_FALLBACK(2);
return CONSTRUCT_OP2(pic->sGT);
}
else if (sym == pic->rGE) {
else if (sym == pic->uGE) {
ARGC_ASSERT_WITH_FALLBACK(2);
return CONSTRUCT_OP2(pic->sGE);
}
else if (sym == pic->rNOT) {
else if (sym == pic->uNOT) {
ARGC_ASSERT(1, "not");
return CONSTRUCT_OP1(pic->sNOT);
}
else if (sym == pic->rVALUES) {
else if (sym == pic->uVALUES) {
return analyze_values(state, obj, tailpos);
}
else if (sym == pic->rCALL_WITH_VALUES) {
else if (sym == pic->uCALL_WITH_VALUES) {
return analyze_call_with_values(state, obj, tailpos);
}
}

View File

@ -288,6 +288,6 @@ pic_init_cont(pic_state *pic)
pic_defun(pic, "call/cc", pic_cont_callcc);
pic_defun(pic, "dynamic-wind", pic_cont_dynamic_wind);
pic_defun_vm(pic, "values", pic->rVALUES, pic_cont_values);
pic_defun_vm(pic, "call-with-values", pic->rCALL_WITH_VALUES, pic_cont_call_with_values);
pic_defun_vm(pic, "values", pic->uVALUES, pic_cont_values);
pic_defun_vm(pic, "call-with-values", pic->uCALL_WITH_VALUES, pic_cont_call_with_values);
}

View File

@ -531,15 +531,15 @@ gc_mark_global_symbols(pic_state *pic)
M(sCALL); M(sTAILCALL); M(sCALL_WITH_VALUES); M(sTAILCALL_WITH_VALUES);
M(sGREF); M(sLREF); M(sCREF); M(sRETURN);
M(rDEFINE); M(rLAMBDA); M(rIF); M(rBEGIN); M(rQUOTE); M(rSETBANG);
M(rDEFINE_SYNTAX); M(rIMPORT); M(rEXPORT);
M(rDEFINE_LIBRARY);
M(rCOND_EXPAND);
M(rCONS); M(rCAR); M(rCDR); M(rNILP);
M(rSYMBOLP); M(rPAIRP);
M(rADD); M(rSUB); M(rMUL); M(rDIV);
M(rEQ); M(rLT); M(rLE); M(rGT); M(rGE); M(rNOT);
M(rVALUES); M(rCALL_WITH_VALUES);
M(uDEFINE); M(uLAMBDA); M(uIF); M(uBEGIN); M(uQUOTE); M(uSETBANG);
M(uDEFINE_SYNTAX); M(uIMPORT); M(uEXPORT);
M(uDEFINE_LIBRARY);
M(uCOND_EXPAND);
M(uCONS); M(uCAR); M(uCDR); M(uNILP);
M(uSYMBOLP); M(uPAIRP);
M(uADD); M(uSUB); M(uMUL); M(uDIV);
M(uEQ); M(uLT); M(uLE); M(uGT); M(uGE); M(uNOT);
M(uVALUES); M(uCALL_WITH_VALUES);
}
static void

View File

@ -111,15 +111,15 @@ typedef struct {
pic_sym *sCALL, *sTAILCALL, *sRETURN;
pic_sym *sCALL_WITH_VALUES, *sTAILCALL_WITH_VALUES;
pic_sym *rDEFINE, *rLAMBDA, *rIF, *rBEGIN, *rQUOTE, *rSETBANG;
pic_sym *rDEFINE_SYNTAX, *rIMPORT, *rEXPORT;
pic_sym *rDEFINE_LIBRARY;
pic_sym *rCOND_EXPAND;
pic_sym *rCONS, *rCAR, *rCDR, *rNILP;
pic_sym *rSYMBOLP, *rPAIRP;
pic_sym *rADD, *rSUB, *rMUL, *rDIV;
pic_sym *rEQ, *rLT, *rLE, *rGT, *rGE, *rNOT;
pic_sym *rVALUES, *rCALL_WITH_VALUES;
pic_sym *uDEFINE, *uLAMBDA, *uIF, *uBEGIN, *uQUOTE, *uSETBANG;
pic_sym *uDEFINE_SYNTAX, *uIMPORT, *uEXPORT;
pic_sym *uDEFINE_LIBRARY;
pic_sym *uCOND_EXPAND;
pic_sym *uCONS, *uCAR, *uCDR, *uNILP;
pic_sym *uSYMBOLP, *uPAIRP;
pic_sym *uADD, *uSUB, *uMUL, *uDIV;
pic_sym *uEQ, *uLT, *uLE, *uGT, *uGE, *uNOT;
pic_sym *uVALUES, *uCALL_WITH_VALUES;
struct pic_lib *PICRIN_BASE;
struct pic_lib *PICRIN_USER;

View File

@ -9,10 +9,10 @@ setup_default_env(pic_state *pic, struct pic_env *env)
{
void pic_define_syntactic_keyword(pic_state *, struct pic_env *, pic_sym *, pic_sym *);
pic_define_syntactic_keyword(pic, env, pic->sDEFINE_LIBRARY, pic->rDEFINE_LIBRARY);
pic_define_syntactic_keyword(pic, env, pic->sIMPORT, pic->rIMPORT);
pic_define_syntactic_keyword(pic, env, pic->sEXPORT, pic->rEXPORT);
pic_define_syntactic_keyword(pic, env, pic->sCOND_EXPAND, pic->rCOND_EXPAND);
pic_define_syntactic_keyword(pic, env, pic->sDEFINE_LIBRARY, pic->uDEFINE_LIBRARY);
pic_define_syntactic_keyword(pic, env, pic->sIMPORT, pic->uIMPORT);
pic_define_syntactic_keyword(pic, env, pic->sEXPORT, pic->uEXPORT);
pic_define_syntactic_keyword(pic, env, pic->sCOND_EXPAND, pic->uCOND_EXPAND);
}
struct pic_lib *
@ -245,7 +245,7 @@ pic_lib_condexpand(pic_state *pic)
for (i = 0; i < argc; i++) {
if (condexpand(pic, pic_car(pic, clauses[i]))) {
return pic_cons(pic, pic_obj_value(pic->rBEGIN), pic_cdr(pic, clauses[i]));
return pic_cons(pic, pic_obj_value(pic->sBEGIN), pic_cdr(pic, clauses[i]));
}
}
@ -317,8 +317,8 @@ pic_init_lib(pic_state *pic)
{
void pic_defmacro(pic_state *, pic_sym *, pic_sym *, pic_func_t);
pic_defmacro(pic, pic->sCOND_EXPAND, pic->rCOND_EXPAND, pic_lib_condexpand);
pic_defmacro(pic, pic->sIMPORT, pic->rIMPORT, pic_lib_import);
pic_defmacro(pic, pic->sEXPORT, pic->rEXPORT, pic_lib_export);
pic_defmacro(pic, pic->sDEFINE_LIBRARY, pic->rDEFINE_LIBRARY, pic_lib_define_library);
pic_defmacro(pic, pic->sCOND_EXPAND, pic->uCOND_EXPAND, pic_lib_condexpand);
pic_defmacro(pic, pic->sIMPORT, pic->uIMPORT, pic_lib_import);
pic_defmacro(pic, pic->sEXPORT, pic->uEXPORT, pic_lib_export);
pic_defmacro(pic, pic->sDEFINE_LIBRARY, pic->uDEFINE_LIBRARY, pic_lib_define_library);
}

View File

@ -77,7 +77,7 @@ macroexpand_symbol(pic_state *pic, pic_sym *sym, struct pic_env *env)
static pic_value
macroexpand_quote(pic_state *pic, pic_value expr)
{
return pic_cons(pic, pic_obj_value(pic->rQUOTE), pic_cdr(pic, expr));
return pic_cons(pic, pic_obj_value(pic->uQUOTE), pic_cdr(pic, expr));
}
static pic_value
@ -161,7 +161,7 @@ macroexpand_lambda(pic_state *pic, pic_value expr, struct pic_env *env)
macroexpand_deferred(pic, in);
return pic_cons(pic, pic_obj_value(pic->rLAMBDA), pic_cons(pic, formal, body));
return pic_cons(pic, pic_obj_value(pic->uLAMBDA), pic_cons(pic, formal, body));
}
static pic_value
@ -174,7 +174,7 @@ macroexpand_define(pic_state *pic, pic_value expr, struct pic_env *env)
var = pic_car(pic, pic_cadr(pic, expr));
val = pic_cdr(pic, pic_cadr(pic, expr));
expr = pic_list3(pic, pic_obj_value(pic->rDEFINE), var, pic_cons(pic, pic_obj_value(pic->rLAMBDA), pic_cons(pic, val, pic_cddr(pic, expr))));
expr = pic_list3(pic, pic_obj_value(pic->uDEFINE), var, pic_cons(pic, pic_obj_value(pic->uLAMBDA), pic_cons(pic, val, pic_cddr(pic, expr))));
}
if (pic_length(pic, expr) != 3) {
@ -191,7 +191,7 @@ macroexpand_define(pic_state *pic, pic_value expr, struct pic_env *env)
}
val = macroexpand(pic, pic_list_ref(pic, expr, 2), env);
return pic_list3(pic, pic_obj_value(pic->rDEFINE), pic_obj_value(rename), val);
return pic_list3(pic, pic_obj_value(pic->uDEFINE), pic_obj_value(rename), val);
}
static pic_value
@ -285,16 +285,16 @@ macroexpand_node(pic_state *pic, pic_value expr, struct pic_env *env)
if (pic_sym_p(car)) {
pic_sym *tag = pic_sym_ptr(car);
if (tag == pic->rDEFINE_SYNTAX) {
if (tag == pic->uDEFINE_SYNTAX) {
return macroexpand_defsyntax(pic, expr, env);
}
else if (tag == pic->rLAMBDA) {
else if (tag == pic->uLAMBDA) {
return macroexpand_defer(pic, expr, env);
}
else if (tag == pic->rDEFINE) {
else if (tag == pic->uDEFINE) {
return macroexpand_define(pic, expr, env);
}
else if (tag == pic->rQUOTE) {
else if (tag == pic->uQUOTE) {
return macroexpand_quote(pic, expr);
}

View File

@ -816,17 +816,17 @@ pic_init_number(pic_state *pic)
pic_defun(pic, "inexact?", pic_number_inexact_p);
pic_gc_arena_restore(pic, ai);
pic_defun_vm(pic, "=", pic->rEQ, pic_number_eq);
pic_defun_vm(pic, "<", pic->rLT, pic_number_lt);
pic_defun_vm(pic, ">", pic->rGT, pic_number_gt);
pic_defun_vm(pic, "<=", pic->rLE, pic_number_le);
pic_defun_vm(pic, ">=", pic->rGE, pic_number_ge);
pic_defun_vm(pic, "=", pic->uEQ, pic_number_eq);
pic_defun_vm(pic, "<", pic->uLT, pic_number_lt);
pic_defun_vm(pic, ">", pic->uGT, pic_number_gt);
pic_defun_vm(pic, "<=", pic->uLE, pic_number_le);
pic_defun_vm(pic, ">=", pic->uGE, pic_number_ge);
pic_gc_arena_restore(pic, ai);
pic_defun_vm(pic, "+", pic->rADD, pic_number_add);
pic_defun_vm(pic, "-", pic->rSUB, pic_number_sub);
pic_defun_vm(pic, "*", pic->rMUL, pic_number_mul);
pic_defun_vm(pic, "/", pic->rDIV, pic_number_div);
pic_defun_vm(pic, "+", pic->uADD, pic_number_add);
pic_defun_vm(pic, "-", pic->uSUB, pic_number_sub);
pic_defun_vm(pic, "*", pic->uMUL, pic_number_mul);
pic_defun_vm(pic, "/", pic->uDIV, pic_number_div);
pic_gc_arena_restore(pic, ai);
pic_defun(pic, "abs", pic_number_abs);

View File

@ -762,11 +762,11 @@ pic_init_pair(pic_state *pic)
{
void pic_defun_vm(pic_state *, const char *, pic_sym *, pic_func_t);
pic_defun_vm(pic, "pair?", pic->rPAIRP, pic_pair_pair_p);
pic_defun_vm(pic, "cons", pic->rCONS, pic_pair_cons);
pic_defun_vm(pic, "car", pic->rCAR, pic_pair_car);
pic_defun_vm(pic, "cdr", pic->rCDR, pic_pair_cdr);
pic_defun_vm(pic, "null?", pic->rNILP, pic_pair_null_p);
pic_defun_vm(pic, "pair?", pic->uPAIRP, pic_pair_pair_p);
pic_defun_vm(pic, "cons", pic->uCONS, pic_pair_cons);
pic_defun_vm(pic, "car", pic->uCAR, pic_pair_car);
pic_defun_vm(pic, "cdr", pic->uCDR, pic_pair_cdr);
pic_defun_vm(pic, "null?", pic->uNILP, pic_pair_null_p);
pic_defun(pic, "set-car!", pic_pair_set_car);
pic_defun(pic, "set-cdr!", pic_pair_set_cdr);

View File

@ -103,13 +103,13 @@ pic_init_core(pic_state *pic)
pic_deflibrary (pic, "(picrin base)") {
size_t ai = pic_gc_arena_preserve(pic);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sDEFINE, pic->rDEFINE);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sSETBANG, pic->rSETBANG);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sQUOTE, pic->rQUOTE);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sLAMBDA, pic->rLAMBDA);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sIF, pic->rIF);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sBEGIN, pic->rBEGIN);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sDEFINE_SYNTAX, pic->rDEFINE_SYNTAX);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sDEFINE, pic->uDEFINE);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sSETBANG, pic->uSETBANG);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sQUOTE, pic->uQUOTE);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sLAMBDA, pic->uLAMBDA);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sIF, pic->uIF);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sBEGIN, pic->uBEGIN);
pic_define_syntactic_keyword(pic, pic->lib->env, pic->sDEFINE_SYNTAX, pic->uDEFINE_SYNTAX);
pic_init_undef(pic); DONE;
pic_init_bool(pic); DONE;
@ -254,7 +254,7 @@ pic_open(int argc, char *argv[], char **envp, pic_allocf allocf)
ai = pic_gc_arena_preserve(pic);
#define S(slot,name) pic->slot = pic_intern_cstr(pic, name);
#define S(slot,name) pic->slot = pic_intern_cstr(pic, name)
S(sDEFINE, "define");
S(sLAMBDA, "lambda");
@ -308,37 +308,37 @@ pic_open(int argc, char *argv[], char **envp, pic_allocf allocf)
pic_gc_arena_restore(pic, ai);
#define R(slot,name) pic->slot = pic_gensym(pic, pic_intern_cstr(pic, name));
#define U(slot,name) pic->slot = pic_gensym(pic, pic_intern_cstr(pic, name))
R(rDEFINE, "define");
R(rLAMBDA, "lambda");
R(rIF, "if");
R(rBEGIN, "begin");
R(rSETBANG, "set!");
R(rQUOTE, "quote");
R(rDEFINE_SYNTAX, "define-syntax");
R(rIMPORT, "import");
R(rEXPORT, "export");
R(rDEFINE_LIBRARY, "define-library");
R(rCOND_EXPAND, "cond-expand");
R(rCONS, "cons");
R(rCAR, "car");
R(rCDR, "cdr");
R(rNILP, "null?");
R(rSYMBOLP, "symbol?");
R(rPAIRP, "pair?");
R(rADD, "+");
R(rSUB, "-");
R(rMUL, "*");
R(rDIV, "/");
R(rEQ, "=");
R(rLT, "<");
R(rLE, "<=");
R(rGT, ">");
R(rGE, ">=");
R(rNOT, "not");
R(rVALUES, "values");
R(rCALL_WITH_VALUES, "call-with-values");
U(uDEFINE, "define");
U(uLAMBDA, "lambda");
U(uIF, "if");
U(uBEGIN, "begin");
U(uSETBANG, "set!");
U(uQUOTE, "quote");
U(uDEFINE_SYNTAX, "define-syntax");
U(uIMPORT, "import");
U(uEXPORT, "export");
U(uDEFINE_LIBRARY, "define-library");
U(uCOND_EXPAND, "cond-expand");
U(uCONS, "cons");
U(uCAR, "car");
U(uCDR, "cdr");
U(uNILP, "null?");
U(uSYMBOLP, "symbol?");
U(uPAIRP, "pair?");
U(uADD, "+");
U(uSUB, "-");
U(uMUL, "*");
U(uDIV, "/");
U(uEQ, "=");
U(uLT, "<");
U(uLE, "<=");
U(uGT, ">");
U(uGE, ">=");
U(uNOT, "not");
U(uVALUES, "values");
U(uCALL_WITH_VALUES, "call-with-values");
pic_gc_arena_restore(pic, ai);
/* root tables */

View File

@ -121,7 +121,7 @@ pic_init_symbol(pic_state *pic)
{
void pic_defun_vm(pic_state *, const char *, pic_sym *, pic_func_t);
pic_defun_vm(pic, "symbol?", pic->rSYMBOLP, pic_symbol_symbol_p);
pic_defun_vm(pic, "symbol?", pic->uSYMBOLP, pic_symbol_symbol_p);
pic_defun(pic, "symbol->string", pic_symbol_symbol_to_string);
pic_defun(pic, "string->symbol", pic_symbol_string_to_symbol);