| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 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 import string | 6 import string |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 HEADER = """\ | 9 HEADER = """\ |
| 10 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 10 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 11 // Use of this source code is governed by a BSD-style license that can be | 11 // Use of this source code is governed by a BSD-style license that can be |
| 12 // found in the LICENSE file. | 12 // found in the LICENSE file. |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 | 418 |
| 419 # OS_WIN specific. Same functors but with stdcall calling conventions. | 419 # OS_WIN specific. Same functors but with stdcall calling conventions. |
| 420 # Functor for method with __stdcall calling conventions. | 420 # Functor for method with __stdcall calling conventions. |
| 421 print "#if defined (OS_WIN)" | 421 print "#if defined (OS_WIN)" |
| 422 stdcall_method = CREATE_METHOD_FUNCTOR_TEMPLATE | 422 stdcall_method = CREATE_METHOD_FUNCTOR_TEMPLATE |
| 423 stdcall_method = stdcall_method.replace("U::", "__stdcall U::") | 423 stdcall_method = stdcall_method.replace("U::", "__stdcall U::") |
| 424 stdcall_method = FixCode(stdcall_method % args) | 424 stdcall_method = FixCode(stdcall_method % args) |
| 425 print stdcall_method | 425 print stdcall_method |
| 426 # Functor for free function with __stdcall calling conventions. | 426 # Functor for free function with __stdcall calling conventions. |
| 427 stdcall_function = CREATE_FUNCTION_FUNCTOR_TEMPLATE | 427 stdcall_function = CREATE_FUNCTION_FUNCTOR_TEMPLATE |
| 428 stdcall_function = stdcall_function.replace("R (*", "R (__stdcall *"); | 428 stdcall_function = stdcall_function.replace("R (*", "R (__stdcall *") |
| 429 print "\n", FixCode(stdcall_function % args) | 429 print "\n", FixCode(stdcall_function % args) |
| 430 | 430 |
| 431 print "#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" | 431 print "#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" |
| 432 stdcall2 = stdcall_method; | 432 stdcall2 = stdcall_method |
| 433 stdcall2 = stdcall2.replace("CreateFunctor(T* obj,", "CreateFunctor(T** obj,") | 433 stdcall2 = stdcall2.replace("CreateFunctor(T* obj,", "CreateFunctor(T** obj,") |
| 434 stdcall2 = stdcall2.replace("new Mutant", "new MutantLateObjectBind") | 434 stdcall2 = stdcall2.replace("new Mutant", "new MutantLateObjectBind") |
| 435 stdcall2 = stdcall2.replace(" " * 17 + "Tuple", " " * 31 + "Tuple") | 435 stdcall2 = stdcall2.replace(" " * 17 + "Tuple", " " * 31 + "Tuple") |
| 436 print stdcall2 | 436 print stdcall2 |
| 437 print "#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" | 437 print "#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" |
| 438 print "#endif // OS_WIN\n" | 438 print "#endif // OS_WIN\n" |
| 439 | 439 |
| 440 | 440 |
| 441 def main(): | 441 def main(): |
| 442 print HEADER | 442 print HEADER |
| 443 for prebound in xrange(0, 6 + 1): | 443 for prebound in xrange(0, 6 + 1): |
| 444 for args in xrange(0, 6 + 1): | 444 for args in xrange(0, 6 + 1): |
| 445 GenerateDispatch(prebound, args) | 445 GenerateDispatch(prebound, args) |
| 446 print MUTANT | 446 print MUTANT |
| 447 for prebound in xrange(0, 6 + 1): | 447 for prebound in xrange(0, 6 + 1): |
| 448 for args in xrange(0, 6 + 1): | 448 for args in xrange(0, 6 + 1): |
| 449 GenerateCreateFunctor(prebound, args) | 449 GenerateCreateFunctor(prebound, args) |
| 450 print FOOTER | 450 print FOOTER |
| 451 return 0 | 451 return 0 |
| 452 | 452 |
| 453 | 453 |
| 454 if __name__ == "__main__": | 454 if __name__ == "__main__": |
| 455 sys.exit(main()) | 455 sys.exit(main()) |
| OLD | NEW |