Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
codes
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
38
Issues
38
List
Boards
Labels
Milestones
Merge Requests
8
Merge Requests
8
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
codes
codes
Commits
211a7dac
Commit
211a7dac
authored
Aug 03, 2015
by
Jonathan Jenkins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mapping: option to count only "first-found" lp entry
parent
d4bd177d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
codes/codes_mapping.h
codes/codes_mapping.h
+4
-2
src/util/codes_mapping.c
src/util/codes_mapping.c
+3
-1
tests/mapping_test.c
tests/mapping_test.c
+1
-1
No files found.
codes/codes_mapping.h
View file @
211a7dac
...
...
@@ -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)
...
...
src/util/codes_mapping.c
View file @
211a7dac
...
...
@@ -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
;
}
}
}
...
...
tests/mapping_test.c
View file @
211a7dac
...
...
@@ -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
]);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment