示例#1
0
/*static */ void
print_option (int bb_no, int f_opt)
{
  char tmp1[10];
  char tmp2[10];
  sprintf (tmp2, "%s", gen_option (tmp1, bb_no, f_opt));
  PRINTF ("%3s", tmp2);
}
示例#2
0
static char *
format_func_options (char *s, cuc_func * f)
{
  int b, first = 1;
  *s = '\0';
  for (b = 0; b < f->num_bb; b++)
    if (f->bb[b].selected_tim >= 0)
      {
	char tmp[10];
	sprintf (s, "%s%s%s", s, first ? "" : ",",
		 gen_option (tmp, b, f->bb[b].selected_tim));
	first = 0;
      }
  return s;
}
示例#3
0
static void gen_group(const ast *group, FILE *out){
	int total_weight = 0;
	for(size_t i = 0; i < group->size; ++i){
		const ast *option = group->children[i];
		atom_type type = get_atom_type(option->children[0]);
		atom_quantifier quantifier = get_option_quantifier(option);
		total_weight += lgen_atom_weight[type][quantifier];
	}
	int x = rand()%total_weight;
	for(size_t i = 0; i < group->size; ++i){
		const ast *option = group->children[i];
		atom_type type = get_atom_type(option->children[0]);
		atom_quantifier quantifier = get_option_quantifier(option);
		int weight = lgen_atom_weight[type][quantifier];
		if(x < weight){
			gen_option(option, out);
			break;
		}
		x -= weight;
	}
}