/*************************************************** NAME : PrintObjectPatternNetwork DESCRIPTION : Displays an indented printout of the object pattern network INPUTS : None RETURNS : Nothing useful SIDE EFFECTS : Object pattern network displayed NOTES : None ***************************************************/ globle void PrintObjectPatternNetwork() { char indentbuf[80]; indentbuf[0] = '\0'; PrintOPNLevel(ObjectNetworkPointer(),indentbuf,0); }
/*************************************************** NAME : PrintObjectPatternNetwork DESCRIPTION : Displays an indented printout of the object pattern network INPUTS : None RETURNS : Nothing useful SIDE EFFECTS : Object pattern network displayed NOTES : None ***************************************************/ globle void PrintObjectPatternNetwork( void *theEnv) { char indentbuf[80]; indentbuf[0] = '\0'; PrintOPNLevel(theEnv,ObjectNetworkPointer(theEnv),indentbuf,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; } }