Skip to content
Snippets Groups Projects
Commit fe24d072 authored by Elizabeth's avatar Elizabeth
Browse files

Added comment string to be written to auto gen files

parent c254be0e
No related branches found
No related tags found
No related merge requests found
......@@ -43,18 +43,19 @@ def generate_source_code(table, dir_name, filename, source_name):
filename: Filename of original source
source_name: Filename without the file extension (ex: foo/blah.cc --> blah)
'''
file_comment = "// AUTO-GENERATED SOURCE CODE. REPLACED ALL INSTANCES OF %s WITH %s\n"
source_file = open(filename, "r")
for knob_config in table:
source_file.seek(0, 0)
new_file_contents = []
new_file_contents = [file_comment % (knob_config.orig_func_name, knob_config.new_func_call)]
# Store complete line to handle cases where one line of code is split into two lines
complete_line = ""
for line in source_file:
# Handles case where 1 actual line of code is split into 2 lines
if len(line) >= 2 and not line.startswith("#") and \
line.find(";") == -1: # Last char is always \n
if not line.startswith("#") and line.find(";") == -1: # Last char is always \n
complete_line += line
continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment