native code generator: Use groups for constructors too.

Change-Id: I42570b4b7b68e36cab1286948d03df0c2f0d4103
This commit is contained in:
Matúš Kukan
2014-01-09 09:20:55 +01:00
parent b85d7b380a
commit 27014f48f4

View File

@@ -13,11 +13,8 @@ from optparse import OptionParser
# relevant function sections will be referenced in lo_get_factory_map().
# That prevents garbage collector to ignore them as unused.
# We need the same groups for new constructor functions, started in
# ae3a0c8da50b36db395984637f5ad74d3b4887bc
# For now, there are only constructor functions for implementations in 'core'
# group, so no need for other groups, core_constructor_list is enough.
# (These functions are referenced in lo_get_constructor_map().)
# The same groups are used for constructor based implementations
# referenced in lo_get_constructor_map().
core_factory_list = [
("libembobj.a", "embobj_component_getFactory"),
@@ -60,6 +57,16 @@ core_factory_list = [
("libxstor.a", "xstor_component_getFactory"),
]
core_constructor_list = [
# sax/source/expatwrap/expwrap.component
"com_sun_star_comp_extensions_xml_sax_ParserExpat",
"com_sun_star_comp_extensions_xml_sax_FastParser",
# svtools/util/svt.component
"com_sun_star_comp_graphic_GraphicProvider_get_implementation",
# svx/util/svx.component
"com_sun_star_drawing_EnhancedCustomShapeEngine_implementation_getFactory",
]
extended_core_factory_list = core_factory_list + [
("libanimcorelo.a", "animcore_component_getFactory"),
("libavmedialo.a", "avmedia_component_getFactory"),
@@ -77,23 +84,35 @@ extended_core_factory_list = core_factory_list + [
("libxmlfdlo.a", "xmlfd_component_getFactory"),
]
extended_core_constructor_list = core_constructor_list + [
]
base_core_factory_list = [
("libdbalo.a", "dba_component_getFactory"),
("libdbaxmllo.a", "dbaxml_component_getFactory"),
]
base_core_constructor_list = [
]
calc_core_factory_list = [
("libscdlo.a", "scd_component_getFactory"),
("libscfiltlo.a", "scfilt_component_getFactory"),
("libsclo.a", "sc_component_getFactory"),
]
calc_core_constructor_list = [
]
calc_factory_list = calc_core_factory_list + [
("libanalysislo.a", "analysis_component_getFactory"),
("libdatelo.a", "date_component_getFactory"),
("libpricinglo.a", "pricing_component_getFactory"),
]
calc_constructor_list = calc_core_constructor_list + [
]
draw_core_factory_list = [
("libsddlo.a", "sdd_component_getFactory"),
("libsdlo.a", "sd_component_getFactory"),
@@ -101,23 +120,35 @@ draw_core_factory_list = [
("libwpftdrawlo.a", "wpftdraw_component_getFactory"),
]
draw_core_constructor_list = [
]
math_factory_list = [
("libsmdlo.a", "smd_component_getFactory"),
("libsmlo.a", "sm_component_getFactory"),
]
math_constructor_list = [
]
writer_core_factory_list = [
("libswdlo.a", "swd_component_getFactory"),
("libswlo.a", "sw_component_getFactory"),
("libwriterfilterlo.a", "writerfilter_component_getFactory"),
]
writer_core_constructor_list = [
]
writer_factory_list = writer_core_factory_list + [
("libhwplo.a", "hwp_component_getFactory"),
("libt602filterlo.a", "t602filter_component_getFactory"),
("libwpftwriterlo.a", "wpftwriter_component_getFactory"),
]
writer_constructor_list = writer_core_constructor_list + [
]
factory_map = {
'core' : core_factory_list,
'extended_core' : extended_core_factory_list,
@@ -130,15 +161,17 @@ factory_map = {
'writer' : writer_factory_list,
}
core_constructor_list = [
# sax/source/expatwrap/expwrap.component
"com_sun_star_comp_extensions_xml_sax_ParserExpat",
"com_sun_star_comp_extensions_xml_sax_FastParser",
# svtools/util/svt.component
"com_sun_star_comp_graphic_GraphicProvider_get_implementation",
# svx/util/svx.component
"com_sun_star_drawing_EnhancedCustomShapeEngine_implementation_getFactory",
]
constructor_map = {
'core' : core_constructor_list,
'extended_core' : extended_core_constructor_list,
'base_core' : base_core_constructor_list,
'calc_core' : calc_core_constructor_list,
'calc' : calc_constructor_list,
'draw_core' : draw_core_constructor_list,
'math' : math_constructor_list,
'writer_core' : writer_core_constructor_list,
'writer' : writer_constructor_list,
}
opts = OptionParser()
opts.add_option("-j", "--java-guard", action="store_true", help="include external java functions", dest="java", default=False)
@@ -148,7 +181,7 @@ opts.add_option("-g", "--group", action="append", help="group of implementations
print ("""/*
* This is a generated file. Do not edit.
* file generated by solenc/bin/native-code.py
* file generated by solenv/bin/native-code.py
*/
#include <osl/detail/component-mapping.h>
@@ -162,8 +195,10 @@ if options.groups:
print ('void * '+factory_function+'( const char* , void* , void* );')
print ('')
for constructor in core_constructor_list:
print ('void * '+constructor+'( void *, void * );')
if options.groups:
for constructor_group in options.groups:
for constructor in constructor_map[constructor_group]:
print ('void * '+constructor+'( void *, void * );')
print ("""
const lib_to_factory_mapping *
@@ -199,8 +234,11 @@ const lib_to_constructor_mapping *
lo_get_constructor_map(void)
{
static lib_to_constructor_mapping map[] = {""")
for constructor in core_constructor_list:
print (' { "' +constructor+ '", ' +constructor+ ' },')
if options.groups:
for constructor_group in options.groups:
for constructor in constructor_map[constructor_group]:
print (' { "' +constructor+ '", ' +constructor+ ' },')
print ("""
{ 0, 0 }