Esempio n. 1
0
static void PrintObjectCmpConstant(
    void *theEnv,
    const char *logicalName,
    void *theValue)
{
#if DEVELOPER
    struct ObjectCmpPNConstant *hack;

    hack = (struct ObjectCmpPNConstant *) ValueToBitMap(theValue);

    EnvPrintRouter(theEnv,logicalName,"(obj-const ");
    EnvPrintRouter(theEnv,logicalName,hack->pass ? "p " : "n ");
    if (hack->general)
        PrintExpression(theEnv,logicalName,GetFirstArgument());
    else
    {
        EnvPrintRouter(theEnv,logicalName,hack->fromBeginning ? "B" : "E");
        PrintLongInteger(theEnv,logicalName,(long long) hack->offset);
        EnvPrintRouter(theEnv,logicalName," ");
        PrintExpression(theEnv,logicalName,GetFirstArgument());
    }
    EnvPrintRouter(theEnv,logicalName,")");
#else
#endif
}
Esempio n. 2
0
/*********************************************************
  NAME         : DisplaySlotConstraintInfo
  DESCRIPTION  : Displays a table summary of type-checking
                  facets for the slots of a class
                  including:
                  type
                  allowed-symbols
                  allowed-integers
                  allowed-floats
                  allowed-values
                  allowed-instance-names
                  range
                  min-number-of-elements
                  max-number-of-elements

                  The function also displays the source
                  class(es) for the facets
  INPUTS       : 1) A format string for use in sprintf
                 2) A buffer to store the display in
                 3) Maximum buffer size
                 4) A pointer to the class
  RETURNS      : Nothing useful
  SIDE EFFECTS : Buffer written to and displayed
  NOTES        : None
 *********************************************************/
static void DisplaySlotConstraintInfo(
  Environment *theEnv,
  const char *logicalName,
  const char *slotNamePrintFormat,
  char *buf,
  unsigned maxlen,
  Defclass *cls)
  {
   long i;
   CONSTRAINT_RECORD *cr;
   const char *strdest = "***describe-class***";

   gensprintf(buf,slotNamePrintFormat,"SLOTS");
   genstrcat(buf,"SYM STR INN INA EXA FTA INT FLT\n");
   WriteString(theEnv,logicalName,buf);
   for (i = 0 ; i < cls->instanceSlotCount ; i++)
     {
      cr = cls->instanceTemplate[i]->constraint;
      gensprintf(buf,slotNamePrintFormat,cls->instanceTemplate[i]->slotName->name->contents);
      if (cr != NULL)
        {
         genstrcat(buf,ConstraintCode(cr,cr->symbolsAllowed,cr->symbolRestriction));
         genstrcat(buf,ConstraintCode(cr,cr->stringsAllowed,cr->stringRestriction));
         genstrcat(buf,ConstraintCode(cr,cr->instanceNamesAllowed,
                                      (cr->instanceNameRestriction || cr->classRestriction)));
         genstrcat(buf,ConstraintCode(cr,cr->instanceAddressesAllowed,cr->classRestriction));
         genstrcat(buf,ConstraintCode(cr,cr->externalAddressesAllowed,0));
         genstrcat(buf,ConstraintCode(cr,cr->factAddressesAllowed,0));
         genstrcat(buf,ConstraintCode(cr,cr->integersAllowed,cr->integerRestriction));
         genstrcat(buf,ConstraintCode(cr,cr->floatsAllowed,cr->floatRestriction));
         OpenStringDestination(theEnv,strdest,buf + strlen(buf),(maxlen - strlen(buf) - 1));
         if (cr->integersAllowed || cr->floatsAllowed || cr->anyAllowed)
           {
            WriteString(theEnv,strdest,"RNG:[");
            PrintExpression(theEnv,strdest,cr->minValue);
            WriteString(theEnv,strdest,"..");
            PrintExpression(theEnv,strdest,cr->maxValue);
            WriteString(theEnv,strdest,"] ");
           }
         if (cls->instanceTemplate[i]->multiple)
           {
            WriteString(theEnv,strdest,"CRD:[");
            PrintExpression(theEnv,strdest,cr->minFields);
            WriteString(theEnv,strdest,"..");
            PrintExpression(theEnv,strdest,cr->maxFields);
            WriteString(theEnv,strdest,"]");
           }
        }
      else
        {
         OpenStringDestination(theEnv,strdest,buf,maxlen);
         WriteString(theEnv,strdest," +   +   +   +   +   +   +   +  RNG:[-oo..+oo]");
         if (cls->instanceTemplate[i]->multiple)
           WriteString(theEnv,strdest," CRD:[0..+oo]");
        }
      WriteString(theEnv,strdest,"\n");
      CloseStringDestination(theEnv,strdest);
      WriteString(theEnv,logicalName,buf);
     }
  }
Esempio n. 3
0
bool YacasPatternPredicateBase::CheckPredicates(LispEnvironment& aEnvironment)
{
    const std::size_t n = iPredicates.size();
  for (std::size_t i = 0; i < n; ++i)
  {
    LispPtr pred;
    aEnvironment.iEvaluator->Eval(aEnvironment, pred, iPredicates[i]);
    if (IsFalse(aEnvironment, pred))
    {
      return false;
    }
    // If the result is not False, it should be True, else probably something is wrong (the expression returned unevaluated)
    bool isTrue = IsTrue(aEnvironment, pred);
    if (!isTrue)
    {
#define LIM_AL 60
      LispString strout;

      aEnvironment.iErrorOutput << "The predicate\n\t";
      PrintExpression(strout, iPredicates[i], aEnvironment, LIM_AL);
      aEnvironment.iErrorOutput << strout;
      aEnvironment.iErrorOutput << "\nevaluated to\n\t";
      PrintExpression(strout, pred, aEnvironment, LIM_AL);
      aEnvironment.iErrorOutput << strout << '\n';

      ShowStack(aEnvironment);
      throw LispErrMaxRecurseDepthReached();
    }
  }
  return true;
}
Esempio n. 4
0
int main(void) {
	int x = y = 1; // error: use of undeclared identifier 'y'

	PrintExpression(x);
	PrintExpression(y);

	return 0;
}
Esempio n. 5
0
globle void ShowFactPatternNetwork(
  void *theEnv)
  {
   struct factPatternNode *patternPtr;
   struct deftemplate *theDeftemplate;
   char *theName;
   int depth = 0, i;

   theName = GetConstructName(theEnv,(char*)"show-fpn",(char*)"template name");
   if (theName == NULL) return;

   theDeftemplate = (struct deftemplate *) EnvFindDeftemplate(theEnv,theName);
   if (theDeftemplate == NULL) return;

   patternPtr = theDeftemplate->patternNetwork;
   while (patternPtr != NULL)
     {
      for (i = 0; i < depth; i++) EnvPrintRouter(theEnv,WDISPLAY,(char*)" ");
      if (patternPtr->header.singlefieldNode) EnvPrintRouter(theEnv,WDISPLAY,(char*)"SF   ");
      else if (patternPtr->header.multifieldNode)
        {
         EnvPrintRouter(theEnv,WDISPLAY,(char*)"MF");
         if (patternPtr->header.endSlot) EnvPrintRouter(theEnv,WDISPLAY,(char*)")");
         else EnvPrintRouter(theEnv,WDISPLAY,(char*)"*");
         PrintLongInteger(theEnv,WDISPLAY,(long long) patternPtr->leaveFields);
         EnvPrintRouter(theEnv,WDISPLAY,(char*)" ");
        }

      EnvPrintRouter(theEnv,WDISPLAY,(char*)"Slot: ");

      PrintLongInteger(theEnv,WDISPLAY,(long long) patternPtr->whichSlot);
      EnvPrintRouter(theEnv,WDISPLAY,(char*)" Field: ");
      PrintLongInteger(theEnv,WDISPLAY,(long long) patternPtr->whichField);
      EnvPrintRouter(theEnv,WDISPLAY,(char*)" Expression: ");
      if (patternPtr->networkTest == NULL) EnvPrintRouter(theEnv,WDISPLAY,(char*)"None");
      else PrintExpression(theEnv,WDISPLAY,patternPtr->networkTest);
      EnvPrintRouter(theEnv,WDISPLAY,(char*)" RightHash: ");
      if (patternPtr->header.rightHash == NULL) EnvPrintRouter(theEnv,WDISPLAY,(char*)"None");
      else PrintExpression(theEnv,WDISPLAY,patternPtr->header.rightHash);
      EnvPrintRouter(theEnv,WDISPLAY,(char*)"\n");

      if (patternPtr->nextLevel == NULL)
        {
         while (patternPtr->rightNode == NULL)
           {
            patternPtr = patternPtr->lastLevel;
            depth--;
            if (patternPtr == NULL) return;
           }
         patternPtr = patternPtr->rightNode;
        }
      else
        {
         patternPtr = patternPtr->nextLevel;
         depth++;
        }
     }
  }
