Commit 211a7dac authored by Jonathan Jenkins's avatar Jonathan Jenkins

mapping: option to count only "first-found" lp entry

parent d4bd177d
......@@ -43,8 +43,10 @@ int codes_mapping_get_group_reps(const char* group_name);
* lp_type_name - name of LP type
* annotation - optional annotation. If NULL, entry is considered
* unannotated
* ignore_annos - If non-zero, then count across all annotations (and
* ignore whatever annotation parameter is passed in)
* ignore_annos - If zero, then count in an annotation-specific manner.
* If 1, then count the "first-found" LP in the
* configuration, regardless of annotation.
* Otherwise, count across all annotations.
*
* returns the number of LPs found (0 in the case of some combination of group,
* lp_type_name, and annotation not being found)
......
......@@ -107,7 +107,7 @@ int codes_mapping_get_lp_count(
// check - if group name is null, then disable ignore_repetitions (the
// former takes precedence)
if (group_name == NULL)
if (group_name == NULL)
ignore_repetitions = 0;
for (int g = 0; g < lpconf.lpgroups_count; g++){
const config_lpgroup_t *lpg = &lpconf.lpgroups[g];
......@@ -125,6 +125,8 @@ int codes_mapping_get_lp_count(
lp_type_ct_total += lpt->count;
else
lp_type_ct_total += lpt->count * lpg->repetitions;
if (ignore_annos == 1)
break;
}
}
}
......
......@@ -163,7 +163,7 @@ int main(int argc, char *argv[])
groups[g], lpnm);
}
printf("TEST1 %2d %6s %s ignore annos\n",
codes_mapping_get_lp_count(groups[g], 0, lps[l], NULL, 1),
codes_mapping_get_lp_count(groups[g], 0, lps[l], NULL, 2),
groups[g], lps[l]);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment