⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prntutil.c

📁 clips源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/****************************************************/globle void AlreadyParsedErrorMessage(  void *theEnv,  char *itemType,  char *itemName)  {   PrintErrorID(theEnv,"PRNTUTIL",5,TRUE);   EnvPrintRouter(theEnv,WERROR,"The ");   if (itemType != NULL) EnvPrintRouter(theEnv,WERROR,itemType);   if (itemName != NULL) EnvPrintRouter(theEnv,WERROR,itemName);   EnvPrintRouter(theEnv,WERROR," has already been parsed.\n");  }/*********************************************************//* SyntaxErrorMessage: Generalized syntax error message. *//*********************************************************/globle void SyntaxErrorMessage(  void *theEnv,  char *location)  {   PrintErrorID(theEnv,"PRNTUTIL",2,TRUE);   EnvPrintRouter(theEnv,WERROR,"Syntax Error");   if (location != NULL)     {      EnvPrintRouter(theEnv,WERROR,":  Check appropriate syntax for ");      EnvPrintRouter(theEnv,WERROR,location);     }   EnvPrintRouter(theEnv,WERROR,".\n");   SetEvaluationError(theEnv,TRUE);  }/****************************************************//* LocalVariableErrorMessage: Generic error message *//*  when a local variable is accessed by an "item"  *//*  which can not access local variables.           *//****************************************************/globle void LocalVariableErrorMessage(  void *theEnv,  char *byWhat)  {   PrintErrorID(theEnv,"PRNTUTIL",6,TRUE);   EnvPrintRouter(theEnv,WERROR,"Local variables can not be accessed by ");   EnvPrintRouter(theEnv,WERROR,byWhat);   EnvPrintRouter(theEnv,WERROR,".\n");  }/******************************************//* SystemError: Generalized error message *//*   for major internal errors.           *//******************************************/globle void SystemError(  void *theEnv,  char *module,  int errorID)  {   PrintErrorID(theEnv,"PRNTUTIL",3,TRUE);   EnvPrintRouter(theEnv,WERROR,"\n*** ");   EnvPrintRouter(theEnv,WERROR,APPLICATION_NAME);   EnvPrintRouter(theEnv,WERROR," SYSTEM ERROR ***\n");   EnvPrintRouter(theEnv,WERROR,"ID = ");   EnvPrintRouter(theEnv,WERROR,module);   PrintLongInteger(theEnv,WERROR,(long int) errorID);   EnvPrintRouter(theEnv,WERROR,"\n");   EnvPrintRouter(theEnv,WERROR,APPLICATION_NAME);   EnvPrintRouter(theEnv,WERROR," data structures are in an inconsistent or corrupted state.\n");   EnvPrintRouter(theEnv,WERROR,"This error may have occurred from errors in user defined code.\n");   EnvPrintRouter(theEnv,WERROR,"**************************\n");  }/*******************************************************//* DivideByZeroErrorMessage: Generalized error message *//*   for when a function attempts to divide by zero.   *//*******************************************************/globle void DivideByZeroErrorMessage(  void *theEnv,  char *functionName)  {   PrintErrorID(theEnv,"PRNTUTIL",7,FALSE);   EnvPrintRouter(theEnv,WERROR,"Attempt to divide by zero in ");   EnvPrintRouter(theEnv,WERROR,functionName);   EnvPrintRouter(theEnv,WERROR," function.\n");  }/*******************************************************//* FloatToString: Converts number to KB string format. *//*******************************************************/globle char *FloatToString(  void *theEnv,  double number)  {   char floatString[40];   int i;   char x;   void *thePtr;   gensprintf(floatString,"%.15g",number);   for (i = 0; (x = floatString[i]) != '\0'; i++)     {      if ((x == '.') || (x == 'e'))        {         thePtr = EnvAddSymbol(theEnv,floatString);         return(ValueToString(thePtr));        }     }   genstrcat(floatString,".0");   thePtr = EnvAddSymbol(theEnv,floatString);   return(ValueToString(thePtr));  }/*******************************************************************//* LongIntegerToString: Converts long integer to KB string format. *//*******************************************************************/globle char *LongIntegerToString(  void *theEnv,  long long number)  {   char buffer[50];   void *thePtr;   gensprintf(buffer,"%lld",number);   thePtr = EnvAddSymbol(theEnv,buffer);   return(ValueToString(thePtr));  }/*******************************************************************//* DataObjectToString: Converts a DATA_OBJECT to KB string format. *//*******************************************************************/globle char *DataObjectToString(  void *theEnv,  DATA_OBJECT *theDO)  {   void *thePtr;   char *theString, *newString;   char *prefix, *postfix;   size_t length;   char buffer[30];      switch (GetpType(theDO))     {      case MULTIFIELD:         prefix = "(";         theString = ValueToString(ImplodeMultifield(theEnv,theDO));         postfix = ")";         break;               case STRING:         prefix = "\"";         theString = DOPToString(theDO);         postfix = "\"";         break;               case INSTANCE_NAME:         prefix = "[";         theString = DOPToString(theDO);         postfix = "]";         break;               case SYMBOL:         return(DOPToString(theDO));               case FLOAT:         return(FloatToString(theEnv,DOPToDouble(theDO)));               case INTEGER:         return(LongIntegerToString(theEnv,DOPToLong(theDO)));               case RVOID:         return("");#if OBJECT_SYSTEM      case INSTANCE_ADDRESS:         thePtr = DOPToPointer(theDO);         if (thePtr == (void *) &InstanceData(theEnv)->DummyInstance)           { return("<Dummy Instance>"); }                    if (((struct instance *) thePtr)->garbage)           {            prefix = "<Stale Instance-";            theString = ValueToString(((struct instance *) thePtr)->name);            postfix = ">";           }         else           {            prefix = "<Instance-";            theString = ValueToString(GetFullInstanceName(theEnv,(INSTANCE_TYPE *) thePtr));            postfix = ">";           }                   break;#endif            case EXTERNAL_ADDRESS:        gensprintf(buffer,"<Pointer-%p>",DOPToPointer(theDO));        thePtr = EnvAddSymbol(theEnv,buffer);        return(ValueToString(thePtr));#if DEFTEMPLATE_CONSTRUCT            case FACT_ADDRESS:         if (DOPToPointer(theDO) == (void *) &FactData(theEnv)->DummyFact)           { return("<Dummy Fact>"); }                  thePtr = DOPToPointer(theDO);         gensprintf(buffer,"<Fact-%lld>",((struct fact *) thePtr)->factIndex);         thePtr = EnvAddSymbol(theEnv,buffer);         return(ValueToString(thePtr));#endif                              default:         return("UNK");     }        length = strlen(prefix) + strlen(theString) + strlen(postfix) + 1;   newString = (char *) genalloc(theEnv,length);   newString[0] = '\0';   genstrcat(newString,prefix);   genstrcat(newString,theString);   genstrcat(newString,postfix);   thePtr = EnvAddSymbol(theEnv,newString);   genfree(theEnv,newString,length);   return(ValueToString(thePtr));  }  /************************************************************//* SalienceInformationError: Error message for errors which *//*   occur during the evaluation of a salience value.       *//************************************************************/globle void SalienceInformationError(  void *theEnv,  char *constructType,  char *constructName)  {   PrintErrorID(theEnv,"PRNTUTIL",8,TRUE);   EnvPrintRouter(theEnv,WERROR,"This error occurred while evaluating the salience");   if (constructName != NULL)     {      EnvPrintRouter(theEnv,WERROR," for ");      EnvPrintRouter(theEnv,WERROR,constructType);      EnvPrintRouter(theEnv,WERROR," ");      EnvPrintRouter(theEnv,WERROR,constructName);     }   EnvPrintRouter(theEnv,WERROR,".\n");  }/**********************************************************//* SalienceRangeError: Error message that is printed when *//*   a salience value does not fall between the minimum   *//*   and maximum salience values.                         *//**********************************************************/globle void SalienceRangeError(  void *theEnv,  int min,  int max)  {   PrintErrorID(theEnv,"PRNTUTIL",9,TRUE);   EnvPrintRouter(theEnv,WERROR,"Salience value out of range ");   PrintLongInteger(theEnv,WERROR,(long int) min);   EnvPrintRouter(theEnv,WERROR," to ");   PrintLongInteger(theEnv,WERROR,(long int) max);   EnvPrintRouter(theEnv,WERROR,".\n");  }/***************************************************************//* SalienceNonIntegerError: Error message that is printed when *//*   a rule's salience does not evaluate to an integer.        *//***************************************************************/globle void SalienceNonIntegerError(  void *theEnv)  {   PrintErrorID(theEnv,"PRNTUTIL",10,TRUE);   EnvPrintRouter(theEnv,WERROR,"Salience value must be an integer value.\n");  }/***************************************************//* SlotExistError: Prints out an appropriate error *//*   message when a slot cannot be found for a     *//*   function. Input to the function is the slot   *//*   name and the function name.                   *//***************************************************/globle void SlotExistError(  void *theEnv,  char *sname,  char *func)  {   PrintErrorID(theEnv,"INSFUN",3,FALSE);   EnvPrintRouter(theEnv,WERROR,"No such slot ");   EnvPrintRouter(theEnv,WERROR,sname);   EnvPrintRouter(theEnv,WERROR," in function ");   EnvPrintRouter(theEnv,WERROR,func);   EnvPrintRouter(theEnv,WERROR,".\n");   SetEvaluationError(theEnv,TRUE);  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -