copy_term/2 debugged and implemented

parent e7d0daad
......@@ -98,6 +98,7 @@
setup-namespace
<namespace-type>
gp-make-attribute-from-data
gp-attvar?
gp-attvar-raw?
gp-att-data
......
(define-module (logic guile-log guile-prolog copy-term)
#:use-module ((logic guile-log umatch)
#:select (gp-var? gp-attvar-raw? gp-make-var
gp-att-data))
gp-att-data
gp-make-attribute-from-data))
#:use-module (logic guile-log guile-prolog attribute)
#:use-module (logic guile-log)
......@@ -31,7 +32,8 @@
((gp-attvar-raw? x S)
(check (h x r)
(<values> (data) (lp (gp-att-data x S)))
(<let> ((y (gp-make-att-from-data data)))
(<let> ((y (gp-make-attribute-from-data
(cons (gp-make-var) data))))
(<code> (variable-set! r y))
(<cc> y))))
......
......@@ -449,7 +449,7 @@ output_and_more(V,N,More) :-
(
(V==[] -> (write(\"yes\"),nl) ; (once((copy_term(V,U,L),
vtosym(U,VV,N,L,LL))),
setenv,write_out(VV,N,LL),nl)),
setenv,write_out(VV,N,LL))),
(More=#t -> more ; throw(finish))
)
).
......@@ -472,8 +472,8 @@ write_out_trail([A|B], Empty) :-
(Empty==1 -> write(',') ; true), nl,
write(\" \"),write(A), write_out_trail(B,1).
write_out_trail([],_) :-
Empty==1 -> write('.') ; true.
write_out_trail([],Empty) :-
Empty==1 -> write('.'), nl ; true.
wstall :- stall,tree.
......
......@@ -37,6 +37,21 @@ SCM_DEFINE(gp_attdata, "gp-att-data", 2, 0, 0, (SCM x, SCM s),
}
#undef FUNC_NAME
SCM_DEFINE(gp_mk_att_data, "gp-make-attribute-from-data", 1, 0, 0, (SCM data),
"check to see if variable is an attributed variable")
#define FUNC_NAME s_gp_mk_att_data
{
SCM x = gp_make_fluid();
SCM *pt = GP_GETREF(x);
scm_t_bits b = SCM_UNPACK(pt[0]);
GP_ATTR_IT(b);
pt[0] = SCM_PACK(b);
pt[1] = data;
return x;
}
#undef FUNC_NAME
SCM_DEFINE(gp_att_rawvar, "gp-att-raw-var", 2, 0, 0, (SCM x, SCM s),
"check to see if variable is an attributed variable")
#define FUNC_NAME s_gp_att_rawvar
......
......@@ -118,6 +118,7 @@ SCM_API SCM gp_clear_frame_x(SCM s);
SCM_API SCM gp_gc();
SCM_API SCM gp_mk_att_data(SCM data);
SCM_API SCM gp_attvar(SCM x, SCM s);
SCM_API SCM gp_attvar_raw(SCM x, SCM s);
SCM_API SCM gp_attdata(SCM x, SCM s);
......
......@@ -67,6 +67,7 @@
gp-gc
gp-make-attribute-from-data
gp-attvar?
gp-attvar-raw?
gp-att-raw-var
......
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