@@ -52,8 +52,12 @@ def check_api(header: Header, api: Dict):
52
52
:param api: docgen json file contents parsed into a dict
53
53
"""
54
54
errors = []
55
- cdef = "c-definition"
56
- pdef = "posix-definition"
55
+ # We require entries to have at least one of these.
56
+ possible_keys = [
57
+ "c-definition" ,
58
+ "in-latest-posix" ,
59
+ "removed-in-posix-2008" ,
60
+ ]
57
61
58
62
# Validate macros
59
63
if "macros" in api :
@@ -66,8 +70,8 @@ def check_api(header: Header, api: Dict):
66
70
macros = api ["macros" ]
67
71
68
72
for name , obj in macros .items ():
69
- if not ( cdef in obj or pdef in obj ):
70
- err = f'error: Macro { name } does not contain at least one required property: " { cdef } " or " { pdef } " '
73
+ if ( not any ( k in obj . keys () for k in possible_keys ) ):
74
+ err = f'error: Macro { name } does not contain at least one required property: { possible_keys } '
71
75
errors .append (err )
72
76
73
77
# Validate functions
@@ -80,8 +84,8 @@ def check_api(header: Header, api: Dict):
80
84
81
85
fns = api ["functions" ]
82
86
for name , obj in fns .items ():
83
- if not ( cdef in obj or pdef in obj ):
84
- err = f'error: function { name } does not contain at least one required property: " { cdef } " or " { pdef } " '
87
+ if ( not any ( k in obj . keys () for k in possible_keys ) ):
88
+ err = f'error: function { name } does not contain at least one required property: { possible_keys } '
85
89
errors .append (err )
86
90
87
91
if errors :
@@ -104,7 +108,7 @@ def print_tbl_dir(name):
104
108
* - { name }
105
109
- Implemented
106
110
- C23 Standard Section
107
- - POSIX.1-2024 Standard Section """
111
+ - POSIX Docs """
108
112
)
109
113
110
114
@@ -128,8 +132,10 @@ def print_functions_rst(header: Header, functions: Dict):
128
132
else :
129
133
print (" -" )
130
134
131
- if "posix-definition" in functions [name ]:
132
- print (f' - { functions [name ]["posix-definition" ]} ' )
135
+ if "in-latest-posix" in functions [name ]:
136
+ print (f' - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/{ name } .html>`__' )
137
+ elif "removed-in-posix-2008" in functions [name ]:
138
+ print (f' - `removed in POSIX.1-2008 <https://pubs.opengroup.org/onlinepubs/007904875/functions/{ name } .html>`__' )
133
139
else :
134
140
print (" -" )
135
141
@@ -154,8 +160,8 @@ def print_macros_rst(header: Header, macros: Dict):
154
160
else :
155
161
print (" -" )
156
162
157
- if "posix-definition " in macros [name ]:
158
- print (f' - { macros [ name ][ "posix-definition" ] } ' )
163
+ if "in-latest-posix " in macros [name ]:
164
+ print (f' - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/ { header . name } .html>`__ ' )
159
165
else :
160
166
print (" -" )
161
167
print ()
0 commit comments