summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-06-16 11:09:53 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-07-03 10:22:45 +0200
commitc6aa66b7cf2c6b7c3c3bd0236c63e19b8ad14fa2 (patch)
tree6529502c6e37bc90ca93f8f4fbc123b4853d46ce
parentinterface: Evaluate interface in some expressions (diff)
downloadrtems-central-c6aa66b7cf2c6b7c3c3bd0236c63e19b8ad14fa2.tar.bz2
interface: Support automatic Doxygen links
-rw-r--r--rtemsqual/interface.py19
-rw-r--r--rtemsqual/tests/spec-interface/func.yml5
-rw-r--r--rtemsqual/tests/test_interface.py3
-rw-r--r--spec/if/rtems/config/api-table.yml3
4 files changed, 21 insertions, 9 deletions
diff --git a/rtemsqual/interface.py b/rtemsqual/interface.py
index a20ea139..76092f1a 100644
--- a/rtemsqual/interface.py
+++ b/rtemsqual/interface.py
@@ -82,12 +82,21 @@ class _InterfaceMapper(ItemMapper):
header_file.add_potential_edge(node, item)
return value
- def get_value(self, item: Item, _path: str, _value: Any, key: str,
+ def get_value(self, item: Item, path: str, value: Any, key: str,
_index: Optional[int]) -> Any:
- # pylint: disable=no-self-use
- if key == "name" and item["type"] == "interface" and item[
- "interface-type"] == "forward-declaration":
- return _forward_declaration(item)
+ if path == "/" and key == "name" and item["type"] == "interface":
+ interface_type = item["interface-type"]
+ if interface_type == "forward-declaration":
+ return _forward_declaration(item)
+ if not self._eval_interface:
+ value = value[key]
+ if interface_type == "function":
+ return f"{value}()"
+ if interface_type in ["enumerator", "typedef"]:
+ return f"::{value}"
+ if interface_type in ["define", "enum", "macro", "variable"]:
+ return f"#{value}"
+ return value
raise KeyError
def enabled_by_to_defined(self, enabled_by: str) -> str:
diff --git a/rtemsqual/tests/spec-interface/func.yml b/rtemsqual/tests/spec-interface/func.yml
index 108fa624..6ca04aaf 100644
--- a/rtemsqual/tests/spec-interface/func.yml
+++ b/rtemsqual/tests/spec-interface/func.yml
@@ -13,7 +13,10 @@ definition:
- int *${.:/params[3]/name}
return: void
variants: []
-description: Function description.
+description: |
+ Function description. References to ${func2:/name}, ${td:/name},
+ ${enum:/name}, ${define:/name}, ${macro:/name}, ${var:/name},
+ ${enumerator-0:/name}, and ${s:/name}.
name: Function
notes: null
params:
diff --git a/rtemsqual/tests/test_interface.py b/rtemsqual/tests/test_interface.py
index b748136e..966c9ddc 100644
--- a/rtemsqual/tests/test_interface.py
+++ b/rtemsqual/tests/test_interface.py
@@ -172,7 +172,8 @@ typedef enum EnumB {
*
* @brief Function brief description.
*
- * Function description.
+ * Function description. References to VeryLongFunction(), ::Integer, #Enum,
+ * #DEFINE, #VERY_LONG_MACRO, #Variable, ::ENUMERATOR_0, and Struct.
*
* @param Param0 is parameter 0.
*
diff --git a/spec/if/rtems/config/api-table.yml b/spec/if/rtems/config/api-table.yml
index 32f1eb06..b32d970e 100644
--- a/spec/if/rtems/config/api-table.yml
+++ b/spec/if/rtems/config/api-table.yml
@@ -115,8 +115,7 @@ definition:
variants: []
definition-kind: typedef-only
description: |
- Use ${get-api-configuration:/name}() to get the configuration
- table.
+ Use ${get-api-configuration:/name} to get the configuration table.
enabled-by: true
interface-type: struct
links: