int		parsing_exec(char **src, t_env *list)
{
  t_bin		*bin;
  t_pars	pars;

  pars.i = 0;
  if (!(bin = malloc(sizeof(t_bin))))
    return (-1);
  bin->head = NULL;
  bin->redo = NULL;
  bin->pre = NULL;
  if (!(pars.path = search_path(list)))
    return (EXIT_FAILURE);
  if (check_first_pars(src, bin, &pars) == -1)
    return (EXIT_FAILURE);
  if (finish_parsing(src, bin, &pars) == -1)
    return (EXIT_FAILURE);
  if (parsing_send(bin, list) == -1)
    return (-1);
  return (EXIT_SUCCESS);
}
Exemplo n.º 2
0
void finish_parsing_and_score() {
  category_count_t best, i, j;
  real_value_t finfinity;

  finish_parsing();
  best = score_losses();

  if( spec.num_cats == 1 ) {
    errormsg(E_WARNING, "only one category specified, this is trivial!\n");
  }

  if( (options & (1<<OPTION_VERBOSE)) &&
      !(options & (1<<OPTION_SCORES)) &&
      !(options & (1<<OPTION_SCORES_EX)) ) {
    fprintf(stdout, "%s\n", spec.catname[best]);
  }

  exit_code = (best + 1);

  if( options & (1<<OPTION_SCORES_EX) ) {

    finfinity = -log(0.0);

    for(i = 1; i < spec.num_cats; i++) {

      for(j = 0; j < spec.num_cats; j++) {
	spec.loss_matrix[best][j] = -finfinity;
	spec.loss_matrix[j][best] = -finfinity;
      }
      spec.loss_matrix[best][best] = +finfinity;

      best = score_losses();
    }

    fprintf(stdout,"\n");

  }

}