Improve code style of generated headers

This commit is contained in:
Rémi Verschelde 2017-11-15 20:16:51 +01:00
parent 677e95d8d1
commit ed2b66f023
4 changed files with 25 additions and 34 deletions

View File

@ -386,7 +386,6 @@ if selected_platform in platform_list:
except:
pass
sys.path.remove(tmppath)
sys.modules.pop('config')

View File

@ -25,7 +25,7 @@ def make_certs_header(target, source, env):
g.write("static const int _certs_uncompressed_size = " + str(decomp_size) + ";\n")
g.write("static const unsigned char _certs_compressed[] = {\n")
for i in range(len(buf)):
g.write(byte_to_str(buf[i]) + ",\n")
g.write("\t" + byte_to_str(buf[i]) + ",\n")
g.write("};\n")
g.write("#endif")
@ -57,7 +57,7 @@ def make_doc_header(target, source, env):
g.write("static const int _doc_data_uncompressed_size = " + str(decomp_size) + ";\n")
g.write("static const unsigned char _doc_data_compressed[] = {\n")
for i in range(len(buf)):
g.write(byte_to_str(buf[i]) + ",\n")
g.write("\t" + byte_to_str(buf[i]) + ",\n")
g.write("};\n")
g.write("#endif")
@ -85,7 +85,7 @@ def make_fonts_header(target, source, env):
g.write("static const int _font_" + name + "_size = " + str(len(buf)) + ";\n")
g.write("static const unsigned char _font_" + name + "[] = {\n")
for i in range(len(buf)):
g.write(byte_to_str(buf[i]) + ",\n")
g.write("\t" + byte_to_str(buf[i]) + ",\n")
g.write("};\n")
@ -116,11 +116,9 @@ def make_translations_header(target, source, env):
buf = zlib.compress(buf)
name = os.path.splitext(os.path.basename(sorted_paths[i]))[0]
#g.write("static const int _translation_"+name+"_compressed_size="+str(len(buf))+";\n")
#g.write("static const int _translation_"+name+"_uncompressed_size="+str(decomp_size)+";\n")
g.write("static const unsigned char _translation_" + name + "_compressed[] = {\n")
for i in range(len(buf)):
g.write(byte_to_str(buf[i]) + ",\n")
g.write("\t" + byte_to_str(buf[i]) + ",\n")
g.write("};\n")
@ -396,9 +394,9 @@ def _make_doc_data_class_path(to_path):
g.write("struct _DocDataClassPath { const char* name; const char* path; };\n")
g.write("static const _DocDataClassPath _doc_data_class_paths[" + str(len(env.doc_class_path) + 1) + "] = {\n");
for c in env.doc_class_path:
g.write("{\""+c+"\",\""+env.doc_class_path[c]+"\"},\n")
g.write("{NULL,NULL}\n")
for c in sorted(env.doc_class_path):
g.write("\t{\"" + c + "\", \"" + env.doc_class_path[c] + "\"},\n")
g.write("\t{NULL, NULL}\n")
g.write("};\n")
@ -423,6 +421,7 @@ if env['tools']:
_make_doc_data_class_path(os.path.join(env.Dir('#').abspath, "editor/doc"))
docs = sorted(docs)
env.Depends("#editor/doc_data_compressed.gen.h", docs)
env.Command("#editor/doc_data_compressed.gen.h", docs, make_doc_header)
# Certificates

View File

@ -1293,21 +1293,15 @@ def detect_modules():
// modules.cpp - THIS FILE IS GENERATED, DO NOT EDIT!!!!!!!
#include "register_module_types.h"
""" + includes_cpp + """
void register_module_types() {
""" + register_cpp + """
}
void unregister_module_types() {
""" + unregister_cpp + """
}
"""
f = open("modules/register_module_types.gen.cpp", "w")

View File

@ -9,7 +9,6 @@ Export('env_modules')
env.modules_sources = [
"register_module_types.gen.cpp",
]
# env.add_source_files(env.modules_sources,"*.cpp")
Export('env')
for x in env.module_list: