コード例 #1
0
ファイル: cstrnchk.c プロジェクト: chrislong/clipsrules
globle int ConstraintCheckValue(
  void *theEnv,
  int theType,
  void *theValue,
  CONSTRAINT_RECORD *theConstraints)
  {
   if (CheckTypeConstraint(theType,theConstraints) == FALSE)
     { return(TYPE_VIOLATION); }

   else if (CheckAllowedValuesConstraint(theType,theValue,theConstraints) == FALSE)
     { return(ALLOWED_VALUES_VIOLATION); }

   else if (CheckAllowedClassesConstraint(theEnv,theType,theValue,theConstraints) == FALSE)
     { return(ALLOWED_CLASSES_VIOLATION); }

   else if (CheckRangeConstraint(theEnv,theType,theValue,theConstraints) == FALSE)
     { return(RANGE_VIOLATION); }

   else if (theType == FCALL)
     {
      if (CheckFunctionReturnType((int) ValueFunctionType(theValue),theConstraints) == FALSE)
        { return(FUNCTION_RETURN_TYPE_VIOLATION); }
     }

   return(NO_VIOLATION);
  }
コード例 #2
0
ファイル: cstrnutl.c プロジェクト: atrniv/CLIPS
globle CONSTRAINT_RECORD *FunctionCallToConstraintRecord(
  void *theEnv,
  EXEC_STATUS,
  void *theFunction)
  {
   CONSTRAINT_RECORD *rv;

   rv = GetConstraintRecord(theEnv,execStatus);
   rv->anyAllowed = FALSE;

   switch ((char) ValueFunctionType(theFunction))
     {
      case 'a':
        rv->externalAddressesAllowed = TRUE;
        break;

      case 'f':
      case 'd':
        rv->floatsAllowed = TRUE;
        break;

      case 'i':
      case 'g':
      case 'l':
        rv->integersAllowed = TRUE;
        break;

      case 'j':
        rv->instanceNamesAllowed = TRUE;
        rv->symbolsAllowed = TRUE;
        rv->stringsAllowed = TRUE;
        break;

      case 'k':
        rv->symbolsAllowed = TRUE;
        rv->stringsAllowed = TRUE;
        break;

      case 'm':
        rv->singlefieldsAllowed = FALSE;
        rv->multifieldsAllowed = TRUE;
        break;

      case 'n':
        rv->floatsAllowed = TRUE;
        rv->integersAllowed = TRUE;
        break;

      case 'o':
        rv->instanceNamesAllowed = TRUE;
        break;

      case 's':
        rv->stringsAllowed = TRUE;
        break;

      case 'u':
        rv->anyAllowed = TRUE;
        rv->multifieldsAllowed = TRUE;
        break;

      case 'w':
      case 'c':
      case 'b':
        rv->symbolsAllowed = TRUE;
        break;

      case 'x':
        rv->instanceAddressesAllowed = TRUE;
        break;

      case 'v':
        rv->voidAllowed = TRUE;
        break;
     }

   return(rv);
  }
コード例 #3
0
ファイル: cstrnutl.c プロジェクト: guitarpoet/php-clips
CONSTRAINT_RECORD *FunctionCallToConstraintRecord(
  void *theEnv,
  void *theFunction)
  {
   CONSTRAINT_RECORD *rv;

   if (ValueFunctionType(theFunction) == 'z')
     { return ArgumentTypeToConstraintRecord2(theEnv,UnknownFunctionType(theFunction)); }
     
   rv = GetConstraintRecord(theEnv);
   rv->anyAllowed = false;

   switch ((char) ValueFunctionType(theFunction))
     {
      case 'a':
        rv->externalAddressesAllowed = true;
        break;

      case 'f':
      case 'd':
        rv->floatsAllowed = true;
        break;

      case 'i':
      case 'g':
      case 'l':
        rv->integersAllowed = true;
        break;

      case 'j':
        rv->instanceNamesAllowed = true;
        rv->symbolsAllowed = true;
        rv->stringsAllowed = true;
        break;

      case 'k':
        rv->symbolsAllowed = true;
        rv->stringsAllowed = true;
        break;

      case 'm':
        rv->singlefieldsAllowed = false;
        rv->multifieldsAllowed = true;
        break;

      case 'n':
        rv->floatsAllowed = true;
        rv->integersAllowed = true;
        break;

      case 'o':
        rv->instanceNamesAllowed = true;
        break;

      case 's':
        rv->stringsAllowed = true;
        break;

      case 'u':
        rv->anyAllowed = true;
        rv->multifieldsAllowed = true;
        break;

      case 'w':
      case 'c':
      case 'b':
        rv->symbolsAllowed = true;
        break;

      case 'x':
        rv->instanceAddressesAllowed = true;
        break;

      case 'y':
        rv->factAddressesAllowed = true;
        break;

      case 'v':
        rv->voidAllowed = true;
        break;
     }

   return(rv);
  }