コード例 #1
0
ファイル: classexm.c プロジェクト: DrItanium/maya
/****************************************************************
  NAME         : BrowseClassesCommand
  DESCRIPTION  : Displays a "graph" of the class hierarchy
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : None
  NOTES        : Syntax : (browse-classes [<class>])
 ****************************************************************/
void BrowseClassesCommand(
  Environment *theEnv,
  UDFContext *context,
  UDFValue *returnValue)
  {
   Defclass *cls;

   if (UDFArgumentCount(context) == 0)
      /* ================================================
         Find the OBJECT root class (has no superclasses)
         ================================================ */
      cls = LookupDefclassByMdlOrScope(theEnv,OBJECT_TYPE_NAME);
   else
     {
      UDFValue theArg;

      if (! UDFFirstArgument(context,SYMBOL_BIT,&theArg))
        return;
      cls = LookupDefclassByMdlOrScope(theEnv,theArg.lexemeValue->contents);
      if (cls == NULL)
        {
         ClassExistError(theEnv,"browse-classes",theArg.lexemeValue->contents);
         return;
        }
     }
   BrowseClasses(cls,STDOUT);
  }
コード例 #2
0
ファイル: router.c プロジェクト: guitarpoet/php-clips
void ExitCommand(
  UDFContext *context,
  CLIPSValue *returnValue)
  {
   int argCnt;
   int status;
   CLIPSValue value;
   Environment *theEnv = UDFContextEnvironment(context);

   argCnt = UDFArgumentCount(context);
   if (argCnt == 0)
     { EnvExitRouter(theEnv,EXIT_SUCCESS); }
   else
    {
     if (! UDFFirstArgument(context,INTEGER_TYPE,&value))
       { EnvExitRouter(theEnv,EXIT_SUCCESS); }
     status = (int) mCVToInteger(&value);
     if (EnvGetEvaluationError(theEnv)) return;
     EnvExitRouter(theEnv,status);
    }

   return;
  }