diff --git a/src/amd/common/sid_tables.py b/src/amd/common/sid_tables.py index a0cb5b2d832..6fc2ad01cef 100644 --- a/src/amd/common/sid_tables.py +++ b/src/amd/common/sid_tables.py @@ -40,6 +40,10 @@ sys.path.append(AMD_REGISTERS) from regdb import Object, RegisterDatabase +def string_to_chars(string): + return "'" + "', '".join(string) + "', '\\0'," + + class StringTable: """ A class for collecting multiple strings in a single larger string that is @@ -70,13 +74,14 @@ class StringTable: to filp. """ fragments = [ - '"%s\\0" /* %s */' % ( + '%s /* %s (%s) */' % ( + string_to_chars(te[0].encode('unicode_escape').decode()), te[0].encode('unicode_escape').decode(), ', '.join(str(idx) for idx in sorted(te[2])) ) for te in self.table ] - filp.write('%sconst char %s[] =\n%s;\n' % ( + filp.write('%sconst char %s[] = {\n%s\n};\n' % ( 'static ' if static else '', name, '\n'.join('\t' + fragment for fragment in fragments)