cam.clp example error

120 views
Skip to first unread message

Руслан Сорокин

unread,
Jan 28, 2024, 4:02:45 AMJan 28
to CLIPSESG
Dear CLIPS users and team!
cam.png
I try to run "cam.clp" example and get this error. I examined a code and did not find a place where slot "search-depth" of "status" fact can get a string value "No move." You can see this value on a screenshot. This puzzled me. As I understand this is a cause of the error.
Any help or tip would be greatly appreciated.

Sincerely,
  Ru

Ryan Johnston

unread,
Jan 28, 2024, 1:21:52 PMJan 28
to CLIPSESG
Hey, Ru,

I'm having a hard time finding cam.clp. Are you able to provide its contents?

Руслан Сорокин

unread,
Jan 29, 2024, 3:39:04 AMJan 29
to CLIPSESG
воскресенье, 28 января 2024 г. в 21:21:52 UTC+3, Ryan Johnston:
cam.clp

CLIPS Support

unread,
Jan 29, 2024, 4:06:03 PMJan 29
to CLIPSESG
It runs without error in CLIPS 6.31, but not 6.4.1, so it looks like a CLIPS bug. I'll look into what's causing the issue.

Руслан Сорокин

unread,
Jan 30, 2024, 2:29:43 AMJan 30
to CLIPSESG
I run it on 6.4.1  4/8/23 as you can see from my screenshot. 

вторник, 30 января 2024 г. в 00:06:03 UTC+3, CLIPS Support:

yoshiaki

unread,
Feb 2, 2024, 7:59:47 AMFeb 2
to CLIPSESG
Hi Gary,

The < function reads garbage data because a part of the fact is trashed during executing the DuplicateCommand().
The patch below is one solution for it.

--- tmpltfun-orig.c 2022-12-14 00:44:10.000000000 +0900
+++ tmpltfun.c 2024-02-02 21:45:49.010835668 +0900
@@ -809,7 +809,10 @@
          /*===================================================*/
 
          IncrementClearReadyLocks(theEnv);
+         newFact->theProposition.header.type = MULTIFIELD_TYPE;
+         RetainMultifield(theEnv,&newFact->theProposition);
          EvaluateExpression(theEnv,testPtr->argList,&computeResult);
+         ReleaseMultifield(theEnv,&newFact->theProposition);
          SetEvaluationError(theEnv,false);
          DecrementClearReadyLocks(theEnv);
 
2024年1月30日火曜日 6:06:03 UTC+9 CLIPS Support:

CLIPS Support

unread,
Feb 3, 2024, 2:12:20 PMFeb 3
to CLIPSESG
Thanks for the information.

CLIPS Support

unread,
Mar 3, 2024, 1:07:41 AMMar 3
to CLIPSESG
A bug fix to the garbage collection algorithm has been check into the svn repository for CLIPS on SourceForge.

On Sunday, January 28, 2024 at 3:02:45 AM UTC-6 zspove...@gmail.com wrote:

denis.be...@gmail.com

unread,
Mar 3, 2024, 1:22:32 AMMar 3
to CLIPSESG
Just to make sure: the bug was not present in version 6.3?

Руслан Сорокин

unread,
Mar 3, 2024, 2:46:02 AMMar 3
to CLIPSESG
Thank you very much for bug fix!
Seems like the bug is not present in version 6.3.

воскресенье, 3 марта 2024 г. в 09:22:32 UTC+3, denis.be...@gmail.com:

Руслан Сорокин

unread,
Mar 3, 2024, 1:42:05 PMMar 3
to CLIPSESG
To test the bug fix I downloaded from SourceForge Tree [r881]  / branches / 70x / two zip files:
- clipsrules-code-r881-branches-70x-core.zip,
- clipsrules-code-r881-branches-70x-examples.zip.
I made a clips executable with make utility (on Linux Mint).
The cam.clp example (I added it to examples) run perfectly. Thanks once more!
But on auto.clp example I got this output listing:

ru@ru-sitrol:~/CLIPS/CLIPS70/clipsrules-code-r881-branches-70x-core$ cd ../clipsrules-code-r881-branches-70x-examples/
ru@ru-sitrol:~/CLIPS/CLIPS70/clipsrules-code-r881-branches-70x-examples$ clips
         CLIPS (6.30 3/17/15)
CLIPS> (load auto.clp)
Defining deffunction: ask-question
Defining deftemplate: av
Defining defrule: system-banner
[EXPRNPSR3] Missing function declaration for lookup.

ERROR:
(defrule MAIN::system-banner ""
   (declare (salience 10))
   =>
   (printout t crlf crlf)
   (printout t (lookup
Defining defrule: determine-attribute
[PRNTUTIL2] Syntax Error:  Check appropriate syntax for defrule.

ERROR:
(defrule MAIN::determine-attribute
   (declare (salience -10))
   (goal (
Defining defrule: print-repair
[EXPRNPSR3] Missing function declaration for lookup.

ERROR:
(defrule MAIN::print-repair ""
   (declare (salience 10))
   (repair ?item)
   =>
   (printout t crlf crlf)
   (printout t (lookup
Defining defrule: no-repairs +j+j
Defining defrule: normal-engine-state-conclusions +j+j+j
Defining defrule: engine-sluggish =j+j+j+j
Defining defrule: engine-misfires =j=j+j+j
Defining defrule: engine-knocks =j=j+j+j
Defining defrule: tank-out-of-gas +j+j+j+j
Defining defrule: battery-dead =j+j+j+j
Defining defrule: point-surface-state-burned =j=j+j+j+j
=j=j+j+j+j
Defining defrule: point-surface-state-contaminated =j=j=j+j+j
=j=j=j+j+j
Defining defrule: repair-distributor-lead-wire =j=j+j+j+j
Defining defrule: replace-ignition-coil =j=j=j+j+j

[CSTRCPSR1] Expected the beginning of a construct.
FALSE
CLIPS>

As I understand "lookup" is an embedded function in a version 7.0.
But bilded by make clips prints on start CLIPS (6.30 3/17/15)?
Would you like to explain this?
Thanks in advance.
Ru



воскресенье, 3 марта 2024 г. в 10:46:02 UTC+3, Руслан Сорокин:

CLIPS Support

unread,
Mar 3, 2024, 6:03:39 PMMar 3
to CLIPSESG
The same issue exists even though it does not manifest itself. In order for the bug to occur, the memory must be garbage collected at the wrong time and then overwritten.

CLIPS Support

unread,
Mar 3, 2024, 6:13:48 PMMar 3
to CLIPSESG
The 7.0 branch is in development. It hasn't been released yet.
Reply all
Reply to author
Forward
0 new messages