| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 Google Inc. All rights reserved. | 2 # Copyright (c) 2013 Google Inc. All rights reserved. |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 parts = param_decl.split(" ") | 402 parts = param_decl.split(" ") |
| 403 self.type = " ".join(parts[:-1]) | 403 self.type = " ".join(parts[:-1]) |
| 404 self.name = parts[-1] | 404 self.name = parts[-1] |
| 405 else: | 405 else: |
| 406 self.type = param_decl | 406 self.type = param_decl |
| 407 self.name = generate_param_name(self.type) | 407 self.name = generate_param_name(self.type) |
| 408 | 408 |
| 409 if re.match("PassRefPtr<", param_decl): | 409 if re.match("PassRefPtr<", param_decl): |
| 410 self.is_prp = True | 410 self.is_prp = True |
| 411 self.value = self.name | 411 self.value = self.name |
| 412 self.name = "prpP" + self.name[1:] | 412 self.name = "prp" + self.name[0].upper() + self.name[1:] |
| 413 self.inner_type = re.match("PassRefPtr<(.+)>", param_decl).group(1) | 413 self.inner_type = re.match("PassRefPtr<(.+)>", param_decl).group(1) |
| 414 else: | 414 else: |
| 415 self.is_prp = False | 415 self.is_prp = False |
| 416 self.value = self.name | 416 self.value = self.name |
| 417 | 417 |
| 418 | 418 |
| 419 def to_str_full(self): | 419 def to_str_full(self): |
| 420 if self.default_value is None: | 420 if self.default_value is None: |
| 421 return self.to_str_class_and_name() | 421 return self.to_str_class_and_name() |
| 422 return "%s %s = %s" % (self.type, self.name, self.default_value) | 422 return "%s %s = %s" % (self.type, self.name, self.default_value) |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 if not output_dirpath: | 552 if not output_dirpath: |
| 553 raise Exception("Output directory must be specified") | 553 raise Exception("Output directory must be specified") |
| 554 except Exception: | 554 except Exception: |
| 555 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html | 555 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html |
| 556 exc = sys.exc_info()[1] | 556 exc = sys.exc_info()[1] |
| 557 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) | 557 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) |
| 558 sys.stderr.write("Usage: <script> --output_dir <output_dir> InspectorInstrum
entation.idl\n") | 558 sys.stderr.write("Usage: <script> --output_dir <output_dir> InspectorInstrum
entation.idl\n") |
| 559 exit(1) | 559 exit(1) |
| 560 | 560 |
| 561 generate(input_path, output_dirpath) | 561 generate(input_path, output_dirpath) |
| OLD | NEW |