| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os.path | 5 import os.path |
| 6 import sys | 6 import sys |
| 7 import optparse | 7 import optparse |
| 8 try: | 8 try: |
| 9 import json | 9 import json |
| 10 except ImportError: | 10 except ImportError: |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 "number": "double", | 208 "number": "double", |
| 209 "integer": "int", | 209 "integer": "int", |
| 210 "boolean": "bool" | 210 "boolean": "bool" |
| 211 } | 211 } |
| 212 defaults = { | 212 defaults = { |
| 213 "number": "0", | 213 "number": "0", |
| 214 "integer": "0", | 214 "integer": "0", |
| 215 "boolean": "false" | 215 "boolean": "false" |
| 216 } | 216 } |
| 217 jsontypes = { | 217 jsontypes = { |
| 218 "number": "TypeNumber", | 218 "number": "TypeDouble", |
| 219 "integer": "TypeNumber", | 219 "integer": "TypeInteger", |
| 220 "boolean": "TypeBoolean", | 220 "boolean": "TypeBoolean", |
| 221 } | 221 } |
| 222 return { | 222 return { |
| 223 "return_type": typedefs[type], | 223 "return_type": typedefs[type], |
| 224 "pass_type": typedefs[type], | 224 "pass_type": typedefs[type], |
| 225 "to_pass_type": "%s", | 225 "to_pass_type": "%s", |
| 226 "to_raw_type": "%s", | 226 "to_raw_type": "%s", |
| 227 "to_rvalue": "%s", | 227 "to_rvalue": "%s", |
| 228 "type": typedefs[type], | 228 "type": typedefs[type], |
| 229 "raw_type": typedefs[type], | 229 "raw_type": typedefs[type], |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 cpp_file = output_file(cpp_file_name) | 346 cpp_file = output_file(cpp_file_name) |
| 347 h_file.write(h_template.render(template_context)) | 347 h_file.write(h_template.render(template_context)) |
| 348 cpp_file.write(cpp_template.render(template_context)) | 348 cpp_file.write(cpp_template.render(template_context)) |
| 349 h_file.close() | 349 h_file.close() |
| 350 cpp_file.close() | 350 cpp_file.close() |
| 351 | 351 |
| 352 | 352 |
| 353 for domain in json_api["domains"]: | 353 for domain in json_api["domains"]: |
| 354 if domain["domain"] in generate_domains: | 354 if domain["domain"] in generate_domains: |
| 355 generate(domain) | 355 generate(domain) |
| OLD | NEW |