得到错误RULECSRT3以前的变量绑定

时间:2017-04-27 14:01:21

标签: c++ clips

从剪辑官方文档中我看到以下

"The restriction string for a function requiring exactly six arguments (of which the first must be a string, the third an integer, and the remaining arguments floats) is:
"66fsui" "

有人能让我明白这是什么意思以及上述陈述是如何有效的?

实际上我在尝试将第3个参数从整数更改为字符串时收到错误..之前is_configured需要“33iiii”,现在我将其更改为“33iisi”

这是代码 我已经改变了,之前它工作得很好..工作代码我在下面的行中评论了

    (object (is-a VEHICLE)
            (NUMBER   1) 
            (IDX      ?ID_X)   
            (IDY      ?ID_Y)
            ;; not using ID_Z in the call below and using STRING_Z
            (IDZ    ?ID_Z)
            (STRINGZ ?STRING_Z)
    )

   =>
   (if (is_configured ?ID_X ?ID_Y ?STRING_Z) then
   ;;(if (is_configured ?ID_X ?ID_Y ?ID_Z) then
      (assert (ELIGIBLE_FOR_CALCULATION ?ID_X ?ID_Y ?ID_Z))
   )

C ++代码就像这样

    bool clips_is_configured()
    {
    DATA_OBJECT doTemp;
    long id_x= 0;
    long id_y = 0;
    std::string string_z;
    //long id_z = 0;


    if (ArgCountCheck("is_configured", EXACTLY, 3) == -1)
            return -1;


    if (ArgTypeCheck("is_configured", 1, INTEGER, &doTemp) == 0)
            return -1;
    id_x = (long) DOToLong(doTemp);


    if (ArgTypeCheck("is_configured", 2, INTEGER, &doTemp) == 0)
            return -1;
    id_y = (long) DOToLong(doTemp);


    // if (ArgTypeCheck("is_configured", 3, INTEGER, &doTemp) == 0)
    if (ArgTypeCheck("is_configured", 3, STRING, &doTemp) == 0)
            return -1;
    string_z = DOToString(doTemp);
    //id_z = (long) DOToLong(doTemp);

    bool x;
    ...........
    // do some calulations based on above values and return bool
    ...........
    return x;
    }

我收到以下错误

    [RULECSTR3] Previous variable bindings of ?ID_Y caused the type restrictions for argument #2 of the expression (is_configured ?ID_X ?ID_Y ?STRING_Z) found in the rule's RHS to be violated.

1 个答案:

答案 0 :(得分:0)

实际上我给出了错误的格式......正确的格式是" 33iiis" 第一个i表示参数的默认类型,如果没有给出

第二个i表示第一个参数的类型

第三个i表示第二个参数的类型

第一个s表示第三个参数的类型

由于