Discussions related to Visual Prolog
mdosnov2016
VIP Member
Posts: 73 Joined: 19 Nov 2016 7:58
Post
by mdosnov2016 » 19 Oct 2017 6:13
Hello all.
My write predicate call fails with error message:
Exception in module ...
<pre>pfc/stream/stdiostate.pro(7) : error r329: Single fact 'outputStream'</pre>
from internal database 'stdioState : stdioState@objectDB' has no value
and it terminates.
My code excerpt is as follows:
Code: Select all
file5x:: writedevice ( fileSelector:: screen ) ,
file5x:: write ( " backend HLS CCC optimization started, please wait..." ) ,
What am I doing wrong?
thank you,
Michael
PrologUser
Thomas Linder Puls
VIP Member
Posts: 1466 Joined: 28 Feb 2000 0:01
Post
by Thomas Linder Puls » 19 Oct 2017 8:21
Assuming that you are in a console program it seems that the
console has not been initialized.
The normal way (currently) to do this is in the goal like this:
This code will:
Initialize the console
Make the console stream the standard output stream
Setup exception handling and dumping
Run main::run in that context
The first and second bullets are important because that also defines the
fileSelector::screen device (because that is the standard output stream).
Regards Thomas Linder Puls
PDC
mdosnov2016
VIP Member
Posts: 73 Joined: 19 Nov 2016 7:58
Post
by mdosnov2016 » 20 Oct 2017 8:22
Thank you Thomas.
And if I want from inside the Prolog code to write/read to/from different files (e.g. .log) do I need
to initialise them the same way?
What would be then an example of code (call)?
Best regards,
Michael
PrologUser
mdosnov2016
VIP Member
Posts: 73 Joined: 19 Nov 2016 7:58
Post
by mdosnov2016 » 20 Oct 2017 17:12
Dear Thomas,
I tried adding the code that you proposed,
but when I reach this point in the VIP8 debugger it tells me:
error: console cannot be initialised.
Can't I run it with the debugger?
Best regards,
Michael
PrologUser
mdosnov2016
VIP Member
Posts: 73 Joined: 19 Nov 2016 7:58
Post
by mdosnov2016 » 20 Oct 2017 18:00
Actually I just created a brand new console type project and I placed in place of main.pack my backend.pack.
Now I can see the messages written on screen in my console window.
Thank you,
Michael
PrologUser