Пример #1
0
static intBool JNSimpleCompareFunction1(
    void *theEnv,
    void *theValue,
    DATA_OBJECT *theResult)
{
    INSTANCE_TYPE *ins1,*ins2;
    struct multifieldMarker *theMarks;
    struct ObjectCmpJoinSingleSlotVars1 *hack;
    int rv;
    INSTANCE_SLOT *is1,*is2;

    hack = (struct ObjectCmpJoinSingleSlotVars1 *) ValueToBitMap(theValue);
    GetPatternObjectAndMarks(theEnv,((int) hack->firstPattern),hack->firstPatternLHS,hack->firstPatternRHS,&ins1,&theMarks);
    is1 = GetInsSlot(ins1,hack->firstSlot);
    GetPatternObjectAndMarks(theEnv,((int) hack->secondPattern),hack->secondPatternLHS,hack->secondPatternRHS,&ins2,&theMarks);
    is2 = GetInsSlot(ins2,hack->secondSlot);
    if (is1->type != is2->type)
        rv = hack->fail;
    else if (is1->value != is2->value)
        rv = hack->fail;
    else
        rv = hack->pass;
    theResult->type = SYMBOL;
    theResult->value = rv ? EnvTrueSymbol(theEnv) : EnvFalseSymbol(theEnv);
    return(rv);
}
Пример #2
0
static CLIPS_BOOLEAN JNSimpleCompareFunction2(
  void *theEnv,
  void *theValue,
  DATA_OBJECT *theResult)
  {
   INSTANCE_TYPE *ins1,*ins2;
   struct multifieldMarker *theMarks;
   struct ObjectCmpJoinSingleSlotVars2 *hack;
   int rv;
   FIELD f1;
   INSTANCE_SLOT *is2;

   hack = (struct ObjectCmpJoinSingleSlotVars2 *) ValueToBitMap(theValue);
   GetPatternObjectAndMarks(theEnv,((int) hack->firstPattern) - 1,&ins1,&theMarks);
   GetInsMultiSlotField(&f1,ins1,(unsigned) hack->firstSlot,
                        (unsigned) hack->fromBeginning,(unsigned) hack->offset);
   GetPatternObjectAndMarks(theEnv,((int) hack->secondPattern) - 1,&ins2,&theMarks);
   is2 = GetInsSlot(ins2,hack->secondSlot);
   if (f1.type != is2->type)
     rv = hack->fail;
   else if (f1.value != is2->value)
     rv = hack->fail;
   else
     rv = hack->pass;
   theResult->type = SYMBOL;
   theResult->value = rv ? EnvTrueSymbol(theEnv) : EnvFalseSymbol(theEnv);
   return(rv);
  }
Пример #3
0
static intBool PNSimpleCompareFunction1(
    void *theEnv,
    void *theValue,
    DATA_OBJECT *theResult)
{
    struct ObjectCmpPNSingleSlotVars1 *hack;
    INSTANCE_SLOT *is1,*is2;
    int rv;

    hack = (struct ObjectCmpPNSingleSlotVars1 *) ValueToBitMap(theValue);
    is1 = GetInsSlot(ObjectReteData(theEnv)->CurrentPatternObject,hack->firstSlot);
    is2 = GetInsSlot(ObjectReteData(theEnv)->CurrentPatternObject,hack->secondSlot);
    if (is1->type != is2->type)
        rv = hack->fail;
    else if (is1->value != is2->value)
        rv = hack->fail;
    else
        rv = hack->pass;
    theResult->type = SYMBOL;
    theResult->value = rv ? EnvTrueSymbol(theEnv) : EnvFalseSymbol(theEnv);
    return(rv);
}
Пример #4
0
static intBool PNSimpleCompareFunction2(
    void *theEnv,
    void *theValue,
    DATA_OBJECT *theResult)
{
    struct ObjectCmpPNSingleSlotVars2 *hack;
    int rv;
    FIELD f1;
    INSTANCE_SLOT *is2;

    hack = (struct ObjectCmpPNSingleSlotVars2 *) ValueToBitMap(theValue);
    GetInsMultiSlotField(&f1,ObjectReteData(theEnv)->CurrentPatternObject,(unsigned) hack->firstSlot,
                         (unsigned) hack->fromBeginning,(unsigned) hack->offset);
    is2 = GetInsSlot(ObjectReteData(theEnv)->CurrentPatternObject,hack->secondSlot);
    if (f1.type != is2->type)
        rv = hack->fail;
    else if (f1.value != is2->value)
        rv = hack->fail;
    else
        rv = hack->pass;
    theResult->type = SYMBOL;
    theResult->value = rv ? EnvTrueSymbol(theEnv) : EnvFalseSymbol(theEnv);
    return(rv);
}