Esempio n. 6
0
static void PrintRange(
  void *theEnv,
  const char *logicalName,
  CONSTRAINT_RECORD *theConstraint)
  {
   if (theConstraint->minValue->value == SymbolData(theEnv)->NegativeInfinity)
     { EnvPrintRouter(theEnv,logicalName,ValueToString(SymbolData(theEnv)->NegativeInfinity)); }
   else PrintExpression(theEnv,logicalName,theConstraint->minValue);
   EnvPrintRouter(theEnv,logicalName," to ");
   if (theConstraint->maxValue->value == SymbolData(theEnv)->PositiveInfinity)
     { EnvPrintRouter(theEnv,logicalName,ValueToString(SymbolData(theEnv)->PositiveInfinity)); }
   else PrintExpression(theEnv,logicalName,theConstraint->maxValue);
  }
Esempio n. 7
0
int main(int argc, char *argv[]) {
	char *arg_1 = argv[(argc > 2) ? argc - 2 : argc - 1];
	char *arg_2 = argv[argc - 1];

	char *string;
	string = malloc(strlen(arg_1) + strlen(arg_2));
	strcpy(string, arg_1);

	PrintExpression(string);
	strcat(string, arg_2);
	PrintExpression(string);

	return 0;
}
Esempio n. 8
0
int main(int argc, char** args)
{
    char s[1024+1];
    gets_s(s);

    void* expr;
    int res = ParseExpression(s, 1024, &expr);
    printErr("ParseExpression", res);
    if (res <= 0)
        return 1;

    res = PrintExpression(expr, s, 1024);
    printErr("PrintExpression", res);
    if (res <= 0)
        return 1;
    s[res] = 0;
    printf("%s\n", s);

    uint8 output[1024];
    res = CompileExpression(expr, output, 1024, IdentifierInfoCallback);
    printErr("CompileExpression", res);
    if (res <= 0)
        return 1;

    std::ofstream f("output.bin");
    f.write((char*)output, res);
    f.close();

    res = ReleaseExpression(expr);
    printErr("ReleaseExpression", res);
    if (res <= 0)
        return 1;

    return 0;
}
Esempio n. 9
0
int main(void) {
	int j = 18;
	for (int j = 6; j < 10; ++j);
	PrintExpression(j);

	return 0;
}
Esempio n. 10
0
globle void PrintHandlerSlotPutFunction(
  char *logicalName,
  void *theValue)
  {
#if DEVELOPER
   HANDLER_SLOT_REFERENCE *theReference;
   DEFCLASS *theDefclass;
   SLOT_DESC *sd;

   theReference = (HANDLER_SLOT_REFERENCE *) ValueToBitMap(theValue);
   PrintRouter(logicalName,"(bind ?self:[");
   theDefclass = ClassIDMap[theReference->classID];
   PrintRouter(logicalName,ValueToString(theDefclass->header.name));
   PrintRouter(logicalName,"]");
   sd = theDefclass->instanceTemplate[theDefclass->slotNameMap[theReference->slotID]];
   PrintRouter(logicalName,ValueToString(sd->slotName->name));
   if (GetFirstArgument() != NULL)
     {
      PrintRouter(logicalName," ");
      PrintExpression(logicalName,GetFirstArgument());
     }
   PrintRouter(logicalName,")");
#else
#if MAC_MPW || MAC_MCW
#pragma unused(logicalName)
#pragma unused(theValue)
#endif
#endif
  }
Esempio n. 11
0
static void ShowJoins(
  void *theEnv,
  void *theRule)
  {
   struct defrule *rulePtr;
   struct joinNode *theJoin;
   struct joinNode *joinList[MAXIMUM_NUMBER_OF_PATTERNS];
   int numberOfJoins;

   rulePtr = (struct defrule *) theRule;

   /*=================================================*/
   /* Loop through each of the disjuncts for the rule */
   /*=================================================*/

   while (rulePtr != NULL)
     {
      /*=====================================*/
      /* Determine the number of join nodes. */
      /*=====================================*/

      numberOfJoins = -1;
      theJoin = rulePtr->lastJoin;
      while (theJoin != NULL)
        {
         if (theJoin->joinFromTheRight)
           { theJoin = (struct joinNode *) theJoin->rightSideEntryStructure; }
         else
           {
            numberOfJoins++;
            joinList[numberOfJoins] = theJoin;
            theJoin = theJoin->lastLevel;
           }
        }

      /*====================*/
      /* Display the joins. */
      /*====================*/

      while (numberOfJoins >= 0)
        {
         char buffer[20];
         sprintf(buffer,"%2d%c%c: ",(int) joinList[numberOfJoins]->depth,
                                     (joinList[numberOfJoins]->patternIsNegated) ? 'n' : ' ',
                                     (joinList[numberOfJoins]->logicalJoin) ? 'l' : ' ');
         EnvPrintRouter(theEnv,WDISPLAY,buffer);
         PrintExpression(theEnv,WDISPLAY,joinList[numberOfJoins]->networkTest);
         EnvPrintRouter(theEnv,WDISPLAY,"\n");
         numberOfJoins--;
        };

      /*===============================*/
      /* Proceed to the next disjunct. */
      /*===============================*/

      rulePtr = rulePtr->disjunct;
      if (rulePtr != NULL) EnvPrintRouter(theEnv,WDISPLAY,"\n");
     }
  }
Esempio n. 12
0
int main(void) {
	enum {
		ONE,
		TWO,
		THREE,
		FOUR
	};

	printf("In main\n");
	PrintExpression(ONE);
	PrintExpression(TWO);
	PrintExpression(THREE);

	printf("\nOutside main\n");
	enum_print();

	return 0;
}
Esempio n. 13
0
void ShowArgTypeErrorInfo(int aArgNr, LispPtr& aArguments, LispEnvironment& aEnvironment)
{
    ShowStack(aEnvironment);
    ShowFunctionError(aArguments, aEnvironment);

    aEnvironment.iErrorOutput << "bad argument number " << aArgNr << " (counting from 1)\n";

    const int LIM_AL = 60;

    LispPtr& arg = Argument(aArguments,aArgNr);
    LispString strout;

    PrintExpression(strout, arg, aEnvironment, LIM_AL);
    aEnvironment.iErrorOutput << "The offending argument " << strout;

    LispPtr eval;
    aEnvironment.iEvaluator->Eval(aEnvironment, eval, arg);
    PrintExpression(strout, eval, aEnvironment, LIM_AL);

    aEnvironment.iErrorOutput << " evaluated to " << strout << '\n';
}
Esempio n. 14
0
int main(int argc, char* argv[]) {
    // Construct a wrapper around the input file stream
    // Defaults to DATA1.txt if the input file wasn't specified
    FileHandler input_file((argv[1] == nullptr ? "DATA1.txt" : argv[1]));
    auto bool_expressions = input_file.ReadInputFile();

    for (auto &expression : bool_expressions) {
	// Print the original boolean expression
	std::cout << "The original boolean expression is:\n"
		  << PrintExpression(expression) << std::endl;

	auto minimized = MinimizeExpression(expression);

	// Print the minimized boolean expression only if it
	// was successfully minimized
	if (minimized.size()) {
	    std::cout << "The minimized boolean expression is:\n"
		      << PrintExpression(minimized) << std::endl;
	}
	std::cout << std::endl;
    }

    return 0;
}
Esempio n. 15
0
globle void PrintExpression(
  char *fileid,
  struct expr *theExpression)
  {
   struct expr *oldExpression;

   if (theExpression == NULL)
     { return; }

   while (theExpression != NULL)
     {
      switch (theExpression->type)
        {
         case SF_VARIABLE:
         case GBL_VARIABLE:
            PrintRouter(fileid,"?");
            PrintRouter(fileid,ValueToString(theExpression->value));
            break;

         case MF_VARIABLE:
         case MF_GBL_VARIABLE:
            PrintRouter(fileid,"$?");
            PrintRouter(fileid,ValueToString(theExpression->value));
            break;

         case FCALL:
           PrintRouter(fileid,"(");
           PrintRouter(fileid,ValueToString(ExpressionFunctionCallName(theExpression)));
           if (theExpression->argList != NULL) { PrintRouter(fileid," "); }
           PrintExpression(fileid,theExpression->argList);
           PrintRouter(fileid,")");
           break;

         default:
           oldExpression = CurrentExpression;
           CurrentExpression = theExpression;
           PrintAtom(fileid,theExpression->type,theExpression->value);
           CurrentExpression = oldExpression;
           break;
        }

      theExpression = theExpression->nextArg;
      if (theExpression != NULL) PrintRouter(fileid," ");
     }

   return;
  }
Esempio n. 16
0
/***************************************************
  NAME         : PrintDeffunctionCall
  DESCRIPTION  : PrintExpression() support function
                 for deffunction calls
  INPUTS       : 1) The output logical name
                 2) The deffunction
  RETURNS      : Nothing useful
  SIDE EFFECTS : Call expression printed
  NOTES        : None
 ***************************************************/
static void PrintDeffunctionCall(
  void *theEnv,
  char *logName,
  void *value)
  {
#if DEVELOPER

   EnvPrintRouter(theEnv,logName,(char*)"(");
   EnvPrintRouter(theEnv,logName,EnvGetDeffunctionName(theEnv,value));
   if (GetFirstArgument() != NULL)
     {
      EnvPrintRouter(theEnv,logName,(char*)" ");
      PrintExpression(theEnv,logName,GetFirstArgument());
     }
   EnvPrintRouter(theEnv,logName,(char*)")");
#else
#endif
  }
Esempio n. 17
0
static void PrintDeffunctionCall(
  void *theEnv,
  EXEC_STATUS,
  char *logName,
  void *value)
  {
#if DEVELOPER

   EnvPrintRouter(theEnv,execStatus,logName,"(");
   EnvPrintRouter(theEnv,execStatus,logName,EnvGetDeffunctionName(theEnv,execStatus,value));
   if (GetFirstArgument() != NULL)
     {
      EnvPrintRouter(theEnv,execStatus,logName," ");
      PrintExpression(theEnv,execStatus,logName,GetFirstArgument());
     }
   EnvPrintRouter(theEnv,execStatus,logName,")");
#else
#if MAC_MCW || WIN_MCW || MAC_XCD
#pragma unused(theEnv,execStatus)
#pragma unused(logName)
#pragma unused(value)
#endif
#endif
  }
Esempio n. 18
0
int main(void) {
	PrintExpression(Sum(1, 2));

	return 0;
}
Esempio n. 19
0
static BOOLEAN CheckArgumentForConstraintError(
  struct expr *expressionList,
  struct expr *lastOne,
  int i,
  struct FunctionDefinition *theFunction,
  struct lhsParseNode *theLHS)
  {
   int theRestriction;
   CONSTRAINT_RECORD *constraint1, *constraint2, *constraint3, *constraint4;
   struct lhsParseNode *theVariable;
   struct expr *tmpPtr;
   int rv = FALSE;

   /*=============================================================*/
   /* Skip anything that isn't a variable or isn't an argument to */
   /* a user defined function (i.e. deffunctions and generic have */
   /* no constraint information so they aren't checked).          */
   /*=============================================================*/

   if ((expressionList->type != SF_VARIABLE) || (theFunction == NULL))
     { return (rv); }

   /*===========================================*/
   /* Get the restrictions for the argument and */
   /* convert them to a constraint record.      */
   /*===========================================*/

   theRestriction = GetNthRestriction(theFunction,i);
   constraint1 = ArgumentTypeToConstraintRecord(theRestriction);

   /*================================================*/
   /* Look for the constraint record associated with */
   /* binding the variable in the LHS of the rule.   */
   /*================================================*/

   theVariable = FindVariable((SYMBOL_HN *) expressionList->value,theLHS);
   if (theVariable != NULL)
     {
      if (theVariable->type == MF_VARIABLE)
        {
         constraint2 = GetConstraintRecord();
         SetConstraintType(MULTIFIELD,constraint2);
        }
      else if (theVariable->constraints == NULL)
        { constraint2 = GetConstraintRecord(); }
      else
        { constraint2 = CopyConstraintRecord(theVariable->constraints); }
     }
   else
     { constraint2 = NULL; }

   /*================================================*/
   /* Look for the constraint record associated with */
   /* binding the variable on the RHS of the rule.   */
   /*================================================*/

   constraint3 = FindBindConstraints((SYMBOL_HN *) expressionList->value);

   /*====================================================*/
   /* Union the LHS and RHS variable binding constraints */
   /* (the variable must satisfy one or the other).      */
   /*====================================================*/

   constraint3 = UnionConstraints(constraint3,constraint2);

   /*====================================================*/
   /* Intersect the LHS/RHS variable binding constraints */
   /* with the function argument restriction constraints */
   /* (the variable must satisfy both).                  */
   /*====================================================*/

   constraint4 = IntersectConstraints(constraint3,constraint1);

   /*====================================*/
   /* Check for unmatchable constraints. */
   /*====================================*/

   if (UnmatchableConstraint(constraint4) && GetStaticConstraintChecking())
     {
      PrintErrorID("RULECSTR",3,TRUE);
      PrintRouter(WERROR,"Previous variable bindings of ?");
      PrintRouter(WERROR,ValueToString((SYMBOL_HN *) expressionList->value));
      PrintRouter(WERROR," caused the type restrictions");
      PrintRouter(WERROR,"\nfor argument #");
      PrintLongInteger(WERROR,(long int) i);
      PrintRouter(WERROR," of the expression ");
      tmpPtr = lastOne->nextArg;
      lastOne->nextArg = NULL;
      PrintExpression(WERROR,lastOne);
      lastOne->nextArg = tmpPtr;
      PrintRouter(WERROR,"\nfound in the rule's RHS to be violated.\n");

      rv = TRUE;
     }

   /*===========================================*/
   /* Free the temporarily created constraints. */
   /*===========================================*/

   RemoveConstraint(constraint1);
   RemoveConstraint(constraint2);
   RemoveConstraint(constraint3);
   RemoveConstraint(constraint4);

   /*========================================*/
   /* Return TRUE if unmatchable constraints */
   /* were detected, otherwise FALSE.        */
   /*========================================*/

   return(rv);
  }
