| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 # Splitting parameters by a comma, assuming that attribute lists contain
no more than one attribute. | 240 # Splitting parameters by a comma, assuming that attribute lists contain
no more than one attribute. |
| 241 self.params = map(Parameter, map(str.strip, match.group(4).split(","))) | 241 self.params = map(Parameter, map(str.strip, match.group(4).split(","))) |
| 242 | 242 |
| 243 self.accepts_cookie = len(self.params) and self.params[0].type == "const
InspectorInstrumentationCookie&" | 243 self.accepts_cookie = len(self.params) and self.params[0].type == "const
InspectorInstrumentationCookie&" |
| 244 self.returns_cookie = self.return_type == "InspectorInstrumentationCooki
e" | 244 self.returns_cookie = self.return_type == "InspectorInstrumentationCooki
e" |
| 245 | 245 |
| 246 self.returns_value = self.return_type != "void" | 246 self.returns_value = self.return_type != "void" |
| 247 | 247 |
| 248 if self.return_type == "bool": | 248 if self.return_type == "bool": |
| 249 self.default_return_value = "false" | 249 self.default_return_value = "false" |
| 250 elif self.return_type == "int": |
| 251 self.default_return_value = "0" |
| 250 elif self.return_type == "String": | 252 elif self.return_type == "String": |
| 251 self.default_return_value = "\"\"" | 253 self.default_return_value = "\"\"" |
| 252 else: | 254 else: |
| 253 self.default_return_value = self.return_type + "()" | 255 self.default_return_value = self.return_type + "()" |
| 254 | 256 |
| 255 for param in self.params: | 257 for param in self.params: |
| 256 if "DefaultReturn" in param.options: | 258 if "DefaultReturn" in param.options: |
| 257 self.default_return_value = param.name | 259 self.default_return_value = param.name |
| 258 | 260 |
| 259 self.params_impl = self.params | 261 self.params_impl = self.params |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 if not output_dirpath: | 524 if not output_dirpath: |
| 523 raise Exception("Output directory must be specified") | 525 raise Exception("Output directory must be specified") |
| 524 except Exception: | 526 except Exception: |
| 525 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html | 527 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html |
| 526 exc = sys.exc_info()[1] | 528 exc = sys.exc_info()[1] |
| 527 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) | 529 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) |
| 528 sys.stderr.write("Usage: <script> --output_dir <output_dir> InspectorInstrum
entation.idl\n") | 530 sys.stderr.write("Usage: <script> --output_dir <output_dir> InspectorInstrum
entation.idl\n") |
| 529 exit(1) | 531 exit(1) |
| 530 | 532 |
| 531 generate(input_path, output_dirpath) | 533 generate(input_path, output_dirpath) |
| OLD | NEW |