当前位置: 首页>>代码示例>>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;未经允许,请勿转载。