Giter Site home page Giter Site logo

swi-prolog / swipl-devel Goto Github PK

View Code? Open in Web Editor NEW
902.0 47.0 166.0 97.82 MB

SWI-Prolog Main development repository

Home Page: http://www.swi-prolog.org

License: Other

Prolog 39.23% Shell 0.65% HTML 0.46% Makefile 0.01% Scilab 0.14% C 47.21% Perl 0.01% TeX 0.05% Batchfile 0.01% M4 0.01% Roff 0.32% DIGITAL Command Language 0.01% CMake 1.53% JavaScript 0.39% OpenEdge ABL 9.97% Python 0.01%
swi-prolog prolog logic-programming

swipl-devel's Introduction

CI

SWI-Prolog: A comprehensive Prolog implementation

SWI-Prolog is an open source (BSD-2) implementation of the Prolog language with many extensions. It is implemented in C (version 11) and Prolog and is available for many platforms (Linux, practically any POSIX like system, MacOS, Windows). All CPUs supported by Debian Linux are supported. A prototype running in your browser based on WASM (Web Assembly) is available.

(SWI-)Prolog is a versatile language. It is being used for business rule validation, natural language processing, software verification, software refactoring, network configuration, security, robotics, reasoning in legal and medical domains, graph processing, machine learning (ILP, PLP), linked data (RDF), mathematical proofs, and much more.

If you are interested in commercial assistence to make SWI-Prolog work in your organization, please contact SWI-Prolog Solutions b.v..

Forking, cloning and submitting patches

This repository uses many Git submodules. This causes the common issue that fork and clone doesn't work. Instead, clone from https://github.com/SWI-Prolog/swipl-devel.git and then associate your clone with your fork (replace me with your github user name).

git clone https://github.com/SWI-Prolog/swipl-devel.git
cd swipl-devel
git submodule update --init
git remote add myfork [email protected]:me/swipl-devel.git

See How to submit a patch for details.

See also the discussion at Being friendly to quick contributions

Building

See CMAKE.md and Build SWI-Prolog from source

Web home

Please find the up-to-date information on SWI-Prolog at https://www.swi-prolog.org.

Trying SWI-Prolog online

An online version of SWI-Prolog is provided by SWISH. Note that this version is subject to sandbox restrictions and does not provide the features most valued in SWI-Prolog such as its rich set of interfaces, multi-threading, modules, etc.

Alternatively, there is a WASM (Web Assembly) version available at http://dev.swi-prolog.org/wasm/shell. This version has no sandbox restrictions. The WASM build allows interaction with the browser's DOM, so it allows for interactive Prolog applications running inside the browser. It is otherwise rather limited though.

Forum/mailing list

Our forum is hosted at a Discourse site. The forum provides a mail list interface.

Documentation

Documentation is available from several locations and in several formats.

  • Several tutorials can be accessed from the Tutorials menu on the home page

  • A HTML version of the documentation is in the doc/Manual directory of the installation. Note that some packagers put this documentation elsewhere or require it to be installed separately.

    These docs can be searched using ?- apropos("query").. Help on a predicate can be disaplayed using e.g., ?- help(append/3).

  • A PDF version of the documentation is available from the download page

You can also install the website locally to use its complete functionality if you are offline. It is available at https://github.com/SWI-Prolog/plweb.

swipl-devel's People

Contributors

abramo-bagnara avatar anionic avatar borisvassilev avatar cmsmcq avatar dgelessus avatar dmchurch avatar dtonhofer avatar edisonm avatar eshelyaron avatar fnogatz avatar github-cygwin avatar janwielemaker avatar jeswr avatar johanromme avatar kamahen avatar keriharris avatar lyzardking avatar madler avatar mgondan avatar mifigiel avatar mndrix avatar pmoura avatar ridgeworks avatar rla avatar saarland47 avatar sddu avatar teamspoon avatar triska avatar uwn avatar wouterbeek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swipl-devel's Issues

`pack_install/[1,2]` hangs when SWI is started from Applications on OS X

The pack_install(Pack) hangs with any pack on OS X if SWI is started from Applications. It creates an empty directory under ~/lib/swipl/pack but does not install pack files. It does not hang and installs the pack correctly when started from Terminal as swipl command. Version 7.1.29. As I do not have permanent access to a Mac, I cannot debug further.

Space handling in SGML parser

Option for space handling does not seem to have any effect on parsing SGML.

Reproducible example:

?- [library(sgml)].
?- [library(http/http_open)].
?- IRI = 'https://lists.w3.org/Archives/Public/w3c-rdfcore-wg'.
?- load_structure($IRI, Dom, [space(preserve)]).
Dom = [element(html, [...], ['\n', ...
?- load_structure($IRI, Dom, [space(sgml)]).
Dom = [element(html, [...], ['\n', ...
?- load_structure($IRI, Dom, [space(default)]).
Dom = [element(html, [...], ['\n', ...
?- load_structure($IRI, Dom, [space(remove)]).
Dom = [element(html, [...], ['\n', ...

GMP binding: truncated integer root

Please add support for the GMP function mpz_root.

For the binding, I suggest the Prolog predicate integer_nth_root(I, N, R, Exact), with description:

integer_nth_root(+I, +N, ?R, ?Exact)

R is the truncated integer part of the N-th root of the integer I.

Exact is true if the computation was exact, i.e., R^N =:= I, otherwise Exact is false.

Examples:

?- integer_nth_root(10, 3, Root, Exact).
Root = 2,
Exact = false.

?- integer_nth_root(27, 3, Root, Exact).
Root = 3,
Exact = true.

This functionality is needed for example in the propagation of the CLP(FD) constraints multiplication and exponentiation, and the GMP binding allows us to simplify and speed up some of the current code.

[Semweb] Support for loading RDF data in datasets.

When loading RDF data from serialization formats supporting RDF datasets (Trig, N-Quads), some RDF triples belong to a specified RDF graph or to the default graph (if not graph is specified).

Currently, the relationships between (1) the file containing the multi-graph serialization, and (2) the graphs imported from that file is not accessible via rdf_graph_property/2.

For example:

?- rdf_graph(G), !, rdf_graph_property(G,P).
G = 'http://www.lexvo.org/data/term/kir/%D0%B8%D1%81%D0%BF%D0%B0%D0%BD%D1%87%D0%B0',
P = hash('70ecb85395368b8e6b90a29bcad0a417') ;
G = 'http://www.lexvo.org/data/term/kir/%D0%B8%D1%81%D0%BF%D0%B0%D0%BD%D1%87%D0%B0',
P = modified(true) ;
G = 'http://www.lexvo.org/data/term/kir/%D0%B8%D1%81%D0%BF%D0%B0%D0%BD%D1%87%D0%B0',
P = triples(7).

The source and source_last_modified properties are missing.

Version number for latest stable release

Hi,

Is there a web page where I can find the version number for the latest stable release?
https://github.com/SWI-Prolog/swipl-devel/blob/master/VERSION lists a different version number from https://github.com/SWI-Prolog/swipl-devel/blob/master/README, which is different from from http://www.swi-prolog.org/Download.html ("7.2.x"). There are also git repository tags, but they also differ (branch V732? tag XPCE-? rel-?).

Specifically, I'm trying to extract the version number automatically, so that I can package the latest stable version of SWI-Prolog for Arch Linux relatively quickly after a release has been made, but I can't find a good URL to use as a source for the version number.

Best regards,
Alexander F Rรธdseth

Error compiling without GMP or MT

I'm trying to make the tiniest version possible of SWI-Prolog to embed it, but I'm having problems configuring with "--disable-gmp" or "--disable-mt".

If I disable GMP, I get errors in "pl-gmp.c", regarding "V_MPZ", "V_MPQ" and lots of undeclared identifiers.

If I disable MT, I get errors in "pl-atom.c", with nasty stuff requiring an item named "thread" in "struct PL_local_data".

Undefined procedure: prolog_ide_stack:predsort/3

I get this error when using gtrace/0 to debug code on Mac OS X in version 7.1.23.

Query:

?- gtrace, main.

Error:

ERROR: prolog_ide_stack:display_levels/3: Undefined procedure: prolog_ide_stack:predsort/3

Goal stack:

 [65] generate_current_predicate(_G1929, _G1926, predsort)
 [58] setof(_G1926:predsort, '$dwim':current_predicate(_G1929, _G1926:predsort), _G2222)
 [54] setup_call_catcher_cleanup('$bags':'$new_findall_bag', '$bags':findall_loop(_G1904, '$messages':dwim_predicate(prolog_ide_stack:predsort, _G1904), _G1914, []), _G2222, '$bags':'$destroy_findall_bag')
 [44] print_message(error, error(existence_error(procedure, prolog_ide_stack:predsort/3), context(prolog_ide_stack:display_levels/3, _G1871)))
 [42] pce_principal:send(@17582044230985/prolog_debugger, show_stack([frame(708, call), frame(683, 52), frame(658, 52), frame(633, 52), frame(608, 52), frame(..., ...)|...], []))

C stack:

C-stack trace labeled "INT":
  [0] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(save_backtrace+0x65) [0x104b1169f]
  [1] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(interruptHandler+0x230) [0x104acdaac]
  [2] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(dispatch_signal+0x371) [0x104ac969c]
  [3] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(handleSignals+0x84) [0x104ac92c2]
  [4] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(PL_next_solution+0x3c78) [0x104a70845]
  [5] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(PL_call_predicate+0x1c) [0x104a7f30e]
  [6] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(printMessage+0x179) [0x104a8ab55]
  [7] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(PL_next_solution+0x9d5b) [0x104a76928]
  [8] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(callProlog+0x14c) [0x104ab263c]
  [9] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(pl_notrace1+0x3f) [0x104ab24d7]
  [10] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(PL_next_solution+0x6ed4) [0x104a73aa1]
  [11] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(tracePort+0x932) [0x104acb509]
  [12] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(PL_next_solution+0xaa70) [0x104a7763d]
  [13] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(query_loop+0x13a) [0x104ab2255]
  [14] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(prologToplevel+0x51) [0x104ab285d]
  [15] [...]/lib/swipl-7.1.23/lib/x86_64-darwin14.0.0/libswipl.dylib(PL_toplevel+0x1e) [0x104a7fbda]
  [16] [...]/bin/swipl(main+0x35) [0x104a5ff1d]
  [17] /usr/lib/system/libdyld.dylib(start+0x1) [0x7fff987185c9]

Segmentation fault

Given the program

foo(1).
foo(2).
bar(A) :-
  A \== B,
  foo(B),
  bar(_).

the query ?- bar(1) results in a crash. GDB stack trace for the latest version from git:

?- bar(1).

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b15202 in do_compare (__PL_ld=0x7ffff7dda3e0 <PL_local_data>, eq=1, agenda=0x7fffffffd8d0) at pl-prims.c:1581
1581        deRef(p2); w2 = *p2;
(gdb) bt
#0  0x00007ffff7b15202 in do_compare (__PL_ld=0x7ffff7dda3e0 <PL_local_data>, eq=1, agenda=0x7fffffffd8d0) at pl-prims.c:1581
#1  compareStandard (p1=<optimized out>, p2=p2@entry=0x7d0008, eq=eq@entry=1, __PL_ld=__PL_ld@entry=0x7ffff7dda3e0 <PL_local_data>) at pl-prims.c:1707
#2  0x00007ffff7addaa4 in PL_next_solution (qid=qid@entry=21) at pl-vmi.c:1355
#3  0x00007ffff7b1857e in query_loop (goal=goal@entry=24965, loop=1) at pl-pro.c:101
#4  0x00007ffff7b18d00 in prologToplevel (goal=goal@entry=24965) at pl-pro.c:402
#5  0x00007ffff7ad78dd in PL_toplevel () at pl-fli.c:3903
#6  0x000000000040088d in main (argc=1, argv=0x7fffffffe1d8) at pl-main.c:116

term_expansion + predicate_property + autoload = infinite loop

Consider the following file bugs.pl:

:- module(bugs,[]).
term_expansion(_,_) :-
    writeln(x),
    predicate_property(bugs:otherwise,imported_from(_)),
    fail.

Loading it with swipl -f none -s bugs.pl produces an infinite list of "x" characters and never loads the top level.

Replacing otherwise with a predicate which is not autoloaded fixes the problem. Alternatively, testing for current_predicate(bugs:otherwise/0) before calling predicate_property also fixes the problem. Alternatively, testing for the property autoload(_) or dynamic (perhaps others) fixes the problem.

I poked around in the term expansion code for the cause of this infinite loop, but didn't see anything obvious. I'll just use one of these workarounds for now.

pack_install does two things

pack_install registers packs with the swi-prolog.org website when they're first installed.

This is a royal pain for pack developers. Usually one has some struggles getting proper pack zip file structure, etc etc and each time one attempts that final pack_install step it contaminates the version number. There needs to be a way to make it possible for pack developers to try before they buy.

Additionally, it's confusing for first time pack developers that pack_install does something besides install the pack on their local machine.

I propose pack_try/1, which does all the steps of pack_install except for installing locally and announcing to the outside world. If pack_try/1 succeeds, pack_register/1 would be guaranteed to succeed.

Broken documentation link

On this page, the link in the sentence below is broken.

See also :</2, which can be used to test for existence and unify multiple key values from a dict.

Global stack allocation sometimes exceeds specified limit

SWI-Prolog sometimes allocates more global stack than specified with the -G option.

For example, with euler_172.pl on a 64-bit machine (tested with Debian 8.1 and OSX Yosemite), I get:

$ swipl -f euler_172.pl  -G5M
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.3.2)
Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

?- run(7), statistics.
len_num(7, 8754480).
% Started at Tue Jul 14 23:24:16 2015
% 2.500 seconds cpu time for 13,823,938 inferences
% 6,860 atoms, 4,208 functors, 3,250 predicates, 57 modules, 153,713 VM-codes
% 
%                        Limit    Allocated       In use
% Local  stack:    268,435,456       61,440        1,832 Bytes
% Global stack:      5,242,880    6,287,344        1,344 Bytes
% Trail  stack:    268,435,456    2,095,096        2,632 Bytes
% 
% 130 garbage collections gained 148,676,256 bytes in 0.471 seconds.
% Stack shifts: 2 local, 11 global, 10 trail in 0.001 seconds
% 1 threads, 0 finished threads used 0.000 seconds

A slightly more extreme example is:

swipl -O -f euler_172.pl -G26G -T4G -g "run(18),statistics,halt"

Yielding:

len_num(18, 227485267000992000).
% Started at Mon Jul 13 11:42:12 2015
% 35257.269 seconds cpu time for 113,872,091,044 inferences
% 6,174 atoms, 3,962 functors, 3,205 predicates, 52 modules, 147,218 VM-codes
% 
%                        Limit    Allocated       In use
% Local  stack:    268,435,456      126,976        1,792 Bytes
% Global stack: 27,917,287,424 34,359,734,256 14,435,913,504 Bytes
% Trail  stack:  4,294,967,296 4,294,965,240        2,256 Bytes
% 
% 589 garbage collections gained 1,465,242,723,928 bytes in 13010.921 seconds.
% Stack shifts: 2 local, 32 global, 27 trail in 0.411 seconds
% 1 threads, 0 finished threads used 0.000 seconds

Such exceeding allocations can lead to unexpected OS swapping and also to unexpected termination of the process (or other processes) even in situations where there would have been enough RAM to perform the intended computation within the specified stack limits.

If possible, please throw a Prolog exception instead of exceeding the specified limits. Thank you!

Submodules aren't fetched by prepare script

The location of submodules is specified relatively to the local repository, thus when running, for example, git submodule update --init --merge or similar commands, the submodules aren't found (git will search for them on the local file system).

After modifying .gitmodules file by replacing ../ with https://github.com/SWI-Prolog/ (such as to make the URL absolute), Git is able to resolve submodules.

"Out of global stack" although trail stack is primarily responsible

When I do, with SWI 7.3.2 (64-bit):

$ swipl -T1m -g "length(_,E),L is 2^E,write(L),write(' '),length(Ls,L), ignore((maplist(=(a),Ls),false)),false"

then I get:

1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 
ERROR: Prolog initialisation failed:
ERROR: Out of global stack

However, with the same amount of global stack, and just increasing the trail stack size, I get:

$ swipl -T2m -g "length(_,E),L is 2^E,write(L),write(' '),length(Ls,L), ignore((maplist(=(a),Ls),false)),false"
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288
ERROR: Prolog initialisation failed:
ERROR: Out of global stack

and increasing only the trail stack even further, I get:

$ swipl -T3m -g "length(_,E),L is 2^E,write(L),write(' '),length(Ls,L), ignore((maplist(=(a),Ls),false)),false"
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152

yet, still ending with:

ERROR: Prolog initialisation failed:
ERROR: Out of global stack

Thus, the trail stack is what should have been increased to get further solutions with this program.

If possible, please adapt the error message to reflect this. Thank you!

relative prefix url in turtle parser

Jan,

The following turtle file

@base http://example.com/foo/ .
@Prefix ns: <../bar/> .
ns:a ns:b ns:c .

Results in a triple with /foo/../bar/ URLs while I expected just /bar/ :+1:
:- rdf(A,B,C).
A = 'http://example.com/foo/../bar/a',
B = 'http://example.com/foo/../bar/b',
C = 'http://example.com/foo/../bar/c'.

Is this a bug in the prefix handling of the turtle parser?

Jacco

PS: the STW thesaurus uses this kind of relative urls, see http://zbw.eu/stw/versions/latest/about
http://zbw.eu/stw/versions/latest/download/stw.ttl.zip

Prolog Navigator and non-prolog files

With an increasing use of SWI-Prolog for web development we're all dealing with more files of other types. My current project has everything from ttl files to javascript

Would it make sense for Prolog Navigator to show all file types (or possibly all that match some user settable rule - e.g. emacs backup files could be ignored)?

PL_initialise and getopt()

Hello devels,

Just inquiring: is there any particular reason not to use getopt(argc, argv, "opts") or getopt_long in function PL_initialise()?

Thanks. (can't seem to label this. Is a question label)

Segmentation fault in garbage collection

Given the program

foo(bar) :-
  foo(_),
  L = [X|X].

the query ?- foo(bar) results in a segmentation fault using SWI-Prolog 6.6.6, 7.1.23, and the latest version from the swipl-devel repository. This happens with both Linux and Windows versions. Prolog reports

[FATAL ERROR: Received signal 11 (segv) while in 2-th garbage collection]

Below is the stack trace shown by GDB.

?- foo(bar).

Program received signal SIGSEGV, Segmentation fault.
into_relocation_chain (current=current@entry=0x7cafb8, stg=stg@entry=16, __PL_ld=__PL_ld@entry=0x7ffff7dda3e0 <PL_local_data>) at pl-gc.c:2140
2140      set_value(current, get_value(head));
(gdb) bt
#0  into_relocation_chain (current=current@entry=0x7cafb8, stg=stg@entry=16, __PL_ld=__PL_ld@entry=0x7ffff7dda3e0 <PL_local_data>) at pl-gc.c:2140
#1  0x00007ffff7b05bf8 in sweep_frame (__PL_ld=0x7ffff7dda3e0 <PL_local_data>, slots=1, fr=0x7caf70) at pl-gc.c:2505
#2  sweep_environments (fr=0x7caf70, PC=<optimized out>) at pl-gc.c:2541
#3  0x00007ffff7b07a3b in sweep_stacks (state=0x7fffffffda50) at pl-gc.c:2594
#4  collect_phase (saved_bar_at=0x7d3ef0, state=0x7fffffffda50) at pl-gc.c:2927
#5  garbageCollect () at pl-gc.c:3810
#6  0x00007ffff7b088d5 in ensureGlobalSpace (cells=<optimized out>, cells@entry=0, flags=flags@entry=1) at pl-gc.c:4013
#7  0x00007ffff7ae779e in PL_next_solution (qid=qid@entry=21) at pl-vmi.c:254
#8  0x00007ffff7b1a8bf in query_loop (goal=goal@entry=24965, loop=1) at pl-pro.c:101
#9  0x00007ffff7b1b07f in prologToplevel (goal=goal@entry=24965) at pl-pro.c:405
#10 0x00007ffff7ad8205 in PL_toplevel () at pl-fli.c:3903
#11 0x000000000040092d in main (argc=1, argv=0x7fffffffe248) at pl-main.c:116

Consistent and preferred use of `?` i.o. `*` in meta-predicate declarations

meta_predicate documents * as a variant of ? that is support for backwards-compatibility reasons only. In addition, predicate_property/2 displays ? for arguments declarated with *.

For consistency it would be better to display ? i.o. * in meta-predicate suggestions from swipl, such as the following:

% Found new meta-predicates in iteration 1 (0.155 sec)
% :- meta_predicate dcg_list:dcg_list_item(3,*,*,?,*,?).

setting/4 behaving oddly

Here's a file:

:- setting(foo, atom, blah, 'foo setting'). 
:-setting(debug_port, number, 7777, 'Port to run server on'). 

When I start SWI-Prolog I get:

ERROR: c:/docs/prolog/educationaboutprolog/ludumdare32/debug_start.pl:1: 
Wrong context: setting/4 can only be used in a directive
Warning: c:/docs/prolog/educationaboutprolog/ludumdare32/debug_start.pl:1: 
Goal (directive) failed: user:setting(foo,atom,blah,'foo setting') 
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.1.35-9-g55e4738) 
Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam 
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software, 
and you are welcome to redistribute it under certain conditions. 
Please visit http://www.swi-prolog.org for details. 

For help, use ?- help(Topic). or ?- apropos(Word). 

1 ?-

This also works with the first line only, or the second non-blank line only.

If I add a blank and C-s C-c C-m it, it compiles fine. If I then exit SWI-Prolog and double click load it, it gives the same error. Inspection of the file with another editor (Notepad++) with a 'show all symbols' feature that makes everything printable doesn't reveal any hidden odd characters.

bafflement abounds.

baffle... baffle... baffle....

eazar001 reports this is reproducible on 7.1.36 linux

netherlands swi-prolog.org site failing breaks pack_install

The swi-prolog.org site is down this morning.

we can tell humans to go to us.swi-prolog.org and it's only 'we're an OS project, if you don't like it help get CDN running', but this morning all our setup scripts are broken because they call pack_install, which tries the main site.

Good reason to increase priority of getting CDN running

SWI-Prolog crashes

On Windows 7 SP1
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.1.29-5-g0a3d88a)

eazar001/yesbot@7bb1519

Reliably crashes (about 75% of time - it's probably a race condition) SWI-Prolog. Attached is a screen shot of it dying.
prologcrash

We're currently debugging yesbot, more info forthcoming with eazar001/yesbot#2

Use of http_open/3 predicate causes memory leak with repeated usage

OS : Arch Linux 32-bit swi-prolog 7.1.26 built from sources

  1. Start swi-prolog
  2. Query http_open('http://www.microsoft.com', Stream, []), read_stream_to_codes(Stream, Codes), string_codes(String, Codes).
  3. Repeat steps 1, 2, and 3.

EXPECTED: I expect that repeating requests as described above will unify String with the Codes ouput and eventually return memory allocated for String back to the system.

OBSERVED: Repeating request like this will actually consistently eat memory. I can observe this behavior simply by running 'top' in another window while executing the code.

RELIABILITY: I can reliably reproduce this issue so long as I am converting the code list into a string, atom, etc. This behavior can also be observed when utilizing the http_get/3 predicate.

-- Thank you for your time consideration.

Use user:portray for assertion errors.

Assertion errors print the offending assertion using format('~q', ...). This is problematic for large terms. Can this be changed to format('~p', ...). Will submit PR when I get a change to rebuild on my machine.

prolog:message(assertion_failed(_, G)) -->
[ 'Assertion failed: ~q'-[G] ].

?- listing(load_foreign_library). "Evolves" perhaps due to autoloading

?- listing(load_foreign_library). "Evolves" perhaps due to autoloading

Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.3.10)
Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

?- listing(load_foreign_library).
:- meta_predicate prolog_listing:load_foreign_library(:).

prolog_listing:load_foreign_library(A) :-
        load_foreign_library(A, default(install)).

:- meta_predicate prolog_listing:load_foreign_library(:,+).

prolog_listing:load_foreign_library(B:A, C) :-
        with_mutex('$foreign', load_foreign_library(A, B, C)).

true.

?- listing(load_foreign_library).
:- meta_predicate shlib:load_foreign_library(:).

shlib:load_foreign_library(A) :-
        load_foreign_library(A, default(install)).

:- meta_predicate shlib:load_foreign_library(:,+).

shlib:load_foreign_library(B:A, C) :-
        with_mutex('$foreign', load_foreign_library(A, B, C)).

shlib:load_foreign_library(A, _, _) :-
        current_library(A, _, _, _, _), !.
shlib:load_foreign_library(A, B, F) :-
        retractall(error(_, _)),
        find_library(A, C, E),
        asserta(loading(A)),
        retractall(foreign_predicate(A, _)),
        catch(B:open_shared_object(C, G), D, true),
        (   nonvar(D)
        ->  delete_foreign_lib(E, C),
            assert(error(C, D)),
            fail
        ;   delete_foreign_lib(E, C)
        ), !,
        (   entry(A, F, H),
            call(B:call_shared_object_function(G, H))
        ->  retractall(loading(A)),
            assert_shlib(A, H, C, B, G)
        ;   foreign_predicate(A, _)
        ->  retractall(loading(A))
        ;   retractall(loading(A)),
            retractall(foreign_predicate(A, _)),
            close_shared_object(G),
            findall(H, entry(A, F, H), I),
            throw(error(existence_error(foreign_install_function,
                                        install(C, I)),
                        _))
        ).
shlib:load_foreign_library(A, _, _) :-
        retractall(loading(A)),
        (   error(_, B)
        ->  retractall(error(_, _)),
            throw(B)
        ;   throw(error(existence_error(foreign_library, A), _))
        ).

true.

?-

I confirmed this happens before and after my other pull request .. And I think this is a linux-only issue. I am creating this issue so if someone wants to fix this before me they are aware of it

pack_remove/1 should not try to delete contents from symlinked directories

pack_remove uses delete_directory_and_contents/1 which descends into symlinked directories and attempts to delete their contents. Packs from tar and git sources could contain symlinks. Symlinks should be removed but not their targets.

I would add a big warning to delete_directory_and_contents/1 documentation about symlinks too.

pack_install: cannot install from local directory containing a version number

Clause

pack_default_options(Dir, Pack, _, Options) :- % Install from directory
should come before the previous clause, otherwise

pack_version_file(Pack, Version, URL),
download_url(URL)

succeeds when URL is a local directory containing a version identifier such as testpack/standalone-0.0.1. Currently it results in error:

ERROR: Domain error: `url' expected, found `'testpack/standalone-0.0.1''

Directory without a version number inside the name does not cause the issue.

read/1 seems to not work correctly?

Running

run(X) :- read(X).

results in the interpreter asking you to enter a prolog term, but after ~5 characters the message "** Execution aborted **" appears.

This on Firefox 34.0

Top level reports negative changes in clause number

... on commit 4edc7c0, pretty much always. For example, loading a source file with exactly one predicate in it:

foo.pl

foo :- true

Then, load it:

?- [foo].
true.

Then, change it to:

foo :- fail.
?- make.
% Updating index for library /home/boris/lib/swipl-7.3.12/library/
% /home/boris/code/foo compiled 0.00 sec, -1 clauses

If you keep on alternating the two definitions, make will always report "-1 clauses".

You will get bigger negative numbers if you make bigger edits.

Typo in documentation theYr should be theIr

A small thing I encountered when reading the online documentation here:
http://www.swi-prolog.org/pldoc/doc_for?object=section%283,%274.16.1%27,swi%28%27/doc/Manual/IO.html%27%29%29

Newly created threads inherit these stream aliases from theyr parent. 
-----------------------------------------------------------^

Also notice how the title of the page is rendered. The title might be rendered this way due to the link, which I clicked to get to this page: http://www.swi-prolog.org/pldoc/doc_for?object=section%282,%274.16%27,swi%28%27/doc/Manual/IO.html%27%29%29 (this is how Google knows this page).

ERROR: A package archive must be named <pack>-<version>.<ext>

Hello,

I am new to prolog and am trying to learn to create prolog packages. I have created a GitHub repo here:

https://github.com/prolibs/app

I then have tried several ways of creating releases here:

https://github.com/prolibs/app/releases

For each release, I have tried taking the .zip URL and passing it to pack_install, but it always errors out. Here is an example:

?- pack_install('https://github.com/prolibs/app/archive/0.1.1.zip').
ERROR: 0.1.1.zip: A package archive must be named <pack>-<version>.<ext>
% Contacting server at http://www.swi-prolog.org/pack/query ... done
Warning: No registered pack matches "https://github.com/prolibs/app/archive/0.1.1.zip"
false.
?-

In that example, the name of the GitHub release is 0.1.1, and so it creates the file https://github.com/prolibs/app/archive/0.1.1.zip.

I have also tried naming the release app-0.1.1, so the URL becomes https://github.com/prolibs/app/archive/app-0.1.1.zip, but that also results in an error:

?- pack_install('https://github.com/prolibs/app/archive/app-0.1.1.zip').
%  library(ssl) compiled into ssl 0.00 sec, 43 clauses
%    library(rbtrees) compiled into rbtrees 0.01 sec, 190 clauses
%   library(thread_pool) compiled into thread_pool 0.01 sec, 238 clauses
%   http_wrapper compiled into httpd_wrapper 0.00 sec, 68 clauses
%  thread_httpd compiled into thread_httpd 0.02 sec, 407 clauses
% library(http/http_ssl_plugin) compiled into http_ssl_plugin 0.02 sec, 462 clauses
ERROR: app-app-0.1.1: A package archive must be named <pack>-<version>.<ext>
ERROR: pack_file `pack.pl' does not exist
?-

The problem there is, if you name your GitHub release something like <name>-<version> (which they recommend not to do anyways), then when the .zip file gets unpacked, it results in a folder called <name>-<name>-version, which is the reason for ERROR: app-app-0.1.1.

So basically, you can't use GitHub's release feature to host prolog packages, which is kind of a bummer. It seems like something that would be straightforward to fix. Is there anything that can be done to support this? If not, what is your recommended workaround?

Thanks for your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.