deps/kb_meme/meme-5.0.1/src/alph-in.c
/*
 * create_wildcard_if_missing
 * Alphabets must have a wildcard so this creates one using
 * the reserved character '?' if none is present.
 */
create_wildcard_if_missing
Alphabets must have a wildcard so this creates one using
the reserved character '?' if none is present.
create_wildcard_if_missing Alphabets must have a wildcard so this creates one using the reserved character ' ? ' if none is present .
static void create_wildcard_if_missing(ALPH_READER_T *reader) {
  RBNODE_T *node;
  ALPH_SYM_T *sym;
  char *core_syms;
  int ncore, i;
  bool created;
  ncore = rbtree_size(reader->core);
  core_syms = mm_malloc(sizeof(char) * (ncore + 1));
  core_syms[ncore] = '\0';
  for (node = rbtree_first(reader->merged), i = 0; node != NULL; node = rbtree_next(node), i++) {
    sym = (ALPH_SYM_T*)rbtree_value(node);
    if (sym->comprise != NULL) break;
    assert(i < ncore);
    core_syms[i] = sym->symbol;
  }
  assert(i == ncore);
  node = rbtree_lookup(reader->merged, core_syms, true, &created);
  if (created) {
    sym = alph_sym_create('?', NULL, -1, '\0', core_syms);
    rbtree_set(reader->merged, node, sym);
  } else {
    free(core_syms);
  }
}
static void create_wildcard_if_missing ( ALPH_READER_T * reader ) { RBNODE_T * node ; ALPH_SYM_T * sym ; char * core_syms ; int ncore , i ; bool created ; ncore = rbtree_size ( reader -> core ) ; core_syms = mm_malloc ( sizeof ( char ) * ( ncore + 1 ) ) ; core_syms [ ncore ] = ' \0 ' ; for ( node = rbtree_first ( reader -> merged ) , i = 0 ; node != NULL ; node = rbtree_next ( node ) , i ++ ) { sym = ( ALPH_SYM_T * ) rbtree_value ( node ) ; if ( sym -> comprise != NULL ) break ; assert ( i < ncore ) ; core_syms [ i ] = sym -> symbol ; } assert ( i == ncore ) ; node = rbtree_lookup ( reader -> merged , core_syms , true , & created ) ; if ( created ) { sym = alph_sym_create ( ' ' , NULL , -1 , ' \0 ' , core_syms ) ; rbtree_set ( reader -> merged , node , sym ) ; } else { free ( core_syms ) ; } }
create_wildcard_if_missing
 Alphabets must have a wildcard so this creates one using
 the reserved character '?'
create_wildcard_if_missing Alphabets must have a wildcard so this creates one using the reserved character ' ? '
// allocate enough space to fit all the core letters // create string of all core symbols // lookup/create the wildcard //add_msg(reader, parmsg_create(SEVERITY_WARNING, -1, -1, -1, "wildcard symbol automatically generated"));