Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: tools/generate_library_loader/generate_library_loader.py

Issue 11348279: Linux: use generated library loader for gsettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ 6 """
7 Creates a library loader (a header and implementation file), 7 Creates a library loader (a header and implementation file),
8 which is a wrapper for dlopen or direct linking with given library. 8 which is a wrapper for dlopen or direct linking with given library.
9 9
10 The loader makes it possible to have the same client code for both cases, 10 The loader makes it possible to have the same client code for both cases,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 }) 183 })
184 member_init.append(IMPL_MEMBER_INIT_TEMPLATE % { 184 member_init.append(IMPL_MEMBER_INIT_TEMPLATE % {
185 'function_name': fn, 185 'function_name': fn,
186 'unique_prefix': unique_prefix 186 'unique_prefix': unique_prefix
187 }) 187 })
188 member_cleanup.append(IMPL_MEMBER_CLEANUP_TEMPLATE % { 188 member_cleanup.append(IMPL_MEMBER_CLEANUP_TEMPLATE % {
189 'function_name': fn, 189 'function_name': fn,
190 'unique_prefix': unique_prefix 190 'unique_prefix': unique_prefix
191 }) 191 })
192 192
193 wrapped_header_include = '#include %s' % options.header 193 wrapped_header_include = '#include %s\n' % options.header
194 194
195 # Some libraries (e.g. libpci) have headers that cannot be included 195 # Some libraries (e.g. libpci) have headers that cannot be included
196 # without extern "C", otherwise they cause the link to fail. 196 # without extern "C", otherwise they cause the link to fail.
197 # TODO(phajdan.jr): This is a workaround for broken headers. Remove it. 197 # TODO(phajdan.jr): This is a workaround for broken headers. Remove it.
198 if options.use_extern_c: 198 if options.use_extern_c:
199 wrapped_header_include = 'extern "C" {\n%s\n}\n' % wrapped_header_include 199 wrapped_header_include = 'extern "C" {\n%s\n}\n' % wrapped_header_include
200 200
201 # It seems cleaner just to have a single #define here and #ifdefs in bunch 201 # It seems cleaner just to have a single #define here and #ifdefs in bunch
202 # of places, rather than having a different set of templates, duplicating 202 # of places, rather than having a different set of templates, duplicating
203 # or complicating more code. 203 # or complicating more code.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 impl_file = open(options.output_cc, 'w') 239 impl_file = open(options.output_cc, 'w')
240 try: 240 try:
241 impl_file.write(impl_contents) 241 impl_file.write(impl_contents)
242 finally: 242 finally:
243 impl_file.close() 243 impl_file.close()
244 244
245 return 0 245 return 0
246 246
247 if __name__ == '__main__': 247 if __name__ == '__main__':
248 sys.exit(main()) 248 sys.exit(main())
OLDNEW
« net/proxy/proxy_config_service_linux.cc ('K') | « net/proxy/proxy_config_service_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698