fixed a more general lookup machanism

parent 27db141c
......@@ -449,8 +449,11 @@ static inline SCM gp_set_unbound_bang(SCM *id, SCM s)
static inline SCM * gp_lookup(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_lookup(GP_UNREF(id),s));
gp_debug0("lookup> /2\n");
if(!GP_STAR(id))
{
......@@ -458,7 +461,17 @@ static inline SCM * gp_lookup(SCM *id, SCM s)
return id;
}
gp_debug0("lookup> /3\n");
if(GP_POINTER(id))
{
id = GP_GETREF(GP_SCM(id));
goto retry2;
}
return id;
}
gp_debug0("lookup> /2\n");
retry:
if(GP_POINTER(id))
{
......@@ -468,6 +481,39 @@ static inline SCM * gp_lookup(SCM *id, SCM s)
gp_debug2("lookup> %x 0 val = %x\n",id,SCM_UNPACK(*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)
......@@ -1114,10 +1160,7 @@ static inline SCM ggp_set(SCM var, SCM val, SCM s)
if(GP(var))
{
id = GP_GETREF(var);
if(_logical_)
id = GP_GETREF(logical_lookup2(GP_UNREF(id),s));
else
id = gp_lookup(id,s);
id = gp_lookup2(id,s);
if(GP_STAR(id))
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