Object as predicate argument?

Discussions related to Visual Prolog
daveplummermd
VIP Member
Posts: 88
Joined: 18 Jul 2006 17:18

Object as predicate argument?

Unread post by daveplummermd » 3 May 2012 23:05

Guys

can you tell me why this code compiles fine fine:

Code: Select all

 onFileNew(_Source, _MenuTag):-        ExeObj=useExe::new("D:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe http://discuss.visual-prolog.com"),        ExeObj:setShowWindow(true()),        ExeObj:run(),        programControl::sleep(15000),        if  ExeObj:isActive() then                ExeObj:terminate(777)         else              stdio::write("Appears to be done :")         end if,         !.
BUT, this does not:

Code: Select all

   onFileNew(_Source, _MenuTag):-        ExeObj=useExe::new("D:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe http://discuss.visual-prolog.com"),        ExeObj:setShowWindow(true()),        ExeObj:run(),        programControl::sleep(15000),       ww(ExeObj),        !.   predicates     ww: (object).      clauses    ww(ExeObj):-    if  (ExeObj:isActive) then             ExeObj:terminate(777)          else              stdio::write("Appears to be done :")         end if,       !.
yielding compiler err: c229 : Undeclared identifier 'isActive/0'
Can I pass the "ExeObj" object as an argument to a predicate?


thanks in advance

Dave Plummer M.D.
Dave Plummer

Steve Lympany
VIP Member
Posts: 119
Joined: 31 Mar 2001 23:01

Unread post by Steve Lympany » 4 May 2012 7:20

Hi,
Just a cursory look..maybe you need the brackets

if (ExeObj:isActive()) then

cheers
steve

daveplummermd
VIP Member
Posts: 88
Joined: 18 Jul 2006 17:18

Unread post by daveplummermd » 4 May 2012 10:54

Thanks

I meant for that to be identical snippets of code. In any case, with change, it does not work either.

Any other ideas?

Dave
Dave Plummer

Steve Lympany
VIP Member
Posts: 119
Joined: 31 Mar 2001 23:01

Unread post by Steve Lympany » 4 May 2012 12:06

Hi,
What's the declaration of ww?
cheers
s

daveplummermd
VIP Member
Posts: 88
Joined: 18 Jul 2006 17:18

Unread post by daveplummermd » 4 May 2012 14:20

the predicate "ww" is declared as:

Code: Select all

predicates     ww: (object).
about half way down.
Dave Plummer

User avatar
Tonton Luc
VIP Member
Posts: 500
Joined: 16 Oct 2001 23:01

Unread post by Tonton Luc » 4 May 2012 18:15

:idea:

Code: Select all

facts mem_use_exe:useExe:=erroneous.     onFileNew(_Source, _MenuTag):-        mem_use_exe:=useExe::new("D:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe http://discuss.visual-prolog.com"),        mem_use_exe:setShowWindow(true()),        mem_use_exe:run(),        programControl::sleep(15000),       ww(),        !.   predicates     ww: ().      clauses    ww():-    if not(isErroneous(mem_use_exe)) and  mem_use_exe:isActive() then             mem_use_exe:terminate(777)          else              stdio::write("Appears to be done :")         end if,       !.

daveplummermd
VIP Member
Posts: 88
Joined: 18 Jul 2006 17:18

Unread post by daveplummermd » 4 May 2012 18:31

Very interesting.

I will study your code carefully.

Thanks for you rapid reply.

Dave Plummer M.D.
Dave Plummer

User avatar
Tonton Luc
VIP Member
Posts: 500
Joined: 16 Oct 2001 23:01

Unread post by Tonton Luc » 4 May 2012 19:21

Hi,

Your previous code compile fine if you change the ww() predicates like :

Code: Select all

predicates     ww: (useExe).      clauses    ww(ExeObj):-    if  ExeObj:isActive() then             ExeObj:terminate(777)          else              stdio::write("Appears to be done :")         end if,       !.
:wink:

daveplummermd
VIP Member
Posts: 88
Joined: 18 Jul 2006 17:18

Unread post by daveplummermd » 5 May 2012 12:26

Very helpful.
Thanks you.
Dave Plummer

Post Reply