UPDATE: I copied my entire Pengines setup from Windows to my Ubuntu 18.04 box. The problem does not happen with Linux. This appears to be a Windows-only thing. I really would like to get this solved on Windows because all my dev tools and the editor (Notepad++) I use along side the XPCE editor are on Windows.
I’m using: SWI-Prolog version 8.0.2. I have a PEngines app that I for some reason is not being recognized as a valid application when I try to call it. I am able to access the Genealogist app and run queries against it from a browser. But whenever I try to access my application, I get the error:
Error: pengine_application **tsll** does not exist
To create my application I cloned the Genealogist application directory. I then change the necessary files to support my application. Here are the pertinent details from their respective files:
FILE: pengines/run.pl
:- [load].
:- server(3030).
FILE: pengines/load.pl
% access at /apps/genealogist/index.html
:- if(exists_source(apps(genealogist/app))).
:- use_module(apps(genealogist/app)).
:- endif.
% access at /apps/tsll/index.html
:- if(exists_source(apps(tsll/app))).
:- use_module(apps(tsll/app)).
:- endif.
FILE: pengines/apps/tsll/app.pl
:- module(app_tsll, []).
:- use_module(library(pengines)).
:- pengine_application(tsll).
:- use_module(tsll:tsll).
FILE: index.html
<script src="js/tsll.js"></script>
FILE: tsll.js
var pengine;
function ask() {
var query = $("#query").val();
if (query) {
pengine = new Pengine({
application: 'tsll',
ask: query,
onsuccess: function() {
writeln(JSON.stringify(this.data));
if (this.more) {
disableButtons(true, false, false, false);
} else {
writeln("No more solutions");
disableButtons(false, true, true, true);
}
},
onfailure: function() {
writeln("Failure");
disableButtons(false, true, true, true);
},
onstop: function() {
writeln("Stopped");
disableButtons(false, true, true, true);
},
onabort: function() {
writeln("Aborted");
disableButtons(false, true, true, true);
},
onerror: function() {
writeln("Error: " + this.data);
disableButtons(false, true, true, true);
}
});
}
}
FILL: tsll.pl
:- module(
% Module name.
tsll,
% Exported predicates list.
[
execute_single_user_action/2,
execute_user_action_list/2,
suggest_next_move_to/3,
u_query/1
]
).
I know the app is being loaded because if I enter some junk into app.pl
the interpreter complains about errors in that file. However, when I execute a query from the browser I get the error message above. I have stared at my files and the exact same files in the Genealogist app and I can’t see anything I’m doing differently, besides altering the necessary items to execute my app instead of the Genealogist app.
Can anyone see a problem in my code that would cause this? I am stumped at this point.
Also, is there some place in the Pengines code that I can place a spy point to try and trace out the issue? I tried tracing from the “front door”, but I’m hoping I don’t have to figure out how to wade through the Pengines multi-threaded HTTP server stuff “at the front” just to get to the point that the system actually tries to load the target app (tsll), to see if I can figure out what is really going wrong here.