/** * Allocates memory for adapted tempates. * each char in unicharset to the newly created templates * * @param InitFromUnicharset if true, add an empty class for * @return Ptr to new adapted templates. * * @note Globals: none */ ADAPT_TEMPLATES Classify::NewAdaptedTemplates(bool InitFromUnicharset) { ADAPT_TEMPLATES Templates; Templates = (ADAPT_TEMPLATES) Emalloc (sizeof (ADAPT_TEMPLATES_STRUCT)); Templates->Templates = NewIntTemplates (); Templates->NumPermClasses = 0; Templates->NumNonEmptyClasses = 0; /* Insert an empty class for each unichar id in unicharset */ for (int i = 0; i < MAX_NUM_CLASSES; i++) { Templates->Class[i] = nullptr; if (InitFromUnicharset && i < unicharset.size()) { AddAdaptedClass(Templates, NewAdaptedClass(), i); } } return (Templates); } /* NewAdaptedTemplates */
/*---------------------------------------------------------------------------*/ ADAPT_TEMPLATES NewAdaptedTemplates() { /* ** Parameters: none ** Globals: none ** Operation: ** Return: none ** Exceptions: none ** History: Fri Mar 8 10:15:28 1991, DSJ, Created. */ ADAPT_TEMPLATES Templates; int i; Templates = (ADAPT_TEMPLATES) Emalloc (sizeof (ADAPT_TEMPLATES_STRUCT)); Templates->Templates = NewIntTemplates (); Templates->NumPermClasses = 0; for (i = 0; i < MAX_NUM_CLASSES; i++) Templates->Class[i] = NULL; return (Templates); } /* NewAdaptedTemplates */