| 49 | |
| 50 | # append a section to the sections array if the name passes muster |
| 51 | def appendSection(section): |
| 52 | # drop static classes which don't have any symbols |
| 53 | if len(section) < 2: |
| 54 | return |
| 55 | # section names are followed by a " -", so double check |
| 56 | if not section[0].endswith("-"): |
| 57 | print("warning: section name does not end with -: "+section[0]) |
| 58 | return |
| 59 | # grab first non-whitespace name ie. "Color" from "Color -" |
| 60 | match = re.match("\S+", section[0]) |
| 61 | if match: |
| 62 | if section[0] == "-": # main module is just a "-" |
| 63 | section[0] = module |
| 64 | else: # class name |
| 65 | section[0] = match.group(0) |
| 66 | else: |
| 67 | print("warning: section name had no non-whitespace match: "+section[0]) |
| 68 | return |
| 69 | # drop sections which match certain strings |
| 70 | if matches(section[0], sectionMatches): |
| 71 | return |
| 72 | # drop sections which contain certain strings |
| 73 | if any(section[0].endswith(x) for x in sectionEnds): |
| 74 | return |
| 75 | # if got this far, the section must be good... |
| 76 | sections.append(section) |
| 77 | |
| 78 | # parse swig output into sections |
| 79 | file = open(infile) |