| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 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 """code generator for GL/GLES extension wrangler.""" | 7 """code generator for GL/GLES extension wrangler.""" |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 # typedef. | 479 # typedef. |
| 480 file.write('\n') | 480 file.write('\n') |
| 481 for [return_type, names, arguments] in functions: | 481 for [return_type, names, arguments] in functions: |
| 482 file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % | 482 file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % |
| 483 (return_type, names[0], arguments)) | 483 (return_type, names[0], arguments)) |
| 484 | 484 |
| 485 # Write declarations for function pointers. Always use the GL name for the | 485 # Write declarations for function pointers. Always use the GL name for the |
| 486 # declaration. | 486 # declaration. |
| 487 file.write('\n') | 487 file.write('\n') |
| 488 for [return_type, names, arguments] in functions: | 488 for [return_type, names, arguments] in functions: |
| 489 file.write('GL_EXPORT extern %sProc g_%s;\n' % (names[0], names[0])) | 489 file.write('extern %sProc g_%s;\n' % (names[0], names[0])) |
| 490 file.write('\n') | 490 file.write('\n') |
| 491 file.write( '} // namespace gfx\n') | 491 file.write( '} // namespace gfx\n') |
| 492 | 492 |
| 493 # Write macros to invoke function pointers. Always use the GL name for the | 493 # Write macros to invoke function pointers. Always use the GL name for the |
| 494 # macro. | 494 # macro. |
| 495 file.write('\n') | 495 file.write('\n') |
| 496 for [return_type, names, arguments] in functions: | 496 for [return_type, names, arguments] in functions: |
| 497 file.write('#define %s ::gfx::g_%s\n' % | 497 file.write('#define %s ::gfx::g_%s\n' % |
| 498 (names[0], names[0])) | 498 (names[0], names[0])) |
| 499 | 499 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 GenerateSource(source_file, functions, set_name) | 661 GenerateSource(source_file, functions, set_name) |
| 662 source_file.close() | 662 source_file.close() |
| 663 | 663 |
| 664 source_file = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb') | 664 source_file = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb') |
| 665 GenerateMockSource(source_file, GL_FUNCTIONS) | 665 GenerateMockSource(source_file, GL_FUNCTIONS) |
| 666 source_file.close() | 666 source_file.close() |
| 667 | 667 |
| 668 | 668 |
| 669 if __name__ == '__main__': | 669 if __name__ == '__main__': |
| 670 main(sys.argv[1:]) | 670 main(sys.argv[1:]) |
| OLD | NEW |