Esempio n. 20
0
globle void ConstraintReferenceErrorMessage(
  struct symbolHashNode *theVariable,
  struct lhsParseNode *theExpression,
  int whichArgument,
  int whichCE,
  struct symbolHashNode *slotName,
  int theField)
  {
   struct expr *temprv;

   PrintErrorID("RULECSTR",2,TRUE);

   /*==========================*/
   /* Print the variable name. */
   /*==========================*/

   PrintRouter(WERROR,"Previous variable bindings of ?");
   PrintRouter(WERROR,ValueToString(theVariable));
   PrintRouter(WERROR," caused the type restrictions");

   /*============================*/
   /* Print the argument number. */
   /*============================*/

   PrintRouter(WERROR,"\nfor argument #");
   PrintLongInteger(WERROR,(long int) whichArgument);

   /*=======================*/
   /* Print the expression. */
   /*=======================*/

   PrintRouter(WERROR," of the expression ");
   temprv = LHSParseNodesToExpression(theExpression);
   ReturnExpression(temprv->nextArg);
   temprv->nextArg = NULL;
   PrintExpression(WERROR,temprv);
   PrintRouter(WERROR,"\n");
   ReturnExpression(temprv);

   /*========================================*/
   /* Print out the index of the conditional */
   /* element and the slot name or field     */
   /* index where the violation occured.     */
   /*========================================*/

   PrintRouter(WERROR,"found in CE #");
   PrintLongInteger(WERROR,(long int) whichCE);
   if (slotName == NULL)
     {
      if (theField > 0)
        {
         PrintRouter(WERROR," field #");
         PrintLongInteger(WERROR,(long int) theField);
        }
     }
   else
     {
      PrintRouter(WERROR," slot ");
      PrintRouter(WERROR,ValueToString(slotName));
     }

   PrintRouter(WERROR," to be violated.\n");
  }
Esempio n. 21
0
globle void DumpRuleAnalysis(
  void *theEnv,
  struct lhsParseNode *tempNode)
  {
   struct lhsParseNode *traceNode;
   char buffer[20];

   EnvPrintRouter(theEnv,WDISPLAY,"\n");
   for (traceNode = tempNode; traceNode != NULL; traceNode = traceNode->bottom)
     {
      if (traceNode->userCE)
        { gensprintf(buffer,"UCE %2d (%2d %2d): ",traceNode->whichCE,traceNode->beginNandDepth,traceNode->endNandDepth); }
      else
        { gensprintf(buffer,"SCE %2d (%2d %2d): ",traceNode->whichCE,traceNode->beginNandDepth,traceNode->endNandDepth); }

      EnvPrintRouter(theEnv,WDISPLAY,buffer);
      
      PrintExpression(theEnv,WDISPLAY,traceNode->networkTest);
      EnvPrintRouter(theEnv,WDISPLAY,"\n");

      if (traceNode->externalNetworkTest != NULL)
        { 
         EnvPrintRouter(theEnv,WDISPLAY,"      ENT: ");
         PrintExpression(theEnv,WDISPLAY,traceNode->externalNetworkTest);
         EnvPrintRouter(theEnv,WDISPLAY,"\n");
        }

      if (traceNode->secondaryNetworkTest != NULL)
        { 
         EnvPrintRouter(theEnv,WDISPLAY,"      SNT: ");
         PrintExpression(theEnv,WDISPLAY,traceNode->secondaryNetworkTest);
         EnvPrintRouter(theEnv,WDISPLAY,"\n");
        }
                 
      if (traceNode->externalRightHash != NULL)
        { 
         EnvPrintRouter(theEnv,WDISPLAY,"      ERH: ");
         PrintExpression(theEnv,WDISPLAY,traceNode->externalRightHash);
         EnvPrintRouter(theEnv,WDISPLAY,"\n");
        }
                 
      if (traceNode->externalLeftHash != NULL)
        { 
         EnvPrintRouter(theEnv,WDISPLAY,"      ELH: ");
         PrintExpression(theEnv,WDISPLAY,traceNode->externalLeftHash);
         EnvPrintRouter(theEnv,WDISPLAY,"\n");
        }
               
      if (traceNode->leftHash != NULL)
        { 
         EnvPrintRouter(theEnv,WDISPLAY,"       LH: ");
         PrintExpression(theEnv,WDISPLAY,traceNode->leftHash);
         EnvPrintRouter(theEnv,WDISPLAY,"\n");
        }
                 
      if (traceNode->rightHash != NULL)
        { 
         EnvPrintRouter(theEnv,WDISPLAY,"       RH: ");
         PrintExpression(theEnv,WDISPLAY,traceNode->rightHash);
         EnvPrintRouter(theEnv,WDISPLAY,"\n");
        }
                 
      if (traceNode->betaHash != NULL)
        { 
         EnvPrintRouter(theEnv,WDISPLAY,"       BH: ");
         PrintExpression(theEnv,WDISPLAY,traceNode->betaHash);
         EnvPrintRouter(theEnv,WDISPLAY,"\n");
        }
     }
  }
Esempio n. 22
0
/**********************************************************
  NAME         : PrintOPNLevel
  DESCRIPTION  : Recursivley prints object pattern network
  INPUTS       : 1) The current object pattern network node
                 2) A buffer holding preceding indentation
                    text showing the level in the tree
                 3) The length of the indentation text
  RETURNS      : Nothing useful
  SIDE EFFECTS : Pattern nodes recursively printed
  NOTES        : None
 **********************************************************/
