Re: Launch gprolog with sh

Daniel Diaz <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
Hi,

this works well on my machine. I suspect your version is too old
(last stable is 1.4.0 and 1.4.1 is in preparation).

The best if to get a more recent version (1.4.0). Either update your
ubuntu package or install a new version from sources

(in that case please get the last snapshot at http://gprolog.univ-paris1.fr/unstable/gprolog-20120319.tgz )

If you don't update your version you can try to avoid the --entry-goal
using a initialization directive to launch init. To do
this add in your file:

:- initialization(init).

You can also easily compile it to provide a native executable:

gplc wumpusMind.pl

Adding (the initialization directive as explained above).

The execute it with:

./wumpusMind

Then you can add call the halt/0 predicate (or friends
like stop/0) and/or gplc linker options like --min-bips
or --no-top-level

(see http://gprolog.org/manual/html_node/gprolog009.html#toc9 ).

BTW: If you upgrade to 1.4.0, you can use the gprolog shebang
support (http://gprolog.org/manual/html_node/gprolog007.html#toc4) .

For this add a very first line in you wumpusMind.pl like:

#!<path_to_gprolog_executable>/gprolog --consult-file

:- initialization(init).

And then you simply execute your script with (after a chmod a+x
./wumpusMind.pl):

./wumpusMind.pl

Daniel

Le 30/03/2012 09:43, Paolo Parise a écrit :

Hi,

I'm writing a script (.sh) which should launch gprolog, load a
file (wumpusMind.pl ) and the initial query (init)
in the same file which is in the form:

init :-

retractall(counter(_)),

...

but there's something wrong (it seems in the consulting of name.pl ):

gprolog --consult-file wumpusMind.pl --entry-goal 'init, nl'

(error message:)

paolo@paolo-PC-Ubuntu:~/Desktop$ sh lauch.sh

GNU Prolog 1.3.0

By Daniel Diaz

Copyright (C) 1999-2007 Daniel Diaz

warning: command-line goal 'init, nl' caused exception:
error(existence_error(procedure,init/0),'command-line')

| ?-

Manually I do the follow:

gprolog

| ?- [name]

| ?- init.

... processing

Have you got a clue?

Thanks in advance!

Paolo P.

--

Ce message a été vérifié par
MailScanner
pour des virus ou des polluriels et rien de
suspect n'a été trouvé.

_______________________________________________
Users-prolog mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/users-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.