/*************************************************** NAME : PrintSlotSources DESCRIPTION : Displays a list of source classes for a composite class (in order of most general to specific) INPUTS : 1) The logical name of the output 2) The name of the slot 3) The precedence list of the class of the slot (the source class shold be first in the list) 4) The index into the packed links array 5) Flag indicating whether to disregard noniherit facet RETURNS : TRUE if a class is printed, FALSE otherwise SIDE EFFECTS : Recursively prints out appropriate memebers from list in reverse order NOTES : None ***************************************************/ static intBool PrintSlotSources( void *theEnv, char *logicalName, SYMBOL_HN *sname, PACKED_CLASS_LINKS *sprec, long theIndex, int inhp) { SLOT_DESC *csp; if (theIndex == sprec->classCount) return(FALSE); csp = FindClassSlot(sprec->classArray[theIndex],sname); if ((csp != NULL) ? ((csp->noInherit == 0) || inhp) : FALSE) { if (csp->composite) { if (PrintSlotSources(theEnv,logicalName,sname,sprec,theIndex+1,FALSE)) EnvPrintRouter(theEnv,logicalName," "); } PrintClassName(theEnv,logicalName,sprec->classArray[theIndex],FALSE); return(TRUE); } else return(PrintSlotSources(theEnv,logicalName,sname,sprec,theIndex+1,FALSE)); }
/*************************************************** NAME : PrintSlotSources DESCRIPTION : Displays a list of source classes for a composite class (in order of most general to specific) INPUTS : 1) The logical name of the output 2) The name of the slot 3) The precedence list of the class of the slot (the source class shold be first in the list) 4) The index into the packed links array 5) Flag indicating whether to disregard noniherit facet RETURNS : True if a class is printed, false otherwise SIDE EFFECTS : Recursively prints out appropriate memebers from list in reverse order NOTES : None ***************************************************/ static bool PrintSlotSources( Environment *theEnv, const char *logicalName, CLIPSLexeme *sname, PACKED_CLASS_LINKS *sprec, unsigned long theIndex, bool inhp) { SlotDescriptor *csp; if (theIndex == sprec->classCount) return false; csp = FindClassSlot(sprec->classArray[theIndex],sname); if ((csp != NULL) ? ((csp->noInherit == 0) || inhp) : false) { if (csp->composite) { if (PrintSlotSources(theEnv,logicalName,sname,sprec,theIndex+1,false)) WriteString(theEnv,logicalName," "); } PrintClassName(theEnv,logicalName,sprec->classArray[theIndex],false,false); return true; } else return(PrintSlotSources(theEnv,logicalName,sname,sprec,theIndex+1,false)); }
/************************************************************* NAME : DisplaySlotBasicInfo DESCRIPTION : Displays a table summary of basic facets for the slots of a class including: single/multiple default/no-default/default-dynamic inherit/no-inherit read-write/initialize-only/read-only local/shared composite/exclusive reactive/non-reactive public/private create-accessor read/write override-message The function also displays the source class(es) for the facets INPUTS : 1) The logical name of the output 2) A format string for use in sprintf (for printing slot names) 3) A format string for use in sprintf (for printing slot override message names) 4) A buffer to store the display in 5) A pointer to the class RETURNS : Nothing useful SIDE EFFECTS : Buffer written to and displayed NOTES : None *************************************************************/ static void DisplaySlotBasicInfo( void *theEnv, char *logicalName, char *slotNamePrintFormat, char *overrideMessagePrintFormat, char *buf, DEFCLASS *cls) { long i; SLOT_DESC *sp; char *createString; gensprintf(buf,slotNamePrintFormat,"SLOTS"); #if DEFRULE_CONSTRUCT genstrcat(buf,"FLD DEF PRP ACC STO MCH SRC VIS CRT "); #else genstrcat(buf,"FLD DEF PRP ACC STO SRC VIS CRT "); #endif EnvPrintRouter(theEnv,logicalName,buf); gensprintf(buf,overrideMessagePrintFormat,"OVRD-MSG"); EnvPrintRouter(theEnv,logicalName,buf); EnvPrintRouter(theEnv,logicalName,"SOURCE(S)\n"); for (i = 0 ; i < cls->instanceSlotCount ; i++) { sp = cls->instanceTemplate[i]; gensprintf(buf,slotNamePrintFormat,ValueToString(sp->slotName->name)); genstrcat(buf,sp->multiple ? "MLT " : "SGL "); if (sp->noDefault) genstrcat(buf,"NIL "); else genstrcat(buf,sp->dynamicDefault ? "DYN " : "STC "); genstrcat(buf,sp->noInherit ? "NIL " : "INH "); if (sp->initializeOnly) genstrcat(buf,"INT "); else if (sp->noWrite) genstrcat(buf," R "); else genstrcat(buf,"RW "); genstrcat(buf,sp->shared ? "SHR " : "LCL "); #if DEFRULE_CONSTRUCT genstrcat(buf,sp->reactive ? "RCT " : "NIL "); #endif genstrcat(buf,sp->composite ? "CMP " : "EXC "); genstrcat(buf,sp->publicVisibility ? "PUB " : "PRV "); createString = GetCreateAccessorString(sp); if (createString[1] == '\0') genstrcat(buf," "); genstrcat(buf,createString); if ((createString[1] == '\0') ? TRUE : (createString[2] == '\0')) genstrcat(buf," "); genstrcat(buf," "); EnvPrintRouter(theEnv,logicalName,buf); gensprintf(buf,overrideMessagePrintFormat, sp->noWrite ? "NIL" : ValueToString(sp->overrideMessage)); EnvPrintRouter(theEnv,logicalName,buf); PrintSlotSources(theEnv,logicalName,sp->slotName->name,&sp->cls->allSuperclasses,0,TRUE); EnvPrintRouter(theEnv,logicalName,"\n"); } }