當前位置: 首頁>>代碼示例>>C++>>正文


C++ EnvArgCountCheck函數代碼示例

本文整理匯總了C++中EnvArgCountCheck函數的典型用法代碼示例。如果您正苦於以下問題:C++ EnvArgCountCheck函數的具體用法?C++ EnvArgCountCheck怎麽用?C++ EnvArgCountCheck使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了EnvArgCountCheck函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: IntegerFunction

globle long int IntegerFunction(
  void *theEnv)
  {
   DATA_OBJECT valstruct;

   /*============================================*/
   /* Check for the correct number of arguments. */
   /*============================================*/

   if (EnvArgCountCheck(theEnv,"integer",EXACTLY,1) == -1) return(0L);

   /*================================================================*/
   /* Check for the correct type of argument. Note that ArgTypeCheck */
   /* will convert floats to integers when an integer is requested   */
   /* (which is the purpose of the integer function).                */
   /*================================================================*/

   if (EnvArgTypeCheck(theEnv,"integer",1,INTEGER,&valstruct) == FALSE) return(0L);

   /*===================================================*/
   /* Return the numeric value converted to an integer. */
   /*===================================================*/

   return(ValueToLong(valstruct.value));
  }
開發者ID:jonathangizmo,項目名稱:pyclips,代碼行數:25,代碼來源:bmathfun.c

示例2: FloatFunction

globle double FloatFunction(
  void *theEnv)
  {
   DATA_OBJECT valstruct;

   /*============================================*/
   /* Check for the correct number of arguments. */
   /*============================================*/

   if (EnvArgCountCheck(theEnv,"float",EXACTLY,1) == -1) return(0.0);

   /*================================================================*/
   /* Check for the correct type of argument. Note that ArgTypeCheck */
   /* will convert integers to floats when a float is requested      */
   /* (which is the purpose of the float function).                  */
   /*================================================================*/

   if (EnvArgTypeCheck(theEnv,"float",1,FLOAT,&valstruct) == FALSE) return(0.0);

   /*================================================*/
   /* Return the numeric value converted to a float. */
   /*================================================*/

   return(ValueToDouble(valstruct.value));
  }
開發者ID:bitcababy,項目名稱:ObjectiveCLIPS,代碼行數:25,代碼來源:bmathfun.c

示例3: LoadFactsCommand

globle int LoadFactsCommand(
  void *theEnv)
  {
   char *fileName;

   /*============================================*/
   /* Check for the correct number of arguments. */
   /*============================================*/

   if (EnvArgCountCheck(theEnv,"load-facts",EXACTLY,1) == -1) return(FALSE);

   /*====================================================*/
   /* Get the file name from which facts will be loaded. */
   /*====================================================*/

   if ((fileName = GetFileName(theEnv,"load-facts",1)) == NULL) return(FALSE);

   /*====================================*/
   /* Call the LoadFacts driver routine. */
   /*====================================*/

   if (EnvLoadFacts(theEnv,fileName) == FALSE) return(FALSE);

   return(TRUE);
  }
開發者ID:DrItanium,項目名稱:electron,代碼行數:25,代碼來源:factcom.c

示例4: ListDefmodulesCommand

globle void ListDefmodulesCommand(
  void *theEnv)
  {
   if (EnvArgCountCheck(theEnv,"list-defmodules",EXACTLY,0) == -1) return;

   EnvListDefmodules(theEnv,WDISPLAY);
  }
開發者ID:DrItanium,項目名稱:durandal,代碼行數:7,代碼來源:modulbsc.c

示例5: SalienceEvaluationName

