Fill in missing fields in pageInfo structures, to the extent they can be inferred. - refpageMap - dictionary of pageInfo structures - specFile - filename - file - list of strings making up the file, indexed by pageInfo
(refpageMap, specFile, file)
| 267 | return line |
| 268 | |
| 269 | def fixupRefs(refpageMap, specFile, file): |
| 270 | """Fill in missing fields in pageInfo structures, to the extent they can be |
| 271 | inferred. |
| 272 | |
| 273 | - refpageMap - dictionary of pageInfo structures |
| 274 | - specFile - filename |
| 275 | - file - list of strings making up the file, indexed by pageInfo""" |
| 276 | # All potential ref pages are now in refpageMap. Process them to |
| 277 | # identify actual page start/end/description boundaries, if |
| 278 | # not already determined from the text. |
| 279 | for name in sorted(refpageMap.keys()): |
| 280 | pi = refpageMap[name] |
| 281 | |
| 282 | # # If nothing is found but an include line with no begin, validity, |
| 283 | # # or end, this is not intended as a ref page (yet). Set the begin |
| 284 | # # line to the include line, so autogeneration can at least |
| 285 | # # pull the include out, but mark it not to be extracted. |
| 286 | # # Examples include the host sync table includes in |
| 287 | # # chapters/fundamentals.adoc and the table of Vk*Flag types in |
| 288 | # # appendices/boilerplate.adoc. |
| 289 | # if pi.begin is None and pi.validity is None and pi.end is None: |
| 290 | # pi.begin = pi.include |
| 291 | # pi.extractPage = False |
| 292 | # pi.Warning = 'No begin, validity, or end lines identified' |
| 293 | # continue |
| 294 | |
| 295 | # Using open block delimiters, ref pages must *always* have a |
| 296 | # defined begin and end. If either is undefined, that is fatal. |
| 297 | if pi.begin is None: |
| 298 | pi.extractPage = False |
| 299 | pi.Warning = 'Cannot identify start of ref page open block' |
| 300 | continue |
| 301 | |
| 302 | if pi.end is None: |
| 303 | pi.extractPage = False |
| 304 | pi.Warning = 'Cannot identify end of ref page open block' |
| 305 | continue |
| 306 | |
| 307 | # If there is no description of the page, infer one from the type |
| 308 | if pi.desc is None: |
| 309 | if pi.type is not None: |
| 310 | # pi.desc = pi.type[0:len(pi.type)-1] + ' (no short description available)' |
| 311 | pi.Warning = 'No short description available; could infer from the type and name' |
| 312 | else: |
| 313 | pi.extractPage = False |
| 314 | pi.Warning = 'No short description available, cannot infer from the type' |
| 315 | continue |
| 316 | |
| 317 | # Try to determine where the parameter and body sections of the page |
| 318 | # begin. funcpointer, proto, and struct pages infer the location of |
| 319 | # the parameter and body sections. Other pages infer the location of |
| 320 | # the body, but have no parameter sections. |
| 321 | # |
| 322 | # Probably some other types infer this as well - refer to list of |
| 323 | # all page types in genRef.py:emitPage() |
| 324 | if pi.include is not None: |
| 325 | if pi.type in ['funcpointers', 'protos', 'structs']: |
| 326 | pi.param = nextPara(file, pi.include) |
no test coverage detected