Branch libreoffice-5-0-4
[LibreOffice.git] / solenv / bin / native-code.py
blob676e9c45e422bd9a9d9b775ec09703e4461ad12b
1 #!/usr/bin/python
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 from __future__ import print_function
9 from optparse import OptionParser
11 import re
12 import sys
13 import xml.etree.ElementTree as ET
15 # foo_component_getFactory functions are split into groups, so that you could
16 # choose e.g. 'core' and 'writer' functionality and through factory_map,
17 # relevant function sections will be referenced in lo_get_factory_map().
18 # That prevents garbage collector to ignore them as unused.
20 # The same groups are used for constructor based implementations
21 # referenced in lo_get_constructor_map().
23 core_factory_list = [
24 ("libembobj.a", "embobj_component_getFactory"),
25 ("libevtattlo.a", "evtatt_component_getFactory"),
26 ("libreflectionlo.a", "reflection_component_getFactory"),
27 ("libcomphelper.a", "comphelp_component_getFactory"),
28 ("libconfigmgrlo.a", "configmgr_component_getFactory"),
29 ("libdrawinglayerlo.a", "drawinglayer_component_getFactory"),
30 ("libfilterconfiglo.a", "filterconfig1_component_getFactory"),
31 ("libfsstoragelo.a", "fsstorage_component_getFactory"),
32 ("libhyphenlo.a", "hyphen_component_getFactory"),
33 ("libi18npoollo.a", "i18npool_component_getFactory"),
34 ("libi18nsearchlo.a", "i18nsearch_component_getFactory"),
35 ("libinvocadaptlo.a", "invocadapt_component_getFactory"),
36 ("liblnglo.a", "lng_component_getFactory"),
37 ("liblnthlo.a", "lnth_component_getFactory"),
38 ("liblocalebe1lo.a", "localebe1_component_getFactory"),
39 ("libooxlo.a", "oox_component_getFactory"),
40 ("libpackage2.a", "package2_component_getFactory"),
41 ("libsmlo.a", "sm_component_getFactory"),
42 ("libsotlo.a", "sot_component_getFactory"),
43 ("libsrtrs1.a", "srtrs1_component_getFactory"),
44 ("libstoragefdlo.a", "storagefd_component_getFactory"),
45 ("libucb1.a", "ucb_component_getFactory"),
46 ("libucpfile1.a", "ucpfile_component_getFactory"),
47 ("libucphier1.a", "ucphier1_component_getFactory"),
48 ("libucptdoc1lo.a", "ucptdoc1_component_getFactory"),
49 ("libunordflo.a", "unordf_component_getFactory"),
50 ("libunoxmllo.a", "unoxml_component_getFactory"),
51 ("libutllo.a", "utl_component_getFactory"),
52 ("libxmlsecurity.a", "xmlsecurity_component_getFactory"),
53 ("libxoflo.a", "xof_component_getFactory"),
54 ("libxolo.a", "xo_component_getFactory"),
55 ("libxsec_xmlsec.a", "xsec_xmlsec_component_getFactory", "#ifndef ANDROID"),
56 ("libxstor.a", "xstor_component_getFactory"),
57 ("libvclcanvaslo.a", "vclcanvas_component_getFactory"),
58 ("libmtfrendererlo.a", "mtfrenderer_component_getFactory"),
61 core_constructor_list = [
62 # canvas/source/factory/canvasfactory.component
63 "com_sun_star_comp_rendering_CanvasFactory_get_implementation",
64 # chart2/source/chartcore.component
65 "com_sun_star_chart2_LinearScaling_get_implementation",
66 "com_sun_star_comp_chart_AreaChartType_get_implementation",
67 "com_sun_star_comp_chart_BarChartType_get_implementation",
68 "com_sun_star_comp_chart_BubbleChartType_get_implementation",
69 "com_sun_star_comp_chart_CandleStickChartType_get_implementation",
70 "com_sun_star_comp_chart_ChartTypeManager_get_implementation",
71 "com_sun_star_comp_chart_ColumnChartType_get_implementation",
72 "com_sun_star_comp_chart_DataSeries_get_implementation",
73 "com_sun_star_comp_chart_DataSource_get_implementation",
74 "com_sun_star_comp_chart_FilledNetChartType_get_implementation",
75 "com_sun_star_comp_chart_GL3DBarChartType_get_implementation",
76 "com_sun_star_comp_chart_FormattedString_get_implementation",
77 "com_sun_star_comp_chart_LineChartType_get_implementation",
78 "com_sun_star_comp_chart_NetChartType_get_implementation",
79 "com_sun_star_comp_chart_PieChartType_get_implementation",
80 "com_sun_star_comp_chart_ScatterChartType_get_implementation",
81 "com_sun_star_comp_chart2_Axis_get_implementation",
82 "com_sun_star_comp_chart2_ChartController_get_implementation",
83 "com_sun_star_comp_chart2_ChartDocumentWrapper_get_implementation",
84 "com_sun_star_comp_chart2_ChartModel_get_implementation",
85 "com_sun_star_comp_chart2_Diagram_get_implementation",
86 "com_sun_star_comp_chart2_ErrorBar_get_implementation",
87 "com_sun_star_comp_chart2_LabeledDataSequence_get_implementation",
88 "com_sun_star_comp_chart2_Legend_get_implementation",
89 "com_sun_star_comp_chart2_LinearRegressionCurve_get_implementation",
90 "com_sun_star_comp_chart2_PolarCoordinateSystem2d_get_implementation",
91 "com_sun_star_comp_chart2_PolarCoordinateSystem3d_get_implementation",
92 "com_sun_star_comp_chart2_PolynomialRegressionCurve_get_implementation",
93 "com_sun_star_comp_chart2_PotentialRegressionCurve_get_implementation",
94 "com_sun_star_comp_chart2_RegressionEquation_get_implementation",
95 "com_sun_star_comp_chart2_Title_get_implementation",
96 "com_sun_star_comp_chart2_XMLFilter_get_implementation",
97 # chart2/source/controller/chartcontroller.component
98 "com_sun_star_comp_chart2_ChartDocumentWrapper_get_implementation",
99 "com_sun_star_comp_chart2_ChartFrameLoader_get_implementation",
100 # dbaccess/util/dba.component
101 "com_sun_star_comp_dba_ORowSet_get_implementation",
102 # forms/util/frm.component
103 "com_sun_star_comp_forms_FormOperations_get_implementation",
104 "com_sun_star_comp_forms_ODatabaseForm_get_implementation",
105 "com_sun_star_comp_forms_OFormattedFieldWrapper_ForcedFormatted_get_implementation",
106 "com_sun_star_comp_forms_ORichTextModel_get_implementation",
107 "com_sun_star_comp_forms_OScrollBarModel_get_implementation",
108 "com_sun_star_comp_forms_OSpinButtonModel_get_implementation",
109 "com_sun_star_form_Model_get_implementation",
110 "com_sun_star_form_OButtonControl_get_implementation",
111 "com_sun_star_form_OButtonModel_get_implementation",
112 "com_sun_star_form_OCheckBoxControl_get_implementation",
113 "com_sun_star_form_OCheckBoxModel_get_implementation",
114 "com_sun_star_form_OComboBoxControl_get_implementation",
115 "com_sun_star_form_OComboBoxModel_get_implementation",
116 "com_sun_star_form_ODateControl_get_implementation",
117 "com_sun_star_form_ODateModel_get_implementation",
118 "com_sun_star_form_OEditControl_get_implementation",
119 "com_sun_star_form_OEditModel_get_implementation",
120 "com_sun_star_form_OFixedTextModel_get_implementation",
121 "com_sun_star_form_OFormsCollection_get_implementation",
122 "com_sun_star_form_OGridControlModel_get_implementation",
123 "com_sun_star_form_OGroupBoxModel_get_implementation",
124 "com_sun_star_form_OListBoxModel_get_implementation",
125 "com_sun_star_form_ONumericModel_get_implementation",
126 "com_sun_star_form_ORadioButtonModel_get_implementation",
127 "com_sun_star_form_XForms_get_implementation",
128 # framework/util/fwk.component
129 "com_sun_star_comp_framework_AutoRecovery_get_implementation",
130 "com_sun_star_comp_framework_Desktop_get_implementation",
131 "com_sun_star_comp_framework_DocumentAcceleratorConfiguration_get_implementation",
132 "com_sun_star_comp_framework_Frame_get_implementation",
133 "com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation",
134 "com_sun_star_comp_framework_JobExecutor_get_implementation",
135 "com_sun_star_comp_framework_LayoutManager_get_implementation",
136 "com_sun_star_comp_framework_ModuleManager_get_implementation",
137 "com_sun_star_comp_framework_ModuleUIConfigurationManager_get_implementation",
138 "com_sun_star_comp_framework_ModuleUIConfigurationManagerSupplier_get_implementation",
139 "com_sun_star_comp_framework_PathSettings_get_implementation",
140 "com_sun_star_comp_framework_PathSubstitution_get_implementation",
141 "com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation",
142 "com_sun_star_comp_framework_TaskCreator_get_implementation",
143 "com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation",
144 "com_sun_star_comp_framework_UIConfigurationManager_get_implementation",
145 "com_sun_star_comp_framework_UIElementFactoryManager_get_implementation",
146 "com_sun_star_comp_framework_URLTransformer_get_implementation",
147 "com_sun_star_comp_framework_WindowStateConfiguration_get_implementation",
148 "com_sun_star_comp_framework_ModuleAcceleratorConfiguration_get_implementation",
149 "org_apache_openoffice_comp_framework_ContextChangeEventMultiplexer_get_implementation",
150 # i18npool/util/i18npool.component
151 "com_sun_star_i18n_BreakIterator_get_implementation",
152 "com_sun_star_i18n_BreakIterator_Unicode_get_implementation",
153 "com_sun_star_i18n_CharacterClassification_get_implementation",
154 "com_sun_star_i18n_CharacterClassification_Unicode_get_implementation",
155 "com_sun_star_i18n_Collator_get_implementation",
156 "com_sun_star_i18n_LocaleDataImpl_get_implementation",
157 "com_sun_star_i18n_NativeNumberSupplier_get_implementation",
158 "com_sun_star_i18n_NumberFormatCodeMapper_get_implementation",
159 "com_sun_star_i18n_Transliteration_get_implementation",
160 "com_sun_star_i18n_Transliteration_IGNORE_CASE_get_implementation",
161 "com_sun_star_i18n_Transliteration_IGNORE_KANA_get_implementation",
162 "com_sun_star_i18n_Transliteration_IGNORE_WIDTH_get_implementation",
163 "com_sun_star_text_DefaultNumberingProvider_get_implementation",
164 # sax/source/expatwrap/expwrap.component
165 "com_sun_star_comp_extensions_xml_sax_FastParser_get_implementation",
166 "com_sun_star_comp_extensions_xml_sax_ParserExpat_get_implementation",
167 "com_sun_star_extensions_xml_sax_Writer_get_implementation",
168 # sfx2/util/sfx.component
169 "SfxDocumentMetaData_get_implementation",
170 "com_sun_star_comp_office_FrameLoader_get_implementation",
171 "com_sun_star_comp_sfx2_AppDispatchProvider_get_implementation",
172 "com_sun_star_comp_sfx2_DocumentTemplates_get_implementation",
173 "com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation",
174 # stoc/source/inspect/introspection.component
175 "com_sun_star_comp_stoc_Introspection_get_implementation",
176 # stoc/util/stocservices.component
177 "com_sun_star_comp_stoc_OServiceManagerWrapper_get_implementation",
178 "com_sun_star_comp_stoc_TypeConverter_get_implementation",
179 "com_sun_star_comp_uri_ExternalUriReferenceTranslator_get_implementation",
180 "com_sun_star_comp_uri_UriReferenceFactory_get_implementation",
181 "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTexpand_get_implementation",
182 "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTscript_get_implementation",
183 # svtools/util/svt.component
184 "com_sun_star_graphic_GraphicObject_get_implementation",
185 "com_sun_star_comp_graphic_GraphicProvider_get_implementation",
186 # svx/util/svx.component
187 "com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation",
188 "com_sun_star_drawing_SvxShapeCollection_get_implementation",
189 # svx/util/svxcore.component
190 "com_sun_star_comp_graphic_PrimitiveFactory2D_get_implementation",
191 "com_sun_star_comp_Draw_GraphicExporter_get_implementation",
192 "com_sun_star_comp_Svx_GraphicExportHelper_get_implementation",
193 "com_sun_star_comp_Svx_GraphicImportHelper_get_implementation",
194 # toolkit/util/tk.component
195 "stardiv_Toolkit_StdTabController_get_implementation",
196 "stardiv_Toolkit_UnoButtonControl_get_implementation",
197 "stardiv_Toolkit_UnoCheckBoxControl_get_implementation",
198 "stardiv_Toolkit_UnoComboBoxControl_get_implementation",
199 "stardiv_Toolkit_UnoControlButtonModel_get_implementation",
200 "stardiv_Toolkit_UnoControlCheckBoxModel_get_implementation",
201 "stardiv_Toolkit_UnoControlComboBoxModel_get_implementation",
202 "stardiv_Toolkit_UnoControlContainer_get_implementation",
203 "stardiv_Toolkit_UnoControlContainerModel_get_implementation",
204 "stardiv_Toolkit_UnoControlDateFieldModel_get_implementation",
205 "stardiv_Toolkit_UnoControlDialogModel_get_implementation",
206 "stardiv_Toolkit_UnoControlFixedTextModel_get_implementation",
207 "stardiv_Toolkit_UnoControlFormattedFieldModel_get_implementation",
208 "stardiv_Toolkit_UnoControlGroupBoxModel_get_implementation",
209 "stardiv_Toolkit_UnoControlListBoxModel_get_implementation",
210 "stardiv_Toolkit_UnoControlNumericFieldModel_get_implementation",
211 "stardiv_Toolkit_UnoControlRadioButtonModel_get_implementation",
212 "stardiv_Toolkit_UnoControlScrollBarModel_get_implementation",
213 "stardiv_Toolkit_UnoDateFieldControl_get_implementation",
214 "stardiv_Toolkit_UnoSpinButtonModel_get_implementation",
215 "stardiv_Toolkit_VCLXPointer_get_implementation",
216 "stardiv_Toolkit_VCLXToolkit_get_implementation",
217 # uui/util/uui.component
218 "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation",
219 # xmloff/util/xo.component
220 "XMLVersionListPersistence_get_implementation",
223 # edit group for apps, where you can edit documents
224 edit_factory_list = [
227 edit_constructor_list = [
228 # framework/util/fwk.component
229 "com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation",
230 # i18npool/util/i18npool.component
231 "com_sun_star_i18n_InputSequenceChecker_get_implementation",
232 "com_sun_star_i18n_OrdinalSuffix_get_implementation",
233 # sc/util/sc.component
234 "Calc_XMLOasisContentExporter_get_implementation",
235 "Calc_XMLOasisExporter_get_implementation",
236 "Calc_XMLOasisMetaExporter_get_implementation",
237 "Calc_XMLOasisSettingsExporter_get_implementation",
238 "Calc_XMLOasisStylesExporter_get_implementation",
239 # starmath/util/sm.component
240 "Math_XMLOasisMetaExporter_get_implementation",
241 "Math_XMLOasisSettingsExporter_get_implementation",
242 # sw/util/sw.component
243 "com_sun_star_comp_Writer_XMLOasisContentExporter_get_implementation",
244 "com_sun_star_comp_Writer_XMLOasisMetaExporter_get_implementation",
245 "com_sun_star_comp_Writer_XMLOasisSettingsExporter_get_implementation",
246 "com_sun_star_comp_Writer_XMLOasisStylesExporter_get_implementation",
249 calc_factory_list = [
250 ("libsclo.a", "sc_component_getFactory"),
251 ("libanalysislo.a", "analysis_component_getFactory"),
252 ("libdatelo.a", "date_component_getFactory"),
253 ("libpricinglo.a", "pricing_component_getFactory"),
256 calc_constructor_list = [
257 # avmedia/util/avmedia.component
258 "com_sun_star_comp_framework_SoundHandler_get_implementation",
259 # sc/util/scd.component
260 "com_sun_star_comp_calc_ExcelBiffFormatDetector_get_implementation",
261 "com_sun_star_comp_calc_FormatDetector_get_implementation",
262 # sc/util/scfilt.component
263 "com_sun_star_comp_oox_xls_ExcelFilter_get_implementation",
264 "com_sun_star_comp_oox_xls_FormulaParser_get_implementation",
265 # scripting/source/vbaevents/vbaevents.component
266 ("ooo_vba_VBAToOOEventDesc_get_implementation", "#if HAVE_FEATURE_SCRIPTING"),
267 # svl/util/svl.component
268 "com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation",
269 "com_sun_star_uno_util_numbers_SvNumberFormatterServiceObject_get_implementation",
272 draw_factory_list = [
273 ("libsdlo.a", "sd_component_getFactory"),
274 ("libsvgfilterlo.a", "svgfilter_component_getFactory"),
275 ("libdeployment.a", "deployment_component_getFactory"),
276 ("libemboleobj.a", "emboleobj_component_getFactory"),
279 draw_constructor_list = [
280 # animations/source/animcore/animcore.component
281 "com_sun_star_animations_AnimateColor_get_implementation",
282 "com_sun_star_animations_AnimateMotion_get_implementation",
283 "com_sun_star_animations_AnimateSet_get_implementation",
284 "com_sun_star_animations_AnimateTransform_get_implementation",
285 "com_sun_star_animations_Animate_get_implementation",
286 "com_sun_star_animations_Audio_get_implementation",
287 "com_sun_star_animations_Command_get_implementation",
288 "com_sun_star_animations_IterateContainer_get_implementation",
289 "com_sun_star_animations_ParallelTimeContainer_get_implementation",
290 "com_sun_star_animations_SequenceTimeContainer_get_implementation",
291 "com_sun_star_animations_TransitionFilter_get_implementation",
292 # sd/util/sd.component
293 "RandomAnimationNode_get_implementation",
294 "com_sun_star_comp_Draw_framework_BasicPaneFactory_get_implementation",
295 "com_sun_star_comp_Draw_framework_BasicToolBarFactory_get_implementation",
296 "com_sun_star_comp_Draw_framework_BasicViewFactory_get_implementation",
297 "com_sun_star_comp_Draw_framework_PresentationFactoryProvider_get_implementation",
298 "com_sun_star_comp_Draw_framework_ResourceID_get_implementation",
299 "com_sun_star_comp_Draw_framework_configuration_ConfigurationController_get_implementation",
300 "com_sun_star_comp_Draw_framework_module_ModuleController_get_implementation",
301 # sd/util/sdd.component
302 "com_sun_star_comp_draw_FormatDetector_get_implementation",
305 writer_factory_list = [
306 ("libswlo.a", "sw_component_getFactory"),
309 writer_constructor_list = [
310 # basic/util/sb.component
311 ("com_sun_star_comp_sfx2_ScriptLibraryContainer_get_implementation", "#if HAVE_FEATURE_SCRIPTING"),
312 # filter/source/textfilterdetect/textfd.component
313 "com_sun_star_comp_filters_PlainTextFilterDetect_get_implementation",
314 # sw/util/sw.component
315 "com_sun_star_comp_Writer_XMLOasisContentImporter_get_implementation",
316 "com_sun_star_comp_Writer_XMLOasisImporter_get_implementation",
317 "com_sun_star_comp_Writer_XMLOasisMetaImporter_get_implementation",
318 "com_sun_star_comp_Writer_XMLOasisSettingsImporter_get_implementation",
319 "com_sun_star_comp_Writer_XMLOasisStylesImporter_get_implementation",
320 "com_sun_star_util_comp_FinalThreadManager_get_implementation",
321 # sw/util/swd.component
322 "com_sun_star_comp_writer_FormatDetector_get_implementation",
323 # writerfilter/util/writerfilter.component
324 "com_sun_star_comp_Writer_RtfFilter_get_implementation",
325 "com_sun_star_comp_Writer_WriterFilter_get_implementation",
328 factory_map = {
329 'core' : core_factory_list,
330 'edit' : edit_factory_list,
331 'calc' : calc_factory_list,
332 'draw' : draw_factory_list,
333 'writer' : writer_factory_list,
336 constructor_map = {
337 'core' : core_constructor_list,
338 'edit' : edit_constructor_list,
339 'calc' : calc_constructor_list,
340 'draw' : draw_constructor_list,
341 'writer' : writer_constructor_list,
344 def get_constructor_guard(constructor):
345 if type(full_constructor_map[constructor]) is bool:
346 return None
347 else:
348 return full_constructor_map[constructor]
350 # instead of outputting native-code.cxx, reduce the services.rdb according to
351 # the constraints, so that we can easily emulate what services do we need to
352 # add for a fully functional file loading / saving / ...
353 def limit_rdb(services_rdb, full_factory_map, full_constructor_map):
354 ET.register_namespace('','http://openoffice.org/2010/uno-components')
355 tree = ET.parse(services_rdb[0])
356 root = tree.getroot()
358 for component in root.findall('{http://openoffice.org/2010/uno-components}component'):
359 # direct
360 uri = component.get('uri')
361 component_name = None
362 if uri != None:
363 component_name = re.sub('^vnd.sun.star.expand:\$LO_LIB_DIR/([^.]*).so$', '\\1.a', uri)
364 if component_name in full_factory_map:
365 continue
367 # via a constructor - limit only to those we have
368 has_constructor = False
369 for implementation in component.findall('{http://openoffice.org/2010/uno-components}implementation'):
370 constructor = implementation.get('constructor')
371 if constructor in full_constructor_map:
372 has_constructor = True
373 else:
374 component.remove(implementation)
376 if not has_constructor:
377 root.remove(component)
379 tree.write(services_rdb[0] + '.out', xml_declaration = True, method = 'xml')
382 # do the actual work
383 opts = OptionParser()
384 opts.add_option("-j", "--java-guard", action="store_true", help="include external java functions", dest="java", default=False)
385 opts.add_option("-g", "--group", action="append", help="group of implementations to make available in application", dest="groups")
386 opts.add_option("-r", "--limit-rdb", action="append", help="instead of outputting native-code.cxx, limit the services.rdb only to the services defined by the groups", dest="services")
388 (options, args) = opts.parse_args()
390 # dict of all the contructors that we need according to -g's
391 full_constructor_map = {}
392 if options.groups:
393 for constructor_group in options.groups:
394 for constructor in constructor_map[constructor_group]:
395 if type(constructor) is tuple:
396 full_constructor_map[constructor[0]] = constructor[1]
397 else:
398 full_constructor_map[constructor] = True
400 # dict of all the factories that we need according to -g's
401 full_factory_map = {}
402 if options.groups:
403 for factory_group in options.groups:
404 for entry in factory_map[factory_group]:
405 factory_guard = None
406 if len(entry) > 2:
407 factory_guard = entry[2]
408 map_entry = { 'function': entry[1], 'guard': factory_guard }
409 full_factory_map[entry[0]] = map_entry
411 # are we only shuffling the services.rdb?
412 if options.services:
413 limit_rdb(options.services, full_factory_map, full_constructor_map)
414 exit(0)
416 print ("""/*
417 * This is a generated file. Do not edit.
419 * File generated by solenv/bin/native-code.py
422 #include <config_features.h>
423 #include <osl/detail/component-mapping.h>
425 extern "C" {
426 """)
428 for entry in sorted(full_factory_map.keys()):
429 factory_function = full_factory_map[entry]['function']
430 factory_guard = full_factory_map[entry]['guard']
431 if factory_guard:
432 print (factory_guard)
433 print('void * ' + factory_function + '( const char* , void* , void* );')
434 if factory_guard:
435 print ('#endif')
437 print ('')
438 for constructor in sorted(full_constructor_map.keys()):
439 constructor_guard = get_constructor_guard(constructor)
440 if constructor_guard:
441 print (constructor_guard)
442 print ('void * '+constructor+'( void *, void * );')
443 if constructor_guard:
444 print ('#endif')
446 print ("""
447 const lib_to_factory_mapping *
448 lo_get_factory_map(void)
450 static lib_to_factory_mapping map[] = {""")
452 for entry in sorted(full_factory_map.keys()):
453 factory_function = full_factory_map[entry]['function']
454 factory_guard = full_factory_map[entry]['guard']
455 if factory_guard:
456 print (factory_guard)
457 print(' { "' + entry + '", ' + factory_function + ' },')
458 if factory_guard:
459 print ('#endif')
461 print ("""
462 { 0, 0 }
463 };""")
465 if options.java:
466 print ("""
467 // Guard against possible function-level link-time pruning of
468 // "unused" code. We need to pull these in, too, as they aren't in
469 // any of the libs we link with -Wl,--whole-archive. Is this necessary?
470 extern void Java_org_libreoffice_android_AppSupport_runMain();
471 volatile void *p = (void *) Java_org_libreoffice_android_AppSupport_runMain;
473 extern void Java_org_libreoffice_android_AppSupport_renderVCL();
474 p = (void *) Java_org_libreoffice_android_AppSupport_renderVCL;
476 extern void Java_org_libreoffice_kit_LibreOfficeKit_initializeNative();
477 p = (void *) Java_org_libreoffice_kit_LibreOfficeKit_initializeNative;
479 extern void Java_org_libreoffice_kit_Office_getError();
480 p = (void *) Java_org_libreoffice_kit_Office_getError;
482 """)
484 print ("""
485 return map;
488 const lib_to_constructor_mapping *
489 lo_get_constructor_map(void)
491 static lib_to_constructor_mapping map[] = {""")
493 for constructor in sorted(full_constructor_map.keys()):
494 constructor_guard = get_constructor_guard(constructor)
495 if constructor_guard:
496 print (constructor_guard)
497 print (' { "' +constructor+ '", ' +constructor+ ' },')
498 if constructor_guard:
499 print ('#endif')
501 print ("""
502 { 0, 0 }
505 return map;
508 }""")
510 # vim:set shiftwidth=4 softtabstop=4 expandtab: