Menu

Modifying facts causes CLIPS to hang

Help
2019-05-19
2019-05-30
  • Christopher

    Christopher - 2019-05-19

    Modifying fact via call to (modify) action causes CLIPS to hang. I am trying to modify a templated fact. Here is the implementation:

    RULES:

    (deffunction reset-allowed-values "Resets allowed values"
        ; no argument
        ($?arg)
        (if (eq (any-factp ((?fact model1)) TRUE) TRUE)
            then
                ;T1_1, T2_1, T3_1
                (do-for-all-facts ((?fact ar-node)) (eq ?fact:trip 1)
                    (modify ?fact (allowed-values L D R A C S))))
    

    MAIN:

    nt main(void) 
    {   
        DATA_OBJECT rtn;
        void *env = CreateEnvironment();
        printf("Environment Created!\n");
    
        EnvSetConserveMemory(env, 1);
    
        int result = EnvLoad(env, "custom/rules/test.clp");
        if(result == 0) {
            printf("Unable to find the consruct!\n");
            DestroyEnvironment(env);
            return(1);
        } else if(result == -1) {
            printf("Unable to load the consruct!\n");
            DestroyEnvironment(env);
            return(1);
        }
        printf("Construct Loaded!\n");
    
        EnvReset(env);
        printf("Environment Reset!\n");
    
        EnvFunctionCall(env,"reset-allowed-values", 0, &rtn);
    
        printf("CLIPS test done! Used memory %ld bytes.\n", EnvMemUsed(env));
    
        DestroyEnvironment(env);
    
      return(0);
    }
    

    I am currently have no idea why the call to modify causes call to reset-allowed-values not to return. CLIPS is built and running in UBUNTU Linux 32bit. Anyone can help me out on this, all help is very much appreciated.

    Thank you very much.

     
  • Gary Riley

    Gary Riley - 2019-05-22

    I can't reprodue the issue. You need to include all of the code in test.clp in your question.

     
  • Christopher

    Christopher - 2019-05-30

    Hi All, i already found the caused of the problem it seems in v6.3 the behavior of modify is different than in v6.4. In v6.3 do-all-facts will not exit if the facts are modified. I replaced this with delayed-do-all-facts. I didn't realize that I was using CLIPSIDE v6.4 when I tested the CLIPS construct and CLIPS v6.3 for the embedded part. Thank you very much for your help and time

     

Log in to post a comment.

MongoDB Logo MongoDB