diff options
Diffstat (limited to 'scripts/gendeclarations.lua')
-rwxr-xr-x | scripts/gendeclarations.lua | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/scripts/gendeclarations.lua b/scripts/gendeclarations.lua index bc55b48a0a..9398bbb31c 100755 --- a/scripts/gendeclarations.lua +++ b/scripts/gendeclarations.lua @@ -3,9 +3,8 @@ local fname = arg[1] local static_fname = arg[2] local non_static_fname = arg[3] -local cpp = arg[4] +local preproc_fname = arg[4] -cpp = cpp:gsub(' %-DINCLUDE_GENERATED_DECLARATIONS ', ' ') local lpeg = require('lpeg') @@ -156,15 +155,14 @@ local pattern = concat( if fname == '--help' then print'Usage:' print() - print' gendeclarations.lua definitions.c static.h non-static.h "cc -E …"' + print' gendeclarations.lua definitions.c static.h non-static.h preprocessor.i' os.exit() end -local pipe = io.popen(cpp .. ' -DDO_NOT_DEFINE_EMPTY_ATTRIBUTES ' .. fname, 'r') -local text = pipe:read('*a') -if not pipe:close() then - os.exit(2) -end +local preproc_f = io.open(preproc_fname) +local text = preproc_f:read("*all") +preproc_f:close() + local header = [[ #ifndef DEFINE_FUNC_ATTRIBUTES @@ -181,7 +179,7 @@ local footer = [[ local non_static = header local static = header -local filepattern = '^# %d+ "[^"]-/?([^"/]+)"' +local filepattern = '^#%a* %d+ "[^"]-/?([^"/]+)"' local curfile init = 0 |