bump product version to 6.4.0.3
[LibreOffice.git] / solenv / bin / native-code.py
blob09b4b50712afc09599eb6722b3c706bfb83adfcd
1 #!/usr/bin/python3
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 optparse import OptionParser
10 import re
11 import sys
12 import xml.etree.ElementTree as ET
14 # foo_component_getFactory functions are split into groups, so that you could
15 # choose e.g. 'core' and 'writer' functionality and through factory_map,
16 # relevant function sections will be referenced in lo_get_factory_map().
17 # That prevents garbage collector to ignore them as unused.
19 # The same groups are used for constructor based implementations
20 # referenced in lo_get_constructor_map().
22 core_factory_list = [
23 ("libembobj.a", "embobj_component_getFactory"),
24 ("libevtattlo.a", "evtatt_component_getFactory"),
25 ("libcomphelper.a", "comphelp_component_getFactory"),
26 ("libconfigmgrlo.a", "configmgr_component_getFactory"),
27 ("libdrawinglayerlo.a", "drawinglayer_component_getFactory"),
28 ("libemfiolo.a", "emfio_component_getFactory"),
29 ("libfilterconfiglo.a", "filterconfig1_component_getFactory"),
30 ("libfsstoragelo.a", "fsstorage_component_getFactory"),
31 ("libhyphenlo.a", "hyphen_component_getFactory"),
32 ("libi18npoollo.a", "i18npool_component_getFactory"),
33 ("libi18nsearchlo.a", "i18nsearch_component_getFactory"),
34 ("libinvocadaptlo.a", "invocadapt_component_getFactory"),
35 ("liblnglo.a", "lng_component_getFactory"),
36 ("liblnthlo.a", "lnth_component_getFactory"),
37 ("liblocalebe1lo.a", "localebe1_component_getFactory"),
38 ("libpackage2.a", "package2_component_getFactory"),
39 ("libsmlo.a", "sm_component_getFactory"),
40 ("libsrtrs1.a", "srtrs1_component_getFactory"),
41 ("libstoragefdlo.a", "storagefd_component_getFactory"),
42 ("libucb1.a", "ucb_component_getFactory"),
43 ("libucpfile1.a", "ucpfile_component_getFactory"),
44 ("libucphier1.a", "ucphier1_component_getFactory"),
45 ("libucptdoc1lo.a", "ucptdoc1_component_getFactory"),
46 ("libunordflo.a", "unordf_component_getFactory"),
47 ("libunoxmllo.a", "unoxml_component_getFactory"),
48 ("libutllo.a", "utl_component_getFactory"),
49 ("libxoflo.a", "xof_component_getFactory"),
50 ("libxolo.a", "xo_component_getFactory"),
51 ("libxstor.a", "xstor_component_getFactory"),
52 ("libvclcanvaslo.a", "vclcanvas_component_getFactory"),
53 ("libmtfrendererlo.a", "mtfrenderer_component_getFactory"),
54 ("libxmlfdlo.a", "xmlfd_component_getFactory"),
55 ("libxmlfalo.a", "xmlfa_component_getFactory"),
56 ("libodfflatxmllo.a", "odfflatxml_component_getFactory"),
57 ("libxmlscriptlo.a", "xmlscript_component_getFactory"),
58 ("libmcnttype.a", "mcnttype_component_getFactory"),
59 ("libvcllo.a", "vcl_component_getFactory"),
60 ("libspelllo.a", "spell_component_getFactory"),
61 ("libpdffilterlo.a", "pdffilter_component_getFactory"),
62 ("libsvgiolo.a", "svgio_component_getFactory"),
63 ("libsvtlo.a", "svt_component_getFactory"),
64 ("libctllo.a", "ctl_component_getFactory"),
65 ("libMacOSXSpelllo.a", "MacOSXSpell_component_getFactory", "#ifdef IOS"),
66 ("libcuilo.a", "cui_component_getFactory"),
67 ("libproxyfaclo.a", "proxyfac_component_getFactory"),
68 ("libguesslanglo.a", "guesslang_component_getFactory"),
71 core_constructor_list = [
72 # canvas/source/factory/canvasfactory.component
73 "com_sun_star_comp_rendering_CanvasFactory_get_implementation",
74 # chart2/source/chartcore.component
75 "com_sun_star_chart2_ExponentialScaling_get_implementation",
76 "com_sun_star_chart2_LinearScaling_get_implementation",
77 "com_sun_star_chart2_LogarithmicScaling_get_implementation",
78 "com_sun_star_chart2_PowerScaling_get_implementation",
79 "com_sun_star_comp_chart_AreaChartType_get_implementation",
80 "com_sun_star_comp_chart_BarChartType_get_implementation",
81 "com_sun_star_comp_chart_BubbleChartType_get_implementation",
82 "com_sun_star_comp_chart_CachedDataSequence_get_implementation",
83 "com_sun_star_comp_chart_CandleStickChartType_get_implementation",
84 "com_sun_star_comp_chart_ChartTypeManager_get_implementation",
85 "com_sun_star_comp_chart_ColumnChartType_get_implementation",
86 "com_sun_star_comp_chart_DataSeries_get_implementation",
87 "com_sun_star_comp_chart_DataSource_get_implementation",
88 "com_sun_star_comp_chart_FilledNetChartType_get_implementation",
89 "com_sun_star_comp_chart_FormattedString_get_implementation",
90 "com_sun_star_comp_chart_InternalDataProvider_get_implementation",
91 "com_sun_star_comp_chart_LineChartType_get_implementation",
92 "com_sun_star_comp_chart_NetChartType_get_implementation",
93 "com_sun_star_comp_chart_PieChartType_get_implementation",
94 "com_sun_star_comp_chart_ScatterChartType_get_implementation",
95 "com_sun_star_comp_chart2_Axis_get_implementation",
96 "com_sun_star_comp_chart2_CartesianCoordinateSystem2d_get_implementation",
97 "com_sun_star_comp_chart2_CartesianCoordinateSystem3d_get_implementation",
98 "com_sun_star_comp_chart2_ChartController_get_implementation",
99 "com_sun_star_comp_chart2_ChartDocumentWrapper_get_implementation",
100 "com_sun_star_comp_chart2_ChartModel_get_implementation",
101 "com_sun_star_comp_chart2_ChartView_get_implementation",
102 "com_sun_star_comp_chart2_ConfigDefaultColorScheme_get_implementation",
103 "com_sun_star_comp_chart2_Diagram_get_implementation",
104 "com_sun_star_comp_chart2_ErrorBar_get_implementation",
105 "com_sun_star_comp_chart2_ExponentialRegressionCurve_get_implementation",
106 "com_sun_star_comp_chart2_GridProperties_get_implementation",
107 "com_sun_star_comp_chart2_LabeledDataSequence_get_implementation",
108 "com_sun_star_comp_chart2_Legend_get_implementation",
109 "com_sun_star_comp_chart2_LinearRegressionCurve_get_implementation",
110 "com_sun_star_comp_chart2_LogarithmicRegressionCurve_get_implementation",
111 "com_sun_star_comp_chart2_MeanValueRegressionCurve_get_implementation",
112 "com_sun_star_comp_chart2_MovingAverageRegressionCurve_get_implementation",
113 "com_sun_star_comp_chart2_PageBackground_get_implementation",
114 "com_sun_star_comp_chart2_PolarCoordinateSystem2d_get_implementation",
115 "com_sun_star_comp_chart2_PolarCoordinateSystem3d_get_implementation",
116 "com_sun_star_comp_chart2_PolynomialRegressionCurve_get_implementation",
117 "com_sun_star_comp_chart2_PotentialRegressionCurve_get_implementation",
118 "com_sun_star_comp_chart2_RegressionEquation_get_implementation",
119 "com_sun_star_comp_chart2_Title_get_implementation",
120 "com_sun_star_comp_chart2_XMLFilter_get_implementation",
121 # chart2/source/controller/chartcontroller.component
122 "com_sun_star_comp_chart2_ChartDocumentWrapper_get_implementation",
123 "com_sun_star_comp_chart2_ChartFrameLoader_get_implementation",
124 "com_sun_star_comp_chart2_WizardDialog_get_implementation",
125 # comphelper/util/comphelp.component
126 "com_sun_star_comp_MemoryStream",
127 "com_sun_star_comp_task_OfficeRestartManager",
128 "AnyCompareFactory_get_implementation",
129 "IndexedPropertyValuesContainer_get_implementation",
130 "NamedPropertyValuesContainer_get_implementation",
131 "com_sun_star_comp_comphelper_OPropertyBag",
132 "com_sun_star_comp_SequenceInputStreamService",
133 "com_sun_star_comp_SequenceOutputStreamService",
134 "com_sun_star_comp_util_OfficeInstallationDirectories",
135 # dbaccess/util/dba.component
136 ("com_sun_star_comp_dba_ORowSet_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
137 # forms/util/frm.component
138 ("com_sun_star_comp_forms_FormOperations_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
139 ("com_sun_star_comp_forms_ODatabaseForm_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
140 ("com_sun_star_comp_forms_OFormattedFieldWrapper_ForcedFormatted_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
141 ("com_sun_star_comp_forms_ORichTextModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
142 ("com_sun_star_comp_forms_OScrollBarModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
143 ("com_sun_star_comp_forms_OSpinButtonModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
144 ("com_sun_star_form_Model_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
145 ("com_sun_star_form_OButtonControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
146 ("com_sun_star_form_OButtonModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
147 ("com_sun_star_form_OCheckBoxControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
148 ("com_sun_star_form_OCheckBoxModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
149 ("com_sun_star_form_OComboBoxControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
150 ("com_sun_star_form_OComboBoxModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
151 ("com_sun_star_form_ODateControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
152 ("com_sun_star_form_ODateModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
153 ("com_sun_star_form_OEditControl_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
154 ("com_sun_star_form_OEditModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
155 ("com_sun_star_form_OFixedTextModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
156 ("com_sun_star_form_OFormsCollection_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
157 ("com_sun_star_form_OGridControlModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
158 ("com_sun_star_form_OGroupBoxModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
159 ("com_sun_star_form_OListBoxModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
160 ("com_sun_star_form_ONumericModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
161 ("com_sun_star_form_ORadioButtonModel_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
162 ("com_sun_star_form_XForms_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
163 # framework/util/fwk.component
164 "com_sun_star_comp_framework_AutoRecovery_get_implementation",
165 "com_sun_star_comp_framework_Desktop_get_implementation",
166 "com_sun_star_comp_framework_DocumentAcceleratorConfiguration_get_implementation",
167 "com_sun_star_comp_framework_Frame_get_implementation",
168 "com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation",
169 "com_sun_star_comp_framework_JobExecutor_get_implementation",
170 "com_sun_star_comp_framework_LayoutManager_get_implementation",
171 "com_sun_star_comp_framework_ModuleManager_get_implementation",
172 "com_sun_star_comp_framework_ModuleUIConfigurationManager_get_implementation",
173 "com_sun_star_comp_framework_ModuleUIConfigurationManagerSupplier_get_implementation",
174 "com_sun_star_comp_framework_PathSettings_get_implementation",
175 "com_sun_star_comp_framework_PathSubstitution_get_implementation",
176 "com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation",
177 "com_sun_star_comp_framework_TaskCreator_get_implementation",
178 "com_sun_star_comp_framework_ToolBarControllerFactory_get_implementation",
179 "com_sun_star_comp_framework_UIConfigurationManager_get_implementation",
180 "com_sun_star_comp_framework_UIElementFactoryManager_get_implementation",
181 "com_sun_star_comp_framework_URLTransformer_get_implementation",
182 "com_sun_star_comp_framework_WindowStateConfiguration_get_implementation",
183 "com_sun_star_comp_framework_ModuleAcceleratorConfiguration_get_implementation",
184 "org_apache_openoffice_comp_framework_ContextChangeEventMultiplexer_get_implementation",
185 # i18npool/util/i18npool.component
186 "com_sun_star_i18n_BreakIterator_get_implementation",
187 "com_sun_star_i18n_BreakIterator_Unicode_get_implementation",
188 "com_sun_star_i18n_CharacterClassification_get_implementation",
189 "com_sun_star_i18n_CharacterClassification_Unicode_get_implementation",
190 "com_sun_star_i18n_Collator_get_implementation",
191 "com_sun_star_i18n_LocaleDataImpl_get_implementation",
192 "com_sun_star_i18n_NativeNumberSupplier_get_implementation",
193 "com_sun_star_i18n_NumberFormatCodeMapper_get_implementation",
194 "com_sun_star_i18n_Transliteration_get_implementation",
195 "com_sun_star_i18n_Transliteration_IGNORE_CASE_get_implementation",
196 "com_sun_star_i18n_Transliteration_IGNORE_KANA_get_implementation",
197 "com_sun_star_i18n_Transliteration_IGNORE_WIDTH_get_implementation",
198 "com_sun_star_text_DefaultNumberingProvider_get_implementation",
199 # sax/source/expatwrap/expwrap.component
200 "com_sun_star_comp_extensions_xml_sax_FastParser_get_implementation",
201 "com_sun_star_comp_extensions_xml_sax_ParserExpat_get_implementation",
202 "com_sun_star_extensions_xml_sax_Writer_get_implementation",
203 # sfx2/util/sfx.component
204 "SfxDocumentMetaData_get_implementation",
205 "com_sun_star_comp_office_FrameLoader_get_implementation",
206 "com_sun_star_comp_sfx2_AppDispatchProvider_get_implementation",
207 "com_sun_star_comp_sfx2_DocumentTemplates_get_implementation",
208 "com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation",
209 # sot/util/sot.component
210 "com_sun_star_comp_embed_OLESimpleStorage",
211 # stoc/source/inspect/introspection.component
212 "com_sun_star_comp_stoc_Introspection_get_implementation",
213 # stoc/source/corereflection/reflection.component
214 "com_sun_star_comp_stoc_CoreReflection_get_implementation",
215 # stoc/util/stocservices.component
216 "com_sun_star_comp_stoc_OServiceManagerWrapper_get_implementation",
217 "com_sun_star_comp_stoc_TypeConverter_get_implementation",
218 "com_sun_star_comp_uri_ExternalUriReferenceTranslator_get_implementation",
219 "com_sun_star_comp_uri_UriReferenceFactory_get_implementation",
220 "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTexpand_get_implementation",
221 "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTscript_get_implementation",
222 # svtools/util/svt.component
223 "com_sun_star_comp_embed_HatchWindowFactory_get_implementation",
224 # vcl/vcl.android.component
225 "com_sun_star_graphic_GraphicObject_get_implementation",
226 "com_sun_star_comp_graphic_GraphicProvider_get_implementation",
227 # svx/util/svx.component
228 "com_sun_star_comp_svx_NumberingToolBoxControl_get_implementation",
229 "com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation",
230 "com_sun_star_drawing_SvxShapeCollection_get_implementation",
231 "com_sun_star_svx_FontHeightToolBoxController_get_implementation",
232 "org_apache_openoffice_comp_svx_sidebar_PanelFactory_get_implementation",
233 # svx/util/svxcore.component
234 "com_sun_star_comp_graphic_PrimitiveFactory2D_get_implementation",
235 "com_sun_star_comp_Draw_GraphicExporter_get_implementation",
236 "com_sun_star_comp_svx_ColorToolBoxControl_get_implementation",
237 "com_sun_star_comp_svx_FontNameToolBoxControl_get_implementation",
238 "com_sun_star_comp_Svx_GraphicExportHelper_get_implementation",
239 "com_sun_star_comp_Svx_GraphicImportHelper_get_implementation",
240 # toolkit/util/tk.component
241 "stardiv_Toolkit_StdTabController_get_implementation",
242 "stardiv_Toolkit_UnoButtonControl_get_implementation",
243 "stardiv_Toolkit_UnoCheckBoxControl_get_implementation",
244 "stardiv_Toolkit_UnoComboBoxControl_get_implementation",
245 "stardiv_Toolkit_UnoControlButtonModel_get_implementation",
246 "stardiv_Toolkit_UnoControlCheckBoxModel_get_implementation",
247 "stardiv_Toolkit_UnoControlComboBoxModel_get_implementation",
248 "stardiv_Toolkit_UnoControlContainer_get_implementation",
249 "stardiv_Toolkit_UnoControlContainerModel_get_implementation",
250 "stardiv_Toolkit_UnoControlDateFieldModel_get_implementation",
251 "stardiv_Toolkit_UnoControlDialogModel_get_implementation",
252 "stardiv_Toolkit_UnoControlFixedTextModel_get_implementation",
253 "stardiv_Toolkit_UnoControlFormattedFieldModel_get_implementation",
254 "stardiv_Toolkit_UnoControlGroupBoxModel_get_implementation",
255 "stardiv_Toolkit_UnoControlListBoxModel_get_implementation",
256 "stardiv_Toolkit_UnoControlNumericFieldModel_get_implementation",
257 "stardiv_Toolkit_UnoControlRadioButtonModel_get_implementation",
258 "stardiv_Toolkit_UnoControlScrollBarModel_get_implementation",
259 "stardiv_Toolkit_UnoDateFieldControl_get_implementation",
260 "stardiv_Toolkit_UnoSpinButtonModel_get_implementation",
261 "stardiv_Toolkit_VCLXPointer_get_implementation",
262 "stardiv_Toolkit_VCLXToolkit_get_implementation",
263 # uui/util/uui.component
264 "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation",
265 # xmloff/util/xo.component
266 "XMLMetaExportComponent_get_implementation",
267 "XMLMetaImportComponent_get_implementation",
268 "XMLVersionListPersistence_get_implementation",
269 "com_sun_star_comp_Impress_XMLOasisImporter_get_implementation",
270 "com_sun_star_comp_Impress_XMLOasisExporter_get_implementation",
271 "com_sun_star_comp_Impress_XMLOasisStylesExporter_get_implementation",
272 "com_sun_star_comp_Impress_XMLOasisContentExporter_get_implementation",
273 "com_sun_star_comp_Impress_XMLOasisMetaExporter_get_implementation",
274 "com_sun_star_comp_Impress_XMLOasisMetaImporter_get_implementation",
275 "com_sun_star_comp_Impress_XMLOasisContentImporter_get_implementation",
276 "com_sun_star_comp_Impress_XMLOasisStylesImporter_get_implementation",
277 "com_sun_star_comp_Impress_XMLOasisSettingsExporter_get_implementation",
278 "com_sun_star_comp_Impress_XMLOasisSettingsImporter_get_implementation",
279 "com_sun_star_comp_Impress_XMLStylesExporter_get_implementation",
280 "com_sun_star_comp_Impress_XMLContentExporter_get_implementation",
281 "com_sun_star_comp_Impress_XMLMetaExporter_get_implementation",
282 "com_sun_star_comp_Impress_XMLSettingsExporter_get_implementation",
283 "com_sun_star_comp_Impress_XMLExporter_get_implementation",
284 "com_sun_star_comp_Draw_XMLExporter_get_implementation",
285 "com_sun_star_comp_Draw_XMLStylesExporter_get_implementation",
286 "com_sun_star_comp_Draw_XMLContentExporter_get_implementation",
287 "com_sun_star_comp_Draw_XMLMetaExporter_get_implementation",
288 "com_sun_star_comp_Draw_XMLSettingsExporter_get_implementation",
289 "com_sun_star_comp_Draw_XMLOasisSettingsExporter_get_implementation",
290 "com_sun_star_comp_Draw_XMLOasisMetaExporter_get_implementation",
291 "com_sun_star_comp_Draw_XMLOasisImporter_get_implementation",
292 "com_sun_star_comp_Draw_XMLOasisStylesImporter_get_implementation",
293 "com_sun_star_comp_Draw_XMLOasisContentImporter_get_implementation",
294 "com_sun_star_comp_Draw_XMLOasisMetaImporter_get_implementation",
295 "com_sun_star_comp_Draw_XMLOasisSettingsImporter_get_implementation",
296 # xmlscript/util/xmlscript.component
297 "com_sun_star_comp_xmlscript_XMLBasicExporter",
298 "com_sun_star_comp_xmlscript_XMLBasicImporter",
299 "com_sun_star_comp_xmlscript_XMLOasisBasicExporter",
300 "com_sun_star_comp_xmlscript_XMLOasisBasicImporter",
301 # xmlsecurity/util/xmlsecurity.component
302 ("com_sun_star_security_CertificateContainer_get_implementation", "#if HAVE_FEATURE_NSS"),
303 ("com_sun_star_security_DocumentDigitalSignatures_get_implementation", "#if HAVE_FEATURE_NSS"),
304 # xmlsecurity/util/xsec_xmlsec.component
305 ("com_sun_star_xml_crypto_NSSInitializer_get_implementation", "#if HAVE_FEATURE_NSS"),
306 ("com_sun_star_xml_crypto_SEInitializer_get_implementation", "#if HAVE_FEATURE_NSS"),
307 ("com_sun_star_xml_security_SEInitializer_Gpg_get_implementation", "#if HAVE_FEATURE_GPGME"),
308 ("com_sun_star_xml_crypto_SecurityEnvironment_get_implementation", "#if HAVE_FEATURE_NSS"),
309 ("com_sun_star_xml_wrapper_XMLDocumentWrapper_get_implementation", "#if HAVE_FEATURE_NSS"),
310 ("com_sun_star_xml_wrapper_XMLElementWrapper_get_implementation", "#if HAVE_FEATURE_NSS"),
311 ("com_sun_star_xml_crypto_XMLSecurityContext_get_implementation", "#if HAVE_FEATURE_NSS"),
312 ("com_sun_star_xml_crypto_XMLSignature_get_implementation", "#if HAVE_FEATURE_NSS"),
313 # oox/util/oox.component
314 "com_sun_star_comp_oox_core_FastTokenHandler_get_implementation",
315 "com_sun_star_comp_oox_FormatDetector_get_implementation",
316 "com_sun_star_comp_oox_docprop_DocumentPropertiesImporter_get_implementation",
317 "com_sun_star_comp_oox_ppt_PowerPointImport_get_implementation",
318 "com_sun_star_comp_oox_ShapeContextHandler_get_implementation",
321 # edit group for apps, where you can edit documents
322 edit_factory_list = [
325 edit_constructor_list = [
326 # framework/util/fwk.component
327 "com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation",
328 "com_sun_star_comp_framework_UICommandDescription_get_implementation",
329 # i18npool/util/i18npool.component
330 "com_sun_star_i18n_InputSequenceChecker_get_implementation",
331 "com_sun_star_i18n_OrdinalSuffix_get_implementation",
332 # sc/util/sc.component
333 "Calc_XMLOasisContentExporter_get_implementation",
334 "Calc_XMLOasisExporter_get_implementation",
335 "Calc_XMLOasisMetaExporter_get_implementation",
336 "Calc_XMLOasisSettingsExporter_get_implementation",
337 "Calc_XMLOasisStylesExporter_get_implementation",
338 # starmath/util/sm.component
339 "Math_XMLOasisMetaExporter_get_implementation",
340 "Math_XMLOasisSettingsExporter_get_implementation",
341 "Math_XMLImporter_get_implementation",
342 "Math_XMLOasisMetaImporter_get_implementation",
343 "Math_XMLOasisSettingsImporter_get_implementation",
344 # starmath/util/smd.component
345 "math_FormatDetector_get_implementation",
346 # sw/util/sw.component
347 "com_sun_star_comp_Writer_XMLOasisContentExporter_get_implementation",
348 "com_sun_star_comp_Writer_XMLOasisMetaExporter_get_implementation",
349 "com_sun_star_comp_Writer_XMLOasisSettingsExporter_get_implementation",
350 "com_sun_star_comp_Writer_XMLOasisStylesExporter_get_implementation",
351 "com_sun_star_comp_Writer_WriterModule_get_implementation",
352 "org_apache_openoffice_comp_sw_sidebar_SwPanelFactory_get_implementation",
355 # math
356 math_factory_list = [
359 math_constructor_list = [
360 # starmath/util/sm.component
361 "Math_XMLOasisMetaExporter_get_implementation",
362 "Math_XMLOasisSettingsExporter_get_implementation",
365 calc_factory_list = [
366 ("libsclo.a", "sc_component_getFactory"),
367 ("libanalysislo.a", "analysis_component_getFactory"),
368 ("libdatelo.a", "date_component_getFactory"),
369 ("libpricinglo.a", "pricing_component_getFactory"),
372 calc_constructor_list = [
373 # avmedia/util/avmedia.component
374 "com_sun_star_comp_framework_SoundHandler_get_implementation",
375 # sc/util/scd.component
376 "com_sun_star_comp_calc_ExcelBiffFormatDetector_get_implementation",
377 "com_sun_star_comp_calc_FormatDetector_get_implementation",
378 # sc/util/scfilt.component
379 "com_sun_star_comp_oox_xls_ExcelFilter_get_implementation",
380 "com_sun_star_comp_oox_xls_FormulaParser_get_implementation",
381 # scripting/source/vbaevents/vbaevents.component
382 ("ooo_vba_VBAToOOEventDesc_get_implementation", "#if HAVE_FEATURE_SCRIPTING"),
383 # svl/util/svl.component
384 "com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation",
385 "com_sun_star_uno_util_numbers_SvNumberFormatterServiceObject_get_implementation",
388 draw_factory_list = [
389 ("libsdlo.a", "sd_component_getFactory"),
390 ("libsvgfilterlo.a", "svgfilter_component_getFactory"),
391 ("libdeployment.a", "deployment_component_getFactory"),
392 ("libemboleobj.a", "emboleobj_component_getFactory"),
395 draw_constructor_list = [
396 # animations/source/animcore/animcore.component
397 "com_sun_star_animations_AnimateColor_get_implementation",
398 "com_sun_star_animations_AnimateMotion_get_implementation",
399 "com_sun_star_animations_AnimateSet_get_implementation",
400 "com_sun_star_animations_AnimateTransform_get_implementation",
401 "com_sun_star_animations_Animate_get_implementation",
402 "com_sun_star_animations_Audio_get_implementation",
403 "com_sun_star_animations_Command_get_implementation",
404 "com_sun_star_animations_IterateContainer_get_implementation",
405 "com_sun_star_animations_ParallelTimeContainer_get_implementation",
406 "com_sun_star_animations_SequenceTimeContainer_get_implementation",
407 "com_sun_star_animations_TransitionFilter_get_implementation",
408 # sd/util/sd.component
409 "RandomAnimationNode_get_implementation",
410 "com_sun_star_comp_Draw_framework_BasicPaneFactory_get_implementation",
411 "com_sun_star_comp_Draw_framework_BasicToolBarFactory_get_implementation",
412 "com_sun_star_comp_Draw_framework_BasicViewFactory_get_implementation",
413 "com_sun_star_comp_Draw_framework_PresentationFactoryProvider_get_implementation",
414 "com_sun_star_comp_Draw_framework_ResourceID_get_implementation",
415 "com_sun_star_comp_Draw_framework_configuration_ConfigurationController_get_implementation",
416 "com_sun_star_comp_Draw_framework_module_ModuleController_get_implementation",
417 "org_openoffice_comp_Draw_framework_PanelFactory_get_implementation",
418 # sd/util/sdd.component
419 "com_sun_star_comp_draw_FormatDetector_get_implementation",
420 # sd/util/sdfilt.component
421 "css_comp_Impress_oox_PowerPointExport",
422 # writerperfect/source/draw/wpftdraw.component
423 "com_sun_star_comp_Draw_VisioImportFilter_get_implementation",
426 writer_factory_list = [
427 ("libswlo.a", "sw_component_getFactory"),
430 writer_constructor_list = [
431 # basic/util/sb.component
432 ("com_sun_star_comp_sfx2_ScriptLibraryContainer_get_implementation", "#if HAVE_FEATURE_SCRIPTING"),
433 # filter/source/textfilterdetect/textfd.component
434 "com_sun_star_comp_filters_PlainTextFilterDetect_get_implementation",
435 # sw/util/sw.component
436 "com_sun_star_comp_Writer_XMLOasisContentImporter_get_implementation",
437 "com_sun_star_comp_Writer_XMLOasisImporter_get_implementation",
438 "com_sun_star_comp_Writer_XMLOasisMetaImporter_get_implementation",
439 "com_sun_star_comp_Writer_XMLOasisSettingsImporter_get_implementation",
440 "com_sun_star_comp_Writer_XMLOasisStylesImporter_get_implementation",
441 "com_sun_star_util_comp_FinalThreadManager_get_implementation",
442 # sw/util/swd.component
443 "com_sun_star_comp_writer_FormatDetector_get_implementation",
444 # sw/util/msword.component
445 "com_sun_star_comp_Writer_RtfExport_get_implementation",
446 "com_sun_star_comp_Writer_DocxExport_get_implementation",
447 # writerfilter/util/writerfilter.component
448 "com_sun_star_comp_Writer_RtfFilter_get_implementation",
449 "com_sun_star_comp_Writer_WriterFilter_get_implementation",
452 factory_map = {
453 'core' : core_factory_list,
454 'edit' : edit_factory_list,
455 'math' : math_factory_list,
456 'calc' : calc_factory_list,
457 'draw' : draw_factory_list,
458 'writer' : writer_factory_list,
461 constructor_map = {
462 'core' : core_constructor_list,
463 'edit' : edit_constructor_list,
464 'math' : math_constructor_list,
465 'calc' : calc_constructor_list,
466 'draw' : draw_constructor_list,
467 'writer' : writer_constructor_list,
470 custom_widgets = [
471 'BookmarksBox',
472 'CategoryListBox',
473 'ColumnEdit',
474 'ContentListBox',
475 'ContextVBox',
476 'CustomAnimationList',
477 'DataTreeListBox',
478 'DropdownBox',
479 'EmojiView',
480 'FontNameBox',
481 'FontSizeBox',
482 'FontStyleBox',
483 'IndexBox',
484 'IndexBox',
485 'ManagedMenuButton',
486 'OptionalBox',
487 'PageNumberListBox',
488 'PaperSizeListBox',
489 'PriorityHBox',
490 'PriorityMergedHBox',
491 'PropertyControl',
492 'RecentDocsView',
493 'RowEdit',
494 'SameContentListBox',
495 'SdPageObjsTLB',
496 'SearchBox',
497 'SearchResultsBox',
498 'SidebarDialControl',
499 'SidebarToolBox',
500 'SpacingListBox',
501 'Svx3DPreviewControl',
502 'SvxCharViewControl',
503 'SvxColorListBox',
504 'SvxColorValueSet',
505 'SvxFillAttrBox',
506 'SvxFillTypeBox',
507 'SvxLightCtl3D',
508 'SvxRelativeField',
509 'SwNavHelpToolBox',
510 'TableValueSet',
511 'TemplateDefaultView',
512 'ValueSet',
515 def get_constructor_guard(constructor):
516 if type(full_constructor_map[constructor]) is bool:
517 return None
518 else:
519 return full_constructor_map[constructor]
521 # instead of outputting native-code.cxx, reduce the services.rdb according to
522 # the constraints, so that we can easily emulate what services do we need to
523 # add for a fully functional file loading / saving / ...
524 def limit_rdb(services_rdb, full_factory_map, full_constructor_map):
525 ET.register_namespace('','http://openoffice.org/2010/uno-components')
526 tree = ET.parse(services_rdb[0])
527 root = tree.getroot()
529 for component in root.findall('{http://openoffice.org/2010/uno-components}component'):
530 # direct
531 uri = component.get('uri')
532 component_name = None
533 if uri != None:
534 component_name = re.sub('^vnd.sun.star.expand:\$LO_LIB_DIR/([^.]*).so$', '\\1.a', uri)
535 if component_name in full_factory_map:
536 continue
538 # via a constructor - limit only to those we have
539 has_constructor = False
540 for implementation in component.findall('{http://openoffice.org/2010/uno-components}implementation'):
541 constructor = implementation.get('constructor')
542 if constructor in full_constructor_map:
543 has_constructor = True
544 else:
545 component.remove(implementation)
547 if not has_constructor:
548 root.remove(component)
550 tree.write(services_rdb[0] + '.out', xml_declaration = True, method = 'xml')
553 # do the actual work
554 opts = OptionParser()
555 opts.add_option("-j", "--java-guard", action="store_true", help="include external java functions", dest="java", default=False)
556 opts.add_option("-g", "--group", action="append", help="group of implementations to make available in application", dest="groups")
557 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")
558 opts.add_option("-C", "--pure-c", action="store_true", help="do not print extern \"C\"", dest="pure_c", default=False)
560 (options, args) = opts.parse_args()
562 # dict of all the constructors that we need according to -g's
563 full_constructor_map = {}
564 if options.groups:
565 for constructor_group in options.groups:
566 for constructor in constructor_map[constructor_group]:
567 if type(constructor) is tuple:
568 full_constructor_map[constructor[0]] = constructor[1]
569 else:
570 full_constructor_map[constructor] = True
572 # dict of all the factories that we need according to -g's
573 full_factory_map = {}
574 if options.groups:
575 for factory_group in options.groups:
576 for entry in factory_map[factory_group]:
577 factory_guard = None
578 if len(entry) > 2:
579 factory_guard = entry[2]
580 map_entry = { 'function': entry[1], 'guard': factory_guard }
581 full_factory_map[entry[0]] = map_entry
583 # are we only shuffling the services.rdb?
584 if options.services:
585 limit_rdb(options.services, full_factory_map, full_constructor_map)
586 exit(0)
588 print ("""/*
589 * This is a generated file. Do not edit.
591 * File generated by solenv/bin/native-code.py
594 #include <config_features.h>
595 #include <config_fuzzers.h>
596 #include <config_gpgme.h>
597 #include <osl/detail/component-mapping.h>
598 #include <string.h>
600 """)
601 if not options.pure_c:
602 print ("""extern "C" {""")
604 for entry in sorted(full_factory_map.keys()):
605 factory_function = full_factory_map[entry]['function']
606 factory_guard = full_factory_map[entry]['guard']
607 if factory_guard:
608 print (factory_guard)
609 print('void * ' + factory_function + '( const char* , void* , void* );')
610 if factory_guard:
611 print ('#endif')
613 print ('')
614 for constructor in sorted(full_constructor_map.keys()):
615 constructor_guard = get_constructor_guard(constructor)
616 if constructor_guard:
617 print (constructor_guard)
618 print ('void * '+constructor+'( void *, void * );')
619 if constructor_guard:
620 print ('#endif')
622 print ('')
623 for entry in sorted(custom_widgets):
624 print ('void make' + entry + '();')
625 print ('typedef void (*custom_widget_func)();')
626 print ('#if !ENABLE_FUZZERS')
627 print ('static struct { const char *name; custom_widget_func func; } custom_widgets[] = {')
628 for entry in sorted(custom_widgets):
629 print (' { "make' + entry + '", make' + entry + ' },')
630 print ('};')
631 print ('#endif')
632 print ('')
633 print ("""
634 custom_widget_func lo_get_custom_widget_func(const char* name)
636 #if ENABLE_FUZZERS
637 (void)name;
638 return nullptr;
639 #else
640 for (size_t i = 0; i < sizeof(custom_widgets) / sizeof(custom_widgets[0]); i++)
641 if (strcmp(name, custom_widgets[i].name) == 0)
642 return custom_widgets[i].func;
643 return nullptr;
644 #endif
646 """)
648 print ("""
649 const lib_to_factory_mapping *
650 lo_get_factory_map(void)
652 static lib_to_factory_mapping map[] = {""")
654 for entry in sorted(full_factory_map.keys()):
655 factory_function = full_factory_map[entry]['function']
656 factory_guard = full_factory_map[entry]['guard']
657 if factory_guard:
658 print (factory_guard)
659 print(' { "' + entry + '", ' + factory_function + ' },')
660 if factory_guard:
661 print ('#endif')
663 print ("""
664 { 0, 0 }
665 };""")
667 if options.java:
668 print ("""
669 extern void Java_org_libreoffice_kit_LibreOfficeKit_initializeNative();
670 volatile void *p = (void *) Java_org_libreoffice_kit_LibreOfficeKit_initializeNative;
672 extern void Java_org_libreoffice_kit_Office_getError();
673 p = (void *) Java_org_libreoffice_kit_Office_getError;
675 """)
677 print ("""
678 return map;
681 const lib_to_constructor_mapping *
682 lo_get_constructor_map(void)
684 static lib_to_constructor_mapping map[] = {""")
686 for constructor in sorted(full_constructor_map.keys()):
687 constructor_guard = get_constructor_guard(constructor)
688 if constructor_guard:
689 print (constructor_guard)
690 print (' { "' +constructor+ '", ' +constructor+ ' },')
691 if constructor_guard:
692 print ('#endif')
694 print ("""
695 { 0, 0 }
698 return map;
701 """)
702 if not options.pure_c:
703 print("""}""")
705 # vim:set shiftwidth=4 softtabstop=4 expandtab: