Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d293b30b75 | ||
|
|
8a788f4cd7 | ||
|
|
2442ba8491 | ||
|
|
b0ecd94faa |
10 changed files with 37248 additions and 10399 deletions
|
|
@ -1 +0,0 @@
|
|||
Yap-5.1.1.tar.gz
|
||||
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Yap-5.1.3.tar.gz
|
||||
chr_translate_bootstrap1.pl
|
||||
chr_translate_bootstrap2.pl
|
||||
chr_translate.pl
|
||||
guard_entailment.pl
|
||||
21
Makefile
21
Makefile
|
|
@ -1,21 +0,0 @@
|
|||
# Makefile for source rpm: yap
|
||||
# $Id$
|
||||
NAME := yap
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attept a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
||||
42
Yap-5.1.3-soname.patch
Normal file
42
Yap-5.1.3-soname.patch
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
diff -up Yap-5.1.3/Makefile.in.soname Yap-5.1.3/Makefile.in
|
||||
--- Yap-5.1.3/Makefile.in.soname 2009-06-15 22:12:57.000000000 +0200
|
||||
+++ Yap-5.1.3/Makefile.in 2009-06-15 21:59:18.000000000 +0200
|
||||
@@ -578,16 +578,16 @@ startup: yap@EXEC_SUFFIX@ $(PL_SOURCES)
|
||||
-rm -f startup
|
||||
echo "bootstrap('$(srcdir)/pl/init.yap'). module(user). save_program(startup)." | @CROSS_SIMULATOR@ ./yap -b $(srcdir)/pl/boot.yap
|
||||
|
||||
-yap@EXEC_SUFFIX@: $(HEADERS) yap.o @YAPLIB@.5.1.3
|
||||
- $(MPI_CC) $(STANDARD_CFLAGS) $(LDFLAGS) -o yap yap.o @YAPLIB@.5.1.3 $(LIBS) @MPI_LIBS@
|
||||
+yap@EXEC_SUFFIX@: $(HEADERS) yap.o @YAPLIB@
|
||||
+ $(MPI_CC) $(STANDARD_CFLAGS) $(LDFLAGS) -o yap yap.o @YAPLIB@ $(LIBS) @MPI_LIBS@
|
||||
|
||||
libYap.a: $(LIB_OBJECTS)
|
||||
-rm -f libYap.a
|
||||
$(AR) rc libYap.a $(LIB_OBJECTS)
|
||||
$(RANLIB) libYap.a
|
||||
|
||||
-@DYNYAPLIB@.5.1.3: $(LIB_OBJECTS)
|
||||
- @DYNLIB_LD@ -Wl,-soname=@YAPLIB@.5.1.3 -o @YAPLIB@.5.1.3 $(LIB_OBJECTS) $(LIBS) $(LDFLGS)
|
||||
+@DYNYAPLIB@: $(LIB_OBJECTS)
|
||||
+ @DYNLIB_LD@ -o @YAPLIB@ $(LIB_OBJECTS) $(LIBS) $(LDFLGS)
|
||||
|
||||
install: install_bin install_data
|
||||
|
||||
@@ -598,7 +598,7 @@ install_unix: startup libYap.a
|
||||
$(INSTALL_PROGRAM) -m 755 yap@EXEC_SUFFIX@ $(DESTDIR)$(BINDIR)/yap
|
||||
mkdir -p $(DESTDIR)$(YAPLIBDIR)
|
||||
$(INSTALL_DATA) startup $(DESTDIR)$(YAPLIBDIR)/startup
|
||||
- @INSTALL_DLLS@ $(INSTALL_DATA) -m 755 @YAPLIB@.5.1.3 $(DESTDIR)$(LIBDIR)
|
||||
+ @INSTALL_DLLS@ $(INSTALL_DATA) -m 755 @YAPLIB@ $(DESTDIR)$(LIBDIR)
|
||||
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap
|
||||
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap/pl
|
||||
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap/swi
|
||||
@@ -643,7 +643,7 @@ install_win32: startup
|
||||
(cd library/tries; make install)
|
||||
@ENABLE_CPLINT@ (cd cplint; make install)
|
||||
|
||||
-install_library: @YAPLIB@.5.1.3
|
||||
+install_library: @YAPLIB@
|
||||
mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
||||
for h in $(HEADERS); do $(INSTALL) $$h $(DESTDIR)$(INCLUDEDIR); done
|
||||
|
||||
25646
chr_translate.pl
25646
chr_translate.pl
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,23 +1,21 @@
|
|||
/* Generated by CHR bootstrap compiler
|
||||
From: chr_translate_bootstrap2.chr
|
||||
Date: [77,111,110,32,77,97,121,32,32,49,32,49,50,58,50,49,58,51,55,32,50,48,48,54,10]
|
||||
Date: Mon Jun 15 21:43:47 2009
|
||||
|
||||
|
||||
DO NOT EDIT. EDIT THE CHR FILE INSTEAD
|
||||
*/
|
||||
|
||||
:-module(chr_translate,[chr_translate/2]).
|
||||
:-use_module(chr_runtime).
|
||||
:-style_check(-singleton).
|
||||
:-style_check(-discontiguous).
|
||||
:-use_module(chr_runtime).
|
||||
:-use_module(chr_hashtable_store).
|
||||
:-style_check(-singleton).
|
||||
:-style_check(-discontiguous).
|
||||
:-use_module(library(lists)).
|
||||
:-use_module(hprolog).
|
||||
:-use_module(library(assoc)).
|
||||
:-use_module(pairlist).
|
||||
:-use_module(library(lists),[append/3,append/2,member/2,delete/3,reverse/2,permutation/2]).
|
||||
:-use_module(library(ordsets)).
|
||||
:-use_module(hprolog).
|
||||
:-use_module(pairlist).
|
||||
:-use_module(a_star).
|
||||
:-use_module(clean_code).
|
||||
:-use_module(builtins).
|
||||
|
|
@ -42,7 +40,7 @@ chr_translate(A,B) :-
|
|||
store_management_preds(C,H),
|
||||
insert_declarations(E,I),
|
||||
chr_module_declaration(J),
|
||||
append_lists([I,H,G,J],B)
|
||||
append([I,H,G,J],B)
|
||||
).
|
||||
store_management_preds(A,B) :-
|
||||
generate_attach_detach_a_constraint_all(A,C),
|
||||
|
|
@ -52,12 +50,16 @@ store_management_preds(A,B) :-
|
|||
generate_extra_clauses(A,G),
|
||||
generate_insert_delete_constraints(A,H),
|
||||
generate_store_code(A,I),
|
||||
append_lists([C,D,E,F,G,H,I],B).
|
||||
append([C,D,E,F,G,H,I],B).
|
||||
specific_declarations([(:-use_module(chr_runtime)),(:-use_module(chr_hashtable_store)),(:-style_check(-discontiguous))|A],A).
|
||||
insert_declarations(A,B) :-
|
||||
( A=[(:-module(C,D))|E] ->
|
||||
B=[(:-module(C,D)),(:-use_module(chr_runtime)),(:-use_module(chr_hashtable_store)),(:-style_check(-singleton)),(:-style_check(-discontiguous))|E]
|
||||
specific_declarations(C,D),
|
||||
( A=[(:-module(E,F))|G] ->
|
||||
B=[(:-module(E,F))|C],
|
||||
D=G
|
||||
;
|
||||
B=[(:-use_module(chr_runtime)),(:-use_module(chr_hashtable_store)),(:-style_check(-singleton)),(:-style_check(-discontiguous))|A]
|
||||
B=C,
|
||||
D=A
|
||||
).
|
||||
chr_module_declaration(A) :-
|
||||
get_target_module(B),
|
||||
|
|
@ -106,12 +108,18 @@ partition_clauses([A|B],C,D,E) :-
|
|||
E=I
|
||||
)
|
||||
;
|
||||
( A=option(L,M) ->
|
||||
( A=(:-chr_option(L,M)) ->
|
||||
handle_option(L,M),
|
||||
C=G,
|
||||
D=H,
|
||||
E=I
|
||||
)
|
||||
;
|
||||
( A=(:-chr_type _) ->
|
||||
C=G,
|
||||
D=H,
|
||||
E=I
|
||||
)
|
||||
;
|
||||
C=G,
|
||||
D=H,
|
||||
|
|
@ -119,12 +127,12 @@ partition_clauses([A|B],C,D,E) :-
|
|||
),
|
||||
partition_clauses(B,G,H,I).
|
||||
is_declaration(A,B) :-
|
||||
( A=(:-C) ->
|
||||
true
|
||||
A=(:-C),
|
||||
(
|
||||
C=..[chr_constraint,D]
|
||||
;
|
||||
A=C
|
||||
C=..[chr_constraint,D]
|
||||
),
|
||||
C=..[constraints,D],
|
||||
conj2list(D,B).
|
||||
parse_rule(A,B) :-
|
||||
A=(C@D),
|
||||
|
|
@ -250,7 +258,7 @@ check_pragma(A,B) :-
|
|||
!,
|
||||
B=pragma(_,_,_,_,E),
|
||||
pragma_unique(E,C,D),
|
||||
format('CHR compiler WARNING: undocument pragma ~w in ~@.
|
||||
format('CHR compiler WARNING: undocumented pragma ~w in ~@.
|
||||
',[A,format_rule(B)]),
|
||||
format(' `--> Only use this pragma if you know what you are doing.
|
||||
',[]).
|
||||
|
|
@ -386,7 +394,7 @@ handle_option(A,B) :-
|
|||
option_definition(optimize,experimental,A) :-
|
||||
A=[unique_analyse_optimise-on,check_unnecessary_active-full,reorder_heads-on,set_semantics_rule-on,check_attachments-on,guard_via_reschedule-on].
|
||||
option_definition(optimize,full,A) :-
|
||||
A=[unique_analyse_optimise-on,check_unnecessary_active-full,reorder_heads-on,set_semantics_rule-on,check_attachments-on,guard_via_reschedule-on].
|
||||
A=[unique_analyse_optimise-off,check_unnecessary_active-full,reorder_heads-on,set_semantics_rule-on,check_attachments-on,guard_via_reschedule-on].
|
||||
option_definition(optimize,sicstus,A) :-
|
||||
A=[unique_analyse_optimise-off,check_unnecessary_active-simplification,reorder_heads-off,set_semantics_rule-off,check_attachments-off,guard_via_reschedule-off].
|
||||
option_definition(optimize,off,A) :-
|
||||
|
|
@ -415,6 +423,7 @@ option_definition(debug,off,A) :-
|
|||
A=[debugable-off].
|
||||
option_definition(type_definition,_,[]).
|
||||
option_definition(type_declaration,_,[]).
|
||||
option_definition(verbosity,_,[]).
|
||||
init_chr_pp_flags :-
|
||||
chr_pp_flag_definition(A,[B|_]),
|
||||
set_chr_pp_flag(A,B),
|
||||
|
|
@ -454,7 +463,7 @@ generate_attach_detach_a_constraint_all([A|B],C) :-
|
|||
E=[]
|
||||
),
|
||||
generate_attach_detach_a_constraint_all(B,F),
|
||||
append_lists([D,E,F],C).
|
||||
append([D,E,F],C).
|
||||
generate_attach_a_constraint(A,[B,C]) :-
|
||||
generate_attach_a_constraint_empty_list(A,B),
|
||||
get_max_constraint_index(D),
|
||||
|
|
@ -491,13 +500,13 @@ generate_attach_body_n(A/B,C,D,E) :-
|
|||
or_pattern(F,G),
|
||||
get_max_constraint_index(H),
|
||||
make_attr(H,I,J,K),
|
||||
nth(F,J,L),
|
||||
substitute(L,J,[D|L],M),
|
||||
nth1(F,J,L),
|
||||
substitute_eq(L,J,[D|L],M),
|
||||
make_attr(H,I,M,N),
|
||||
substitute(L,J,[D],O),
|
||||
substitute_eq(L,J,[D],O),
|
||||
make_attr(H,P,O,Q),
|
||||
copy_term(J,R),
|
||||
nth(F,R,[D]),
|
||||
copy_term_nat(J,R),
|
||||
nth1(F,R,[D]),
|
||||
delete(R,[D],S),
|
||||
set_elems(S,[]),
|
||||
make_attr(H,G,R,T),
|
||||
|
|
@ -541,10 +550,10 @@ generate_detach_body_n(A/B,C,D,E) :-
|
|||
and_pattern(F,H),
|
||||
get_max_constraint_index(I),
|
||||
make_attr(I,J,K,L),
|
||||
nth(F,K,M),
|
||||
substitute(M,K,[],N),
|
||||
nth1(F,K,M),
|
||||
substitute_eq(M,K,[],N),
|
||||
make_attr(I,O,N,P),
|
||||
substitute(M,K,Q,R),
|
||||
substitute_eq(M,K,Q,R),
|
||||
make_attr(I,J,R,S),
|
||||
get_target_module(T),
|
||||
E=(get_attr(C,T,U)->U=L,(J/\G=:=G->'chr sbag_del_element'(M,D,Q),(Q==[]->O is J/\H,(O==0->del_attr(C,T);put_attr(C,T,P));put_attr(C,T,S));true);true).
|
||||
|
|
@ -611,13 +620,13 @@ generate_extra_clauses(A,[B,C,D,E,F]) :-
|
|||
generate_allocate_clause(D),
|
||||
generate_insert_constraint_internal(F).
|
||||
generate_remove_clause(A) :-
|
||||
A=(remove_constraint_internal(B,C,D):-arg(2,B,E),E=mutable(F),'chr update_mutable'(removed,E),(compound(F)->C=[],D=no;F==removed->C=[],D=no;D=yes,chr_indexed_variables(B,C))).
|
||||
A=(remove_constraint_internal(B,C,D):-arg(2,B,E),'chr get_mutable'(F,E),'chr update_mutable'(removed,E),(compound(F)->C=[],D=no;F==removed->C=[],D=no;D=yes,chr_indexed_variables(B,C))).
|
||||
generate_activate_clause(A) :-
|
||||
A=(activate_constraint(B,C,D,E):-arg(2,D,F),F=mutable(G),'chr update_mutable'(active,F),(nonvar(E)->true;arg(4,D,H),H=mutable(I),E is I+1,'chr update_mutable'(E,H)),(compound(G)->term_variables(G,C),'chr none_locked'(C),B=yes;G==removed->chr_indexed_variables(D,C),B=yes;C=[],B=no)).
|
||||
A=(activate_constraint(B,C,D,E):-arg(2,D,F),'chr get_mutable'(G,F),'chr update_mutable'(active,F),(nonvar(E)->true;arg(4,D,H),'chr get_mutable'(I,H),E is I+1,'chr update_mutable'(E,H)),(compound(G)->term_variables(G,C),'chr none_locked'(C),B=yes;G==removed->chr_indexed_variables(D,C),B=yes;C=[],B=no)).
|
||||
generate_allocate_clause(A) :-
|
||||
A=(allocate_constraint(B,C,D,E):-C=..[suspension,F,G,B,H,I,D|E],H=mutable(0),'chr empty_history'(J),I=mutable(J),chr_indexed_variables(C,K),G=mutable(passive(K)),'chr gen_id'(F)).
|
||||
A=(allocate_constraint(B,C,D,E):-C=..[suspension,F,G,B,H,I,D|E],'chr create_mutable'(0,H),'chr empty_history'(J),'chr create_mutable'(J,I),chr_indexed_variables(C,K),'chr create_mutable'(passive(K),G),'chr gen_id'(F)).
|
||||
generate_insert_constraint_internal(A) :-
|
||||
A=(insert_constraint_internal(yes,B,C,D,E,F):-C=..[suspension,G,H,D,I,J,E|F],chr_indexed_variables(C,B),'chr none_locked'(B),H=mutable(active),I=mutable(0),J=mutable(K),'chr empty_history'(K),'chr gen_id'(G)).
|
||||
A=(insert_constraint_internal(yes,B,C,D,E,F):-C=..[suspension,G,H,D,I,J,E|F],chr_indexed_variables(C,B),'chr none_locked'(B),'chr create_mutable'(active,H),'chr create_mutable'(0,I),'chr empty_history'(K),'chr create_mutable'(K,J),'chr gen_id'(G)).
|
||||
global_indexed_variables_clause(A,B) :-
|
||||
( forsome(C,A,chr_translate:may_trigger(C)) ->
|
||||
D=(E=..[_,_,_,_,_,_,F|_],'$indexed_variables'(F,G))
|
||||
|
|
@ -730,12 +739,14 @@ generate_insert_constraint_body(default,A,B,C) :-
|
|||
;
|
||||
generate_attach_body_n(A,E,B,F)
|
||||
),
|
||||
C=('chr global_term_ref_1'(E),F).
|
||||
C=('chr default_store'(E),F).
|
||||
generate_insert_constraint_body(multi_hash(A),B,C,D) :-
|
||||
generate_multi_hash_insert_constraint_bodies(A,B,C,D).
|
||||
generate_insert_constraint_body(global_ground,A,B,C) :-
|
||||
global_ground_store_name(A,D),
|
||||
C=(nb_getval(D,E),b_setval(D,[B|E])).
|
||||
make_get_store_goal(D,E,F),
|
||||
make_update_store_goal(D,[B|E],G),
|
||||
C=(F,G).
|
||||
generate_insert_constraint_body(multi_store(A),B,C,D) :-
|
||||
find_with_var_identity(E,[C],(member(F,A),chr_translate:generate_insert_constraint_body(F,B,C,E)),G),
|
||||
list2conj(G,D).
|
||||
|
|
@ -743,7 +754,8 @@ generate_multi_hash_insert_constraint_bodies([],_,_,true).
|
|||
generate_multi_hash_insert_constraint_bodies([A|B],C,D,(E,F)) :-
|
||||
multi_hash_store_name(C,A,G),
|
||||
multi_hash_key(C,A,D,H,I),
|
||||
E=(H,nb_getval(G,J),insert_ht(J,I,D)),
|
||||
make_get_store_goal(G,J,K),
|
||||
E=(H,K,insert_ht(J,I,D)),
|
||||
generate_multi_hash_insert_constraint_bodies(B,C,D,F).
|
||||
generate_delete_constraint(A,B,C) :-
|
||||
make_name('$delete_from_store_',B,D),
|
||||
|
|
@ -755,16 +767,18 @@ generate_delete_constraint_body(default,A,B,C) :-
|
|||
get_max_constraint_index(D),
|
||||
( D==1 ->
|
||||
generate_detach_body_1(A,E,B,F),
|
||||
C=('chr global_term_ref_1'(E),F)
|
||||
C=('chr default_store'(E),F)
|
||||
;
|
||||
generate_detach_body_n(A,E,B,F),
|
||||
C=('chr global_term_ref_1'(E),F)
|
||||
C=('chr default_store'(E),F)
|
||||
).
|
||||
generate_delete_constraint_body(multi_hash(A),B,C,D) :-
|
||||
generate_multi_hash_delete_constraint_bodies(A,B,C,D).
|
||||
generate_delete_constraint_body(global_ground,A,B,C) :-
|
||||
global_ground_store_name(A,D),
|
||||
C=(nb_getval(D,E),'chr sbag_del_element'(E,B,F),b_setval(D,F)).
|
||||
make_get_store_goal(D,E,F),
|
||||
make_update_store_goal(D,G,H),
|
||||
C=(F,'chr sbag_del_element'(E,B,G),H).
|
||||
generate_delete_constraint_body(multi_store(A),B,C,D) :-
|
||||
find_with_var_identity(E,[C],(member(F,A),chr_translate:generate_delete_constraint_body(F,B,C,E)),G),
|
||||
list2conj(G,D).
|
||||
|
|
@ -772,7 +786,8 @@ generate_multi_hash_delete_constraint_bodies([],_,_,true).
|
|||
generate_multi_hash_delete_constraint_bodies([A|B],C,D,(E,F)) :-
|
||||
multi_hash_store_name(C,A,G),
|
||||
multi_hash_key(C,A,D,H,I),
|
||||
E=(H,nb_getval(G,J),delete_ht(J,I,D)),
|
||||
make_get_store_goal(G,J,K),
|
||||
E=(H,K,delete_ht(J,I,D)),
|
||||
generate_multi_hash_delete_constraint_bodies(B,C,D,F).
|
||||
generate_delete_constraint_call(A,B,C) :-
|
||||
make_name('$delete_from_store_',A,D),
|
||||
|
|
@ -803,19 +818,22 @@ multi_store_generate_store_code([A|B],C,D,E) :-
|
|||
multi_hash_store_initialisations([],_,A,A).
|
||||
multi_hash_store_initialisations([A|B],C,D,E) :-
|
||||
multi_hash_store_name(C,A,F),
|
||||
D=[(:-new_ht(G),nb_setval(F,G))|H],
|
||||
multi_hash_store_initialisations(B,C,H,E).
|
||||
make_init_store_goal(F,G,H),
|
||||
D=[(:-new_ht(G),H)|I],
|
||||
multi_hash_store_initialisations(B,C,I,E).
|
||||
global_ground_store_initialisation(A,B,C) :-
|
||||
global_ground_store_name(A,D),
|
||||
B=[(:-nb_setval(D,[]))|C].
|
||||
make_init_store_goal(D,[],E),
|
||||
B=[(:-E)|C].
|
||||
multi_hash_via_lookups([],_,A,A).
|
||||
multi_hash_via_lookups([A|B],C,D,E) :-
|
||||
multi_hash_via_lookup_name(C,A,F),
|
||||
G=..[F,H,I],
|
||||
multi_hash_store_name(C,A,J),
|
||||
K=(nb_getval(J,L),lookup_ht(L,H,I)),
|
||||
D=[(G:-K)|M],
|
||||
multi_hash_via_lookups(B,C,M,E).
|
||||
make_get_store_goal(J,K,L),
|
||||
M=(L,lookup_ht(K,H,I)),
|
||||
D=[(G:-M)|N],
|
||||
multi_hash_via_lookups(B,C,N,E).
|
||||
multi_hash_via_lookup_name(A/B,C,D) :-
|
||||
( integer(C) ->
|
||||
E=C
|
||||
|
|
@ -886,7 +904,7 @@ enumerate_store_body(default,A,B,C) :-
|
|||
get_constraint_index(A,D),
|
||||
get_target_module(E),
|
||||
get_max_constraint_index(F),
|
||||
G=('chr global_term_ref_1'(H),get_attr(H,E,I)),
|
||||
G=('chr default_store'(H),get_attr(H,E,I)),
|
||||
( F>1 ->
|
||||
J is D+1,
|
||||
K=(arg(J,I,L),'chr sbag_member'(B,L))
|
||||
|
|
@ -898,12 +916,14 @@ enumerate_store_body(multi_hash([A|_]),B,C,D) :-
|
|||
multi_hash_enumerate_store_body(A,B,C,D).
|
||||
enumerate_store_body(global_ground,A,B,C) :-
|
||||
global_ground_store_name(A,D),
|
||||
C=(nb_getval(D,E),'chr sbag_member'(B,E)).
|
||||
make_get_store_goal(D,E,F),
|
||||
C=(F,'chr sbag_member'(B,E)).
|
||||
enumerate_store_body(multi_store(A),B,C,D) :-
|
||||
once((member(E,A),enumerate_store_body(E,B,C,D))).
|
||||
multi_hash_enumerate_store_body(A,B,C,D) :-
|
||||
multi_hash_store_name(B,A,E),
|
||||
D=(nb_getval(E,F),value_ht(F,C)).
|
||||
make_get_store_goal(E,F,G),
|
||||
D=(G,value_ht(F,C)).
|
||||
check_attachments(A) :-
|
||||
( chr_pp_flag(check_attachments,on) ->
|
||||
check_constraint_attachments(A)
|
||||
|
|
@ -1084,35 +1104,6 @@ gen_uncond_attach_goal(A,B,C,D) :-
|
|||
),
|
||||
generate_insert_constraint_call(A,B,H),
|
||||
C=(activate_constraint(I,G,B,D),(I==yes->H,F;true)).
|
||||
occurrences_code(A,B,C,D,E,F,G) :-
|
||||
( A>B ->
|
||||
E=D,
|
||||
F=G
|
||||
;
|
||||
occurrence_code(A,C,D,H,F,I),
|
||||
J is A+1,
|
||||
occurrences_code(J,B,C,H,E,I,G)
|
||||
).
|
||||
occurrences_code(A,B,C,D,E,F) :-
|
||||
get_occurrence(B,A,G,H),
|
||||
( is_passive(G,H) ->
|
||||
D=C,
|
||||
E=F
|
||||
;
|
||||
get_rule(G,I),
|
||||
I=pragma(rule(J,K,_,_),ids(L,M),_,_,_),
|
||||
( select2(L,J,H,N,O,P) ->
|
||||
D=C,
|
||||
head1_code(N,P,O,I,B,C,E,F)
|
||||
;
|
||||
( select2(M,K,H,Q,R,S) ->
|
||||
length(S,T),
|
||||
head2_code(Q,S,R,I,T,B,C,E,U),
|
||||
inc_id(C,D),
|
||||
gen_alloc_inc_clause(B,C,U,F)
|
||||
)
|
||||
)
|
||||
).
|
||||
rules_code([],_,A,A,B,B).
|
||||
rules_code([A|B],C,D,E,F,G) :-
|
||||
rule_code(A,C,D,H,F,I),
|
||||
|
|
@ -1338,7 +1329,7 @@ unique_analyse_optimise_main([A|B],C,D,[E|F]) :-
|
|||
apply_unique_patterns_to_constraints(O,Q,H,S),
|
||||
globalize_unique_pragmas(R,M),
|
||||
globalize_unique_pragmas(S,M),
|
||||
append_lists([R,S,K],T),
|
||||
append([R,S,K],T),
|
||||
E=pragma(I,J,T,L,M),
|
||||
U is C+1,
|
||||
unique_analyse_optimise_main(B,U,H,F).
|
||||
|
|
@ -1358,16 +1349,14 @@ apply_unique_patterns_to_constraints([A|B],[C|D],E,F) :-
|
|||
apply_unique_pattern(A,B,C,D) :-
|
||||
C=unique(E,F),
|
||||
subsumes(A,E,G),
|
||||
( setof(H,I^J^K^(member(I,F),lookup_eq(G,I,J),term_variables(J,K),member(H,K)),L) ->
|
||||
true
|
||||
;
|
||||
L=[]
|
||||
),
|
||||
D=unique(B,L).
|
||||
find_with_var_identity(H,G,(member(I,F),lookup_eq(G,I,J),term_variables(J,K),member(H,K)),L),
|
||||
sort(L,M),
|
||||
N=M,
|
||||
D=unique(B,N).
|
||||
subsumes(A,B,C) :-
|
||||
empty_assoc(D),
|
||||
empty_ds(D),
|
||||
subsumes_aux(A,B,D,E),
|
||||
assoc_to_list(E,F),
|
||||
ds_to_list(E,F),
|
||||
build_unifier(F,C).
|
||||
subsumes_aux(A,B,C,D) :-
|
||||
( compound(B),
|
||||
|
|
@ -1381,13 +1370,13 @@ subsumes_aux(A,B,C,D) :-
|
|||
)
|
||||
;
|
||||
( var(B),
|
||||
get_assoc(A,C,G) ->
|
||||
get_ds(A,C,G) ->
|
||||
G==B,
|
||||
D=C
|
||||
)
|
||||
;
|
||||
var(B),
|
||||
put_assoc(A,C,B,D)
|
||||
put_ds(A,C,B,D)
|
||||
).
|
||||
subsumes_aux(0,_,_,A,A) :-
|
||||
!.
|
||||
|
|
@ -1416,11 +1405,10 @@ discover_unique_pattern(A,B,C) :-
|
|||
term_variables(I,L),
|
||||
select_pragma_unique_variables(K,L,M),
|
||||
N=unique(I,M),
|
||||
copy_term(N,C),
|
||||
( prolog_flag(verbose,O),
|
||||
O==yes ->
|
||||
copy_term_nat(N,C),
|
||||
( verbosity_on ->
|
||||
format('Found unique pattern ~w in rule ~d~@
|
||||
',[C,B,(E=yes(P)->write([58,32]),write(P);true)])
|
||||
',[C,B,(E=yes(O)->write([58,32]),write(O);true)])
|
||||
;
|
||||
true
|
||||
).
|
||||
|
|
@ -1611,7 +1599,7 @@ rest_heads_retrieval_and_matching_n([A|B],[C|D],E,F,G,H,[I,J|K],[L|M],N,O,P) :-
|
|||
;
|
||||
get_constraint_index(Q/R,X),
|
||||
make_attr(V,_,Y,T),
|
||||
nth(X,Y,W)
|
||||
nth1(X,Y,W)
|
||||
)
|
||||
;
|
||||
lookup_passive_head(S,A,[H|F],N,I,W),
|
||||
|
|
@ -1621,7 +1609,7 @@ rest_heads_retrieval_and_matching_n([A|B],[C|D],E,F,G,H,[I,J|K],[L|M],N,O,P) :-
|
|||
head_arg_matches(A1,N,B1,C1),
|
||||
D1=..[suspension,_,E1,_,_,_,_|Z],
|
||||
different_from_other_susps(A,L,F,G,F1),
|
||||
create_get_mutable(active,E1,G1),
|
||||
create_get_mutable_ref(active,E1,G1),
|
||||
H1=('chr sbag_member'(L,W),L=D1,G1,F1,B1),
|
||||
( member(unique(C,I1),E),
|
||||
check_unique_keys(I1,N) ->
|
||||
|
|
@ -1647,7 +1635,7 @@ check_unique_keys([A|B],C) :-
|
|||
lookup_eq(C,A,_),
|
||||
check_unique_keys(B,C).
|
||||
different_from_other_susps(A,B,C,D,E) :-
|
||||
( bagof(F,G^(nth(G,C,H),\+A\=H,nth(G,D,I),F=(B\==I)),J) ->
|
||||
( bagof(F,G^(nth1(G,C,H),\+A\=H,nth1(G,D,I),F=(B\==I)),J) ->
|
||||
list2conj(J,E)
|
||||
;
|
||||
E=true
|
||||
|
|
@ -1676,7 +1664,7 @@ common_variables(A,B,C) :-
|
|||
gen_get_mod_constraints(A,B,C) :-
|
||||
get_target_module(D),
|
||||
( A==[] ->
|
||||
B=('chr global_term_ref_1'(E),get_attr(E,D,F),F=C)
|
||||
B=('chr default_store'(E),get_attr(E,D,F),F=C)
|
||||
;
|
||||
( A=[G] ->
|
||||
H='chr via_1'(G,I)
|
||||
|
|
@ -1701,7 +1689,7 @@ guard_body_copies2(A,B,C,D) :-
|
|||
term_variables(I,N),
|
||||
term_variables(L,O),
|
||||
( chr_pp_flag(guard_locks,on),
|
||||
bagof('chr lock'(P)-'chr unlock'(P),Q^(member(Q,N),lookup_eq(B,Q,P),memberchk_eq(P,O)),R) ->
|
||||
find_with_var_identity('chr lock'(P)-'chr unlock'(P),B,(member(Q,N),lookup_eq(B,Q,P),memberchk_eq(P,O)),R) ->
|
||||
once(pairup(S,T,R))
|
||||
;
|
||||
S=[],
|
||||
|
|
@ -1864,7 +1852,7 @@ simpagation_head2_worker_body(A,B,C,D,E,F,G,H,I/J,K,L,M) :-
|
|||
head_info(B,B1,C1,_,_,D1),
|
||||
head_arg_matches(D1,S,E1,F1),
|
||||
G1=..[suspension,_,H1,_,_,_,_|C1],
|
||||
create_get_mutable(active,H1,I1),
|
||||
create_get_mutable_ref(active,H1,I1),
|
||||
J1=(N=G1,I1),
|
||||
(
|
||||
(
|
||||
|
|
@ -1917,8 +1905,8 @@ simpagation_head2_worker_body(A,B,C,D,E,F,G,H,I/J,K,L,M) :-
|
|||
gen_state_cond_call(A,B,C,D,E) :-
|
||||
length(F,B),
|
||||
G=..[suspension,_,H,_,I,_,_|F],
|
||||
create_get_mutable(active,H,J),
|
||||
create_get_mutable(D,I,K),
|
||||
create_get_mutable_ref(active,H,J),
|
||||
create_get_mutable_ref(D,I,K),
|
||||
E=(A=G,J,K->'chr update_mutable'(inactive,H),C;true).
|
||||
simpagation_head2_worker_end(A,B,C/D,E,F,G) :-
|
||||
head_info(A,D,_,_,H,I),
|
||||
|
|
@ -1993,7 +1981,7 @@ propagation_body(A,B,C,D,E,F/G,H,I,J) :-
|
|||
functor(A,_,S),
|
||||
gen_vars(S,T),
|
||||
U=..[suspension,_,V,_,_,_,_|T],
|
||||
create_get_mutable(active,V,W),
|
||||
create_get_mutable_ref(active,V,W),
|
||||
X=(Q=U,W),
|
||||
Y=[[Q|R]|M],
|
||||
build_head(F,G,H,Y,Z),
|
||||
|
|
@ -2087,7 +2075,7 @@ propagation_accumulator([A|B],[C|D],E,F/G,H,I,J) :-
|
|||
head_arg_matches(T,N,U,V),
|
||||
W=..[suspension,_,X,_,_,_,_|R],
|
||||
different_from_other_susps(C,S,D,O,Y),
|
||||
create_get_mutable(active,X,Z),
|
||||
create_get_mutable_ref(active,X,Z),
|
||||
A1=(S=W,Z,Y,U),
|
||||
lookup_passive_head(A,[C|D],V,B1,C1),
|
||||
inc_id(H,D1),
|
||||
|
|
@ -2192,7 +2180,7 @@ order_score_vars([A|B],C,D,E,F) :-
|
|||
G=E
|
||||
),
|
||||
order_score_vars(B,C,D,G,F).
|
||||
create_get_mutable(A,B,C) :-
|
||||
create_get_mutable_ref(A,B,C) :-
|
||||
C=(B=mutable(A)).
|
||||
gen_var(_).
|
||||
gen_vars(A,B) :-
|
||||
|
|
@ -2213,13 +2201,13 @@ build_head(A,B,C,D,E) :-
|
|||
E=..[F|D].
|
||||
buildName(A,B,C,D) :-
|
||||
atom_concat(A,/,E),
|
||||
atom_concat(E,B,F),
|
||||
atomic_concat(E,B,F),
|
||||
buildName_(C,F,D).
|
||||
buildName_([],A,A).
|
||||
buildName_([A|B],C,D) :-
|
||||
buildName_(B,C,E),
|
||||
atom_concat(E,'__',F),
|
||||
atom_concat(F,A,D).
|
||||
atomic_concat(F,A,D).
|
||||
vars_susp(A,B,C,D) :-
|
||||
length(B,A),
|
||||
append(B,[C],D).
|
||||
|
|
@ -2267,7 +2255,20 @@ atom_concat_list([A],A) :-
|
|||
!.
|
||||
atom_concat_list([A|B],C) :-
|
||||
atom_concat_list(B,D),
|
||||
atom_concat(A,D,C).
|
||||
atomic_concat(A,D,C).
|
||||
atomic_concat(A,B,C) :-
|
||||
make_atom(A,D),
|
||||
make_atom(B,E),
|
||||
atom_concat(D,E,C).
|
||||
make_atom(A,B) :-
|
||||
( atom(A) ->
|
||||
B=A
|
||||
;
|
||||
( number(A) ->
|
||||
number_codes(A,C),
|
||||
atom_codes(B,C)
|
||||
)
|
||||
).
|
||||
make_name(A,B/C,D) :-
|
||||
atom_concat_list([A,B,/,C],D).
|
||||
set_elems([],_).
|
||||
|
|
@ -2296,7 +2297,7 @@ lookup_passive_head(default,A,B,C,D,E) :-
|
|||
functor(A,I,J),
|
||||
get_constraint_index(I/J,K),
|
||||
make_attr(H,_,L,F),
|
||||
nth(K,L,E)
|
||||
nth1(K,L,E)
|
||||
).
|
||||
lookup_passive_head(multi_hash(A),B,_,C,D,E) :-
|
||||
once((member(F,A),multi_hash_key_args(F,B,G),translate(G,C,H))),
|
||||
|
|
@ -2312,7 +2313,7 @@ lookup_passive_head(multi_hash(A),B,_,C,D,E) :-
|
|||
lookup_passive_head(global_ground,A,_,_,B,C) :-
|
||||
functor(A,D,E),
|
||||
global_ground_store_name(D/E,F),
|
||||
B=nb_getval(F,C),
|
||||
make_get_store_goal(F,C,B),
|
||||
update_store_type(D/E,global_ground).
|
||||
lookup_passive_head(multi_store(A),B,C,D,E,F) :-
|
||||
once((member(G,A),lookup_passive_head(G,B,C,D,E,F))).
|
||||
|
|
@ -2347,12 +2348,15 @@ validate_store_type_assumptions([]).
|
|||
validate_store_type_assumptions([A|B]) :-
|
||||
validate_store_type_assumption(A),
|
||||
validate_store_type_assumptions(B).
|
||||
verbosity_on :-
|
||||
prolog_flag(verbose,A),
|
||||
A==yes.
|
||||
attr_unify_hook(_,_) :-
|
||||
write('ERROR: Unexpected triggering of attr_unify_hook/2 in module '),
|
||||
writeln(chr_translate).
|
||||
remove_constraint_internal(A,B,C) :-
|
||||
arg(2,A,D),
|
||||
D=mutable(E),
|
||||
'chr get_mutable'(E,D),
|
||||
'chr update_mutable'(removed,D),
|
||||
( compound(E) ->
|
||||
B=[],
|
||||
|
|
@ -2368,13 +2372,13 @@ remove_constraint_internal(A,B,C) :-
|
|||
).
|
||||
activate_constraint(A,B,C,D) :-
|
||||
arg(2,C,E),
|
||||
E=mutable(F),
|
||||
'chr get_mutable'(F,E),
|
||||
'chr update_mutable'(active,E),
|
||||
( nonvar(D) ->
|
||||
true
|
||||
;
|
||||
arg(4,C,G),
|
||||
G=mutable(H),
|
||||
'chr get_mutable'(H,G),
|
||||
D is H+1,
|
||||
'chr update_mutable'(D,G)
|
||||
),
|
||||
|
|
@ -2393,21 +2397,21 @@ activate_constraint(A,B,C,D) :-
|
|||
).
|
||||
allocate_constraint(A,B,C,D) :-
|
||||
B=..[suspension,E,F,A,G,H,C|D],
|
||||
G=mutable(0),
|
||||
'chr create_mutable'(0,G),
|
||||
'chr empty_history'(I),
|
||||
H=mutable(I),
|
||||
'chr create_mutable'(I,H),
|
||||
chr_indexed_variables(B,J),
|
||||
F=mutable(passive(J)),
|
||||
'chr create_mutable'(passive(J),F),
|
||||
'chr gen_id'(E).
|
||||
chr_indexed_variables(_,[]).
|
||||
insert_constraint_internal(yes,A,B,C,D,E) :-
|
||||
B=..[suspension,F,G,C,H,I,D|E],
|
||||
chr_indexed_variables(B,A),
|
||||
'chr none_locked'(A),
|
||||
G=mutable(active),
|
||||
H=mutable(0),
|
||||
I=mutable(J),
|
||||
'chr create_mutable'(active,G),
|
||||
'chr create_mutable'(0,H),
|
||||
'chr empty_history'(J),
|
||||
'chr create_mutable'(J,I),
|
||||
'chr gen_id'(F).
|
||||
'$insert_in_store_constraint/2'(A) :-
|
||||
arg(8,A,B),
|
||||
|
|
@ -2573,19 +2577,14 @@ insert_constraint_internal(yes,A,B,C,D,E) :-
|
|||
'chr sbag_del_element'(D,A,E),
|
||||
b_setval('$chr_store_global_ground_chr_translate:allocation_occurrence/2',E).
|
||||
'$insert_in_store_rule/2'(A) :-
|
||||
nb_getval('$chr_store_global_ground_chr_translate:rule/2',B),
|
||||
b_setval('$chr_store_global_ground_chr_translate:rule/2',[A|B]),
|
||||
arg(7,A,C),
|
||||
nb_getval('$chr_store_multi_hash_chr_translate:rule/2-1',D),
|
||||
insert_ht(D,C,A),
|
||||
arg(7,A,B),
|
||||
nb_getval('$chr_store_multi_hash_chr_translate:rule/2-1',C),
|
||||
insert_ht(C,B,A),
|
||||
true.
|
||||
'$delete_from_store_rule/2'(A) :-
|
||||
nb_getval('$chr_store_global_ground_chr_translate:rule/2',B),
|
||||
'chr sbag_del_element'(B,A,C),
|
||||
b_setval('$chr_store_global_ground_chr_translate:rule/2',C),
|
||||
arg(7,A,D),
|
||||
nb_getval('$chr_store_multi_hash_chr_translate:rule/2-1',E),
|
||||
delete_ht(E,D,A),
|
||||
arg(7,A,B),
|
||||
nb_getval('$chr_store_multi_hash_chr_translate:rule/2-1',C),
|
||||
delete_ht(C,B,A),
|
||||
true.
|
||||
'$enumerate_suspensions'(A) :-
|
||||
(
|
||||
|
|
@ -2640,8 +2639,8 @@ insert_constraint_internal(yes,A,B,C,D,E) :-
|
|||
nb_getval('$chr_store_multi_hash_chr_translate:allocation_occurrence/2-1',R),
|
||||
value_ht(R,A)
|
||||
;
|
||||
nb_getval('$chr_store_global_ground_chr_translate:rule/2',S),
|
||||
'chr sbag_member'(A,S)
|
||||
nb_getval('$chr_store_multi_hash_chr_translate:rule/2-1',S),
|
||||
value_ht(S,A)
|
||||
).
|
||||
:-new_ht(A),nb_setval('$chr_store_multi_hash_chr_translate:constraint/2-2',A).
|
||||
'$via1_multi_hash_constraint/2-2'(A,B) :-
|
||||
|
|
@ -2700,7 +2699,6 @@ insert_constraint_internal(yes,A,B,C,D,E) :-
|
|||
nb_getval('$chr_store_multi_hash_chr_translate:allocation_occurrence/2-1',C),
|
||||
lookup_ht(C,A,B).
|
||||
:-nb_setval('$chr_store_global_ground_chr_translate:allocation_occurrence/2',[]).
|
||||
:-nb_setval('$chr_store_global_ground_chr_translate:rule/2',[]).
|
||||
:-new_ht(A),nb_setval('$chr_store_multi_hash_chr_translate:rule/2-1',A).
|
||||
'$via1_multi_hash_rule/2-1'(A,B) :-
|
||||
nb_getval('$chr_store_multi_hash_chr_translate:rule/2-1',C),
|
||||
|
|
@ -2871,25 +2869,47 @@ attached(A,B) :-
|
|||
'attached/2__2'(A,B,C) :-
|
||||
B==maybe,
|
||||
'$via1_multi_hash_attached/2-1'(A,E),
|
||||
( 'chr sbag_member'(D,E),
|
||||
(
|
||||
'chr sbag_member'(D,E),
|
||||
D=suspension(_,H,_,_,_,_,F,G),
|
||||
H=mutable(active),
|
||||
F==A,
|
||||
G==maybe ->
|
||||
true
|
||||
),
|
||||
!,
|
||||
( var(C) ->
|
||||
true
|
||||
G==maybe,
|
||||
!,
|
||||
( var(C) ->
|
||||
true
|
||||
;
|
||||
remove_constraint_internal(C,_,I),
|
||||
( I==yes ->
|
||||
'$delete_from_store_attached/2'(C)
|
||||
;
|
||||
true
|
||||
)
|
||||
)
|
||||
;
|
||||
remove_constraint_internal(C,_,I),
|
||||
!,
|
||||
'attached/2__2__0'(E,A,B,C)
|
||||
).
|
||||
'attached/2__2__0'([],A,B,C) :-
|
||||
'attached/2__3'(A,B,C).
|
||||
'attached/2__2__0'([D|E],A,B,C) :-
|
||||
( D=suspension(_,H,_,_,_,_,F,G),
|
||||
H=mutable(active),
|
||||
F==A,
|
||||
G==maybe ->
|
||||
remove_constraint_internal(D,_,I),
|
||||
( I==yes ->
|
||||
'$delete_from_store_attached/2'(C)
|
||||
'$delete_from_store_attached/2'(D)
|
||||
;
|
||||
true
|
||||
)
|
||||
),
|
||||
'attached/2__2__0'(E,A,B,C)
|
||||
;
|
||||
'attached/2__2__0'(E,A,B,C)
|
||||
).
|
||||
'attached/2__2'(_,_,A) :-
|
||||
'attached/2__2'(A,B,C) :-
|
||||
'attached/2__3'(A,B,C).
|
||||
'attached/2__3'(_,_,A) :-
|
||||
activate_constraint(B,_,A,_),
|
||||
( B==yes ->
|
||||
'$insert_in_store_attached/2'(A)
|
||||
|
|
@ -2910,30 +2930,56 @@ is_attached(A) :-
|
|||
!.
|
||||
indexed_argument(A,B) :-
|
||||
'indexed_argument/2__0'(A,B,_).
|
||||
'indexed_argument/2__0'(A,B,_) :-
|
||||
'$via1_multi_hash_indexed_argument/2-1'(A,D),
|
||||
( 'chr sbag_member'(C,D),
|
||||
C=suspension(_,G,_,_,_,_,E,F),
|
||||
G=mutable(active),
|
||||
E==A,
|
||||
F==B ->
|
||||
true
|
||||
),
|
||||
!.
|
||||
'indexed_argument/2__0'(A,B,C) :-
|
||||
insert_constraint_internal(_,_,C,chr_translate:'indexed_argument/2__0'(A,B,C),indexed_argument(A,B),[A,B]),
|
||||
'$insert_in_store_indexed_argument/2'(C).
|
||||
'$via1_multi_hash_indexed_argument/2-1'(A,E),
|
||||
(
|
||||
'chr sbag_member'(D,E),
|
||||
D=suspension(_,H,_,_,_,_,F,G),
|
||||
H=mutable(active),
|
||||
F==A,
|
||||
G==B,
|
||||
!
|
||||
;
|
||||
!,
|
||||
allocate_constraint(chr_translate:'indexed_argument/2__0'(A,B,C),C,indexed_argument(A,B),[A,B]),
|
||||
'indexed_argument/2__0__0'(E,A,B,C)
|
||||
).
|
||||
'indexed_argument/2__0__0'([],A,B,C) :-
|
||||
'indexed_argument/2__1'(A,B,C).
|
||||
'indexed_argument/2__0__0'([D|E],A,B,C) :-
|
||||
( D=suspension(_,H,_,_,_,_,F,G),
|
||||
H=mutable(active),
|
||||
F==A,
|
||||
G==B ->
|
||||
remove_constraint_internal(D,_,I),
|
||||
( I==yes ->
|
||||
'$delete_from_store_indexed_argument/2'(D)
|
||||
;
|
||||
true
|
||||
),
|
||||
'indexed_argument/2__0__0'(E,A,B,C)
|
||||
;
|
||||
'indexed_argument/2__0__0'(E,A,B,C)
|
||||
).
|
||||
'indexed_argument/2__0'(A,B,C) :-
|
||||
allocate_constraint(chr_translate:'indexed_argument/2__0'(A,B,C),C,indexed_argument(A,B),[A,B]),
|
||||
'indexed_argument/2__1'(A,B,C).
|
||||
'indexed_argument/2__1'(_,_,A) :-
|
||||
activate_constraint(B,_,A,_),
|
||||
( B==yes ->
|
||||
'$insert_in_store_indexed_argument/2'(A)
|
||||
;
|
||||
true
|
||||
).
|
||||
is_indexed_argument(A,B) :-
|
||||
'is_indexed_argument/2__0'(A,B,_).
|
||||
'is_indexed_argument/2__0'(A,B,_) :-
|
||||
'$via1_multi_hash_indexed_argument/2-1'(A,D),
|
||||
( 'chr sbag_member'(C,D),
|
||||
C=suspension(_,G,_,_,_,_,E,F),
|
||||
G=mutable(active),
|
||||
E==A,
|
||||
F==B ->
|
||||
true
|
||||
),
|
||||
'chr sbag_member'(C,D),
|
||||
C=suspension(_,G,_,_,_,_,E,F),
|
||||
G=mutable(active),
|
||||
E==A,
|
||||
F==B,
|
||||
!.
|
||||
'is_indexed_argument/2__0'(_,_,_) :-
|
||||
!,
|
||||
|
|
@ -3020,26 +3066,23 @@ update_store_type(A,B) :-
|
|||
C=suspension(_,G,_,_,_,_,E,F),
|
||||
G=mutable(active),
|
||||
E==A,
|
||||
'chr lock'(B),
|
||||
'chr lock'(F),
|
||||
member(B,F),
|
||||
'chr unlock'(B),
|
||||
'chr unlock'(F),
|
||||
!.
|
||||
'update_store_type/2__0'(A,B,_) :-
|
||||
'$via1_multi_hash_actual_store_types/2-1'(A,D),
|
||||
'chr sbag_member'(C,D),
|
||||
C=suspension(_,G,_,_,_,_,E,F),
|
||||
G=mutable(active),
|
||||
E==A,
|
||||
!,
|
||||
remove_constraint_internal(C,_,H),
|
||||
( H==yes ->
|
||||
'$delete_from_store_actual_store_types/2'(C)
|
||||
(
|
||||
'chr lock'(B),
|
||||
'chr lock'(F),
|
||||
member(B,F),
|
||||
'chr unlock'(B),
|
||||
'chr unlock'(F),
|
||||
!
|
||||
;
|
||||
true
|
||||
),
|
||||
actual_store_types(A,[B|F]).
|
||||
!,
|
||||
remove_constraint_internal(C,_,H),
|
||||
( H==yes ->
|
||||
'$delete_from_store_actual_store_types/2'(C)
|
||||
;
|
||||
true
|
||||
),
|
||||
actual_store_types(A,[B|F])
|
||||
).
|
||||
'update_store_type/2__0'(A,B,_) :-
|
||||
!,
|
||||
actual_store_types(A,[B]).
|
||||
|
|
@ -3246,27 +3289,28 @@ occurrence(A,B,C,D) :-
|
|||
'occurrence/4__0'(A,B,C,D,_).
|
||||
'occurrence/4__0'(A,B,C,D,E) :-
|
||||
allocate_constraint(chr_translate:'occurrence/4__0'(A,B,C,D,E),E,occurrence(A,B,C,D),[A,B,C,D]),
|
||||
'chr novel_production'(E,46),
|
||||
!,
|
||||
'chr extend_history'(E,46),
|
||||
activate_constraint(F,_,E,G),
|
||||
( F==yes ->
|
||||
'$insert_in_store_occurrence/4'(E)
|
||||
(
|
||||
'chr novel_production'(E,46),
|
||||
!,
|
||||
'chr extend_history'(E,46),
|
||||
activate_constraint(F,_,E,G),
|
||||
( F==yes ->
|
||||
'$insert_in_store_occurrence/4'(E)
|
||||
;
|
||||
true
|
||||
),
|
||||
max_occurrence(A,B),
|
||||
( E=suspension(_,H,_,I,_,_,_,_,_,_),
|
||||
H=mutable(active),
|
||||
I=mutable(G) ->
|
||||
'chr update_mutable'(inactive,H),
|
||||
'occurrence/4__1'(A,B,C,D,E)
|
||||
;
|
||||
true
|
||||
)
|
||||
;
|
||||
true
|
||||
),
|
||||
max_occurrence(A,B),
|
||||
( E=suspension(_,H,_,I,_,_,_,_,_,_),
|
||||
H=mutable(active),
|
||||
I=mutable(G) ->
|
||||
'chr update_mutable'(inactive,H),
|
||||
'occurrence/4__1'(A,B,C,D,E)
|
||||
;
|
||||
true
|
||||
).
|
||||
'occurrence/4__0'(A,B,C,D,E) :-
|
||||
allocate_constraint(chr_translate:'occurrence/4__0'(A,B,C,D,E),E,occurrence(A,B,C,D),[A,B,C,D]),
|
||||
'occurrence/4__1'(A,B,C,D,E).
|
||||
'occurrence/4__1'(A,B,C,D,E) :-
|
||||
'$via1_multi_hash_allocation_occurrence/2-1'(A,F),
|
||||
!,
|
||||
|
|
@ -3430,38 +3474,34 @@ get_occurrence(A,B,C,D) :-
|
|||
fail.
|
||||
max_occurrence(A,B) :-
|
||||
'max_occurrence/2__0'(A,B,_).
|
||||
'max_occurrence/2__0'(A,B,_) :-
|
||||
'$via1_multi_hash_max_occurrence/2-1'(A,D),
|
||||
( 'chr sbag_member'(C,D),
|
||||
C=suspension(_,G,_,_,_,_,E,F),
|
||||
G=mutable(active),
|
||||
E==A ->
|
||||
true
|
||||
),
|
||||
F>=B,
|
||||
!.
|
||||
'max_occurrence/2__0'(A,B,C) :-
|
||||
'$via1_multi_hash_max_occurrence/2-1'(A,D),
|
||||
!,
|
||||
allocate_constraint(chr_translate:'max_occurrence/2__0'(A,B,C),C,max_occurrence(A,B),[A,B]),
|
||||
'max_occurrence/2__0__0'(D,A,B,C).
|
||||
'$via1_multi_hash_max_occurrence/2-1'(A,E),
|
||||
(
|
||||
'chr sbag_member'(D,E),
|
||||
D=suspension(_,H,_,_,_,_,F,G),
|
||||
H=mutable(active),
|
||||
F==A,
|
||||
G>=B,
|
||||
!
|
||||
;
|
||||
!,
|
||||
allocate_constraint(chr_translate:'max_occurrence/2__0'(A,B,C),C,max_occurrence(A,B),[A,B]),
|
||||
'max_occurrence/2__0__0'(E,A,B,C)
|
||||
).
|
||||
'max_occurrence/2__0__0'([],A,B,C) :-
|
||||
'max_occurrence/2__1'(A,B,C).
|
||||
'max_occurrence/2__0__0'([D|E],A,B,C) :-
|
||||
( D=suspension(_,H,_,_,_,_,F,G),
|
||||
H=mutable(active),
|
||||
F==A ->
|
||||
( B>=G ->
|
||||
remove_constraint_internal(D,_,I),
|
||||
( I==yes ->
|
||||
'$delete_from_store_max_occurrence/2'(D)
|
||||
;
|
||||
true
|
||||
),
|
||||
'max_occurrence/2__0__0'([],A,B,C)
|
||||
F==A,
|
||||
B>=G ->
|
||||
remove_constraint_internal(D,_,I),
|
||||
( I==yes ->
|
||||
'$delete_from_store_max_occurrence/2'(D)
|
||||
;
|
||||
'max_occurrence/2__0__0'([],A,B,C)
|
||||
)
|
||||
true
|
||||
),
|
||||
'max_occurrence/2__0__0'(E,A,B,C)
|
||||
;
|
||||
'max_occurrence/2__0__0'(E,A,B,C)
|
||||
).
|
||||
|
|
@ -3479,12 +3519,10 @@ get_max_occurrence(A,B) :-
|
|||
'get_max_occurrence/2__0'(A,B,_).
|
||||
'get_max_occurrence/2__0'(A,B,_) :-
|
||||
'$via1_multi_hash_max_occurrence/2-1'(A,D),
|
||||
( 'chr sbag_member'(C,D),
|
||||
C=suspension(_,G,_,_,_,_,E,F),
|
||||
G=mutable(active),
|
||||
E==A ->
|
||||
true
|
||||
),
|
||||
'chr sbag_member'(C,D),
|
||||
C=suspension(_,G,_,_,_,_,E,F),
|
||||
G=mutable(active),
|
||||
E==A,
|
||||
!,
|
||||
B=F.
|
||||
'get_max_occurrence/2__0'(_,A,_) :-
|
||||
|
|
@ -3492,45 +3530,6 @@ get_max_occurrence(A,B) :-
|
|||
A=0.
|
||||
allocation_occurrence(A,B) :-
|
||||
'allocation_occurrence/2__0'(A,B,_).
|
||||
'allocation_occurrence/2__0'(A,B,_) :-
|
||||
'$via1_multi_hash_occurrence/4-1'(A,I),
|
||||
nb_getval('$chr_store_global_ground_chr_translate:rule/2',D),
|
||||
'chr sbag_member'(C,D),
|
||||
C=suspension(_,G,_,_,_,_,E,F),
|
||||
G=mutable(active),
|
||||
'chr sbag_member'(H,I),
|
||||
H=suspension(_,N,_,_,_,_,J,K,L,M),
|
||||
N=mutable(active),
|
||||
J==A,
|
||||
K==B,
|
||||
L==E,
|
||||
'chr lock'(F),
|
||||
'chr lock'(M),
|
||||
F=pragma(_,ids(_,_),_,_,_),
|
||||
member(M,_),
|
||||
'chr unlock'(F),
|
||||
'chr unlock'(M),
|
||||
!,
|
||||
O is B+1,
|
||||
allocation_occurrence(A,O).
|
||||
'allocation_occurrence/2__0'(A,B,_) :-
|
||||
'$via1_multi_hash_occurrence/4-1'(A,I),
|
||||
nb_getval('$chr_store_global_ground_chr_translate:rule/2',D),
|
||||
'chr sbag_member'(C,D),
|
||||
C=suspension(_,G,_,_,_,_,E,F),
|
||||
G=mutable(active),
|
||||
'chr sbag_member'(H,I),
|
||||
H=suspension(_,M,_,_,_,_,J,K,L,_),
|
||||
M=mutable(active),
|
||||
J==A,
|
||||
K==B,
|
||||
L==E,
|
||||
'chr lock'(F),
|
||||
F=pragma(rule(_,_,_,true),_,_,_,_),
|
||||
'chr unlock'(F),
|
||||
!,
|
||||
N is B+1,
|
||||
allocation_occurrence(A,N).
|
||||
'allocation_occurrence/2__0'(A,B,_) :-
|
||||
'$via1_multi_hash_occurrence/4-1'(A,D),
|
||||
'chr sbag_member'(C,D),
|
||||
|
|
@ -3538,15 +3537,40 @@ allocation_occurrence(A,B) :-
|
|||
I=mutable(active),
|
||||
E==A,
|
||||
F==B,
|
||||
'$via1_multi_hash_passive/2-1'(G,K),
|
||||
'chr sbag_member'(J,K),
|
||||
J=suspension(_,N,_,_,_,_,L,M),
|
||||
N=mutable(active),
|
||||
L==G,
|
||||
M==H,
|
||||
!,
|
||||
O is B+1,
|
||||
allocation_occurrence(A,O).
|
||||
(
|
||||
'$via1_multi_hash_rule/2-1'(G,K),
|
||||
'chr sbag_member'(J,K),
|
||||
J=suspension(_,N,_,_,_,_,L,M),
|
||||
N=mutable(active),
|
||||
L==G,
|
||||
'chr lock'(M),
|
||||
(
|
||||
'chr lock'(H),
|
||||
M=pragma(_,ids(_,_),_,_,_),
|
||||
member(H,_),
|
||||
'chr unlock'(M),
|
||||
'chr unlock'(H),
|
||||
!,
|
||||
O is B+1,
|
||||
allocation_occurrence(A,O)
|
||||
;
|
||||
M=pragma(rule(_,_,_,true),_,_,_,_),
|
||||
'chr unlock'(M),
|
||||
!,
|
||||
P is B+1,
|
||||
allocation_occurrence(A,P)
|
||||
)
|
||||
;
|
||||
'$via1_multi_hash_passive/2-1'(G,R),
|
||||
'chr sbag_member'(Q,R),
|
||||
Q=suspension(_,U,_,_,_,_,S,T),
|
||||
U=mutable(active),
|
||||
S==G,
|
||||
T==H,
|
||||
!,
|
||||
V is B+1,
|
||||
allocation_occurrence(A,V)
|
||||
).
|
||||
'allocation_occurrence/2__0'(A,B,C) :-
|
||||
insert_constraint_internal(_,_,C,chr_translate:'allocation_occurrence/2__0'(A,B,C),allocation_occurrence(A,B),[A,B]),
|
||||
'$insert_in_store_allocation_occurrence/2'(C).
|
||||
|
|
|
|||
21095
guard_entailment.pl
21095
guard_entailment.pl
File diff suppressed because it is too large
Load diff
6
sources
6
sources
|
|
@ -1 +1,5 @@
|
|||
1f5c26642a27158c98f6c2fac56d3dad Yap-5.1.1.tar.gz
|
||||
d04265acead9286b363f7209ac382490 Yap-5.1.3.tar.gz
|
||||
89b0825d04a5615b78ca0ff67908b047 chr_translate_bootstrap1.pl
|
||||
ebbc6fe2972f03696e8b5397b0076726 chr_translate_bootstrap2.pl
|
||||
773fa939564fb229fc7e541e5a74515a chr_translate.pl
|
||||
72541b7579caf15bebe19fc2fc80dd08 guard_entailment.pl
|
||||
|
|
|
|||
29
yap.spec
29
yap.spec
|
|
@ -1,12 +1,12 @@
|
|||
Name: yap
|
||||
Version: 5.1.1
|
||||
Release: 13%{?dist}
|
||||
Version: 5.1.3
|
||||
Release: 1%{?dist}
|
||||
|
||||
Summary: High-performance Prolog Compiler
|
||||
|
||||
Group: Development/Languages
|
||||
License: Artistic 2.0 or LGPLv2+
|
||||
Source: http://www.ncc.up.pt/~vsc/Yap/current/Yap-5.1.1.tar.gz
|
||||
Source: http://www.ncc.up.pt/~vsc/Yap/current/Yap-%{version}.tar.gz
|
||||
Source1: guard_entailment.pl
|
||||
Source2: chr_translate_bootstrap1.pl
|
||||
Source3: chr_translate_bootstrap2.pl
|
||||
|
|
@ -53,12 +53,15 @@ Documentation for Yap.
|
|||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
||||
find -name CVS -print0 | xargs -0 rm -rf
|
||||
cp %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} LGPL/chr
|
||||
|
||||
# remove redundant rpath
|
||||
sed -i '/-Wl,-R/d' configure
|
||||
# properly link dynamically
|
||||
sed -i 's/SHLIB_LD=.*/SHLIB_LD="gcc -shared"/' configure
|
||||
# add soname to library
|
||||
sed -i 's/@YAPLIB@/@YAPLIB@.%{version}/g' Makefile.in
|
||||
sed -i 's/@DYNYAPLIB@/@DYNYAPLIB@.%{version}/g' Makefile.in
|
||||
sed -i 's/@DYNLIB_LD@/@DYNLIB_LD@ -Wl,-soname=@YAPLIB@.%{version} /g' Makefile.in
|
||||
|
||||
find -name Makefile.in | xargs sed -i 's|$(ROOTDIR)/lib|$(ROOTDIR)/%{_lib}|'
|
||||
find -name Makefile.in | xargs sed -i 's|$(EROOTDIR)/lib|$(EROOTDIR)/%{_lib}|'
|
||||
|
|
@ -89,9 +92,11 @@ find -name '*.lgt' -exec chmod 0644 '{}' ';'
|
|||
find -name '*.h' -exec chmod 0644 '{}' ';'
|
||||
find -name '*.c' -exec chmod 0644 '{}' ';'
|
||||
|
||||
(cd $RPM_BUILD_ROOT%{_libdir}; ln -sf libYap.so.%{version} libYap.so)
|
||||
|
||||
# move examples to docdir
|
||||
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
|
||||
mv $RPM_BUILD_ROOT%{_datadir}/Yap/examples $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
|
||||
#mv $RPM_BUILD_ROOT%{_datadir}/Yap/examples $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
|
||||
rm -rf $RPM_BUILD_ROOT%{_datadir}/Yap/clpbn/examples
|
||||
|
||||
%post
|
||||
|
|
@ -119,20 +124,18 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%{_bindir}/yap
|
||||
%{_datadir}/Yap
|
||||
%{_libdir}/Yap
|
||||
%{_libdir}/libYap.so
|
||||
%{_libdir}/libYap.so*
|
||||
%{_infodir}/*
|
||||
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%{_libdir}/libYap.a
|
||||
%{_libdir}/libYap.so
|
||||
%{_includedir}/Yap
|
||||
|
||||
|
||||
%files docs
|
||||
%defattr(-,root,root,-)
|
||||
%doc docs/*.html
|
||||
%doc docs/yap.pdf
|
||||
%doc LGPL/pillow/doc/pillow_doc_html/*
|
||||
%doc LGPL/pillow/doc/article.ps.gz
|
||||
%doc --parent Logtalk/manuals
|
||||
|
|
@ -140,13 +143,13 @@ rm -rf $RPM_BUILD_ROOT
|
|||
|
||||
|
||||
%changelog
|
||||
* Mon Jun 15 2009 Gerard Milmeister <gemi@bluewin.ch> - 5.1.3-1
|
||||
- new release 5.1.3
|
||||
|
||||
* Sun Mar 01 2009 Ralf Corsépius <corsepiu@fedoraproject.org> - 5.1.1-13
|
||||
- Add Yap-5.1.1-config.sub.patch:
|
||||
Upgrade outdated config.sub to fix rebuild breakdown on ppc64.
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1.1-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Fri Jul 11 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 5.1.1-11
|
||||
- fix license tag
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue