diff options
Diffstat (limited to 'tools/upbc.lua')
-rw-r--r-- | tools/upbc.lua | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/tools/upbc.lua b/tools/upbc.lua index a538b1c..8ac4f73 100644 --- a/tools/upbc.lua +++ b/tools/upbc.lua @@ -77,28 +77,28 @@ for _, file in ipairs(files) do hfile:close() cfile:close() - end - - -- Write C API. - hfilename = outbase .. ".upb.h" - cfilename = outbase .. ".upb.c" - - if os.getenv("UPBC_VERBOSE") then - print("upbc:") - print(string.format(" source file=%s", src)) - print(string.format(" output file base=%s", outbase)) - print(string.format(" hfilename=%s", hfilename)) - print(string.format(" cfilename=%s", cfilename)) - end + else + -- Write C API. + hfilename = outbase .. ".upb.h" + cfilename = outbase .. ".upb.c" + + if os.getenv("UPBC_VERBOSE") then + print("upbc:") + print(string.format(" source file=%s", src)) + print(string.format(" output file base=%s", outbase)) + print(string.format(" hfilename=%s", hfilename)) + print(string.format(" cfilename=%s", cfilename)) + end - local hfile = assert(io.open(hfilename, "w"), "couldn't open " .. hfilename) - local cfile = assert(io.open(cfilename, "w"), "couldn't open " .. cfilename) + local hfile = assert(io.open(hfilename, "w"), "couldn't open " .. hfilename) + local cfile = assert(io.open(cfilename, "w"), "couldn't open " .. cfilename) - local happend = dump_cinit.file_appender(hfile) - local cappend = dump_cinit.file_appender(cfile) + local happend = dump_cinit.file_appender(hfile) + local cappend = dump_cinit.file_appender(cfile) - make_c_api.write_gencode(file, hfilename, happend, cappend) + make_c_api.write_gencode(file, hfilename, happend, cappend) - hfile:close() - cfile:close() + hfile:close() + cfile:close() + end end |