how to call a determ predicate in the top - leve goal

Discussions related to Visual Prolog
Post Reply
mdosnov2016
Active Member
Posts: 73
Joined: 19 Nov 2016 7:58

how to call a determ predicate in the top - leve goal

Post by mdosnov2016 » 22 Dec 2017 7:34

I have the declaration:

Code: Select all

    generate_top : core::runnable.
and

Code: Select all

    generate_top() :-         not(file5x::existfile(itf_fact_dba)),         !,         itf_not_found_message.       generate_top() :-         %file5x::openfile(fileSelector::screen),         %thread::start(go,maxStack),         file5x::writedevice(fileSelector::screen),         file5x::write("HLS CCC optimization started, please wait..."),         %outputStream::write(" backend HLS CCC optimization started, please wait..."),         file5x::existfile(itf_fact_dba),         %file5x::closefile(fileSelector::screen),         assertz(consecutive_106("false")),         assert_global_constraint_conditionally0,         check_for_program_name,         itf_found_message,         report_global_constraint,         %showBadTerms(itf_fact_dba),         file::consult(itf_fact_dba, backend_dbase),         hdl_style(Hdlform),         !,         extract_loops_from_all_modules_wrapper(2),         % don't process the ADA package         generate_hdl_recursive_wrapper(Hdlform, "synergy", 1),         file5x::writedevice(fileSelector::screen),         file5x::nl,         file5x::write(" CCC Backend synthesis completed! "),         end_time_message,         %openfile(stdout),         file5x::writedevice(fileSelector::screen),         file5x::write(" optimization completed, check HDL results!"),         %file5x::closefile(fileSelector::screen),         !         or         console::write("Main run failed!").   end implement main   goal     console::runUtf8(main::generate_top),     !     or     console::write("Error").
the compiler complains:

Type Action Description Filename Path
e631 The predicate 'main::generate_top/0', which is declared as 'procedure', is actually 'determ' main.pro

and when I change the declaration to:

Code: Select all

    generate_top : () determ.


then the compiler complains:

Type Action Description Filename Path
e504 The expression has type '() determ', which is incompatible with the type '() procedure' main.pro

how can I deal with this situation?
PrologUser

User avatar
Thomas Linder Puls
VIP Member
Posts: 2333
Joined: 28 Feb 2000 0:01

Re: how to call a determ predicate in the top - leve goal

Post by Thomas Linder Puls » 22 Dec 2017 9:25

Which line gives the error message?
Regards Thomas Linder Puls
PDC

mdosnov2016
Active Member
Posts: 73
Joined: 19 Nov 2016 7:58

Re: how to call a determ predicate in the top - leve goal

Post by mdosnov2016 » 22 Dec 2017 13:50

Code: Select all

console::runUtf8(main::generate_top),
is the line responsible
PrologUser

User avatar
Thomas Linder Puls
VIP Member
Posts: 2333
Joined: 28 Feb 2000 0:01

Re: how to call a determ predicate in the top - leve goal

Post by Thomas Linder Puls » 22 Dec 2017 14:02

No, that is not the line you come to when you double click the error message.
Regards Thomas Linder Puls
PDC

mdosnov2016
Active Member
Posts: 73
Joined: 19 Nov 2016 7:58

Re: how to call a determ predicate in the top - leve goal

Post by mdosnov2016 » 22 Dec 2017 14:52

I swear this is the line that it takes me to.
PrologUser

User avatar
Thomas Linder Puls
VIP Member
Posts: 2333
Joined: 28 Feb 2000 0:01

Re: how to call a determ predicate in the top - leve goal

Post by Thomas Linder Puls » 22 Dec 2017 16:31

Sorry, I was referring to your first case:

Code: Select all

e631 The predicate 'main::generate_top/0', which is declared as 'procedure', is actually 'determ' main.pro
runUtf8 is declared to take a runnable as argument:

Code: Select all

predicates     runUtf8 : (runnable Runnable).     % @short Runs #Runnable after having initialized the console (see console::initUtf8), reestablish the console codepages upon completion of #Runnable.     % @end
So clearly generate_top should be a runnable.

So that is the case you should consider.
Regards Thomas Linder Puls
PDC

Post Reply