int match_node_list(node_address *n1, node_address *n2, u_int len2)
{
	u_int	i;
	for (i = 0; i < len2; i++) {
		if (match_node(n2+i, n1))
			return 1;
	}
	return 0;
}
Ejemplo n.º 2
0
void *		del_node_as(t_list ** list, bool (*match_node)(void *))
{
  if ((*list))
    {
      (*list)->cur = (*list)->begin;
      while ((*list)->cur)
	{
	  if (match_node((*list)->cur->data))
	    return (del_node(list, ((*list)->cur)));
	  (*list)->cur = (*list)->cur->next;
	}
    }
  return (NULL);
}
Ejemplo n.º 3
0
static void
generate_main(int num)
{
  NODE *sent;
  NODE **stock;
  int i,n,c;

  /* avoid generating same sentence */
  stock = (NODE **)mymalloc(sizeof(NODE *)*num);
  n = 0;
  c = 0;
  while (n < num) {
    sent = new_generate();
    for (i=0;i<n;i++) {
      if (match_node(sent, stock[i])) break;
    }
    if (i >= n) {		/* no match, store as new */
      stock[n++] = sent;
      for (i=sent->seqnum-1;i>=0;i--) {
	if (term_mode) {
	  if (no_term_file) {
	    printf(" %s", winfo->wname[sent->seq[i]]);
	  } else {
	    printf(" %s", termname[winfo->wton[sent->seq[i]]]);
	  }
	} else {
	  printf(" %s", winfo->woutput[sent->seq[i]]);
	}
      }
      printf("\n");
      c = 0;
    } else {			/* same, ignored */
      c++;
      if (c >= MAXHYPO) {
	printf("no further sentence in the last %d trial\n", c);
	break;
      }
      free(sent);
    }
  }
  
  for(i=0;i<n;i++) free(stock[i]);
  free(stock);
}