剪辑6.3 CLIPSDLL.h如何从c修改事实?

时间:2018-07-01 15:49:46

标签: clips

我使用片段6.3。 (CLIPSDynamic32)共享的dll

#include "CLIPSDLL.h"
#include "cstrcpsr.h"
#include <locale.h>
#include <stdio.h>
#include "clips.h"
Environment *theEnv;

void main(int argc, char** argv)
{
    int ret;
    theEnv = __CreateEnvironment();
    int status = __Load(theEnv, "H:\\ClipsIntegrationExample\\clips1.clp");

    __Reset(theEnv);
    __AssertString(theEnv, "(templ1(name1 yes))");
    __Run(theEnv,-1);


    __DestroyEnvironment(theEnv);
    getch();
}

这是剪辑文件clp

(deftemplate MAIN::templ1
    (slot name1))

如何从c修改事实?

1 个答案:

答案 0 :(得分:0)

检索由AssertString创建的事实的事实索引,然后构造一个字符串,该字符串可以传递给Eval函数以修改事实。例如:

"(do-for-fact ((?f templ1)) (= (fact-index ?f) 2) (modify ?f (name1 xyz)))"

另请参阅When embedding CLIPS into C Language, what function can used to modify the fact from C program