Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / solenv / bin / native-code.py
blobb7481c15baa84128f4186ceea92f634a93ad063e
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 ("libcomphelper.a", "comphelp_component_getFactory"),
27 ("libconfigmgrlo.a", "configmgr_component_getFactory"),
28 ("libdrawinglayerlo.a", "drawinglayer_component_getFactory"),
29 ("libemfiolo.a", "emfio_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 ("libsrtrs1.a", "srtrs1_component_getFactory"),
43 ("libstoragefdlo.a", "storagefd_component_getFactory"),
44 ("libucb1.a", "ucb_component_getFactory"),
45 ("libucpfile1.a", "ucpfile_component_getFactory"),
46 ("libucphier1.a", "ucphier1_component_getFactory"),
47 ("libucptdoc1lo.a", "ucptdoc1_component_getFactory"),
48 ("libunordflo.a", "unordf_component_getFactory"),
49 ("libunoxmllo.a", "unoxml_component_getFactory"),
50 ("libutllo.a", "utl_component_getFactory"),
51 ("libxoflo.a", "xof_component_getFactory"),
52 ("libxolo.a", "xo_component_getFactory"),
53 ("libxsec_xmlsec.a", "xsec_xmlsec_component_getFactory", "#if HAVE_FEATURE_NSS"),
54 ("libxstor.a", "xstor_component_getFactory"),
55 ("libvclcanvaslo.a", "vclcanvas_component_getFactory"),
56 ("libmtfrendererlo.a", "mtfrenderer_component_getFactory"),
57 ("libxmlfdlo.a", "xmlfd_component_getFactory"),
58 ("libxmlfalo.a", "xmlfa_component_getFactory"),
59 ("libodfflatxmllo.a", "odfflatxml_component_getFactory"),
60 ("libxmlscriptlo.a", "xmlscript_component_getFactory"),
61 ("libmcnttype.a", "mcnttype_component_getFactory"),
62 ("libvcllo.a", "vcl_component_getFactory"),
63 ("libspelllo.a", "spell_component_getFactory"),
64 ("libsvgiolo.a", "svgio_component_getFactory")
67 core_constructor_list = [
68 # canvas/source/factory/canvasfactory.component
69 "com_sun_star_comp_rendering_CanvasFactory_get_implementation",
70 # chart2/source/chartcore.component
71 "com_sun_star_chart2_LinearScaling_get_implementation",
72 "com_sun_star_comp_chart_AreaChartType_get_implementation",
73 "com_sun_star_comp_chart_BarChartType_get_implementation",
74 "com_sun_star_comp_chart_BubbleChartType_get_implementation",
75 "com_sun_star_comp_chart_CandleStickChartType_get_implementation",
76 "com_sun_star_comp_chart_ChartTypeManager_get_implementation",
77 "com_sun_star_comp_chart_ColumnChartType_get_implementation",
78 "com_sun_star_comp_chart_DataSeries_get_implementation",
79 "com_sun_star_comp_chart_DataSource_get_implementation",
80 "com_sun_star_comp_chart_FilledNetChartType_get_implementation",
81 "com_sun_star_comp_chart_GL3DBarChartType_get_implementation",
82 "com_sun_star_comp_chart_FormattedString_get_implementation",
83 "com_sun_star_comp_chart_LineChartType_get_implementation",
84 "com_sun_star_comp_chart_NetChartType_get_implementation",
85 "com_sun_star_comp_chart_PieChartType_get_implementation",
86 "com_sun_star_comp_chart_ScatterChartType_get_implementation",
87 "com_sun_star_comp_chart2_Axis_get_implementation",
88 "com_sun_star_comp_chart2_ChartController_get_implementation",
89 "com_sun_star_comp_chart2_ChartDocumentWrapper_get_implementation",
90 "com_sun_star_comp_chart2_ChartModel_get_implementation",
91 "com_sun_star_comp_chart2_Diagram_get_implementation",
92 "com_sun_star_comp_chart2_ErrorBar_get_implementation",
93 "com_sun_star_comp_chart2_LabeledDataSequence_get_implementation",
94 "com_sun_star_comp_chart2_Legend_get_implementation",
95 "com_sun_star_comp_chart2_LinearRegressionCurve_get_implementation",
96 "com_sun_star_comp_chart2_PolarCoordinateSystem2d_get_implementation",
97 "com_sun_star_comp_chart2_PolarCoordinateSystem3d_get_implementation",
98 "com_sun_star_comp_chart2_PolynomialRegressionCurve_get_implementation",
99 "com_sun_star_comp_chart2_PotentialRegressionCurve_get_implementation",
100 "com_sun_star_comp_chart2_RegressionEquation_get_implementation",
101 "com_sun_star_comp_chart2_Title_get_implementation",
102 "com_sun_star_comp_chart2_XMLFilter_get_implementation",
103 # chart2/source/controller/chartcontroller.component
104 "com_sun_star_comp_chart2_ChartDocumentWrapper_get_implementation",
105 "com_sun_star_comp_chart2_ChartFrameLoader_get_implementation",
106 # comphelper/util/comphelp.component
107 "com_sun_star_comp_MemoryStream",
108 "com_sun_star_comp_task_OfficeRestartManager",
109 "IndexedPropertyValuesContainer_get_implementation",
110 "NamedPropertyValuesContainer_get_implementation",
111 "com_sun_star_comp_comphelper_OPropertyBag",
112 "com_sun_star_comp_SequenceInputStreamService",
113 "com_sun_star_comp_SequenceOutputStreamService",
114 # dbaccess/util/dba.component
115 ("com_sun_star_comp_dba_ORowSet_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
116 # forms/util/frm.component
117 ("com_sun_star_comp_forms_FormOperations_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
118 ("com_sun_star_comp_forms_ODatabaseForm_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
119 ("com_sun_star_comp_forms_OFormattedFieldWrapper_ForcedFormatted_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
120 ("com_sun_star_comp_forms_ORichTextModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
121 ("com_sun_star_comp_forms_OScrollBarModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
122 ("com_sun_star_comp_forms_OSpinButtonModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
123 ("com_sun_star_form_Model_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
124 ("com_sun_star_form_OButtonControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
125 ("com_sun_star_form_OButtonModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
126 ("com_sun_star_form_OCheckBoxControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
127 ("com_sun_star_form_OCheckBoxModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
128 ("com_sun_star_form_OComboBoxControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
129 ("com_sun_star_form_OComboBoxModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
130 ("com_sun_star_form_ODateControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
131 ("com_sun_star_form_ODateModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
132 ("com_sun_star_form_OEditControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
133 ("com_sun_star_form_OEditModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
134 ("com_sun_star_form_OFixedTextModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
135 ("com_sun_star_form_OFormsCollection_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
136 ("com_sun_star_form_OGridControlModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
137 ("com_sun_star_form_OGroupBoxModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
138 ("com_sun_star_form_OListBoxModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
139 ("com_sun_star_form_ONumericModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
140 ("com_sun_star_form_ORadioButtonModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
141 ("com_sun_star_form_XForms_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
142 # framework/util/fwk.component
143 "com_sun_star_comp_framework_AutoRecovery_get_implementation",
144 "com_sun_star_comp_framework_Desktop_get_implementation",
145 "com_sun_star_comp_framework_DocumentAcceleratorConfiguration_get_implementation",
146 "com_sun_star_comp_framework_Frame_get_implementation",
147 "com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation",
148 "com_sun_star_comp_framework_JobExecutor_get_implementation",
149 "com_sun_star_comp_framework_LayoutManager_get_implementation",
150 "com_sun_star_comp_framework_ModuleManager_get_implementation",
151 "com_sun_star_comp_framework_ModuleUIConfigurationManager_get_implementation",
152 "com_sun_star_comp_framework_ModuleUIConfigurationManagerSupplier_get_implementation",
153 "com_sun_star_comp_framework_PathSettings_get_implementation",
154 "com_sun_star_comp_framework_PathSubstitution_get_implementation",
155 "com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation",
156 "com_sun_star_comp_framework_TaskCreator_get_implementation",
157 "com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation",
158 "com_sun_star_comp_framework_UIConfigurationManager_get_implementation",
159 "com_sun_star_comp_framework_UIElementFactoryManager_get_implementation",
160 "com_sun_star_comp_framework_URLTransformer_get_implementation",
161 "com_sun_star_comp_framework_WindowStateConfiguration_get_implementation",
162 "com_sun_star_comp_framework_ModuleAcceleratorConfiguration_get_implementation",
163 "org_apache_openoffice_comp_framework_ContextChangeEventMultiplexer_get_implementation",
164 # i18npool/util/i18npool.component
165 "com_sun_star_i18n_BreakIterator_get_implementation",
166 "com_sun_star_i18n_BreakIterator_Unicode_get_implementation",
167 "com_sun_star_i18n_CharacterClassification_get_implementation",
168 "com_sun_star_i18n_CharacterClassification_Unicode_get_implementation",
169 "com_sun_star_i18n_Collator_get_implementation",
170 "com_sun_star_i18n_LocaleDataImpl_get_implementation",
171 "com_sun_star_i18n_NativeNumberSupplier_get_implementation",
172 "com_sun_star_i18n_NumberFormatCodeMapper_get_implementation",
173 "com_sun_star_i18n_Transliteration_get_implementation",
174 "com_sun_star_i18n_Transliteration_IGNORE_CASE_get_implementation",
175 "com_sun_star_i18n_Transliteration_IGNORE_KANA_get_implementation",
176 "com_sun_star_i18n_Transliteration_IGNORE_WIDTH_get_implementation",
177 "com_sun_star_text_DefaultNumberingProvider_get_implementation",
178 # sax/source/expatwrap/expwrap.component
179 "com_sun_star_comp_extensions_xml_sax_FastParser_get_implementation",
180 "com_sun_star_comp_extensions_xml_sax_ParserExpat_get_implementation",
181 "com_sun_star_extensions_xml_sax_Writer_get_implementation",
182 # sfx2/util/sfx.component
183 "SfxDocumentMetaData_get_implementation",
184 "com_sun_star_comp_office_FrameLoader_get_implementation",
185 "com_sun_star_comp_sfx2_AppDispatchProvider_get_implementation",
186 "com_sun_star_comp_sfx2_DocumentTemplates_get_implementation",
187 "com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation",
188 # sot/util/sot.component
189 "com_sun_star_comp_embed_OLESimpleStorage",
190 # stoc/source/inspect/introspection.component
191 "com_sun_star_comp_stoc_Introspection_get_implementation",
192 # stoc/source/corereflection/reflection.component
193 "com_sun_star_comp_stoc_CoreReflection_get_implementation",
194 # stoc/util/stocservices.component
195 "com_sun_star_comp_stoc_OServiceManagerWrapper_get_implementation",
196 "com_sun_star_comp_stoc_TypeConverter_get_implementation",
197 "com_sun_star_comp_uri_ExternalUriReferenceTranslator_get_implementation",
198 "com_sun_star_comp_uri_UriReferenceFactory_get_implementation",
199 "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTexpand_get_implementation",
200 "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTscript_get_implementation",
201 # vcl/vcl.android.component
202 "com_sun_star_graphic_GraphicObject_get_implementation",
203 "com_sun_star_comp_graphic_GraphicProvider_get_implementation",
204 # svx/util/svx.component
205 "com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation",
206 "com_sun_star_drawing_SvxShapeCollection_get_implementation",
207 # svx/util/svxcore.component
208 "com_sun_star_comp_graphic_PrimitiveFactory2D_get_implementation",
209 "com_sun_star_comp_Draw_GraphicExporter_get_implementation",
210 "com_sun_star_comp_Svx_GraphicExportHelper_get_implementation",
211 "com_sun_star_comp_Svx_GraphicImportHelper_get_implementation",
212 # toolkit/util/tk.component
213 "stardiv_Toolkit_StdTabController_get_implementation",
214 "stardiv_Toolkit_UnoButtonControl_get_implementation",
215 "stardiv_Toolkit_UnoCheckBoxControl_get_implementation",
216 "stardiv_Toolkit_UnoComboBoxControl_get_implementation",
217 "stardiv_Toolkit_UnoControlButtonModel_get_implementation",
218 "stardiv_Toolkit_UnoControlCheckBoxModel_get_implementation",
219 "stardiv_Toolkit_UnoControlComboBoxModel_get_implementation",
220 "stardiv_Toolkit_UnoControlContainer_get_implementation",
221 "stardiv_Toolkit_UnoControlContainerModel_get_implementation",
222 "stardiv_Toolkit_UnoControlDateFieldModel_get_implementation",
223 "stardiv_Toolkit_UnoControlDialogModel_get_implementation",
224 "stardiv_Toolkit_UnoControlFixedTextModel_get_implementation",
225 "stardiv_Toolkit_UnoControlFormattedFieldModel_get_implementation",
226 "stardiv_Toolkit_UnoControlGroupBoxModel_get_implementation",
227 "stardiv_Toolkit_UnoControlListBoxModel_get_implementation",
228 "stardiv_Toolkit_UnoControlNumericFieldModel_get_implementation",
229 "stardiv_Toolkit_UnoControlRadioButtonModel_get_implementation",
230 "stardiv_Toolkit_UnoControlScrollBarModel_get_implementation",
231 "stardiv_Toolkit_UnoDateFieldControl_get_implementation",
232 "stardiv_Toolkit_UnoSpinButtonModel_get_implementation",
233 "stardiv_Toolkit_VCLXPointer_get_implementation",
234 "stardiv_Toolkit_VCLXToolkit_get_implementation",
235 # uui/util/uui.component
236 "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation",
237 # xmloff/util/xo.component
238 "XMLVersionListPersistence_get_implementation",
239 # xmlscript/util/xmlscript.component
240 "com_sun_star_comp_xmlscript_XMLBasicExporter",
241 "com_sun_star_comp_xmlscript_XMLBasicImporter",
242 "com_sun_star_comp_xmlscript_XMLOasisBasicExporter",
243 "com_sun_star_comp_xmlscript_XMLOasisBasicImporter",
244 # xmlsecurity/util/xmlsecurity.component
245 ("com_sun_star_security_CertificateContainer_get_implementation", "#if HAVE_FEATURE_NSS"),
246 ("com_sun_star_security_DocumentDigitalSignatures_get_implementation", "#if HAVE_FEATURE_NSS"),
249 # edit group for apps, where you can edit documents
250 edit_factory_list = [
253 edit_constructor_list = [
254 # framework/util/fwk.component
255 "com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation",
256 # i18npool/util/i18npool.component
257 "com_sun_star_i18n_InputSequenceChecker_get_implementation",
258 "com_sun_star_i18n_OrdinalSuffix_get_implementation",
259 # sc/util/sc.component
260 "Calc_XMLOasisContentExporter_get_implementation",
261 "Calc_XMLOasisExporter_get_implementation",
262 "Calc_XMLOasisMetaExporter_get_implementation",
263 "Calc_XMLOasisSettingsExporter_get_implementation",
264 "Calc_XMLOasisStylesExporter_get_implementation",
265 # starmath/util/sm.component
266 "Math_XMLOasisMetaExporter_get_implementation",
267 "Math_XMLOasisSettingsExporter_get_implementation",
268 # sw/util/sw.component
269 "com_sun_star_comp_Writer_XMLOasisContentExporter_get_implementation",
270 "com_sun_star_comp_Writer_XMLOasisMetaExporter_get_implementation",
271 "com_sun_star_comp_Writer_XMLOasisSettingsExporter_get_implementation",
272 "com_sun_star_comp_Writer_XMLOasisStylesExporter_get_implementation",
275 # math
276 math_factory_list = [
279 math_constructor_list = [
280 # starmath/util/sm.component
281 "Math_XMLOasisMetaExporter_get_implementation",
282 "Math_XMLOasisSettingsExporter_get_implementation",
285 calc_factory_list = [
286 ("libsclo.a", "sc_component_getFactory"),
287 ("libanalysislo.a", "analysis_component_getFactory"),
288 ("libdatelo.a", "date_component_getFactory"),
289 ("libpricinglo.a", "pricing_component_getFactory"),
292 calc_constructor_list = [
293 # avmedia/util/avmedia.component
294 "com_sun_star_comp_framework_SoundHandler_get_implementation",
295 # sc/util/scd.component
296 "com_sun_star_comp_calc_ExcelBiffFormatDetector_get_implementation",
297 "com_sun_star_comp_calc_FormatDetector_get_implementation",
298 # sc/util/scfilt.component
299 "com_sun_star_comp_oox_xls_ExcelFilter_get_implementation",
300 "com_sun_star_comp_oox_xls_FormulaParser_get_implementation",
301 # scripting/source/vbaevents/vbaevents.component
302 ("ooo_vba_VBAToOOEventDesc_get_implementation", "#if HAVE_FEATURE_SCRIPTING"),
303 # svl/util/svl.component
304 "com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation",
305 "com_sun_star_uno_util_numbers_SvNumberFormatterServiceObject_get_implementation",
308 draw_factory_list = [
309 ("libsdlo.a", "sd_component_getFactory"),
310 ("libsvgfilterlo.a", "svgfilter_component_getFactory"),
311 ("libdeployment.a", "deployment_component_getFactory"),
312 ("libemboleobj.a", "emboleobj_component_getFactory"),
315 draw_constructor_list = [
316 # animations/source/animcore/animcore.component
317 "com_sun_star_animations_AnimateColor_get_implementation",
318 "com_sun_star_animations_AnimateMotion_get_implementation",
319 "com_sun_star_animations_AnimateSet_get_implementation",
320 "com_sun_star_animations_AnimateTransform_get_implementation",
321 "com_sun_star_animations_Animate_get_implementation",
322 "com_sun_star_animations_Audio_get_implementation",
323 "com_sun_star_animations_Command_get_implementation",
324 "com_sun_star_animations_IterateContainer_get_implementation",
325 "com_sun_star_animations_ParallelTimeContainer_get_implementation",
326 "com_sun_star_animations_SequenceTimeContainer_get_implementation",
327 "com_sun_star_animations_TransitionFilter_get_implementation",
328 # sd/util/sd.component
329 "RandomAnimationNode_get_implementation",
330 "com_sun_star_comp_Draw_framework_BasicPaneFactory_get_implementation",
331 "com_sun_star_comp_Draw_framework_BasicToolBarFactory_get_implementation",
332 "com_sun_star_comp_Draw_framework_BasicViewFactory_get_implementation",
333 "com_sun_star_comp_Draw_framework_PresentationFactoryProvider_get_implementation",
334 "com_sun_star_comp_Draw_framework_ResourceID_get_implementation",
335 "com_sun_star_comp_Draw_framework_configuration_ConfigurationController_get_implementation",
336 "com_sun_star_comp_Draw_framework_module_ModuleController_get_implementation",
337 # sd/util/sdd.component
338 "com_sun_star_comp_draw_FormatDetector_get_implementation",
341 writer_factory_list = [
342 ("libswlo.a", "sw_component_getFactory"),
345 writer_constructor_list = [
346 # basic/util/sb.component
347 ("com_sun_star_comp_sfx2_ScriptLibraryContainer_get_implementation", "#if HAVE_FEATURE_SCRIPTING"),
348 # filter/source/textfilterdetect/textfd.component
349 "com_sun_star_comp_filters_PlainTextFilterDetect_get_implementation",
350 # sw/util/sw.component
351 "com_sun_star_comp_Writer_XMLOasisContentImporter_get_implementation",
352 "com_sun_star_comp_Writer_XMLOasisImporter_get_implementation",
353 "com_sun_star_comp_Writer_XMLOasisMetaImporter_get_implementation",
354 "com_sun_star_comp_Writer_XMLOasisSettingsImporter_get_implementation",
355 "com_sun_star_comp_Writer_XMLOasisStylesImporter_get_implementation",
356 "com_sun_star_util_comp_FinalThreadManager_get_implementation",
357 # sw/util/swd.component
358 "com_sun_star_comp_writer_FormatDetector_get_implementation",
359 # writerfilter/util/writerfilter.component
360 "com_sun_star_comp_Writer_RtfFilter_get_implementation",
361 "com_sun_star_comp_Writer_WriterFilter_get_implementation",
364 factory_map = {
365 'core' : core_factory_list,
366 'edit' : edit_factory_list,
367 'math' : math_factory_list,
368 'calc' : calc_factory_list,
369 'draw' : draw_factory_list,
370 'writer' : writer_factory_list,
373 constructor_map = {
374 'core' : core_constructor_list,
375 'edit' : edit_constructor_list,
376 'math' : math_constructor_list,
377 'calc' : calc_constructor_list,
378 'draw' : draw_constructor_list,
379 'writer' : writer_constructor_list,
382 def get_constructor_guard(constructor):
383 if type(full_constructor_map[constructor]) is bool:
384 return None
385 else:
386 return full_constructor_map[constructor]
388 # instead of outputting native-code.cxx, reduce the services.rdb according to
389 # the constraints, so that we can easily emulate what services do we need to
390 # add for a fully functional file loading / saving / ...
391 def limit_rdb(services_rdb, full_factory_map, full_constructor_map):
392 ET.register_namespace('','http://openoffice.org/2010/uno-components')
393 tree = ET.parse(services_rdb[0])
394 root = tree.getroot()
396 for component in root.findall('{http://openoffice.org/2010/uno-components}component'):
397 # direct
398 uri = component.get('uri')
399 component_name = None
400 if uri != None:
401 component_name = re.sub('^vnd.sun.star.expand:\$LO_LIB_DIR/([^.]*).so$', '\\1.a', uri)
402 if component_name in full_factory_map:
403 continue
405 # via a constructor - limit only to those we have
406 has_constructor = False
407 for implementation in component.findall('{http://openoffice.org/2010/uno-components}implementation'):
408 constructor = implementation.get('constructor')
409 if constructor in full_constructor_map:
410 has_constructor = True
411 else:
412 component.remove(implementation)
414 if not has_constructor:
415 root.remove(component)
417 tree.write(services_rdb[0] + '.out', xml_declaration = True, method = 'xml')
420 # do the actual work
421 opts = OptionParser()
422 opts.add_option("-j", "--java-guard", action="store_true", help="include external java functions", dest="java", default=False)
423 opts.add_option("-g", "--group", action="append", help="group of implementations to make available in application", dest="groups")
424 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")
425 opts.add_option("-C", "--pure-c", action="store_true", help="do not print extern \"C\"", dest="pure_c", default=False)
427 (options, args) = opts.parse_args()
429 # dict of all the constructors that we need according to -g's
430 full_constructor_map = {}
431 if options.groups:
432 for constructor_group in options.groups:
433 for constructor in constructor_map[constructor_group]:
434 if type(constructor) is tuple:
435 full_constructor_map[constructor[0]] = constructor[1]
436 else:
437 full_constructor_map[constructor] = True
439 # dict of all the factories that we need according to -g's
440 full_factory_map = {}
441 if options.groups:
442 for factory_group in options.groups:
443 for entry in factory_map[factory_group]:
444 factory_guard = None
445 if len(entry) > 2:
446 factory_guard = entry[2]
447 map_entry = { 'function': entry[1], 'guard': factory_guard }
448 full_factory_map[entry[0]] = map_entry
450 # are we only shuffling the services.rdb?
451 if options.services:
452 limit_rdb(options.services, full_factory_map, full_constructor_map)
453 exit(0)
455 print ("""/*
456 * This is a generated file. Do not edit.
458 * File generated by solenv/bin/native-code.py
461 #include <config_features.h>
462 #include <osl/detail/component-mapping.h>
464 """)
465 if not options.pure_c:
466 print ("""extern "C" {""")
468 for entry in sorted(full_factory_map.keys()):
469 factory_function = full_factory_map[entry]['function']
470 factory_guard = full_factory_map[entry]['guard']
471 if factory_guard:
472 print (factory_guard)
473 print('void * ' + factory_function + '( const char* , void* , void* );')
474 if factory_guard:
475 print ('#endif')
477 print ('')
478 for constructor in sorted(full_constructor_map.keys()):
479 constructor_guard = get_constructor_guard(constructor)
480 if constructor_guard:
481 print (constructor_guard)
482 print ('void * '+constructor+'( void *, void * );')
483 if constructor_guard:
484 print ('#endif')
486 print ("""
487 const lib_to_factory_mapping *
488 lo_get_factory_map(void)
490 static lib_to_factory_mapping map[] = {""")
492 for entry in sorted(full_factory_map.keys()):
493 factory_function = full_factory_map[entry]['function']
494 factory_guard = full_factory_map[entry]['guard']
495 if factory_guard:
496 print (factory_guard)
497 print(' { "' + entry + '", ' + factory_function + ' },')
498 if factory_guard:
499 print ('#endif')
501 print ("""
502 { 0, 0 }
503 };""")
505 if options.java:
506 print ("""
507 extern void Java_org_libreoffice_kit_LibreOfficeKit_initializeNative();
508 volatile void *p = (void *) Java_org_libreoffice_kit_LibreOfficeKit_initializeNative;
510 extern void Java_org_libreoffice_kit_Office_getError();
511 p = (void *) Java_org_libreoffice_kit_Office_getError;
513 """)
515 print ("""
516 return map;
519 const lib_to_constructor_mapping *
520 lo_get_constructor_map(void)
522 static lib_to_constructor_mapping map[] = {""")
524 for constructor in sorted(full_constructor_map.keys()):
525 constructor_guard = get_constructor_guard(constructor)
526 if constructor_guard:
527 print (constructor_guard)
528 print (' { "' +constructor+ '", ' +constructor+ ' },')
529 if constructor_guard:
530 print ('#endif')
532 print ("""
533 { 0, 0 }
536 return map;
539 """)
540 if not options.pure_c:
541 print("""}""")
543 # vim:set shiftwidth=4 softtabstop=4 expandtab: