Example #1
0
void UnwatchCommand(
  Environment *theEnv,
  UDFContext *context,
  UDFValue *returnValue)
  {
   UDFValue theValue;
   const char *argument;
   bool recognized;
   WatchItemRecord *wPtr;

   /*==========================================*/
   /* Determine which item is to be unwatched. */
   /*==========================================*/

   if (! UDFFirstArgument(context,SYMBOL_BIT,&theValue)) return;

   argument = theValue.lexemeValue->contents;
   wPtr = ValidWatchItem(theEnv,argument,&recognized);
   if (recognized == false)
     {
      SetEvaluationError(theEnv,true);
      UDFInvalidArgumentMessage(context,"watchable symbol");
      return;
     }

   /*=================================================*/
   /* Check to make sure extra arguments are allowed. */
   /*=================================================*/

   if (GetNextArgument(GetFirstArgument()) != NULL)
     {
      if ((wPtr == NULL) ? true : (wPtr->accessFunc == NULL))
        {
         SetEvaluationError(theEnv,true);
         ExpectedCountError(theEnv,"unwatch",EXACTLY,1);
         return;
        }
     }

   /*=====================*/
   /* Set the watch item. */
   /*=====================*/

   SetWatchItem(theEnv,argument,false,GetNextArgument(GetFirstArgument()));
  }
Example #2
0
globle void UnwatchCommand(
  void *theEnv)
  {
   DATA_OBJECT theValue;
   char *argument;
   int recognized;
   struct watchItem *wPtr;

   /*==========================================*/
   /* Determine which item is to be unwatched. */
   /*==========================================*/

   if (EnvArgTypeCheck(theEnv,"unwatch",1,SYMBOL,&theValue) == FALSE) return;
   argument = DOToString(theValue);
   wPtr = ValidWatchItem(theEnv,argument,&recognized);
   if (recognized == FALSE)
     {
      SetEvaluationError(theEnv,TRUE);
      ExpectedTypeError1(theEnv,"unwatch",1,"watchable symbol");
      return;
     }

   /*=================================================*/
   /* Check to make sure extra arguments are allowed. */
   /*=================================================*/

   if (GetNextArgument(GetFirstArgument()) != NULL)
     {
      if ((wPtr == NULL) ? TRUE : (wPtr->accessFunc == NULL))
        {
         SetEvaluationError(theEnv,TRUE);
         ExpectedCountError(theEnv,"unwatch",EXACTLY,1);
         return;
        }
     }

   /*=====================*/
   /* Set the watch item. */
   /*=====================*/

   SetWatchItem(theEnv,argument,OFF,GetNextArgument(GetFirstArgument()));
  }
Example #3
0
globle BOOLEAN Unwatch(
  char *itemName)
  {
   return(SetWatchItem(itemName,OFF,NULL));
  }
Example #4
0
BOOL FAR PASCAL WatchDlgProc (
   HWND     hDlg,
   unsigned message,
   WORD     wParam,
   LONG     lParam)

{  static int count;
   switch (message)
   {  case WM_INITDIALOG:
      {  count = 0;
	 count += SetCheckBox(hDlg, IDC_WATCH_COMPILE,    GetWatchItem("compilations"));
	 count += SetCheckBox(hDlg, IDC_WATCH_FACTS,      GetWatchItem("facts"));
	 count += SetCheckBox(hDlg, IDC_WATCH_INSTANCE,   GetWatchItem("instances"));
	 count += SetCheckBox(hDlg, IDC_WATCH_RULES,      GetWatchItem("rules"));
	 count += SetCheckBox(hDlg, IDC_WATCH_GENERIC,    GetWatchItem("generic-functions"));
	 count += SetCheckBox(hDlg, IDC_WATCH_MESSAGE,    GetWatchItem("messages"));
	 count += SetCheckBox(hDlg, IDC_WATCH_DEFFUN,     GetWatchItem("deffunctions"));
	 count += SetCheckBox(hDlg, IDC_WATCH_STATS,      GetWatchItem("statistics"));
	 count += SetCheckBox(hDlg, IDC_WATCH_GLOBAL,     GetWatchItem("globals"));
	 count += SetCheckBox(hDlg, IDC_WATCH_SLOT,       GetWatchItem("slots"));
	 count += SetCheckBox(hDlg, IDC_WATCH_ACTIVE,     GetWatchItem("activations"));
	 count += SetCheckBox(hDlg, IDC_WATCH_METHOD,     GetWatchItem("methods"));
	 count += SetCheckBox(hDlg, IDC_WATCH_FOCUS,      GetWatchItem("focus"));
	 count += SetCheckBox(hDlg, IDC_WATCH_MSGHANDLER, GetWatchItem("message-handlers"));
	 if (count == IDC_WATCH_COUNT )
	    EnableWindow(GetDlgItem(hDlg, IDC_WATCH_ALL ), FALSE);
	 else if ( count == 0 )
	    EnableWindow(GetDlgItem(hDlg, IDC_WATCH_NONE), FALSE);
	 return (TRUE);
      }

      case WM_COMMAND:
      {  switch (wParam)
	 {  case IDC_OK:
	       SetWatchItem ("compilations",     IsDlgButtonChecked (hDlg, IDC_WATCH_COMPILE),NULL);
	       SetWatchItem ("statistics",       IsDlgButtonChecked (hDlg, IDC_WATCH_STATS),NULL);
#if DEFTEMPLATE_CONSTRUCT
	       SetWatchItem ("facts",            IsDlgButtonChecked (hDlg, IDC_WATCH_FACTS),NULL);
#endif
#if OBJECT_SYSTEM
	       SetWatchItem ("instances",        IsDlgButtonChecked (hDlg, IDC_WATCH_INSTANCE),NULL);
	       SetWatchItem ("slots",            IsDlgButtonChecked (hDlg, IDC_WATCH_SLOT),NULL);
	       SetWatchItem ("messages",         IsDlgButtonChecked (hDlg, IDC_WATCH_MESSAGE),NULL);
	       SetWatchItem ("message-handlers", IsDlgButtonChecked (hDlg, IDC_WATCH_MSGHANDLER),NULL);
#endif
#if DEFFUNCTION_CONSTRUCT
	       SetWatchItem ("deffunctions",     IsDlgButtonChecked (hDlg, IDC_WATCH_DEFFUN),NULL);
#endif
#if DEFRULE_CONSTRUCT
	       SetWatchItem ("rules",            IsDlgButtonChecked (hDlg, IDC_WATCH_RULES),NULL);
	       SetWatchItem ("activations",      IsDlgButtonChecked (hDlg, IDC_WATCH_ACTIVE),NULL);
	       SetWatchItem ("focus",            IsDlgButtonChecked (hDlg, IDC_WATCH_FOCUS),NULL);
#endif
#if DEFGENERIC_CONSTRUCT
	       SetWatchItem ("generic-functions",IsDlgButtonChecked (hDlg, IDC_WATCH_GENERIC),NULL);
	       SetWatchItem ("methods",          IsDlgButtonChecked (hDlg, IDC_WATCH_METHOD),NULL);
#endif
#if DEFGLOBAL_CONSTRUCT
	       SetWatchItem ("globals",          IsDlgButtonChecked (hDlg, IDC_WATCH_GLOBAL),NULL);
#endif

	    case IDC_CANCEL:
	    {  EndDialog ( hDlg, IDOK);
	       return ( TRUE );
	    }

	    case IDC_WATCH_COMPILE:
	    case IDC_WATCH_FACTS:
	    case IDC_WATCH_INSTANCE:
	    case IDC_WATCH_RULES:
	    case IDC_WATCH_GENERIC:
	    case IDC_WATCH_MESSAGE:
	    case IDC_WATCH_DEFFUN:
	    case IDC_WATCH_STATS:
	    case IDC_WATCH_GLOBAL:
	    case IDC_WATCH_SLOT:
	    case IDC_WATCH_METHOD:
	    case IDC_WATCH_MSGHANDLER:
	    case IDC_WATCH_ACTIVE:
	    case IDC_WATCH_FOCUS:
	    {  if (IsDlgButtonChecked (hDlg, wParam))
	       {  SetCheckBox ( hDlg, wParam, 0);
		  count --;
	       }
	       else
	       {  SetCheckBox(hDlg, wParam, 1);
		  count++;
	       }
	       if (count == IDC_WATCH_COUNT )
		  EnableWindow(GetDlgItem(hDlg, IDC_WATCH_ALL ), FALSE);
	       else if ( count == 0 )
		  EnableWindow(GetDlgItem(hDlg, IDC_WATCH_NONE), FALSE);
	       else
	       {  EnableWindow(GetDlgItem(hDlg, IDC_WATCH_ALL ), TRUE);
		  EnableWindow(GetDlgItem(hDlg, IDC_WATCH_NONE ), TRUE);
	       }
	       return (TRUE);
	    }

	    case IDC_WATCH_ALL:
		 {  WORD x;
	       for ( x=IDC_WATCH_START; x<=IDC_WATCH_END; x++)
		  SetCheckBox ( hDlg,x,1);
	       EnableWindow(GetDlgItem(hDlg, IDC_WATCH_ALL ), FALSE);
	       EnableWindow(GetDlgItem(hDlg, IDC_WATCH_NONE), TRUE);
	       count = IDC_WATCH_COUNT;
	       return ( TRUE );
	    }

	    case IDC_WATCH_NONE:
	    {  WORD x;
	       for ( x=IDC_WATCH_START; x<=IDC_WATCH_END; x++)
		  SetCheckBox ( hDlg,x,0);
	       EnableWindow(GetDlgItem(hDlg, IDC_WATCH_NONE), FALSE);
	       EnableWindow(GetDlgItem(hDlg, IDC_WATCH_ALL ), TRUE);
	       count = 0;
	       return ( TRUE );
	    }
	 }
      }
   }
   return ( FALSE );
}
Example #5
0
globle CLIPS_BOOLEAN EnvUnwatch(
  void *theEnv,
  char *itemName)
  {
   return(SetWatchItem(theEnv,itemName,OFF,NULL));
  }
Example #6
0
bool UnwatchString(
  Environment *theEnv,
  const char *itemName)
  {
   return SetWatchItem(theEnv,itemName,false,NULL);
  }
Example #7
0
void SetWatchState(
  Environment *theEnv,
  WatchItem item,
  bool newState)
  {
   switch (item)
     {
      case ALL:
        SetWatchItem(theEnv,"all",newState,NULL);
        return;

      case FACTS:
        SetWatchItem(theEnv,"facts",newState,NULL);
        return;
        
      case INSTANCES:
        SetWatchItem(theEnv,"instances",newState,NULL);
        return;
        
      case SLOTS:
        SetWatchItem(theEnv,"slots",newState,NULL);
        return;
        
      case RULES:
        SetWatchItem(theEnv,"rules",newState,NULL);
        return;
        
      case ACTIVATIONS:
        SetWatchItem(theEnv,"activations",newState,NULL);
        return;
        
      case MESSAGES:
        SetWatchItem(theEnv,"messages",newState,NULL);
        return;
        
      case MESSAGE_HANDLERS:
        SetWatchItem(theEnv,"message-handlers",newState,NULL);
        return;
        
      case GENERIC_FUNCTIONS:
        SetWatchItem(theEnv,"generic-functions",newState,NULL);
        return;
        
      case METHODS:
        SetWatchItem(theEnv,"methods",newState,NULL);
        return;
        
      case DEFFUNCTIONS:
        SetWatchItem(theEnv,"deffunctions",newState,NULL);
        return;
        
      case COMPILATIONS:
        SetWatchItem(theEnv,"compilations",newState,NULL);
        return;
        
      case STATISTICS:
        SetWatchItem(theEnv,"statistics",newState,NULL);
        return;
        
      case GLOBALS:
        SetWatchItem(theEnv,"globals",newState,NULL);
        return;
        
      case FOCUS:
        SetWatchItem(theEnv,"focus",newState,NULL);
        return;
     }
  }