diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-12-02 07:46:17 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-12-02 07:57:30 +0100 |
commit | 3a0c2838e51d05e9b3d27fee3e473e8907ee6d5d (patch) | |
tree | b16f4dc51882d15567e530c8f3fe3e09cfda7ac5 | |
parent | spec: Add not pre-qualified constraints (diff) | |
download | rtems-central-3a0c2838e51d05e9b3d27fee3e473e8907ee6d5d.tar.bz2 |
specview.py: Improve "api" filter
-rwxr-xr-x | specview.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/specview.py b/specview.py index 8ad8f3c6..2f4560e9 100755 --- a/specview.py +++ b/specview.py @@ -28,7 +28,7 @@ import argparse import itertools import sys -from typing import Any, List, Optional, Set, Tuple +from typing import Any, Dict, List, Optional, Set, Tuple from rtemsspec.items import EmptyItem, Item, ItemCache, ItemMapper, \ ItemGetValueContext, Link @@ -384,32 +384,39 @@ def _action_list(enabled: List[str], item: Item) -> None: _API_INTERFACES = [ "interface/appl-config-option/feature", + "interface/appl-config-option/feature-enable", "interface/appl-config-option/initializer", "interface/appl-config-option/integer", "interface/function", "interface/macro", + "interface/unspecified-function", ] _API_ROLES = [ "requirement-refinement", - "interface-placement", + "interface-ingroup", "appl-config-group-member", ] -def _gather_api_names(item: Item, names: List[str]) -> None: +def _gather_api_names(item: Item, names: Dict[str, List[str]]) -> None: if item.type in _API_INTERFACES and _is_pre_qualified(item): - names.append(item["name"]) + group = names.setdefault(item.parent(_API_ROLES)["name"], []) + group.append(item["name"]) for child in item.children(_API_ROLES): _gather_api_names(child, names) def _list_api(item_cache: ItemCache) -> None: - names = [] # type: List[str] - _gather_api_names(item_cache["/if/domain"], names) - _gather_api_names(item_cache["/acfg/if/domain"], names) - for name in sorted(names): - print(name) + names = {} # type: Dict[str, List[str]] + _gather_api_names(item_cache["/req/applconfig"], names) + _gather_api_names(item_cache["/if/group"], names) + _gather_api_names(item_cache["/c/if/group"], names) + _gather_api_names(item_cache["/newlib/if/group"], names) + for group in sorted(names.keys()): + print(group) + for name in sorted(names[group]): + print(f"\t{name}") def main() -> None: |