Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: tools/json_to_struct/json_to_struct.py

Issue 13599004: Fix some low hanging inefficiencies in the docs server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/json_schema_compiler/model.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2012 The Chromium Authors. All rights reserved. 2 # Copyright 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 # Format for the JSON schema file: 6 # Format for the JSON schema file:
7 # { 7 # {
8 # "type_name": "DesiredCStructName", 8 # "type_name": "DesiredCStructName",
9 # "headers": [ // Optional list of headers to be included by the .h. 9 # "headers": [ // Optional list of headers to be included by the .h.
10 # "path/to/header.h" 10 # "path/to/header.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 # } 47 # }
48 48
49 import json 49 import json
50 from datetime import datetime 50 from datetime import datetime
51 import os.path 51 import os.path
52 import sys 52 import sys
53 import optparse 53 import optparse
54 import re 54 import re
55 _script_path = os.path.realpath(__file__) 55 _script_path = os.path.realpath(__file__)
56 56
57 sys.path.insert(0, os.path.normpath(_script_path + "/../../")) 57 sys.path.insert(0, os.path.normpath(_script_path + "/../../json_comment_eater"))
58 try: 58 try:
59 import json_comment_eater 59 import json_comment_eater
60 finally: 60 finally:
61 sys.path.pop(0) 61 sys.path.pop(0)
62 62
63 import struct_generator 63 import struct_generator
64 import element_generator 64 import element_generator
65 65
66 HEAD = """// Copyright %d The Chromium Authors. All rights reserved. 66 HEAD = """// Copyright %d The Chromium Authors. All rights reserved.
67 // Use of this source code is governed by a BSD-style license that can be 67 // Use of this source code is governed by a BSD-style license that can be
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 basepath = os.path.normpath(opts.destbase) 202 basepath = os.path.normpath(opts.destbase)
203 else: 203 else:
204 basepath = '' 204 basepath = ''
205 205
206 schema = _Load(opts.schema) 206 schema = _Load(opts.schema)
207 description = _Load(description_filename) 207 description = _Load(description_filename)
208 208
209 head = HEAD % (datetime.now().year, opts.schema, description_filename) 209 head = HEAD % (datetime.now().year, opts.schema, description_filename)
210 _GenerateH(basepath, output_root, head, opts.namespace, schema, description) 210 _GenerateH(basepath, output_root, head, opts.namespace, schema, description)
211 _GenerateCC(basepath, output_root, head, opts.namespace, schema, description) 211 _GenerateCC(basepath, output_root, head, opts.namespace, schema, description)
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/model.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698