void RuleSet::InActivate(const char *ctg) { for (int i=0; i<nRules; i++) { Rule *r = rules[i]; if (!r->IsHelpRule() && r->CategoryName() && !strcmp(ctg, r->CategoryName())) InActivate(r); } }
bool RuleSet::FixRules() { isFixed = true; for (int i=0; i<nRules; i++) { Rule *r = rules[i]; if (r->Id() && r->Id()->RuleNo() < 0) { Message(MSG_WARNING, "help rule", r->Name(), "is not defined"); isFixed = false; } else r->ResolveHelpRules(); for (RuleTerm *rt = r->FirstRuleTerm(); rt; rt = rt->Next()) if (rt->GetJump() && rt->GetJump()->GetId()->GetRuleIndex() <= i) { Message(MSG_WARNING, r->Name(), "jumps backwards"); isFixed = false; } if (!r->IsHelpRule()) { if (!r->CategoryName()) { Message(MSG_WARNING, "rule", r->Name(), "has no category"); //isFixed = false; } else { Category *cat = FindCategory(r->CategoryName()); if (!cat) { Message(MSG_WARNING, "category", r->CategoryName(), "never declared"); isFixed = false; } else for (RuleTerm *rt = r->FirstRuleTerm(); rt; rt = rt->Next()) rt->category = cat; } if (r->FirstRuleTerm() && !r->FirstRuleTerm()->IsScrutinizing() && r->FirstRuleTerm()->GetInfo()) { Message(MSG_WARNING, r->Name(), ", only scrutinizing rules can have info"); isFixed = false; } } } return isFixed; }