meson: Move generated source to fpi- prefix and use more readable code

Instead of concatenating strings, use an array of strings and finally join
them using newline.
This commit is contained in:
Marco Trevisan (Treviño)
2019-12-04 13:44:08 +01:00
parent a176fa1d34
commit b2e55308d6
2 changed files with 15 additions and 8 deletions

View File

@@ -117,15 +117,22 @@ foreach driver: drivers
endforeach
# Export the drivers' types to the core code
drivers_type_list = '#include <glib-object.h>\n'
drivers_type_list += '#include "fpi-context.h"\n'
drivers_type_func = 'void fpi_get_driver_types(GArray *drivers)\n{\n\tGType t;\n'
drivers_type_list = []
drivers_type_func = []
drivers_type_list += '#include <glib-object.h>'
drivers_type_list += '#include "fpi-context.h"'
drivers_type_list += ''
drivers_type_func += 'void fpi_get_driver_types (GArray *drivers)'
drivers_type_func += ' {'
drivers_type_func += ' GType t;'
drivers_type_func += ''
foreach driver: drivers
drivers_type_list += 'extern GType (fpi_device_' + driver + '_get_type) (void);\n'
drivers_type_func += ' t = fpi_device_' + driver + '_get_type(); g_array_append_val (drivers, t);\n'
drivers_type_list += 'extern GType (fpi_device_' + driver + '_get_type) (void);'
drivers_type_func += ' t = fpi_device_' + driver + '_get_type ();'
drivers_type_func += ' g_array_append_val (drivers, t);\n'
endforeach
drivers_type_list += ''
drivers_type_func += '};'
drivers_type_func += '}'
root_inc = include_directories('.')