From: Tom S. <tsc...@us...> - 2003-09-29 14:03:29
|
Update of /cvsroot/xsb/XSB/syslib In directory sc8-pr-cvs1:/tmp/cvs-serv31267/syslib Modified Files: Makefile machine.H machine.P machine.xwam x_interp.H x_interp.P x_interp.xwam Removed Files: atts.P Log Message: Merged CHR related updates to branch release_2_6 into the HEAD. Index: Makefile =================================================================== RCS file: /cvsroot/xsb/XSB/syslib/Makefile,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- Makefile 20 Sep 2002 06:00:02 -0000 1.45 +++ Makefile 29 Sep 2003 13:05:16 -0000 1.46 @@ -25,7 +25,7 @@ OBJEXT=.xwam -ALL = assert${OBJEXT} atts${OBJEXT} basics${OBJEXT} consult${OBJEXT} \ +ALL = assert${OBJEXT} basics${OBJEXT} consult${OBJEXT} \ banner${OBJEXT} \ curr_sym${OBJEXT} dbclause${OBJEXT} \ dcg${OBJEXT} debugger${OBJEXT} domain${OBJEXT}\ Index: machine.H =================================================================== RCS file: /cvsroot/xsb/XSB/syslib/machine.H,v retrieving revision 1.54 retrieving revision 1.55 diff -u -r1.54 -r1.55 --- machine.H 30 Jul 2003 17:44:22 -0000 1.54 +++ machine.H 29 Sep 2003 13:05:17 -0000 1.55 @@ -138,12 +138,21 @@ '$$findall_add'/3, '$$findall_get_solutions'/4, socket_request/7, + set_arg/3, put_attributes/2, - get_attributes/3, + get_attributes/2, delete_attributes/1, attv_unify/2, + put_attr/3, + get_attr/3, + del_attr/2, + install_verify_attribute_handler/4, + verify_attribute_handler/4, globalvar/1, interprolog_callback/3. + +:- import assert/1, retract/1 from assert. +:- import write/1, writeln/1 from standard. :- export file_function/7, conname/2, conpsc/2, machine_file_exists/1, Index: machine.P =================================================================== RCS file: /cvsroot/xsb/XSB/syslib/machine.P,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- machine.P 30 Jul 2003 17:44:23 -0000 1.62 +++ machine.P 29 Sep 2003 13:05:17 -0000 1.63 @@ -70,6 +70,7 @@ term_new(PSC, Term) :- term_new(PSC, Term). term_arg(Term, Index, Arg) :- term_arg(Term, Index, Arg). term_set_arg(Term, Index, Arg, Perm) :- term_set_arg(Term, Index, Arg, Perm). +set_arg(Term, Index, Arg) :- term_set_arg(Term,Index,Arg,-1). stat_flag(Flag, Value) :- stat_flag(Flag, Value). stat_set_flag(Flag, Value) :- stat_set_flag(Flag, Value). buff_alloc(Size, Buffer) :- buff_alloc(Size, Buffer). @@ -184,8 +185,8 @@ trimcore :- '_$builtin'(TRIMCORE). -put_attributes(_Var, _VNew) :- '_$builtin'(PUT_ATTRIBUTES). -get_attributes(_Var, _V, _OldMask) :- '_$builtin'(GET_ATTRIBUTES). +put_attributes(_Var, _LNew) :- '_$builtin'(PUT_ATTRIBUTES). +get_attributes(_Var, _L) :- '_$builtin'(GET_ATTRIBUTES). delete_attributes(_Var) :- '_$builtin'(DELETE_ATTRIBUTES). '_$attv_unify'(_Var,_Value) :- '_$builtin'(ATTV_UNIFY). @@ -195,6 +196,63 @@ -> '_$attv_unify'(Var,Value) ; Var = Value ). + +put_attr(Var,Mod,Val) :- + ( get_attributes(Var,Atts) -> + '$put_attr'(Atts,Mod,Val,NAtts), + put_attributes(Var,NAtts) + ; + put_attributes(Var,[Mod,Val]) + ). + +'$put_attr'([],Mod,Val,[Mod,Val]). +'$put_attr'([M,A|R],Mod,Val,NAtts) :- + ( M == Mod -> + NAtts = [Mod,Val|R] + ; + NAtts = [M,A|NR], + '$put_attr'(R,Mod,Val,NR) + ). + +get_attr(Var,Mod,Attr) :- + get_attributes(Var,Atts), + '$get_attr'(Atts,Mod,Attr). + +'$get_attr'([M,A|Rest],Mod,Attr) :- + ( M == Mod -> + Attr = A + ; + '$get_attr'(Rest,Mod,Attr) + ). + +del_attr(Var,Mod) :- + ( get_attributes(Var,Atts) -> + '$del_attr'(Atts,Mod,NAtts), + ( NAtts == [] -> + delete_attributes(Var) + ; + put_attributes(Var,NAtts) + ) + ; + true + ). + +'$del_attr'([],_,[]). +'$del_attr'([M,A|R],Mod,NAtts) :- + ( M == Mod -> + NAtts = R + ; + NAtts = [M,A|NR], + '$del_attr'(R,Mod,NR) + ). + +install_verify_attribute_handler(Mod,Attr,Value,Handler) :- + ( retract(verify_attribute_handler(Mod,_,_,_)) -> + write('Warning: replacing previous verify_attribute_handler for module '),write(Mod),writeln('.') + ; + true + ), + assert(verify_attribute_handler(Mod,Attr,Value,Handler)). /* This is the builtin where people should put their private, experimental builtin code. SEE THE EXAMPLE IN emu/private_builtin.c to UNDERSTAND HOW Index: machine.xwam =================================================================== RCS file: /cvsroot/xsb/XSB/syslib/machine.xwam,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 Binary files /tmp/cvsLzIy7h and /tmp/cvsenh6Wp differ Index: x_interp.H =================================================================== RCS file: /cvsroot/xsb/XSB/syslib/x_interp.H,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- x_interp.H 4 Nov 2002 18:09:13 -0000 1.33 +++ x_interp.H 29 Sep 2003 13:05:17 -0000 1.34 @@ -35,8 +35,8 @@ :- import file_read/3, vv/2 from xsb_read. %% These are explicitly imported because they are used early on, %% before XSB is fully bootstrapped. -:- import abort/0, call_c/1, call_expose/1, catch/3, goal_cut_trans/3, - atom_codes/2, seeing/1, telling/1, see/1, tell/1, seen/0, told/0 +:- import abort/0, call/1, call_c/1, call_expose/1, catch/3, goal_cut_trans/3, + atom_codes/2, seeing/1, telling/1, see/1, tell/1, seen/0, told/0, write/1, nl/0, is_attv/1 from standard. :- import '$$exception_ball'/1 from standard. :- import close_open_tables/0, conname/2, @@ -52,7 +52,9 @@ :- import push_stdin/2, pop_stdin/1 from push_io. :- import retractall/1 from assert. :- import call_xsb_hook/2, xsb_exit_hook/1 from xsb_hook. -:- import verify_attributes/2 from usermod. +%:- import verify_attributes/2 from usermod. +:- import attv_unify/2, get_attributes/2, verify_attribute_handler/4 from machine. + :- import conset/2, conget/2 from gensym. :- import banner_control/1 from banner. Index: x_interp.P =================================================================== RCS file: /cvsroot/xsb/XSB/syslib/x_interp.P,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- x_interp.P 4 Nov 2002 18:09:14 -0000 1.46 +++ x_interp.P 29 Sep 2003 13:05:17 -0000 1.47 @@ -234,11 +234,26 @@ call_c(Call). handle_interrupts([]) :- !. -handle_interrupts([[Var|Value]|Ints]) :- -% file_write(1, '.... [Var|Value] = '), -% file_write(1, [Var|Value]), file_nl(1), - verify_attributes(Var, Value), +handle_interrupts([[Atts|Value]|Ints]) :- + %file_write(1, '.... [Var|Value] = '), + %file_write(1, [Var|Value]), file_nl(1), + % verify_attributes(Var, Value) + %write(Var),write(Value),nl, + general_verify_attributes(Atts,Value), handle_interrupts(Ints). + +general_verify_attributes(Atts,Value) :- + %get_attributes(Var,Atts), + %attv_unify(Var,Value), + %file_write(1, '.... attv_unify(Var,Value) '), + %file_write(1, [Var|Value]), file_nl(1), + call_attribute_handlers(Atts,Value). + +call_attribute_handlers([],_). +call_attribute_handlers([Mod,Attr|Rest],Value) :- + verify_attribute_handler(Mod,Attr,Value,Handler), + call(Handler), + call_attribute_handlers(Rest,Value). /* === version message ================================================= */ Index: x_interp.xwam =================================================================== RCS file: /cvsroot/xsb/XSB/syslib/x_interp.xwam,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 Binary files /tmp/cvsrFHaUx and /tmp/cvsGJnSAV differ --- atts.P DELETED --- |