proper paralell values handling

parent c1e2fe18
...@@ -1546,7 +1546,7 @@ SCM_DEFINE(gp_pop_engine, "gp-pop-engine", 0, 0, 0, (), ...@@ -1546,7 +1546,7 @@ SCM_DEFINE(gp_pop_engine, "gp-pop-engine", 0, 0, 0, (),
gp_debug0("Pop Engine>\n"); gp_debug0("Pop Engine>\n");
SCM s_stack = SCM_CAR(gp_engine_path); SCM s_stack = SCM_CAR(gp_engine_path);
if(SCM_CONSP(gp_store_path)) if(SCM_CONSP(gp_store_path))
gp_store_path = SCM_CDR(gp_store_path); gp_store_path = SCM_CDR(gp_store_path);
else else
...@@ -1635,7 +1635,7 @@ SCM_DEFINE(gp_push_engine, "gp-push-engine", 2, 0, 0, (SCM s, SCM e), ...@@ -1635,7 +1635,7 @@ SCM_DEFINE(gp_push_engine, "gp-push-engine", 2, 0, 0, (SCM s, SCM e),
if(!SCM_CONSP(cdr)) if(!SCM_CONSP(cdr))
{ {
cdr = scm_cons(SCM_EOL,SCM_EOL); cdr = scm_cons(SCM_EOL,SCM_EOL);
} }
ss = scm_cons(carss , scm_cons(SCM_CAR(cdr), gp_paths)); ss = scm_cons(carss , scm_cons(SCM_CAR(cdr), gp_paths));
...@@ -1753,11 +1753,17 @@ SCM all_variable_bindings = SCM_BOOL_F; ...@@ -1753,11 +1753,17 @@ SCM all_variable_bindings = SCM_BOOL_F;
SCM folder(SCM key, SCM val, SCM seed, SCM data) SCM folder(SCM key, SCM val, SCM seed, SCM data)
{ {
int level = scm_to_int(SCM_CDR(data));
if(GP_ID(key) > level)
return seed;
SCM val2 = scm_hash_ref(key, variable_bindings, SCM_BOOL_F); SCM val2 = scm_hash_ref(key, variable_bindings, SCM_BOOL_F);
if(scm_is_true(val)) if(scm_is_true(val))
{ {
return seed return seed;
} }
else else
{ {
...@@ -1783,7 +1789,42 @@ SCM folder(SCM key, SCM val, SCM seed, SCM data) ...@@ -1783,7 +1789,42 @@ SCM folder(SCM key, SCM val, SCM seed, SCM data)
} }
} }
SCM get_all_conflicting_bindings(SCM l) SCM level1(SCM data, SCM ll, SCM ret);
SCM level0(SCM data, SCM l, SCM ret)
{
for(;SCM_CONSP(l);l = SCM_CDR(l))
{
ret = level1(data,SCM_CAR(l),ret);
}
return ret;
}
SCM level1(SCM data, SCM ll, SCM ret)
{
SCM ll = SCM_CAR(l);
SCM l0 = SCM_CAR(data);
for(;SCM_CONSP(ll);ll=SCM_CDR(ll))
{
if(scm_is_eq(ll, l0))
break;
{
SCM x = SCM_CAR(ll);
if(vlist_p(x))
ret = vhash_fold_all_exp(data, folder, ret, SCM_CAR(l));
if(SCM_I_VECTOR_P(x))
ret = level0(data, ret);
if(SCM_CONSP(x))
ret = folder(SCM_CAR(x), SCM_CDR(x), ret, data);
}
}
return ret;
}
SCM get_all_conflicting_bindings(SCM l, SCM data)
{ {
variable_bindings_found = scm_make_hash_table(); variable_bindings_found = scm_make_hash_table();
all_variable_bindings = scm_make_hash_table(); all_variable_bindings = scm_make_hash_table();
...@@ -1792,9 +1833,9 @@ SCM get_all_conflicting_bindings(SCM l) ...@@ -1792,9 +1833,9 @@ SCM get_all_conflicting_bindings(SCM l)
for(;SCM_CONSP(l);l=SCM_CDR(l)) for(;SCM_CONSP(l);l=SCM_CDR(l))
{ {
variable_bindings = scm_make_hash_table(); variable_bindings = scm_make_hash_table();
ret = vhash_fold_all_exp(SCM_BOOL_F, folder, ret, SCM_CAR(l)); ret = level1(data, SCM_CAR(l), ret);
} }
return ret; return ret;
} }
...@@ -1804,7 +1845,9 @@ SCM_DEFINE(gp_combine_state, "gp-combine-state", 2, 0, 0, (SCM s, SCM l), ...@@ -1804,7 +1845,9 @@ SCM_DEFINE(gp_combine_state, "gp-combine-state", 2, 0, 0, (SCM s, SCM l),
{ {
SCM data = gp_gp_cdr(s,s); SCM data = gp_gp_cdr(s,s);
SCM l0 = SCM_CAR(data); SCM l0 = SCM_CAR(data);
struct gp_stack * gp = get_gp();
SCM ll = SCM_EOL; SCM ll = SCM_EOL;
while(SCM_CONSP(l)) while(SCM_CONSP(l))
{ {
...@@ -1817,7 +1860,10 @@ SCM_DEFINE(gp_combine_state, "gp-combine-state", 2, 0, 0, (SCM s, SCM l), ...@@ -1817,7 +1860,10 @@ SCM_DEFINE(gp_combine_state, "gp-combine-state", 2, 0, 0, (SCM s, SCM l),
l = SCM_CDR(l); l = SCM_CDR(l);
} }
SCM ret = get_all_conflicting_bindings(ll);
SCM data = scm_cons(l0, scm_from_int(gp->id));
SCM ret = get_all_conflicting_bindings(ll,data);
SCM sout; SCM sout;
......
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