documentation improvemeents
This commit is contained in:
parent
882eaca30c
commit
b7ae9cb45e
2
H/Yap.h
2
H/Yap.h
@ -104,7 +104,7 @@
|
||||
|
||||
typedef int _Bool;
|
||||
|
||||
#typedef bool _Bool;
|
||||
#define bool _Bool;
|
||||
|
||||
#define false 0
|
||||
#define true 1
|
||||
|
@ -767,7 +767,7 @@ COMMON(int) PL_qualify(term_t raw, term_t qualified);
|
||||
|
||||
static inline word
|
||||
setBoolean(bool *flag, term_t old, term_t new)
|
||||
{ int fl = *flag; if ( !PL_unify_bool_ex(old, &fl) ||
|
||||
{ int fl = *flag; if ( !PL_unify_bool_ex(old, fl) ||
|
||||
!PL_get_bool_ex(new, &fl) )
|
||||
fail;
|
||||
*flag = fl;
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
/** @defgroup CLPQR Constraint Logic Programming over Reals
|
||||
/** @defgroup clpr Constraint Logic Programming over Rationals and Reals
|
||||
@ingroup SWILibrary
|
||||
@{
|
||||
|
||||
@ -24,8 +24,8 @@ explicitely before using it:
|
||||
:- use_module(library(clpr)).
|
||||
~~~~~
|
||||
|
||||
@defgroup CLPR_Solver_Predicates Solver Predicates
|
||||
@ingroup CLPQR
|
||||
@defgroup CLPR_Solver_Predicates Solver Predicates
|
||||
@ingroup clpr
|
||||
@{
|
||||
|
||||
|
||||
@ -75,8 +75,8 @@ result in an exception.
|
||||
~~~~~
|
||||
|
||||
|
||||
@defgroup CLPR_Unification Use of unification
|
||||
@ingroup CLPQR
|
||||
@defgroup CLPR_Unification Use of unification
|
||||
@ingroup clpr
|
||||
@{
|
||||
|
||||
Instead of using the `{}/1` predicate, you can also use the standard
|
||||
@ -102,31 +102,34 @@ X = 5.0
|
||||
|
||||
|
||||
|
||||
@defgroup CLPR_NonhYlinear_Constraints Non-Linear Constraints
|
||||
@ingroup CLPQR
|
||||
@defgroup CLPR_NonhYlinear_Constraints Non-Linear Constraints
|
||||
@ingroup clpr
|
||||
@{
|
||||
|
||||
|
||||
In this version, non-linear constraints do not get solved until certain
|
||||
conditions are satisfied. We call these conditions the isolation axioms.
|
||||
conditions are satisfied. We call these conditions the _isolation_ axioms.
|
||||
They are given in the following table.
|
||||
|
||||
~~~~~
|
||||
A = B * C when B or C is ground or // A = 5 * C or A = B * 4 \\
|
||||
A and (B or C) are ground // 20 = 5 * C or 20 = B * 4 \\
|
||||
A = B * C when B or C is ground or // A = 5 * C or A = B * 4 \\
|
||||
A and (B or C) are ground // 20 = 5 * C or 20 = B * 4 \\
|
||||
|
||||
A = B / C when C is ground or // A = B / 3
|
||||
A and B are ground // 4 = 12 / C
|
||||
A and B are ground // 4 = 12 / C
|
||||
|
||||
X = min(Y,Z) when Y and Z are ground or // X = min(4,3)
|
||||
X = max(Y,Z) Y and Z are ground // X = max(4,3)
|
||||
X = abs(Y) Y is ground // X = abs(-7)
|
||||
X = min(Y,Z) when Y and Z are ground or // X = min(4,3)
|
||||
X = max(Y,Z) Y and Z are ground // X = max(4,3)
|
||||
X = abs(Y) Y is ground // X = abs(-7)
|
||||
|
||||
X = pow(Y,Z) when X and Y are ground or // 8 = 2 ^ Z
|
||||
X = exp(Y,Z) X and Z are ground // 8 = Y ^ 3
|
||||
X = Y ^ Z Y and Z are ground // X = 2 ^ 3
|
||||
X = Y ^ Z Y and Z are ground // X = 2 ^ 3
|
||||
|
||||
X = sin(Y) when X is ground or // 1 = sin(Y)
|
||||
X = cos(Y) Y is ground // X = sin(1.5707)
|
||||
X = cos(Y) Y is ground // X = sin(1.5707)
|
||||
X = tan(Y)
|
||||
~~~~~
|
||||
|
||||
@}
|
||||
|
||||
|
@ -58,7 +58,7 @@ PROJECT_LOGO = misc/icons/yap_96x96x32.png
|
||||
# entered, it will be relative to the location where doxygen was started. If
|
||||
# left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = ../doxout
|
||||
OUTPUT_DIRECTORY = /scratch/vitor/doxout
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
|
||||
# directories (in 2 levels) under the output directory of each output format and
|
||||
|
23
docs/yap.md
23
docs/yap.md
@ -901,8 +901,6 @@ being designed to work with the swig (@url(www.swig.org}) interface compiler.
|
||||
|
||||
@defgroup YAPProgramming Programming in YAP
|
||||
|
||||
@page Programming Programming in YAP
|
||||
|
||||
+ @ref Syntax
|
||||
|
||||
+ @ref Indexing
|
||||
@ -911,8 +909,6 @@ being designed to work with the swig (@url(www.swig.org}) interface compiler.
|
||||
|
||||
@defgroup SWILibrary SWI-Prolog Libraries and Packages
|
||||
|
||||
@page SWI The SWI-Prolog Library and Packages
|
||||
|
||||
+ @ref Read_Utilities Read Utilities
|
||||
|
||||
+ @ref shlib SWI-Prolog's shlib library
|
||||
@ -921,9 +917,9 @@ being designed to work with the swig (@url(www.swig.org}) interface compiler.
|
||||
|
||||
+ @ref archive
|
||||
|
||||
+ @ref CHR
|
||||
+ @ref chr
|
||||
|
||||
+ @ref CLPQR
|
||||
+ @ref clpr
|
||||
|
||||
+ @ref zlib
|
||||
|
||||
@ -931,7 +927,7 @@ being designed to work with the swig (@url(www.swig.org}) interface compiler.
|
||||
|
||||
@page Packages The YAP Packages
|
||||
|
||||
+ @ref REAL
|
||||
+ @ref real
|
||||
|
||||
+ @ref BDDs
|
||||
|
||||
@ -939,6 +935,19 @@ being designed to work with the swig (@url(www.swig.org}) interface compiler.
|
||||
|
||||
+ @ref MYDDAS
|
||||
|
||||
@defgroup http The SWI The SWI http packages
|
||||
|
||||
Tthe package HTTP is a series of libraries developed by Jan Wielmaker
|
||||
and the SWI-Prolog community for accessing and serving data on the
|
||||
web. It supports lower-level transport protocols, but also
|
||||
data-representation primitives, and more.
|
||||
|
||||
The port to YAP focussed on the client-side support. The server
|
||||
package has not been as widely tested.
|
||||
|
||||
|
||||
\toc
|
||||
|
||||
@page Compatibility Compatibility with Other Prolog systems
|
||||
|
||||
YAP has been designed to be as compatible as possible with
|
||||
|
@ -1,23 +1,4 @@
|
||||
|
||||
/** @defgroup LineUtilities Line Manipulation Utilities
|
||||
@ingroup YAPLibrary
|
||||
@{
|
||||
|
||||
This package provides a set of useful predicates to manipulate
|
||||
sequences of characters codes, usually first read in as a line. It is
|
||||
available by loading the library `library(lineutils)`.
|
||||
|
||||
|
||||
|
||||
@pred search_for(+ _Char_,+ _Line_)
|
||||
|
||||
|
||||
|
||||
Search for a character _Char_ in the list of codes _Line_.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
:- module(line_utils,
|
||||
[search_for/2,
|
||||
search_for/3,
|
||||
@ -35,6 +16,17 @@ Search for a character _Char_ in the list of codes _Line_.
|
||||
process/2
|
||||
]).
|
||||
|
||||
/** @defgroup LineUtilities Line Manipulation Utilities
|
||||
@ingroup YAPLibrary
|
||||
@{
|
||||
|
||||
This package provides a set of useful predicates to manipulate
|
||||
sequences of characters codes, usually first read in as a line. It is
|
||||
available by loading the library `library(lineutils)`.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
:- meta_predicate
|
||||
filter(+,+,2),
|
||||
file_filter(+,+,2),
|
||||
@ -48,6 +40,10 @@ Search for a character _Char_ in the list of codes _Line_.
|
||||
:- use_module(library(readutil),
|
||||
[read_line_to_codes/2]).
|
||||
|
||||
/**
|
||||
@pred search_for(+ _Char_,+ _Line_)
|
||||
Search for a character _Char_ in the list of codes _Line_.
|
||||
*/
|
||||
search_for(C,L) :-
|
||||
search_for(C, L, []).
|
||||
|
||||
@ -55,6 +51,12 @@ search_for(C) --> [C], !.
|
||||
search_for(C) --> [_],
|
||||
search_for(C).
|
||||
|
||||
/** @pred scan_integer(? _Int_,+ _Line_,+ _RestOfLine_)
|
||||
|
||||
Scan the list of codes _Line_ for an integer _Nat_, either a
|
||||
positive, zero, or negative integer, and unify _RestOfLine_ with
|
||||
the remainder of the line.
|
||||
*/
|
||||
scan_integer(N) -->
|
||||
"-", !,
|
||||
scan_natural(0, N0),
|
||||
@ -62,6 +64,12 @@ scan_integer(N) -->
|
||||
scan_integer(N) -->
|
||||
scan_natural(0, N).
|
||||
|
||||
/** @pred scan_natural(? _Nat_,+ _Line_,+ _RestOfLine_)
|
||||
|
||||
Scan the list of codes _Line_ for a natural number _Nat_, zero
|
||||
or a positive integer, and unify _RestOfLine_ with the remainder
|
||||
of the line.
|
||||
*/
|
||||
scan_natural(N) -->
|
||||
scan_natural(0, N).
|
||||
|
||||
@ -72,9 +80,31 @@ scan_natural(N0,N) -->
|
||||
get_natural(N1,N).
|
||||
scan_natural(N,N) --> [].
|
||||
|
||||
/** @pred split(+ _Line_,- _Split_)
|
||||
|
||||
Unify _Words_ with a set of strings obtained from _Line_ by
|
||||
using the blank characters as separators.
|
||||
*/
|
||||
split(String, Strings) :-
|
||||
split_at_blank(" ", Strings, String, []).
|
||||
|
||||
/** @pred split(+ _Line_,+ _Separators_,- _Split_)
|
||||
|
||||
|
||||
|
||||
Unify _Words_ with a set of strings obtained from _Line_ by
|
||||
using the character codes in _Separators_ as separators. As an
|
||||
example, consider:
|
||||
|
||||
~~~~~{.prolog}
|
||||
?- split("Hello * I am free"," *",S).
|
||||
|
||||
S = ["Hello","I","am","free"] ?
|
||||
|
||||
no
|
||||
~~~~~
|
||||
|
||||
*/
|
||||
split(String, SplitCodes, Strings) :-
|
||||
split_at_blank(SplitCodes, Strings, String, []).
|
||||
|
||||
@ -96,9 +126,28 @@ split(SplitCodes, [C|New], Set) -->
|
||||
split(SplitCodes, New, Set).
|
||||
split(_, [], []) --> [].
|
||||
|
||||
/** @pred fields(+ _Line_,- _Split_)
|
||||
|
||||
Unify _Words_ with a set of strings obtained from _Line_ by
|
||||
using the blank characters as field separators.
|
||||
|
||||
*/
|
||||
fields(String, Strings) :-
|
||||
fields(" ", Strings, String, []).
|
||||
|
||||
/** @pred fields(+ _Line_,+ _Separators_,- _Split_)
|
||||
|
||||
Unify _Words_ with a set of strings obtained from _Line_ by
|
||||
using the character codes in _Separators_ as separators for
|
||||
fields. If two separators occur in a row, the field is considered
|
||||
empty. As an example, consider:
|
||||
|
||||
~~~~~{.prolog}
|
||||
?- fields("Hello I am free"," *",S).
|
||||
|
||||
S = ["Hello","","I","am","","free"] ?
|
||||
~~~~~
|
||||
*/
|
||||
fields(String, FieldsCodes, Strings) :-
|
||||
dofields(FieldsCodes, First, More, String, []),
|
||||
(
|
||||
@ -118,16 +167,32 @@ dofields(FieldsCodes, [C|New], Set) -->
|
||||
dofields(FieldsCodes, New, Set).
|
||||
dofields(_, [], []) --> [].
|
||||
|
||||
/** @pred glue(+ _Words_,+ _Separator_,- _Line_)
|
||||
|
||||
Unify _Line_ with string obtained by glueing _Words_ with
|
||||
the character code _Separator_.
|
||||
*/
|
||||
glue([], _, []).
|
||||
glue([A], _, A) :- !.
|
||||
glue([H|T], [B|_], Merged) :-
|
||||
append(H, [B|Rest], Merged),
|
||||
glue(T, [B], Rest).
|
||||
|
||||
/** @pred copy_line(+ _StreamInput_,+ _StreamOutput_)
|
||||
|
||||
Copy a line from _StreamInput_ to _StreamOutput_.
|
||||
*/
|
||||
copy_line(StreamInp, StreamOut) :-
|
||||
read_line_to_codes(StreamInp, Line),
|
||||
format(StreamOut, '~s~n', [Line]).
|
||||
|
||||
|
||||
/** @pred filter(+ _StreamInp_, + _StreamOut_, + _Goal_)
|
||||
|
||||
For every line _LineIn_ in stream _StreamInp_, execute
|
||||
`call(Goal,LineIn,LineOut)`, and output _LineOut_ to
|
||||
stream _StreamOut_.
|
||||
*/
|
||||
filter(StreamInp, StreamOut, Command) :-
|
||||
repeat,
|
||||
read_line_to_codes(StreamInp, Line),
|
||||
@ -141,7 +206,11 @@ filter(StreamInp, StreamOut, Command) :-
|
||||
fail
|
||||
).
|
||||
|
||||
/** @pred process(+ _StreamInp_, + _Goal_)
|
||||
|
||||
For every line _LineIn_ in stream _StreamInp_, call
|
||||
`call(Goal,LineIn)`.
|
||||
*/
|
||||
process(StreamInp, Command) :-
|
||||
repeat,
|
||||
read_line_to_codes(StreamInp, Line),
|
||||
@ -155,6 +224,12 @@ process(StreamInp, Command) :-
|
||||
).
|
||||
|
||||
|
||||
/** @pred file_filter(+ _FileIn_, + _FileOut_, + _Goal_)
|
||||
|
||||
For every line _LineIn_ in file _FileIn_, execute
|
||||
`call(Goal,LineIn,LineOut)`, and output _LineOut_ to file
|
||||
_FileOut_.
|
||||
*/
|
||||
file_filter(Inp, Out, Command) :-
|
||||
open(Inp, read, StreamInp),
|
||||
open(Out, write, StreamOut),
|
||||
@ -162,6 +237,12 @@ file_filter(Inp, Out, Command) :-
|
||||
close(StreamInp),
|
||||
close(StreamOut).
|
||||
|
||||
/** @pred file_filter_with_initialization(+ _FileIn_, + _FileOut_, + _Goal_, + _FormatCommand_, + _Arguments_)
|
||||
|
||||
Same as file_filter/3, but before starting the filter execute
|
||||
`format/3` on the output stream, using _FormatCommand_ and
|
||||
_Arguments_.
|
||||
*/
|
||||
file_filter_with_initialization(Inp, Out, Command, FormatString, Parameters) :-
|
||||
open(Inp, read, StreamInp),
|
||||
open(Out, write, StreamOut),
|
||||
@ -169,5 +250,6 @@ file_filter_with_initialization(Inp, Out, Command, FormatString, Parameters) :-
|
||||
filter(StreamInp, StreamOut, Command),
|
||||
close(StreamInp),
|
||||
close(StreamOut).
|
||||
|
||||
|
||||
/**
|
||||
@}
|
||||
*/
|
||||
|
@ -125,8 +125,8 @@ PL_get_size_ex(term_t t, size_t *i)
|
||||
|
||||
|
||||
int
|
||||
PL_get_bool_ex(term_t t, int *i)
|
||||
{ if ( PL_get_bool(t, i) )
|
||||
PL_get_bool_ex(term_t t, int *ip)
|
||||
{ if ( PL_get_bool(t, ip) )
|
||||
succeed;
|
||||
|
||||
return PL_error(NULL, 0, NULL, ERR_TYPE, ATOM_bool, t);
|
||||
@ -209,7 +209,7 @@ PL_get_module_ex(term_t name, module_t *m)
|
||||
int
|
||||
PL_unify_bool_ex(term_t t, int val)
|
||||
{ GET_LD
|
||||
bool v;
|
||||
int v;
|
||||
|
||||
if ( PL_is_variable(t) )
|
||||
return PL_unify_atom(t, val ? ATOM_true : ATOM_false);
|
||||
|
@ -583,10 +583,7 @@ yes
|
||||
|
||||
|
||||
|
||||
@pred db_describe(+).
|
||||
|
||||
|
||||
|
||||
@pred db_describe(+)
|
||||
|
||||
The `db_describe/3` predicate does the same action as
|
||||
db_datalog_describe/2 predicate but with one major
|
||||
|
@ -1,16 +1,85 @@
|
||||
SOBJ= $(PACKSODIR)/prosqlite.$(SOEXT)
|
||||
CFLAGS+=-std=c99
|
||||
LIBS= -lsqlite3
|
||||
################################################################
|
||||
# Makefile template for SWI-Prolog PROSQLITE interface
|
||||
#
|
||||
# This template is used by configure to create Makefile. See
|
||||
# the file INSTALL for further installation instructions.
|
||||
#
|
||||
# License: LGPL
|
||||
#
|
||||
# Author: Nicos Angelopoulos & Jan Wielemaker (jan@swi.psy.uva.nl)
|
||||
################################################################
|
||||
|
||||
all: $(SOBJ)
|
||||
PACKAGE=prosqlite
|
||||
DOC=prosqlite
|
||||
include ../Makefile.defs
|
||||
|
||||
$(SOBJ): c/prosqlite.o
|
||||
mkdir -p $(PACKSODIR)
|
||||
$(LD) $(LDSOFLAGS) -o $@ $(SWISOLIB) $< $(LIBS)
|
||||
CFLAGS+= -I/usr/include -I.
|
||||
LDSOFLAGS+= -L/usr/lib
|
||||
|
||||
LIBS=-lgmp -lreadline -lncurses -lpthread -lresolv -lnss_dns -lnss_files -lcrypt -lstdc++ -lm -L/u/vitor/lib -ldl -lnsl
|
||||
NETLIBS=@NETLIBS@
|
||||
|
||||
LIBPL= prolog/prosqlite.pl
|
||||
TARGETS= prosqlite.so
|
||||
|
||||
PROSQLITEOBJ= prosqlite.o
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
nolib::
|
||||
@echo "WARNING: Could not find sqlite library; skipped"
|
||||
|
||||
|
||||
prosqlite.o: $(srcdir)/c/prosqlite.c
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
prosqlite.so: $(PROSQLITEOBJ)
|
||||
$(LD) $(LDSOFLAGS) -o $@ $(AROBJ) -lsqlite3 -lgmp -lreadline -lncurses -lpthread -lresolv -lnss_dns -lnss_files -lcrypt -lstdc++ -lm -L/u/vitor/lib -ldl -lnsl $(LIBPLSO)
|
||||
|
||||
install: $(TARGETS) $(addprefix $(srcdir)/, $(LIBPL)) install-examples
|
||||
mkdir -p $(DESTDIR)$(SOLIBDIR)
|
||||
for f in $(TARGETS); do \
|
||||
[ "$$f" = nolib ] || $(INSTALL_PROGRAM) $$f $(DESTDIR)$(SOLIBDIR); \
|
||||
done
|
||||
mkdir -p $(DESTDIR)$(PLLIBDIR)
|
||||
for f in $(LIBPL); do \
|
||||
$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(PLLIBDIR); \
|
||||
done
|
||||
$(MKINDEX)
|
||||
|
||||
ln-install::
|
||||
@$(MAKE) INSTALL_DATA='../ln-install' INSTALL_PROGRAM='../ln-install' install
|
||||
|
||||
rpm-install: install
|
||||
|
||||
html-install::
|
||||
mkdir -p $(DESTDIR)$(PKGDOCDIR)
|
||||
$(INSTALL) -m 644 $(DOC).html $(DESTDIR)$(PKGDOCDIR)
|
||||
|
||||
pdf-install::
|
||||
mkdir -p $(DESTDIR)$(PKGDOCDIR)
|
||||
$(INSTALL) -m 644 $(DOC).pdf $(DESTDIR)$(PKGDOCDIR)
|
||||
|
||||
nnuninstall::
|
||||
(cd $(SOLIBDIR) && rm -f $(TARGETS))
|
||||
(cd $(PLLIBDIR) && rm -f $(LIBPL))
|
||||
$(PL) -f none -g make -t halt
|
||||
|
||||
################################################################
|
||||
# Check
|
||||
################################################################
|
||||
|
||||
check::
|
||||
install::
|
||||
|
||||
|
||||
################################################################
|
||||
# Clean
|
||||
################################################################
|
||||
|
||||
clean:
|
||||
rm -f c/prosqlite.o
|
||||
distclean: clean
|
||||
rm -f $(SOBJ)
|
||||
rm -f $(AROBJ) *~ *.o *% a.out core config.log
|
||||
|
||||
distclean: clean
|
||||
rm -f $(TARGETS) config.cache config.h config.status Makefile
|
||||
rm -f $(DOC).aux $(DOC).log $(DOC).out $(DOC).toc
|
||||
rm -rf autom4te.cache
|
||||
|
Reference in New Issue
Block a user