예제 #1
0
파일: classexm.c 프로젝트: DrItanium/maya
/*********************************************************
  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);
     }
  }
예제 #2
0
globle void GetFactPPForm(
  char *buffer,
  int bufferLength,
  void *theFact)
  {
   OpenStringDestination("FactPPForm",buffer,bufferLength);
   PrintFactWithIdentifier("FactPPForm",(struct fact *) theFact);
   CloseStringDestination("FactPPForm");
  }
예제 #3
0
globle void EnvGetActivationPPForm(
    void *theEnv,
    char *buffer,
    unsigned bufferLength,
    void *theActivation)
{
    OpenStringDestination(theEnv,(char*)"ActPPForm",buffer,bufferLength);
    PrintActivation(theEnv,(char*)"ActPPForm",(void *) theActivation);
    CloseStringDestination(theEnv,(char*)"ActPPForm");
}
예제 #4
0
globle void EnvGetActivationBasisPPForm(
    void *theEnv,
    char *buffer,
    unsigned bufferLength,
    void *vTheActivation)
{
    struct activation *theActivation = (struct activation *) vTheActivation;

    OpenStringDestination(theEnv,(char*)"ActPPForm",buffer,bufferLength);
    PrintPartialMatch(theEnv,(char*)"ActPPForm",theActivation->basis);
    CloseStringDestination(theEnv,(char*)"ActPPForm");
}
예제 #5
0
파일: globldef.c 프로젝트: femto/rbclips
globle void EnvGetDefglobalValueForm(
  void *theEnv,
  char *buffer,
  unsigned bufferLength,
  void *vTheGlobal)
  {
   struct defglobal *theGlobal = (struct defglobal *) vTheGlobal;

   OpenStringDestination(theEnv,"GlobalValueForm",buffer,bufferLength);
   EnvPrintRouter(theEnv,"GlobalValueForm","?*");
   EnvPrintRouter(theEnv,"GlobalValueForm",ValueToString(theGlobal->header.name));
   EnvPrintRouter(theEnv,"GlobalValueForm","* = ");
   PrintDataObject(theEnv,"GlobalValueForm",&theGlobal->current);
   CloseStringDestination(theEnv,"GlobalValueForm");
  }