(*args)
| 102 | fd.write(line_prefix+ m.group(1)+"\n") |
| 103 | |
| 104 | def main(*args): |
| 105 | n_file=0 |
| 106 | |
| 107 | if len(args) == 1 and args[0] == '--all': |
| 108 | paths = [] |
| 109 | |
| 110 | for top_level in ["./arm_compute", "./src", "./examples", "./tests", "./utils", "./framework", "./support"]: |
| 111 | for root, _, files in os.walk(top_level): |
| 112 | paths.extend([os.path.join(root, f) for f in files]) |
| 113 | else: |
| 114 | paths = args |
| 115 | for path in paths: |
| 116 | if (path[-3:] not in ("cpp", "inl", "hpp") and |
| 117 | path[-2:] not in ("cl",) and |
| 118 | path[-2:] not in ("cs",) and |
| 119 | path[-1] not in ("h",)): |
| 120 | continue |
| 121 | |
| 122 | print("[{}] {}".format(n_file, path)) |
| 123 | |
| 124 | n_file += 1 |
| 125 | |
| 126 | with open(path,'r+', encoding="utf-8") as fd: |
| 127 | comment = list() |
| 128 | first_param = -1 |
| 129 | last_param = -1 |
| 130 | n_line = 0 |
| 131 | |
| 132 | lines = fd.readlines() |
| 133 | fd.seek(0) |
| 134 | fd.truncate() |
| 135 | |
| 136 | for line in lines: |
| 137 | n_line += 1 |
| 138 | |
| 139 | # Start comment |
| 140 | # Match C-style comment /* anywhere in the line |
| 141 | if re.search(r"/\*", line): |
| 142 | #print("Start comment {}".format(n_line)) |
| 143 | |
| 144 | if len(comment) > 0: |
| 145 | raise Exception("{}:{}: Already in a comment!".format(path,n_line)) |
| 146 | |
| 147 | comment.append(line) |
| 148 | |
| 149 | # Comment already started |
| 150 | elif len(comment) > 0: |
| 151 | #print("Add line to comment {}".format(n_line)) |
| 152 | |
| 153 | comment.append(line) |
| 154 | |
| 155 | # Non-comment line |
| 156 | else: |
| 157 | #print("Normal line {}".format(n_line)) |
| 158 | |
| 159 | fd.write(line) |
| 160 | |
| 161 | # Match param declaration in Doxygen comment |
no test coverage detected