FDK/Tools/Programs/public/lib/source/uforead/uforead.c
/* Add char record. Return 1 if record exists else 0. Char record returned by
 "chr" parameter. */
Add char record. Return 1 if record exists else 0. Char record returned by
"chr" parameter.
Add char record . Return 1 if record exists else 0 . Char record returned by " chr " parameter .
static int addChar(ufoCtx h, STI sti, Char **chr)
{
	size_t index;
	int found =
    ctuLookup(getString(h, sti),
              h->chars.byName.array, h->chars.byName.cnt,
              sizeof(h->chars.byName.array[0]), matchChar, &index, h);
	if (found)
		*chr = &h->chars.index.array[h->chars.byName.array[index]];
	else
    {
		long *new = &dnaGROW(h->chars.byName, h->chars.byName.cnt)[index];
		memmove(new + 1, new, (h->chars.byName.cnt++ - index) *
				sizeof(h->chars.byName.array[0]));
		*new = h->chars.index.cnt;
		*chr = dnaNEXT(h->chars.index);
    }
	return found;
}
static int addChar ( ufoCtx h , STI sti , Char * * chr ) { size_t index ; int found = ctuLookup ( getString ( h , sti ) , h -> chars . byName . array , h -> chars . byName . cnt , sizeof ( h -> chars . byName . array [ 0 ] ) , matchChar , & index , h ) ; if ( found ) * chr = & h -> chars . index . array [ h -> chars . byName . array [ index ] ] ; else { long * new = & dnaGROW ( h -> chars . byName , h -> chars . byName . cnt ) [ index ] ; memmove ( new + 1 , new , ( h -> chars . byName . cnt ++ - index ) * sizeof ( h -> chars . byName . array [ 0 ] ) ) ; * new = h -> chars . index . cnt ; * chr = dnaNEXT ( h -> chars . index ) ; } return found ; }
Add char record.
Add char record .
/* Match found; return existing record */ /* Not found; add to table and return new record */ /* Make and fill hole */