( path, filename )
| 77 | parseFile(dir, name) |
| 78 | |
| 79 | def parseFile( path, filename ): |
| 80 | f = io.open( os.path.join(path, filename), 'r', encoding='utf-8' ) |
| 81 | blanks = 0 |
| 82 | write( u"// start {0}\n".format( filename ) ) |
| 83 | for line in f: |
| 84 | if '// ~*~* CATCH_CPP_STITCH_PLACE *~*~' in line: |
| 85 | insertCpps() |
| 86 | continue |
| 87 | elif ifParser.match( line ): |
| 88 | globals['ifdefs'] += 1 |
| 89 | elif endIfParser.match( line ): |
| 90 | globals['ifdefs'] -= 1 |
| 91 | if globals['ifdefs'] == globals['implIfDefs']: |
| 92 | globals['implIfDefs'] = -1 |
| 93 | m = includesParser.match( line ) |
| 94 | if m: |
| 95 | header = m.group(1) |
| 96 | headerPath, sep, headerFile = header.rpartition( "/" ) |
| 97 | if headerFile not in seenHeaders: |
| 98 | if headerFile != "tbc_text_format.h" and headerFile != "clara.h": |
| 99 | seenHeaders.add( headerFile ) |
| 100 | if headerPath == "internal" and path.endswith("internal/"): |
| 101 | headerPath = "" |
| 102 | sep = "" |
| 103 | if os.path.exists( path + headerPath + sep + headerFile ): |
| 104 | parseFile( path + headerPath + sep, headerFile ) |
| 105 | else: |
| 106 | parseFile( rootPath + headerPath + sep, headerFile ) |
| 107 | else: |
| 108 | if ifImplParser.match(line): |
| 109 | globals['implIfDefs'] = globals['ifdefs'] |
| 110 | if (not guardParser.match( line ) or defineParser.match( line ) ) and not commentParser1.match( line )and not commentParser2.match( line ): |
| 111 | if blankParser.match( line ): |
| 112 | blanks = blanks + 1 |
| 113 | else: |
| 114 | blanks = 0 |
| 115 | if blanks < 2 and not defineParser.match(line): |
| 116 | write( line.rstrip() + "\n" ) |
| 117 | write( u'// end {}\n'.format(filename) ) |
| 118 | |
| 119 | def warnUnparsedHeaders(): |
| 120 | unparsedHeaders = possibleHeaders.difference( seenHeaders ) |
no test coverage detected