Exemplo n.º 1
0
/*-------------------------------------------------------------------------*/
void free_adapted_class(ADAPT_CLASS adapt_class) {
  int i;

  for (i = 0; i < MAX_NUM_CONFIGS; i++) {
    if (ConfigIsPermanent (adapt_class, i)
      && PermConfigFor (adapt_class, i) != NULL)
      FreePermConfig (PermConfigFor (adapt_class, i));
    else if (!ConfigIsPermanent (adapt_class, i)
      && TempConfigFor (adapt_class, i) != NULL)
      FreeTempConfig (TempConfigFor (adapt_class, i));
  }
  FreeBitVector (adapt_class->PermProtos);
  FreeBitVector (adapt_class->PermConfigs);
  destroy_nodes (adapt_class->TempProtos, FreeTempProto);
  Efree(adapt_class);
}
Exemplo n.º 2
0
/*---------------------------------------------------------------------------*/
ADAPT_CLASS NewAdaptedClass() { 
/*
 **	Parameters: none
 **	Globals: none
 **	Operation: This operation allocates and initializes a new adapted
 **		class data structure and returns a ptr to it.
 **	Return: Ptr to new class data structure.
 **	Exceptions: none
 **	History: Thu Mar 14 12:58:13 1991, DSJ, Created.
 */
  ADAPT_CLASS Class;
  int i;

  Class = (ADAPT_CLASS) Emalloc (sizeof (ADAPT_CLASS_STRUCT));
  Class->NumPermConfigs = 0;
  Class->TempProtos = NIL;

  Class->PermProtos = NewBitVector (MAX_NUM_PROTOS);
  Class->PermConfigs = NewBitVector (MAX_NUM_CONFIGS);
  zero_all_bits (Class->PermProtos, WordsInVectorOfSize (MAX_NUM_PROTOS));
  zero_all_bits (Class->PermConfigs, WordsInVectorOfSize (MAX_NUM_CONFIGS));

  for (i = 0; i < MAX_NUM_CONFIGS; i++)
    TempConfigFor (Class, i) = NULL;

  return (Class);

}                                /* NewAdaptedClass */
Exemplo n.º 3
0
/**
 * This operation allocates and initializes a new adapted
 * class data structure and returns a ptr to it.
 *
 * @return Ptr to new class data structure.
 *
 * @note Globals: none
 * @note Exceptions: none
 * @note History: Thu Mar 14 12:58:13 1991, DSJ, Created.
 */
ADAPT_CLASS NewAdaptedClass() {
  ADAPT_CLASS Class;
  int i;

  Class = (ADAPT_CLASS) Emalloc (sizeof (ADAPT_CLASS_STRUCT));
  Class->NumPermConfigs = 0;
  Class->MaxNumTimesSeen = 0;
  Class->TempProtos = NIL_LIST;

  Class->PermProtos = NewBitVector (MAX_NUM_PROTOS);
  Class->PermConfigs = NewBitVector (MAX_NUM_CONFIGS);
  zero_all_bits (Class->PermProtos, WordsInVectorOfSize (MAX_NUM_PROTOS));
  zero_all_bits (Class->PermConfigs, WordsInVectorOfSize (MAX_NUM_CONFIGS));

  for (i = 0; i < MAX_NUM_CONFIGS; i++)
    TempConfigFor (Class, i) = NULL;

  return (Class);

}                                /* NewAdaptedClass */
Exemplo n.º 4
0
// Returns FontinfoId of the given config of the given adapted class.
int Classify::GetFontinfoId(ADAPT_CLASS Class, uinT8 ConfigId) {
  return (ConfigIsPermanent(Class, ConfigId) ?
      PermConfigFor(Class, ConfigId)->FontinfoId :
      TempConfigFor(Class, ConfigId)->FontinfoId);
}