diff options
author | Remko Tronçon <git@el-tramo.be> | 2013-12-30 11:21:45 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2014-01-03 11:09:06 (GMT) |
commit | 26bb5aa9e2f520c3c943797e6143c32e5b16806b (patch) | |
tree | 0caa41938acf53da946847f8803c62e579525af9 /Sluift/SConscript | |
parent | 0b19dc7292b7672c9fbb711a411c392bc5b2bb34 (diff) | |
download | swift-26bb5aa9e2f520c3c943797e6143c32e5b16806b.zip swift-26bb5aa9e2f520c3c943797e6143c32e5b16806b.tar.bz2 |
Sluift: Add help support
Provide a 'help' function that takes a table/function, and prints help
for it. A structured representation can be retrieved through 'get_help'.
Change-Id: I2b3ce8992943ef30cee2604fba9200feed263fa5
Diffstat (limited to 'Sluift/SConscript')
-rw-r--r-- | Sluift/SConscript | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Sluift/SConscript b/Sluift/SConscript index 116c5f1..d88e948 100644 --- a/Sluift/SConscript +++ b/Sluift/SConscript @@ -52,13 +52,16 @@ elif env["SCONS_STAGE"] == "build" : version_header += "#define SLUIFT_VERSION_STRING \"" + Version.getBuildVersion(env.Dir("#").abspath, "sluift") + "\"\n" sluift_env.WriteVal("Version.h", sluift_env.Value(version_header)) - # Generate core.cpp + # Generate core.c def generate_embedded_lua(env, target, source) : f = open(source[0].abspath, "r") data = f.read() f.close() + data_bytes = bytearray(data) f = open(target[0].abspath, "w") - f.write('const char ' + source[0].name.replace(".", "_") + "[] = \"" + data.replace("\\", "\\\\").replace("\n", "\\n").replace('"', '\\"') + "\";") + f.write('#include <stddef.h>\n') + f.write('const size_t ' + source[0].name.replace(".", "_") + "_size = " + str(len(data_bytes)) + ";\n") + f.write('const char ' + source[0].name.replace(".", "_") + "[] = {" + ", ".join([str(b) for b in data_bytes]) + "};\n") f.close() sluift_env.Command("core.c", ["core.lua"], env.Action(generate_embedded_lua, cmdstr="$GENCOMSTR")) |