users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Launch gprolog with sh


From: Daniel Diaz
Subject: Re: Launch gprolog with sh
Date: Fri, 30 Mar 2012 10:26:38 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

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:)

address@hidden:~/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é.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]