Returns a tuple of lists: dlist for the list of data symbols and flist for the list of function symbols. dlist, flist = parse_nm(nm_output)
(nm_output)
| 72 | return nm_output |
| 73 | |
| 74 | def parse_nm(nm_output): |
| 75 | """Returns a tuple of lists: dlist for the list of data |
| 76 | symbols and flist for the list of function symbols. |
| 77 | |
| 78 | dlist, flist = parse_nm(nm_output)""" |
| 79 | data = DATA_RE.findall(nm_output) |
| 80 | func = FUNC_RE.findall(nm_output) |
| 81 | |
| 82 | flist = [] |
| 83 | for sym in data: |
| 84 | if sym in func and (sym[:2] == 'Py' or sym[:3] == '_Py' or sym[:4] == 'init'): |
| 85 | flist.append(sym) |
| 86 | |
| 87 | dlist = [] |
| 88 | for sym in data: |
| 89 | if sym not in flist and (sym[:2] == 'Py' or sym[:3] == '_Py'): |
| 90 | dlist.append(sym) |
| 91 | |
| 92 | dlist.sort() |
| 93 | flist.sort() |
| 94 | return dlist, flist |
| 95 | |
| 96 | def output_def(dlist, flist, header, file = sys.stdout): |
| 97 | """Outputs the final DEF file to a file defaulting to stdout. |