static void PrintOPNLevel(
  void *theEnv,
  OBJECT_PATTERN_NODE *pptr,
  char *indentbuf,
  int ilen)
  {
   CLASS_BITMAP *cbmp;
   SLOT_BITMAP *sbmp;
   register unsigned i;
   OBJECT_PATTERN_NODE *uptr;
   OBJECT_ALPHA_NODE *alphaPtr;

   while (pptr != NULL)
     {
      EnvPrintRouter(theEnv,WDISPLAY,indentbuf);
      if (pptr->alphaNode != NULL)
        EnvPrintRouter(theEnv,WDISPLAY,"+");
      EnvPrintRouter(theEnv,WDISPLAY,ValueToString(FindIDSlotName(theEnv,pptr->slotNameID)));
      EnvPrintRouter(theEnv,WDISPLAY," (");
      PrintLongInteger(theEnv,WDISPLAY,(long) pptr->slotNameID);
      EnvPrintRouter(theEnv,WDISPLAY,") ");
      EnvPrintRouter(theEnv,WDISPLAY,pptr->endSlot ? "EPF#" : "PF#");
      PrintLongInteger(theEnv,WDISPLAY,(long) pptr->whichField);
      EnvPrintRouter(theEnv,WDISPLAY," ");
      EnvPrintRouter(theEnv,WDISPLAY,pptr->multifieldNode ? "$? " : "? ");
      if (pptr->networkTest != NULL)
        PrintExpression(theEnv,WDISPLAY,pptr->networkTest);
      EnvPrintRouter(theEnv,WDISPLAY,"\n");
      alphaPtr = pptr->alphaNode;
      while (alphaPtr != NULL)
        {
         EnvPrintRouter(theEnv,WDISPLAY,indentbuf);
         EnvPrintRouter(theEnv,WDISPLAY,"     Classes:");
         cbmp = (CLASS_BITMAP *) ValueToBitMap(alphaPtr->classbmp);
         for (i = 0 ; i <= cbmp->maxid ; i++)
           if (TestBitMap(cbmp->map,i))
             {
              EnvPrintRouter(theEnv,WDISPLAY," ");
              EnvPrintRouter(theEnv,WDISPLAY,EnvGetDefclassName(theEnv,(void *) DefclassData(theEnv)->ClassIDMap[i]));
             }
         if (alphaPtr->slotbmp != NULL)
           {
            sbmp = (SLOT_BITMAP *) ValueToBitMap(pptr->alphaNode->slotbmp);
            EnvPrintRouter(theEnv,WDISPLAY," *** Slots:");
            for (i = NAME_ID ; i <= sbmp->maxid ; i++)
              if (TestBitMap(sbmp->map,i))
                {
                 for (uptr = pptr ; uptr != NULL ; uptr  = uptr->lastLevel)
                   if (uptr->slotNameID == i)
                     break;
                 if (uptr == NULL)
                   {
                    EnvPrintRouter(theEnv,WDISPLAY," ");
                    EnvPrintRouter(theEnv,WDISPLAY,ValueToString(FindIDSlotName(theEnv,i)));
                   }
                }
           }
         EnvPrintRouter(theEnv,WDISPLAY,"\n");
         alphaPtr = alphaPtr->nxtInGroup;
        }
      indentbuf[ilen++] = (char) ((pptr->rightNode != NULL) ? '|' : ' ');
      indentbuf[ilen++] = ' ';
      indentbuf[ilen++] = ' ';
      indentbuf[ilen] = '\0';
      PrintOPNLevel(theEnv,pptr->nextLevel,indentbuf,ilen);
      ilen -= 3;
      indentbuf[ilen] = '\0';
      pptr = pptr->rightNode;
     }
  }
Esempio n. 23
0
static void VariableReferenceErrorMessage(
  void *theEnv,
  struct symbolHashNode *theVariable,
  struct lhsParseNode *theExpression,
  int whichCE,
  struct symbolHashNode *slotName,
  int theField)
  {
   struct expr *temprv;

   /*=============================*/
   /* Print the error message ID. */
   /*=============================*/

   PrintErrorID(theEnv,"ANALYSIS",4,TRUE);

   /*=================================*/
   /* Print the name of the variable. */
   /*=================================*/

   EnvPrintRouter(theEnv,WERROR,"Variable ?");
   EnvPrintRouter(theEnv,WERROR,ValueToString(theVariable));
   EnvPrintRouter(theEnv,WERROR," ");

   /*=================================================*/
   /* If the variable was found inside an expression, */
   /* then print the expression.                      */
   /*=================================================*/

   if (theExpression != NULL)
     {
      whichCE = theExpression->whichCE;
      temprv = LHSParseNodesToExpression(theEnv,theExpression);
      ReturnExpression(theEnv,temprv->nextArg);
      temprv->nextArg = NULL;
      EnvPrintRouter(theEnv,WERROR,"found in the expression ");
      PrintExpression(theEnv,WERROR,temprv);
      EnvPrintRouter(theEnv,WERROR,"\n");
      ReturnExpression(theEnv,temprv);
     }

   /*====================================================*/
   /* Print the CE in which the variable was referenced. */
   /*====================================================*/

   EnvPrintRouter(theEnv,WERROR,"was referenced in CE #");
   PrintLongInteger(theEnv,WERROR,(long int) whichCE);

   /*=====================================*/
   /* Identify the slot or field in which */
   /* the variable was found.             */
   /*=====================================*/

   if (slotName == NULL)
     {
      if (theField > 0)
        {
         EnvPrintRouter(theEnv,WERROR," field #");
         PrintLongInteger(theEnv,WERROR,(long int) theField);
        }
     }
   else
     {
      EnvPrintRouter(theEnv,WERROR," slot ");
      EnvPrintRouter(theEnv,WERROR,ValueToString(slotName));
     }

   EnvPrintRouter(theEnv,WERROR," before being defined.\n");
  }
Esempio n. 24
0
void enum_print(void) {
	PrintExpression(ONE);
	PrintExpression(TWO);
	PrintExpression(THREE);
}