Add a spec asciidoc macro prefix to an API name, depending on its type (protos, structs, enums, etc.). If the name is not recognized, use the generic link macro 'reflink:'. If rewriteAlias is True, and name is an alias of something else, use that name instead (on the as
(name, rewriteAlias = True)
| 149 | |
| 150 | |
| 151 | def macroPrefix(name, rewriteAlias = True): |
| 152 | """Add a spec asciidoc macro prefix to an API name, depending on its type |
| 153 | (protos, structs, enums, etc.). |
| 154 | |
| 155 | If the name is not recognized, use the generic link macro 'reflink:'. |
| 156 | |
| 157 | If rewriteAlias is True, and name is an alias of something else, use |
| 158 | that name instead (on the assumption that the promoted-to API has a |
| 159 | target refpage, while the alias does not). |
| 160 | """ |
| 161 | |
| 162 | if rewriteAlias: |
| 163 | while name in api.alias: |
| 164 | name = api.alias[name] |
| 165 | |
| 166 | if name in api.basetypes: |
| 167 | return f'basetype:{name}' |
| 168 | if name in api.defines: |
| 169 | return f'dlink:{name}' |
| 170 | if name in api.enums: |
| 171 | return f'elink:{name}' |
| 172 | if name in api.flags: |
| 173 | return f'tlink:{name}' |
| 174 | if name in api.funcpointers: |
| 175 | return f'tlink:{name}' |
| 176 | if name in api.handles: |
| 177 | return f'slink:{name}' |
| 178 | if name in api.protos: |
| 179 | return f'flink:{name}' |
| 180 | if name in api.structs: |
| 181 | return f'slink:{name}' |
| 182 | if name == 'TBD': |
| 183 | return 'No cross-references are available' |
| 184 | |
| 185 | # Fallthrough - cannot find API type for name, so treat as a reflink. |
| 186 | # This mostly affects feature and extension names e.g. VK_VERSION_1_0. |
| 187 | return f'reflink:{name}' |
| 188 | |
| 189 | |
| 190 | def seeAlsoList(apiName, explicitRefs=set(), apiAliases=set()): |
no outgoing calls
no test coverage detected