globle void *SetSalienceEvaluationCommand(
    void *theEnv)
{
    DATA_OBJECT argPtr;
    char *argument, *oldValue;

    /*==================================================*/
    /* Get the current setting for salience evaluation. */
    /*==================================================*/

    oldValue = SalienceEvaluationName(EnvGetSalienceEvaluation(theEnv));

    /*=========================================*/
    /* This function expects a single argument */
    /* which must be a symbol.                 */
    /*=========================================*/

    if (EnvArgCountCheck(theEnv,(char*)"set-salience-evaluation",EXACTLY,1) == -1)
    {
        return((SYMBOL_HN *) EnvAddSymbol(theEnv,oldValue));
    }

    if (EnvArgTypeCheck(theEnv,(char*)"set-salience-evaluation",1,SYMBOL,&argPtr) == FALSE)
    {
        return((SYMBOL_HN *) EnvAddSymbol(theEnv,oldValue));
    }

    /*=============================================================*/
    /* The allowed symbols to pass as an argument to this function */
    /* are when-defined, when-activated, and every-cycle.          */
    /*=============================================================*/

    argument = DOToString(argPtr);

    if (strcmp(argument,(char*)"when-defined") == 0)
    {
        EnvSetSalienceEvaluation(theEnv,WHEN_DEFINED);
    }
    else if (strcmp(argument,(char*)"when-activated") == 0)
    {
        EnvSetSalienceEvaluation(theEnv,WHEN_ACTIVATED);
    }
    else if (strcmp(argument,(char*)"every-cycle") == 0)
    {
        EnvSetSalienceEvaluation(theEnv,EVERY_CYCLE);
    }
    else
    {
        ExpectedTypeError1(theEnv,(char*)"set-salience-evaluation",1,
                           (char*)"symbol with value when-defined, when-activated, or every-cycle");
        return((SYMBOL_HN *) EnvAddSymbol(theEnv,oldValue));
    }

    /*=================================================*/
    /* Return the old setting for salience evaluation. */
    /*=================================================*/

    return((SYMBOL_HN *) EnvAddSymbol(theEnv,oldValue));
}
開發者ID:DrItanium,項目名稱:AdventureEngine,代碼行數:59,代碼來源:agenda.c

示例6: SetIncrementalResetCommand

globle int SetIncrementalResetCommand(
  void *theEnv,
  EXEC_STATUS)
  {
   int oldValue;
   DATA_OBJECT argPtr;
   struct defmodule *theModule;

   oldValue = EnvGetIncrementalReset(theEnv,execStatus);

   /*============================================*/
   /* Check for the correct number of arguments. */
   /*============================================*/

   if (EnvArgCountCheck(theEnv,execStatus,"set-incremental-reset",EXACTLY,1) == -1)
     { return(oldValue); }

   /*=========================================*/
   /* The incremental reset behavior can't be */
   /* changed when rules are loaded.          */
   /*=========================================*/

   SaveCurrentModule(theEnv,execStatus);

   for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,execStatus,NULL);
        theModule != NULL;
        theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,execStatus,theModule))
     {
      EnvSetCurrentModule(theEnv,execStatus,(void *) theModule);
      if (EnvGetNextDefrule(theEnv,execStatus,NULL) != NULL)
        {
         RestoreCurrentModule(theEnv,execStatus);
         PrintErrorID(theEnv,execStatus,"INCRRSET",1,FALSE);
         EnvPrintRouter(theEnv,execStatus,WERROR,"The incremental reset behavior cannot be changed with rules loaded.\n");
         SetEvaluationError(theEnv,execStatus,TRUE);
         return(oldValue);
        }
     }
     
   RestoreCurrentModule(theEnv,execStatus);

   /*==================================================*/
   /* The symbol FALSE disables incremental reset. Any */
   /* other value enables incremental reset.           */
   /*==================================================*/

   EnvRtnUnknown(theEnv,execStatus,1,&argPtr);

   if ((argPtr.value == EnvFalseSymbol(theEnv,execStatus)) && (argPtr.type == SYMBOL))
     { EnvSetIncrementalReset(theEnv,execStatus,FALSE); }
   else
     { EnvSetIncrementalReset(theEnv,execStatus,TRUE); }

   /*=======================*/
   /* Return the old value. */
   /*=======================*/

   return(oldValue);
  }
開發者ID:atrniv,項目名稱:CLIPS,代碼行數:59,代碼來源:incrrset.c

示例7: ResetCommand

globle void ResetCommand(
  void *theEnv,
  EXEC_STATUS)
  {
   if (EnvArgCountCheck(theEnv,execStatus,"reset",EXACTLY,0) == -1) return;
   EnvReset(theEnv,execStatus);
   return;
  }
開發者ID:atrniv,項目名稱:CLIPS,代碼行數:8,代碼來源:constrct.c

示例8: EnvArgCountCheck

globle void *GetClassDefaultsModeCommand(
  void *theEnv,
	EXEC_STATUS)
  {
   EnvArgCountCheck(theEnv,execStatus,"get-class-defaults-mode",EXACTLY,0);

   return((SYMBOL_HN *) EnvAddSymbol(theEnv,execStatus,GetClassDefaultsModeName(EnvGetClassDefaultsMode(theEnv,execStatus))));
  }
開發者ID:atrniv,項目名稱:CLIPS,代碼行數:8,代碼來源:classcom.c

示例9: GetFocusStackFunction

globle void GetFocusStackFunction(
  void *theEnv,
  DATA_OBJECT_PTR returnValue)
  {
   if (EnvArgCountCheck(theEnv,"get-focus-stack",EXACTLY,0) == -1) return;

   EnvGetFocusStack(theEnv,returnValue);
  }
