Ejemplo n.º 1
0
static struct templateSlot *GetNextTemplateSlotToPrint(
  void *theEnv,
  struct fact *theFact,
  struct templateSlot *slotPtr,
  int *position,
  int ignoreDefaults,
  const char *changeMap)
  {
   DATA_OBJECT tempDO;
   struct field *sublist;

   sublist = theFact->theProposition.theFields;
   if (slotPtr == NULL)
     { slotPtr = theFact->whichDeftemplate->slotList; }
   else
     {
      slotPtr = slotPtr->next;
      (*position)++;
     }
     
   while (slotPtr != NULL)
     {
      if ((changeMap != NULL) && (TestBitMap(changeMap,*position) == 0))
        {
         (*position)++;
         slotPtr = slotPtr->next;
         continue;
        }

      if (ignoreDefaults && (slotPtr->defaultDynamic == false))
        {
         DeftemplateSlotDefault(theEnv,theFact->whichDeftemplate,slotPtr,&tempDO,true);
         
         if (slotPtr->multislot == false)
           {
            if ((GetType(tempDO) == sublist[*position].type) &&
                (GetValue(tempDO) == sublist[*position].value))
              {     
               (*position)++;
               slotPtr = slotPtr->next;
               continue;
              }
           }
         else if (MultifieldsEqual((struct multifield*) GetValue(tempDO),
                                   (struct multifield *) sublist[*position].value))
           {
            (*position)++;
            slotPtr = slotPtr->next;
            continue;
           }
        }
        
      return slotPtr;
     }
     
   return NULL;
  }
Ejemplo n.º 2
0
static struct templateSlot *GetNextTemplateSlotToPrint(
  Environment *theEnv,
  struct fact *theFact,
  struct templateSlot *slotPtr,
  int *position,
  int ignoreDefaults,
  const char *changeMap)
  {
   UDFValue tempDO;
   CLIPSValue *sublist;

   sublist = theFact->theProposition.contents;
   if (slotPtr == NULL)
     { slotPtr = theFact->whichDeftemplate->slotList; }
   else
     {
      slotPtr = slotPtr->next;
      (*position)++;
     }

   while (slotPtr != NULL)
     {
      if ((changeMap != NULL) && (TestBitMap(changeMap,*position) == 0))
        {
         (*position)++;
         slotPtr = slotPtr->next;
         continue;
        }

      if (ignoreDefaults && (slotPtr->defaultDynamic == false))
        {
         DeftemplateSlotDefault(theEnv,theFact->whichDeftemplate,slotPtr,&tempDO,true);

         if (slotPtr->multislot == false)
           {
            if (tempDO.value == sublist[*position].value)
              {
               (*position)++;
               slotPtr = slotPtr->next;
               continue;
              }
           }
         else if (MultifieldsEqual((Multifield *) tempDO.value,
                                   (Multifield *) sublist[*position].value))
           {
            (*position)++;
            slotPtr = slotPtr->next;
            continue;
           }
        }

      return slotPtr;
     }

   return NULL;
  }