fixed a more general lookup machanism

parent 27db141c
...@@ -449,25 +449,71 @@ static inline SCM gp_set_unbound_bang(SCM *id, SCM s) ...@@ -449,25 +449,71 @@ static inline SCM gp_set_unbound_bang(SCM *id, SCM s)
static inline SCM * gp_lookup(SCM *id, SCM s) static inline SCM * gp_lookup(SCM *id, SCM s)
{ {
gp_debug0("lookup>\n"); gp_debug0("lookup>\n");
id = GP_GETREF(logical_lookup(GP_UNREF(id),s));
gp_debug0("lookup> /2\n");
if(!GP_STAR(id)) if(SCM_CONSP(s) && !scm_is_eq(SCM_EOL,SCM_CDR(s)))
{ {
gp_debug0("lookup> no star\n"); retry2:
id = GP_GETREF(logical_lookup(GP_UNREF(id),s));
if(!GP_STAR(id))
{
gp_debug0("lookup> no star\n");
return id;
}
if(GP_POINTER(id))
{
id = GP_GETREF(GP_SCM(id));
goto retry2;
}
return id; return id;
} }
gp_debug0("lookup> /3\n"); gp_debug0("lookup> /2\n");
retry: retry:
if(GP_POINTER(id)) if(GP_POINTER(id))
{ {
id = GP_GETREF(GP_SCM(id)); id = GP_GETREF(GP_SCM(id));
goto retry; goto retry;
} }
gp_debug2("lookup> %x 0 val = %x\n",id,SCM_UNPACK(*id)) ; gp_debug2("lookup> %x 0 val = %x\n",id,SCM_UNPACK(*id)) ;
return id; return id;
}
static inline SCM * gp_lookup2(SCM *id, SCM s)
{
gp_debug0("lookup>\n");
if(SCM_CONSP(s) && !scm_is_eq(SCM_EOL,SCM_CDR(s)))
{
retry2:
id = GP_GETREF(logical_lookup2(GP_UNREF(id),s));
if(!GP_STAR(id))
{
scm_misc_error("gp_lookup2","could not lookup a variable",SCM_EOL);
return id;
}
if(GP_POINTER(id))
{
id = GP_GETREF(GP_SCM(id));
goto retry2;
}
return id;
}
retry:
if(GP_POINTER(id))
{
id = GP_GETREF(GP_SCM(id));
goto retry;
}
return id;
} }
static inline SCM gp_newframe(SCM s) static inline SCM gp_newframe(SCM s)
...@@ -1114,11 +1160,8 @@ static inline SCM ggp_set(SCM var, SCM val, SCM s) ...@@ -1114,11 +1160,8 @@ static inline SCM ggp_set(SCM var, SCM val, SCM s)
if(GP(var)) if(GP(var))
{ {
id = GP_GETREF(var); id = GP_GETREF(var);
if(_logical_) id = gp_lookup2(id,s);
id = GP_GETREF(logical_lookup2(GP_UNREF(id),s));
else
id = gp_lookup(id,s);
if(GP_STAR(id)) if(GP_STAR(id))
if(GP(val)) if(GP(val))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment