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 c_code = args.generate_c_code
if c_code: if c_code:
header_name = c_code + '.h' header_name = c_code + '.h'
h = open(path.join(outdir, header_name), 'w') with open(path.join(outdir, header_name), 'w') as outfile:
c = open(path.join(outdir, c_code + '.c'), 'w') gen = codegen.HeaderCodeGenerator(all_ifaces,
gen = codegen.CodeGenerator(all_ifaces, args.c_namespace,
args.c_namespace, args.c_generate_object_manager,
args.interface_prefix, args.c_generate_autocleanup,
args.c_generate_object_manager, header_name,
args.c_generate_autocleanup, args.pragma_once,
docbook_gen, outfile)
h, c, gen.generate()
header_name,
args.pragma_once) with open(path.join(outdir, c_code + '.c'), 'w') as outfile:
ret = gen.generate() gen = codegen.CodeGenerator(all_ifaces,
h.close() args.c_namespace,
c.close() args.c_generate_object_manager,
header_name,
docbook_gen,
outfile)
gen.generate()
sys.exit(0) sys.exit(0)