| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Creates windows and posix stub files for a given set of signatures. | 7 """Creates windows and posix stub files for a given set of signatures. |
| 8 | 8 |
| 9 For libraries that need to be loaded outside of the standard executable startup | 9 For libraries that need to be loaded outside of the standard executable startup |
| 10 path mechanism, stub files need to be generated for the wanted functions. In | 10 path mechanism, stub files need to be generated for the wanted functions. In |
| 11 windows, this is done via "def" files and the delay load mechanism. On a posix | 11 windows, this is done via "def" files and the delay load mechanism. On a posix |
| 12 system, a set of stub functions need to be generated that dispatch to functions | 12 system, a set of stub functions need to be generated that dispatch to functions |
| 13 found via dlsym. | 13 found via dlsym. |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 This function splits the filename from the extention on that basename of | 337 This function splits the filename from the extention on that basename of |
| 338 the path and returns that as the module name. | 338 the path and returns that as the module name. |
| 339 | 339 |
| 340 Args: | 340 Args: |
| 341 infile_path: String holding the path to the input file. | 341 infile_path: String holding the path to the input file. |
| 342 | 342 |
| 343 Returns: | 343 Returns: |
| 344 The module name as a string. | 344 The module name as a string. |
| 345 """ | 345 """ |
| 346 basename = os.path.basename(infile_path) | 346 basename = os.path.basename(infile_path) |
| 347 return os.path.splitext(basename)[0] | 347 |
| 348 # This loop continously removes suffixes of the filename separated by a "." |
| 349 # character. |
| 350 while 1: |
| 351 new_basename = os.path.splitext(basename)[0] |
| 352 if basename == new_basename: |
| 353 break |
| 354 else: |
| 355 basename = new_basename |
| 356 return basename |
| 348 | 357 |
| 349 | 358 |
| 350 def ParseSignatures(infile): | 359 def ParseSignatures(infile): |
| 351 """Parses function signatures in the input file. | 360 """Parses function signatures in the input file. |
| 352 | 361 |
| 353 This function parses a file of signatures into a list of dictionaries that | 362 This function parses a file of signatures into a list of dictionaries that |
| 354 represent the function signatures in the input file. Each dictionary has | 363 represent the function signatures in the input file. Each dictionary has |
| 355 the following keys: | 364 the following keys: |
| 356 return_type: A string with the return type. | 365 return_type: A string with the return type. |
| 357 name: A string with the name of the function. | 366 name: A string with the name of the function. |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 if options.type == FILE_TYPE_WIN: | 1025 if options.type == FILE_TYPE_WIN: |
| 1017 CreateWindowsLibForSigFiles(args, out_dir, intermediate_dir) | 1026 CreateWindowsLibForSigFiles(args, out_dir, intermediate_dir) |
| 1018 elif options.type == FILE_TYPE_POSIX_STUB: | 1027 elif options.type == FILE_TYPE_POSIX_STUB: |
| 1019 CreatePosixStubsForSigFiles(args, options.stubfile_name, out_dir, | 1028 CreatePosixStubsForSigFiles(args, options.stubfile_name, out_dir, |
| 1020 intermediate_dir, options.path_from_source, | 1029 intermediate_dir, options.path_from_source, |
| 1021 options.extra_stub_header) | 1030 options.extra_stub_header) |
| 1022 | 1031 |
| 1023 | 1032 |
| 1024 if __name__ == '__main__': | 1033 if __name__ == '__main__': |
| 1025 main() | 1034 main() |
| OLD | NEW |