scons: Delete the unused do_embed_text function.

Change-Id: I2ad37c9965e7a58e288711f0fa5bb1858f121c05
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48968
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
Gabe Black
2021-08-02 01:00:39 -07:00
parent 8dffadf4e4
commit d52db719cd

View File

@@ -61,36 +61,6 @@ CompoundFlag('Ruby', [ 'RubyQueue', 'RubyNetwork', 'RubyTester',
'RubyDma', 'RubyPort', 'RubySequencer', 'RubyCacheTrace',
'RubyPrefetcher'])
def do_embed_text(target, source, env):
"""convert a text file into a file that can be embedded in C
using an #include statement, that defines a \"const char *\" pointing
to the same text.
This is useful to embed scripts and configuration files in object files.
"""
escape = [ "\'", "\"", "\\", "\?" ]
# reads the text file in, line by line, converting it to a C string
fin = open(str(source[0]), 'r')
fout = open(str(target[0]), 'w' )
fout.write("static const char *%s =\n" % source[1].get_contents());
for l in fin:
# add escape sequences for the characters in escape
fout.write("\"")
for char in l:
if char == "\n":
break
if char in escape:
fout.write("\\")
fout.write(char)
else:
fout.write(char)
fout.write("\\n\"\n");
fout.write(";\n");
fin.close()
fout.close()
#
# Link includes
#