[rtems-central commit] applconfig: Use unspecified function

Sebastian Huber sebh at rtems.org
Fri May 7 17:06:26 UTC 2021


Module:    rtems-central
Branch:    master
Commit:    9c8a0fba69cbaf305a78bbf685e04ca757d25534
Changeset: http://git.rtems.org/rtems-central/commit/?id=9c8a0fba69cbaf305a78bbf685e04ca757d25534

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri May  7 13:29:13 2021 +0200

applconfig: Use unspecified function

---

 rtemsspec/applconfig.py               |  6 ------
 rtemsspec/sphinxcontent.py            | 19 ++++++++++++-------
 spec/acfg/if/max-thread-name-size.yml |  2 +-
 spec/c/if/pthread-setname-np.yml      | 13 +++++++++++++
 4 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/rtemsspec/applconfig.py b/rtemsspec/applconfig.py
index ab629b9..e4cd29e 100644
--- a/rtemsspec/applconfig.py
+++ b/rtemsspec/applconfig.py
@@ -261,9 +261,6 @@ def _sphinx_ref(ref: str) -> str:
     return f":ref:`{ref}`"
 
 
-_PTHREAD_NAME_NP = "http://man7.org/linux/man-pages/man3/" \
-    "pthread_setname_np.3.html"
-
 _SPHINX_DOC_REFS = {
     "config-scheduler-clustered":
     _sphinx_ref("ConfigurationSchedulersClustered"),
@@ -271,7 +268,6 @@ _SPHINX_DOC_REFS = {
     "config-unlimited-objects": _sphinx_ref("ConfigUnlimitedObjects"),
     "mp-proxies": _sphinx_ref("MPCIProxies"),
     "mrsp": _sphinx_ref("MrsP"),
-    "pthread-setname-np": f"`PTHREAD_SETNAME_NP(3) <{_PTHREAD_NAME_NP}>`_",
     "scheduler-cbs": _sphinx_ref("SchedulerCBS"),
     "scheduler-concepts": _sphinx_ref("RTEMSAPIClassicScheduler"),
     "scheduler-edf": _sphinx_ref("SchedulerEDF"),
@@ -317,8 +313,6 @@ _DOXYGEN_DOC_REFS = {
     _c_user_ref(
         "key_concepts.html#multiprocessor-resource-sharing-protocol-mrsp",
         "Multiprocessor Resource Sharing Protocol (MrsP)"),
-    "pthread-setname-np":
-    f"<a href={_PTHREAD_NAME_NP}>PTHREAD_SETNAME_NP(3)</a>",
     "scheduler-cbs":
     _c_user_ref(
         "scheduling_concepts.html#constant-bandwidth-server-scheduling-cbs",
diff --git a/rtemsspec/sphinxcontent.py b/rtemsspec/sphinxcontent.py
index 3ac0a9b..5ebf528 100644
--- a/rtemsspec/sphinxcontent.py
+++ b/rtemsspec/sphinxcontent.py
@@ -229,22 +229,27 @@ def _get_value_sphinx_type(ctx: ItemGetValueContext) -> Any:
     return f":c:type:`{ctx.value[ctx.key]}`"
 
 
-def _get_value_sphinx_ref(ctx: ItemGetValueContext,
-                          get_value: ItemGetValue) -> Any:
+def _get_value_sphinx_ref(ctx: ItemGetValueContext, get_value: ItemGetValue,
+                          postfix: str) -> Any:
     if "c-user" in ctx.item["references"]:
         sphinx_ref = ctx.item["references"]["c-user"]
-        return f":ref:`{ctx.value[ctx.key]} <{sphinx_ref}>`"
+        return f":ref:`{ctx.value[ctx.key]}{postfix} <{sphinx_ref}>`"
     if "url" in ctx.item["references"]:
-        return f"`{ctx.value[ctx.key]} <{ctx.item['references']['url']}>`_"
+        url = ctx.item["references"]["url"]
+        return f"`{ctx.value[ctx.key]}{postfix} <{url}>`_"
     return get_value(ctx)
 
 
 def _get_value_sphinx_unspecified_define(ctx: ItemGetValueContext) -> Any:
-    return _get_value_sphinx_ref(ctx, _get_value_sphinx_macro)
+    return _get_value_sphinx_ref(ctx, _get_value_sphinx_macro, "")
+
+
+def _get_value_sphinx_unspecified_function(ctx: ItemGetValueContext) -> Any:
+    return _get_value_sphinx_ref(ctx, _get_value_sphinx_function, "()")
 
 
 def _get_value_sphinx_unspecified_type(ctx: ItemGetValueContext) -> Any:
-    return _get_value_sphinx_ref(ctx, _get_value_sphinx_type)
+    return _get_value_sphinx_ref(ctx, _get_value_sphinx_type, "")
 
 
 class SphinxMapper(ItemMapper):
@@ -274,7 +279,7 @@ class SphinxMapper(ItemMapper):
         self.add_get_value("interface/unspecified-define:/name",
                            _get_value_sphinx_unspecified_define)
         self.add_get_value("interface/unspecified-function:/name",
-                           _get_value_sphinx_function)
+                           _get_value_sphinx_unspecified_function)
         self.add_get_value("interface/unspecified-type:/name",
                            _get_value_sphinx_unspecified_type)
 
diff --git a/spec/acfg/if/max-thread-name-size.yml b/spec/acfg/if/max-thread-name-size.yml
index c9423ec..08ba007 100644
--- a/spec/acfg/if/max-thread-name-size.yml
+++ b/spec/acfg/if/max-thread-name-size.yml
@@ -24,7 +24,7 @@ links:
 name: CONFIGURE_MAXIMUM_THREAD_NAME_SIZE
 notes: |
   The default value was chosen for Linux compatibility, see
-  ${.:/document-reference/pthread-setname-np}.
+  ${/c/if/pthread-setname-np:/name}.
 
   The size of the thread control block is increased by the maximum thread name
   size.
diff --git a/spec/c/if/pthread-setname-np.yml b/spec/c/if/pthread-setname-np.yml
new file mode 100644
index 0000000..90f3b12
--- /dev/null
+++ b/spec/c/if/pthread-setname-np.yml
@@ -0,0 +1,13 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+index-entries: []
+interface-type: unspecified-function
+links:
+- role: interface-placement
+  uid: pthread
+name: pthread_setname_np
+references:
+  url: http://man7.org/linux/man-pages/man3/pthread_setname_np.3.html
+type: interface



More information about the vc mailing list