change SWI stuff to swi directory.

This commit is contained in:
Vitor Santos Costa 2013-03-05 15:50:38 -06:00
parent 263a1a548c
commit a5000dab32
55 changed files with 15540 additions and 3255 deletions

View File

@ -1,165 +0,0 @@
/* $Id$
Part of SWI-Prolog
Author: Jan Wielemaker
E-mail: wielemak@science.uva.nl
WWW: http://www.swi-prolog.org
Copyright (C): 1985-2006, University of Amsterdam
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
As a special exception, if you link this library with other files,
compiled with a Free Software compiler, to produce an executable, this
library does not by itself cause the resulting executable to be covered
by the GNU General Public License. This exception does not however
invalidate any other reasons why the executable file might be covered by
the GNU General Public License.
*/
:- module(pairs,
[ pairs_keys_values/3,
pairs_values/2,
pairs_keys/2,
group_pairs_by_key/2,
transpose_pairs/2,
map_list_to_pairs/3
]).
/** <module> Operations on key-value lists
This module implements common operations on Key-Value lists, also known
as _Pairs_. Pairs have great practical value, especially due to
keysort/2 and the library assoc.pl.
This library is based on disussion in the SWI-Prolog mailinglist,
including specifications from Quintus and a library proposal by Richard
O'Keefe.
@see keysort/2, library(assoc)
@author Jan Wielemaker
*/
%% pairs_keys_values(?Pairs, ?Keys, ?Values) is det.
%
% True if Keys holds the keys of Pairs and Values the values.
%
% Deterministic if any argument is instantiated to a finite list
% and the others are either free or finite lists. All three lists
% are in the same order.
%
% @see pairs_values/2 and pairs_keys/2.
pairs_keys_values(Pairs, Keys, Values) :-
( nonvar(Pairs) ->
pairs_keys_values_(Pairs, Keys, Values)
; nonvar(Keys) ->
keys_values_pairs(Keys, Values, Pairs)
; values_keys_pairs(Values, Keys, Pairs)
).
pairs_keys_values_([], [], []).
pairs_keys_values_([K-V|Pairs], [K|Keys], [V|Values]) :-
pairs_keys_values_(Pairs, Keys, Values).
keys_values_pairs([], [], []).
keys_values_pairs([K|Ks], [V|Vs], [K-V|Pairs]) :-
keys_values_pairs(Ks, Vs, Pairs).
values_keys_pairs([], [], []).
values_keys_pairs([V|Vs], [K|Ks], [K-V|Pairs]) :-
values_keys_pairs(Vs, Ks, Pairs).
%% pairs_values(+Pairs, -Values) is det.
%
% Remove the keys from a list of Key-Value pairs. Same as
% pairs_keys_values(Pairs, _, Values)
pairs_values([], []).
pairs_values([_-V|T0], [V|T]) :-
pairs_values(T0, T).
%% pairs_keys(+Pairs, -Keys) is det.
%
% Remove the values from a list of Key-Value pairs. Same as
% pairs_keys_values(Pairs, Keys, _)
pairs_keys([], []).
pairs_keys([K-_|T0], [K|T]) :-
pairs_keys(T0, T).
%% group_pairs_by_key(+Pairs, -Joined:list(Key-Values)) is det.
%
% Group values with the same key. Pairs must be a key-sorted list.
% For example:
%
% ==
% ?- group_pairs_by_key([a-2, a-1, b-4], X).
%
% X = [a-[2,1], b-[4]]
% ==
%
% @param Pairs Key-Value list, sorted to the standard order
% of terms (as keysort/2 does)
% @param Joined List of Key-Group, where Group is the
% list of Values associated with Key.
group_pairs_by_key([], []).
group_pairs_by_key([M-N|T0], [M-[N|TN]|T]) :-
same_key(M, T0, TN, T1),
group_pairs_by_key(T1, T).
same_key(M, [M-N|T0], [N|TN], T) :- !,
same_key(M, T0, TN, T).
same_key(_, L, [], L).
%% transpose_pairs(+Pairs, -Transposed) is det.
%
% Swap Key-Value to Value-Key and sort the result on Value
% (the new key) using keysort/2.
transpose_pairs(Pairs, Transposed) :-
flip_pairs(Pairs, Flipped),
keysort(Flipped, Transposed).
flip_pairs([], []).
flip_pairs([Key-Val|Pairs], [Val-Key|Flipped]) :-
flip_pairs(Pairs, Flipped).
%% map_list_to_pairs(:Function, +List, -Keyed)
%
% Create a key-value list by mapping each element of List.
% For example, if we have a list of lists we can create a
% list of Length-List using
%
% ==
% map_list_to_pairs(length, ListOfLists, Pairs),
% ==
:- meta_predicate
map_list_to_pairs(2, +, -).
map_list_to_pairs(Function, List, Pairs) :-
map_list_to_pairs2(List, Function, Pairs).
map_list_to_pairs2([], _, []).
map_list_to_pairs2([H|T0], Pred, [K-H|T]) :-
call(Pred, H, K),
map_list_to_pairs2(T0, Pred, T).

View File

@ -700,7 +700,7 @@ all: startup.yss
@INSTALL_DLLS@ (cd library/random; $(MAKE))
@INSTALL_DLLS@ (cd library/regex; $(MAKE))
@INSTALL_DLLS@ (cd library/rltree; $(MAKE))
@ENABLE_WINCONSOLE@ (cd LGPL/swi_console; $(MAKE))
@ENABLE_WINCONSOLE@ (cd swi/console; $(MAKE))
@INSTALL_DLLS@ (cd library/system; $(MAKE))
@INSTALL_DLLS@ (cd library/tries; $(MAKE))
@ENABLE_CLIB@ @INSTALL_DLLS@ (cd packages/clib; $(MAKE))
@ -740,7 +740,7 @@ yap-win: yap-win@EXEC_SUFFIX@
yapwin: yap-win@EXEC_SUFFIX@
yap-win@EXEC_SUFFIX@: $(PLCONS_OBJECTS) $(HEADERS) @YAPLIB@
(cd LGPL/swi_console; $(MAKE))
(cd swi/console; $(MAKE))
$(MPI_CC) -municode -DUNICODE -D_UNICODE $(EXECUTABLE_CFLAGS) $(LDFLAGS) -Wl,-subsystem,windows -o yap-win $(PLCONS_OBJECTS) plterm.dll @YAPLIB@ $(LIBS) @MPI_LIBS@
libYap.a: $(LIB_OBJECTS)
@ -842,7 +842,7 @@ install_win32: startup.yss @ENABLE_WINCONSOLE@ yap-win@EXEC_SUFFIX@
(cd library/regex; $(MAKE) install)
(cd library/rltree; $(MAKE) install)
(cd library/system; $(MAKE) install)
@ENABLE_WINCONSOLE@ (cd LGPL/swi_console; $(MAKE) install)
@ENABLE_WINCONSOLE@ (cd swi/console; $(MAKE) install)
@INSTALL_MATLAB@ (cd library/matlab; $(MAKE) install)
@ENABLE_REAL@ (cd packages/real; $(MAKE) install)
(cd library/tries; $(MAKE) install)
@ -883,11 +883,10 @@ install_data: install_copied_files install_bin
install_copied_files:
(cd library ; $(MAKE) install)
@ENABLE_MINISAT@ (cd packages/swi-minisat2; $(MAKE) install)
(cd LGPL ; $(MAKE) install)
(cd GPL ; $(MAKE) install)
(cd swi/library ; $(MAKE) install)
$(INSTALL_DATA) $(srcdir)/LGPL/pillow/icon_address.pl $(DESTDIR)$(SHAREDIR)/Yap/
$(INSTALL_DATA) $(srcdir)/LGPL/pillow/pillow.pl $(DESTDIR)$(SHAREDIR)/Yap/
@INSTALLCLP@(cd LGPL/clp ; $(MAKE) install)
@INSTALLCLP@(cd swi/library/clp ; $(MAKE) install)
(cd packages/CLPBN ; $(MAKE) install)
(cd packages/meld; $(MAKE) install)
(cd packages/xml; $(MAKE) install)
@ -914,7 +913,7 @@ clean: clean_docs
@INSTALL_DLLS@ (cd library/random; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/regex; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/rltree; $(MAKE) clean)
@ENABLE_WINCONSOLE@ (cd LGPL/swi_console; $(MAKE) clean)
@ENABLE_WINCONSOLE@ (cd swi/console; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/system; $(MAKE) clean)
@INSTALL_DLLS@ (cd library/tries; $(MAKE) clean)
@ENABLE_CLIB@ @INSTALL_DLLS@ (cd packages/clib; $(MAKE) clean)

18492
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -2479,9 +2479,7 @@ mkdir -p library/regex
mkdir -p library/system
mkdir -p library/tries
mkdir -p library/rltree
mkdir -p LGPL/clp
mkdir -p LGPL/swi_console
mkdir -p GPL
mkdir -p LGPL
mkdir -p packages/
mkdir -p packages/bdd
mkdir -p packages/clib
@ -2530,9 +2528,12 @@ mkdir -p packages/sgml
mkdir -p packages/xml
mkdir -p packages/zlib
mkdir -p packages/archive
mkdir -p swi
mkdir -p swi/console
mkdir -p swi/library
mkdir -p swi/library/clp
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([GPL/Makefile])
AC_CONFIG_FILES([library/Makefile])
AC_CONFIG_FILES([library/lammpi/Makefile])
AC_CONFIG_FILES([library/matlab/Makefile])
@ -2543,9 +2544,6 @@ AC_CONFIG_FILES([library/regex/Makefile])
AC_CONFIG_FILES([library/rltree/Makefile])
AC_CONFIG_FILES([library/system/Makefile])
AC_CONFIG_FILES([library/tries/Makefile])
AC_CONFIG_FILES([LGPL/Makefile])
AC_CONFIG_FILES([LGPL/clp/Makefile])
AC_CONFIG_FILES([LGPL/swi_console/Makefile])
AC_CONFIG_FILES([packages/Makefile.defs])
AC_CONFIG_FILES([packages/Dialect.defs])
AC_CONFIG_FILES([packages/CLPBN/Makefile])
@ -2555,6 +2553,9 @@ AC_CONFIG_FILES([packages/cplint/slipcase/Makefile])
AC_CONFIG_FILES([packages/meld/Makefile])
AC_CONFIG_FILES([packages/xml/Makefile])
AC_CONFIG_FILES([packages/ProbLog/Makefile ])
AC_CONFIG_FILES([swi/console/Makefile])
AC_CONFIG_FILES([swi/library/Makefile])
AC_CONFIG_FILES([swi/library/clp/Makefile])
if test "$ENABLE_CHR" = ""; then
AC_CONFIG_FILES([packages/chr/Makefile])

@ -1 +1 @@
Subproject commit d6fd44a4a8dbbb0bae9331c05191e12fc2727f1d
Subproject commit 8227ad57d54473b719d330632b8e3c5536776b71

7
LGPL/Makefile.in → swi/library/Makefile.in Executable file → Normal file
View File

@ -24,14 +24,19 @@ INSTALL_PROGRAM=@INSTALL_PROGRAM@
srcdir=@srcdir@
YAP_EXTRAS=@YAP_EXTRAS@
PROGRAMS= $(srcdir)/base64.pl \
PROGRAMS= \
$(srcdir)/aggregate.pl \
$(srcdir)/base64.pl \
$(srcdir)/broadcast.pl \
$(srcdir)/ctypes.pl \
$(srcdir)/date.pl \
$(srcdir)/debug.pl \
$(srcdir)/error.pl \
$(srcdir)/main.pl \
$(srcdir)/maplist.pl \
$(srcdir)/menu.pl \
$(srcdir)/nb_set.pl \
$(srcdir)/occurs.yap \
$(srcdir)/operators.pl \
$(srcdir)/option.pl \
$(srcdir)/pairs.pl \

View File

@ -22,17 +22,11 @@ INSTALL=@INSTALL@
INSTALL_DATA=@INSTALL_DATA@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
srcdir=@srcdir@
YAP_EXTRAS=@YAP_EXTRAS@
PROGRAMS= \
$(srcdir)/aggregate.pl \
$(srcdir)/ctypes.pl \
$(srcdir)/error.pl \
$(srcdir)/occurs.yap \
$(srcdir)/pairs.pl
PROGRAMS= $(srcdir)/clp_events.pl
install: $(PROGRAMS)
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap
for p in $(PROGRAMS); do $(INSTALL_DATA) $$p $(DESTDIR)$(SHAREDIR)/Yap; done
mkdir -p $(DESTDIR)$(SHAREDIR)/Yap/clp
for p in $(PROGRAMS); do $(INSTALL_DATA) $$p $(DESTDIR)$(SHAREDIR)/Yap/clp; done

View File

@ -0,0 +1,89 @@
/* $Id: clp_events.pl,v 1.1 2005-10-28 17:53:27 vsc Exp $
Part of SWI-Prolog
Author: Tom Schrijvers
E-mail: tom.schrijvers@cs.kuleuven.ac.be
WWW: http://www.swi-prolog.org
Copyright (C): 2005, K.U.Leuven
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
As a special exception, if you link this library with other files,
compiled with a Free Software compiler, to produce an executable, this
library does not by itself cause the resulting executable to be covered
by the GNU General Public License. This exception does not however
invalidate any other reasons why the executable file might be covered by
the GNU General Public License.
*/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Module for managing constraint solver events.
%
% Author: Tom Schrijvers
% E-mail: tom.schrijvers@cs.kuleuven.ac.be
% Copyright: 2005, K.U.Leuven
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:-module(clp_events,
[
notify/2,
subscribe/4,
unsubscribe/2
]).
notify(V,NMod) :-
( get_attr(V,clp_events,List) ->
notify_list(List,NMod)
;
true
).
subscribe(V,NMod,SMod,Goal) :-
( get_attr(V,clp_events,List) ->
put_attr(V,clp_events,[entry(NMod,SMod,Goal)|List])
;
put_attr(V,clp_events,[entry(NMod,SMod,Goal)])
).
unsubscribe(V,SMod) :-
( get_attr(V,clp_events,List) ->
unsubscribe_list(List,SMod,NList),
put_attr(V,clp_events,NList)
;
true
).
notify_list([],_).
notify_list([entry(Mod,_,Goal)|Rest],NMod) :-
( Mod == NMod ->
call(Goal)
;
true
),
notify_list(Rest,NMod).
unsubscribe_list([],_,_).
unsubscribe_list([Entry|Rest],SMod,List) :-
Entry = entry(_,Mod,_),
( Mod == SMod ->
List = Rest
;
List = [Entry|Tail],
unsubscribe_list(Rest,SMod,Tail)
).
attr_unify_hook(_,_).