Problem with clips

41 views
Skip to first unread message

Ankur S.

unread,
Jul 26, 2012, 6:43:40 AM7/26/12
to clip...@googlegroups.com
Hello Everyone,

I am using below code to load .clp file in my iPhone application.

InitializeEnvironment();
Clear();

NSString *filePath = [[NSBundle mainBundle]
                      pathForResource
:@"animal" ofType:@"clp"];

NSData *myData = [NSData dataWithContentsOfFile:filePath];

if (myData) {

   
char *clipsFileChar = (char *)[filePath cStringUsingEncoding:NSASCIIStringEncoding];

   
IncrementGCLocks();
   
Load(clipsFileChar);
   
Reset();
   
AssertString("(find-all-facts ((?f state-list)) FALSE)");

   
int numberRulesFired = Run(-1);
   
NSLog(@"Number of rules that fired: %d", numberRulesFired);

   
DecrementGCLocks();
}
else {
   
NSLog(@"Could not find file %@", filePath);

}

the problem is when I run my app, it goes to infinite loop from line int numberRulesFired = Run(-1);.
it keeps printing first question from .clp file. I am using CLIPS version 6.30
Am I missing anything here?

Reply all
Reply to author
Forward
0 new messages