summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-01-27 09:51:47 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-02-09 08:09:23 +0100
commit68210e1c06f8746101ad765ba646a25c6364ef11 (patch)
tree9bbd35ced6c48d71a91bf2ba36d239d55b020c27 /solenv
parent5d86b4b7c75f978f01397f3ed5a4e3c3316c2971 (diff)
native-code.py: Share more code around the factories too.
Change-Id: Iff0909ee110058cd3e351e4a96738d5b8e6ba62e
Diffstat (limited to 'solenv')
-rwxr-xr-xsolenv/bin/native-code.py60
1 files changed, 31 insertions, 29 deletions
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 2f58a8e6dfbb..8afb2cef1d30 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -189,7 +189,7 @@ constructor_map = {
# instead of outputting native-code.cxx, reduce the services.rdb according to
# the constraints, so that we can easily emulate what services do we need to
# add for a fully functional file loading / saving / ...
-def limit_rdb(services_rdb, full_constructor_map):
+def limit_rdb(services_rdb, full_factory_map, full_constructor_map):
ET.register_namespace('','http://openoffice.org/2010/uno-components')
tree = ET.parse(services_rdb[0])
root = tree.getroot()
@@ -211,15 +211,27 @@ opts.add_option("-r", "--limit-rdb", action="append", help="instead of outputtin
(options, args) = opts.parse_args()
-# construct a list of all the contructors that we need according to -g's
+# dict of all the contructors that we need according to -g's
full_constructor_map = {}
if options.groups:
for constructor_group in options.groups:
for constructor in constructor_map[constructor_group]:
full_constructor_map[constructor] = True
+# dict of all the factories that we need according to -g's
+full_factory_map = {}
+if options.groups:
+ for factory_group in options.groups:
+ for entry in factory_map[factory_group]:
+ factory_guard = None
+ if len(entry) > 2:
+ factory_guard = entry[2]
+ map_entry = { 'function': entry[1], 'guard': factory_guard }
+ full_factory_map[entry[0]] = map_entry
+
+# are we only shuffling the services.rdb?
if options.services:
- limit_rdb(options.services, full_constructor_map)
+ limit_rdb(options.services, full_factory_map, full_constructor_map)
exit(0)
print ("""/*
@@ -232,19 +244,14 @@ print ("""/*
extern "C" {
""")
-if options.groups:
- for factory_group in options.groups:
- for entry in factory_map[factory_group]:
- factory_name = entry[0]
- factory_function = entry[1]
- factory_guard = None
- if len(entry) > 2:
- factory_guard = entry[2]
- if factory_guard:
- print (factory_guard)
- print ('void * '+factory_function+'( const char* , void* , void* );')
- if factory_guard:
- print ('#endif')
+for entry in sorted(full_factory_map.keys()):
+ factory_function = full_factory_map[entry]['function']
+ factory_guard = full_factory_map[entry]['guard']
+ if factory_guard:
+ print (factory_guard)
+ print('void * ' + factory_function + '( const char* , void* , void* );')
+ if factory_guard:
+ print ('#endif')
print ('')
for constructor in sorted(full_constructor_map.keys()):
@@ -256,19 +263,14 @@ lo_get_factory_map(void)
{
static lib_to_factory_mapping map[] = {""")
-if options.groups:
- for factory_group in options.groups:
- for entry in factory_map[factory_group]:
- factory_name = entry[0]
- factory_function = entry[1]
- factory_guard = None
- if len(entry) > 2:
- factory_guard = entry[2]
- if factory_guard:
- print (factory_guard)
- print (' { "'+factory_name+'", '+factory_function+' },')
- if factory_guard:
- print ('#endif')
+for entry in sorted(full_factory_map.keys()):
+ factory_function = full_factory_map[entry]['function']
+ factory_guard = full_factory_map[entry]['guard']
+ if factory_guard:
+ print (factory_guard)
+ print(' { "' + entry + '", ' + factory_function + ' },')
+ if factory_guard:
+ print ('#endif')
print ("""
{ 0, 0 }