gdbus-codegen: Split C header and code generation

The class that generated both C header and code has been split into
two classes. These clases are now specialized on creating the header
or the body code.

All parameters that do not belong to each class have also been
deleted, so only the necessary parameters still remain. These also
includes the header and code file descriptors, leaving only the
corresponding file descriptor necessary for each class.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
This commit is contained in:
Iñigo Martínez 2018-01-04 09:56:59 +01:00
parent a66f2f80e0
commit 22772acff8
2 changed files with 2326 additions and 2310 deletions

File diff suppressed because it is too large Load Diff

View File

@ -197,20 +197,24 @@ def codegen_main():
c_code = args.generate_c_code
if c_code:
header_name = c_code + '.h'
h = open(path.join(outdir, header_name), 'w')
c = open(path.join(outdir, c_code + '.c'), 'w')
gen = codegen.CodeGenerator(all_ifaces,
args.c_namespace,
args.interface_prefix,
args.c_generate_object_manager,
args.c_generate_autocleanup,
docbook_gen,
h, c,
header_name,
args.pragma_once)
ret = gen.generate()
h.close()
c.close()
with open(path.join(outdir, header_name), 'w') as outfile:
gen = codegen.HeaderCodeGenerator(all_ifaces,
args.c_namespace,
args.c_generate_object_manager,
args.c_generate_autocleanup,
header_name,
args.pragma_once,
outfile)
gen.generate()
with open(path.join(outdir, c_code + '.c'), 'w') as outfile:
gen = codegen.CodeGenerator(all_ifaces,
args.c_namespace,
args.c_generate_object_manager,
header_name,
docbook_gen,
outfile)
gen.generate()
sys.exit(0)