static int 
te_calc_prefs_simp_imp (const EPI *epi, const REL_INFO *rel_info,
			const RESULTS *results, const TREC_MEAS *tm,
			TREC_EVAL *eval)
{
    RESULTS_PREFS results_prefs;
    long i;
    long poss, ful;

    if (UNDEF == form_prefs_counts (epi, rel_info, results, &results_prefs))
	return (UNDEF);
    
    ful = poss = 0;
    for (i = 0; i < results_prefs.num_jgs; i++) {
	ful += results_prefs.jgs[i].num_prefs_fulfilled_ret;
	ful += results_prefs.jgs[i].num_prefs_fulfilled_imp;
	poss += results_prefs.jgs[i].num_prefs_possible_ret;
	poss += results_prefs.jgs[i].num_prefs_possible_imp;
    }
    /* Simple ratio of preferences fulfilled to preferences possible */
    if (poss) {
        eval->values[tm->eval_index].value =
	    (double) ful / (double) poss;
    }
    return (1);
}
static int te_calc_prefs_num_prefs_ful_ret(const EPI *epi,
		const REL_INFO *rel_info, const RESULTS *results, const TREC_MEAS *tm,
		TREC_EVAL *eval) {
	RESULTS_PREFS results_prefs;
	long i;
	long ful;

	if (UNDEF == form_prefs_counts(epi, rel_info, results, &results_prefs))
		return (UNDEF);

	ful = 0;
	for (i = 0; i < results_prefs.num_jgs; i++) {
		ful += results_prefs.jgs[i].num_prefs_fulfilled_ret;
	}
	eval->values[tm->eval_index].value = (double) ful;
	return (1);
}
static int 
te_calc_prefs_num_prefs_poss (const EPI *epi, const REL_INFO *rel_info,
			      const RESULTS *results, const TREC_MEAS *tm,
			      TREC_EVAL *eval)
{
    RESULTS_PREFS results_prefs;
    long i;
    long poss;

    if (UNDEF == form_prefs_counts (epi, rel_info, results, &results_prefs))
	return (UNDEF);
    
    poss = 0;
    for (i = 0; i < results_prefs.num_jgs; i++) {
	poss += results_prefs.jgs[i].num_prefs_possible_ret;
	poss += results_prefs.jgs[i].num_prefs_possible_imp;
	poss += results_prefs.jgs[i].num_prefs_possible_notoccur;
    }
    eval->values[tm->eval_index].value = (double) poss;
    return (1);
}