開發者ID:femto,項目名稱:rbclips,代碼行數:8,代碼來源:engine.c

示例10: ClearCommand

globle void ClearCommand(
  void *theEnv,
  EXEC_STATUS)
  {
   if (EnvArgCountCheck(theEnv,execStatus,"clear",EXACTLY,0) == -1) return;
   EnvClear(theEnv,execStatus);
   return;
  }
開發者ID:atrniv,項目名稱:CLIPS,代碼行數:8,代碼來源:constrct.c

示例11: LowcaseFunction

globle void LowcaseFunction(
  void *theEnv,
  DATA_OBJECT_PTR returnValue)
  {
   DATA_OBJECT theArg;
   unsigned i;
   size_t slen;
   char *osptr, *nsptr;

   /*================================================*/
   /* Function lowcase expects exactly one argument. */
   /*================================================*/

   if (EnvArgCountCheck(theEnv,"lowcase",EXACTLY,1) == -1)
     {
      SetpType(returnValue,STRING);
      SetpValue(returnValue,(void *) EnvAddSymbol(theEnv,""));
      return;
     }

   /*==================================================*/
   /* The argument should be of type symbol or string. */
   /*==================================================*/

   if (EnvArgTypeCheck(theEnv,"lowcase",1,SYMBOL_OR_STRING,&theArg) == FALSE)
     {
      SetpType(returnValue,STRING);
      SetpValue(returnValue,(void *) EnvAddSymbol(theEnv,""));
      return;
     }

   /*======================================================*/
   /* Allocate temporary memory and then copy the original */
   /* string or symbol to that memory, while lowercasing   */
   /* upper case alphabetic characters.                    */
   /*======================================================*/

   osptr = DOToString(theArg);
   slen = strlen(osptr) + 1;
   nsptr = (char *) gm2(theEnv,slen);

   for (i = 0  ; i < slen ; i++)
     {
      if (isupper(osptr[i]))
        { nsptr[i] = (char) tolower(osptr[i]); }
      else
        { nsptr[i] = osptr[i]; }
     }

   /*========================================*/
   /* Return the lowercased string and clean */
   /* up the temporary memory used.          */
   /*========================================*/

   SetpType(returnValue,GetType(theArg));
   SetpValue(returnValue,(void *) EnvAddSymbol(theEnv,nsptr));
   rm(theEnv,nsptr,slen);
  }
開發者ID:RobotJustina,項目名稱:JUSTINA,代碼行數:58,代碼來源:strngfun.c

示例12: EnvArgCountCheck

globle void *GetFocusFunction(
  void *theEnv)
  {
   struct defmodule *rv;

   EnvArgCountCheck(theEnv,"get-focus",EXACTLY,0);
   rv = (struct defmodule *) EnvGetFocus(theEnv);
   if (rv == NULL) return((SYMBOL_HN *) EnvFalseSymbol(theEnv));
   return(rv->name);
  }
開發者ID:femto,項目名稱:rbclips,代碼行數:10,代碼來源:engine.c

示例13: BatchCommand

globle int BatchCommand(
    void *theEnv)
{
    char *fileName;

    if (EnvArgCountCheck(theEnv,(char*)"batch",EXACTLY,1) == -1) return(FALSE);
    if ((fileName = GetFileName(theEnv,(char*)"batch",1)) == NULL) return(FALSE);

    return(OpenBatch(theEnv,fileName,FALSE));
}
開發者ID:DrItanium,項目名稱:AdventureEngine,代碼行數:10,代碼來源:filecom.c

示例14: DribbleOnCommand

globle int DribbleOnCommand(
  void *theEnv)
  {
   char *fileName;

   if (EnvArgCountCheck(theEnv,"dribble-on",EXACTLY,1) == -1) return(FALSE);
   if ((fileName = GetFileName(theEnv,"dribble-on",1)) == NULL) return(FALSE);

   return (EnvDribbleOn(theEnv,fileName));
  }
開發者ID:ricksladkey,項目名稱:CLIPS,代碼行數:10,代碼來源:filecom.c

示例15: BatchStarCommand

globle int BatchStarCommand(
  void *theEnv)
  {
   char *fileName;

   if (EnvArgCountCheck(theEnv,"batch*",EXACTLY,1) == -1) return(FALSE);
   if ((fileName = GetFileName(theEnv,"batch*",1)) == NULL) return(FALSE);

   return(EnvBatchStar(theEnv,fileName));
  }
開發者ID:ricksladkey,項目名稱:CLIPS,代碼行數:10,代碼來源:filecom.c


注:本文中的EnvArgCountCheck函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。