Exemplo n.º 1
0
static void TraceErrorToJoin(
    void *theEnv,
    struct factPatternNode *patternPtr,
    int traceRight)
{
    struct joinNode *joinPtr;
    char buffer[60];

    while (patternPtr != NULL)
    {
        if (patternPtr->header.stopNode)
        {
            for (joinPtr = patternPtr->header.entryJoin;
                    joinPtr != NULL;
                    joinPtr = joinPtr->rightMatchNode)
            {
                sprintf(buffer,"      Of pattern #%d in rule(s):\n",GetPatternNumberFromJoin(joinPtr));
                EnvPrintRouter(theEnv,WERROR,buffer);
                TraceErrorToRule(theEnv,joinPtr,"         ");
            }
        }
        else
        {
            TraceErrorToJoin(theEnv,patternPtr->nextLevel,TRUE);
        }

        if (traceRight) patternPtr = patternPtr->rightNode;
        else patternPtr = NULL;
    }
}
Exemplo n.º 2
0
static void TraceErrorToJoin(
    void *theEnv,
    struct factPatternNode *patternPtr,
    int traceRight)
{
    struct joinNode *joinPtr;

    while (patternPtr != NULL)
    {
        if (patternPtr->header.stopNode)
        {
            for (joinPtr = patternPtr->header.entryJoin;
                    joinPtr != NULL;
                    joinPtr = joinPtr->rightMatchNode)
            {
                TraceErrorToRule(theEnv,joinPtr,"      ");
            }
        }
        else
        {
            TraceErrorToJoin(theEnv,patternPtr->nextLevel,TRUE);
        }

        if (traceRight) patternPtr = patternPtr->rightNode;
        else patternPtr = NULL;
    }
}
Exemplo n.º 3
0
static void PatternNetErrorMessage(
    void *theEnv,
    struct factPatternNode *patternPtr)
{
    char buffer[60];
    struct templateSlot *theSlots;
    int i;

    /*=======================================*/
    /* Print the fact being pattern matched. */
    /*=======================================*/

    PrintErrorID(theEnv,"FACTMCH",1,TRUE);
    EnvPrintRouter(theEnv,WERROR,"This error occurred in the fact pattern network\n");
    EnvPrintRouter(theEnv,WERROR,"   Currently active fact: ");
    PrintFact(theEnv,WERROR,FactData(theEnv)->CurrentPatternFact,FALSE,FALSE);
    EnvPrintRouter(theEnv,WERROR,"\n");

    /*==============================================*/
    /* Print the field position or slot name of the */
    /* pattern from which the error originated.     */
    /*==============================================*/

    if (FactData(theEnv)->CurrentPatternFact->whichDeftemplate->implied)
    {
        sprintf(buffer,"   Problem resides in field #%d\n",patternPtr->whichField);
    }
    else
    {
        theSlots = FactData(theEnv)->CurrentPatternFact->whichDeftemplate->slotList;
        for (i = 0; i < (int) patternPtr->whichSlot; i++) theSlots = theSlots->next;
        sprintf(buffer,"   Problem resides in slot %s\n",ValueToString(theSlots->slotName));
    }

    EnvPrintRouter(theEnv,WERROR,buffer);

    /*==========================================================*/
    /* Trace the pattern to its entry point to the join network */
    /* (which then traces to the defrule data structure so that */
    /* the name(s) of the rule(s) utilizing the patterns can be */
    /* printed).                                                */
    /*==========================================================*/

    TraceErrorToJoin(theEnv,patternPtr,FALSE);
    EnvPrintRouter(theEnv,WERROR,"\n");
}