deps/kb_meme/meme-5.0.1/src/alph-in.c
/*
 * process_ambig
 * process a ambiguous symbol and the list of equal core symbols
 * check that the referenced core symbols have been defined and
 * check that the ambiguous symbol is completely new. Add the
 * ambiguous symbol to the set of ambiguous symbols.
 */
process_ambig
process a ambiguous symbol and the list of equal core symbols
check that the referenced core symbols have been defined and
check that the ambiguous symbol is completely new. Add the
ambiguous symbol to the set of ambiguous symbols.
process_ambig process a ambiguous symbol and the list of equal core symbols check that the referenced core symbols have been defined and check that the ambiguous symbol is completely new . Add the ambiguous symbol to the set of ambiguous symbols .
static void process_ambig(ALPH_READER_T *reader, const int64_t line_num,
    char symbol, char* name, int colour, char *comprise) {
  ALPH_SYM_T *sym;
  char *eq_sym, sym_str[2];
  if (sort_and_remove_duplicates(comprise)) {
    add_msg(reader, parmsg_create(SEVERITY_WARNING, -1, line_num, -1,
        "ambiguous symbol %c has a duplication in the comprising symbols", symbol));
  }
  sym_str[1] = '\0';
  for (eq_sym = comprise; *eq_sym != '\0'; eq_sym++) {
    sym_str[0] = *eq_sym;
    if (rbtree_find(reader->core, sym_str) == NULL) {
      add_msg(reader, parmsg_create(SEVERITY_ERROR, -1, line_num, -1,
            "required core symbol %c has not been defined", *eq_sym));
    }
  }
  if (symbol == '?') {
    if (strlen(comprise) != rbtree_size(reader->core)) {
      add_msg(reader, parmsg_create(SEVERITY_ERROR, -1, line_num, -1,
            "symbol '?' is reserved as a wildcard and cannot be defined to have any other meaning"));
    }
  }
  sym_str[0] = symbol;
  sym = alph_sym_create(symbol, name, colour, '\0', comprise);
  if (!rbtree_make(reader->all, sym_str, NULL)) {
    alph_sym_destroy(sym);
    add_msg(reader, parmsg_create(SEVERITY_ERROR, -1, line_num, -1,
          "ambiguous symbol %c is already defined", symbol));
    return;
  }
  track_alias(reader, sym);
  if (symbol >= 'A' && symbol <= 'Z') reader->seen_upper_case = true;
  else if (symbol >= 'a' && symbol <= 'z') reader->seen_lower_case = true;
}
static void process_ambig ( ALPH_READER_T * reader , const int64_t line_num , char symbol , char * name , int colour , char * comprise ) { ALPH_SYM_T * sym ; char * eq_sym , sym_str [ 2 ] ; if ( sort_and_remove_duplicates ( comprise ) ) { add_msg ( reader , parmsg_create ( SEVERITY_WARNING , -1 , line_num , -1 , " " , symbol ) ) ; } sym_str [ 1 ] = ' \0 ' ; for ( eq_sym = comprise ; * eq_sym != ' \0 ' ; eq_sym ++ ) { sym_str [ 0 ] = * eq_sym ; if ( rbtree_find ( reader -> core , sym_str ) == NULL ) { add_msg ( reader , parmsg_create ( SEVERITY_ERROR , -1 , line_num , -1 , " " , * eq_sym ) ) ; } } if ( symbol == ' ' ) { if ( strlen ( comprise ) != rbtree_size ( reader -> core ) ) { add_msg ( reader , parmsg_create ( SEVERITY_ERROR , -1 , line_num , -1 , " " ) ) ; } } sym_str [ 0 ] = symbol ; sym = alph_sym_create ( symbol , name , colour , ' \0 ' , comprise ) ; if ( ! rbtree_make ( reader -> all , sym_str , NULL ) ) { alph_sym_destroy ( sym ) ; add_msg ( reader , parmsg_create ( SEVERITY_ERROR , -1 , line_num , -1 , " " , symbol ) ) ; return ; } track_alias ( reader , sym ) ; if ( symbol >= ' ' && symbol <= ' ' ) reader -> seen_upper_case = true ; else if ( symbol >= ' ' && symbol <= ' ' ) reader -> seen_lower_case = true ; }
process_ambig
 process a ambiguous symbol and the list of equal core symbols
 check that the referenced core symbols have been defined and
 check that the ambiguous symbol is completely new.
process_ambig process a ambiguous symbol and the list of equal core symbols check that the referenced core symbols have been defined and check that the ambiguous symbol is completely new .
// Ensure comprise is sorted and there are no duplicates. // check that the referenced symbols exist in the core set // check it is a wildcard