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

Side by Side Diff: ppapi/native_client/src/tools/srpcgen.py

Issue 9119001: srpcgen: Use 'const char*' for string parameters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased; update year in copyright header srpcgen emits Created 8 years, 11 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 | « ppapi/native_client/src/shared/ppapi_proxy/upcall_server.cc ('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 # -*- python -*- 1 # -*- python -*-
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2012 The Native Client 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 """Build "SRPC" interfaces from specifications. 6 """Build "SRPC" interfaces from specifications.
7 7
8 SRPC interfaces consist of one or more interface classes, typically defined 8 SRPC interfaces consist of one or more interface classes, typically defined
9 in a set of .srpc files. The specifications are Python dictionaries, with a 9 in a set of .srpc files. The specifications are Python dictionaries, with a
10 top level 'name' element and an 'rpcs' element. The rpcs element is a list 10 top level 'name' element and an 'rpcs' element. The rpcs element is a list
11 containing a number of rpc methods, each of which has a 'name', an 'inputs', 11 containing a number of rpc methods, each of which has a 'name', an 'inputs',
12 and an 'outputs' element. These elements are lists of input or output 12 and an 'outputs' element. These elements are lists of input or output
13 parameters, which are lists pairs containing a name and type. The set of 13 parameters, which are lists pairs containing a name and type. The set of
14 types includes all the SRPC basic types. 14 types includes all the SRPC basic types.
15 15
16 These SRPC specifications are used to generate a header file and either a 16 These SRPC specifications are used to generate a header file and either a
17 server or client stub file, as determined by the command line flag -s or -c. 17 server or client stub file, as determined by the command line flag -s or -c.
18 """ 18 """
19 19
20 import getopt 20 import getopt
21 #import re 21 #import re
22 #import string 22 #import string
23 #import StringIO 23 #import StringIO
24 import sys 24 import sys
25 import os 25 import os
26 26
27 COPYRIGHT_AND_AUTOGEN_COMMENT = """\ 27 COPYRIGHT_AND_AUTOGEN_COMMENT = """\
28 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 28 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
29 // Use of this source code is governed by a BSD-style license that can be 29 // Use of this source code is governed by a BSD-style license that can be
30 // found in the LICENSE file. 30 // found in the LICENSE file.
31 // 31 //
32 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 32 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
33 // 33 //
34 // Automatically generated code. See srpcgen.py 34 // Automatically generated code. See srpcgen.py
35 // 35 //
36 // NaCl Simple Remote Procedure Call interface abstractions. 36 // NaCl Simple Remote Procedure Call interface abstractions.
37 """ 37 """
38 38
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 'double': ['d', 'double', 'u.dval', ''], 74 'double': ['d', 'double', 'u.dval', ''],
75 'double[]': ['D', 'double*', 'arrays.darr', 'u.count'], 75 'double[]': ['D', 'double*', 'arrays.darr', 'u.count'],
76 'handle': ['h', 'NaClSrpcImcDescType', 'u.hval', ''], 76 'handle': ['h', 'NaClSrpcImcDescType', 'u.hval', ''],
77 'int32_t': ['i', 'int32_t', 'u.ival', ''], 77 'int32_t': ['i', 'int32_t', 'u.ival', ''],
78 'int32_t[]': ['I', 'int32_t*', 'arrays.iarr', 'u.count'], 78 'int32_t[]': ['I', 'int32_t*', 'arrays.iarr', 'u.count'],
79 'int64_t': ['l', 'int64_t', 'u.lval', ''], 79 'int64_t': ['l', 'int64_t', 'u.lval', ''],
80 'int64_t[]': ['L', 'int64_t', 'arrays.larr', 'u.count'], 80 'int64_t[]': ['L', 'int64_t', 'arrays.larr', 'u.count'],
81 'PP_Instance': ['i', 'PP_Instance', 'u.ival', ''], 81 'PP_Instance': ['i', 'PP_Instance', 'u.ival', ''],
82 'PP_Module': ['i', 'PP_Module', 'u.ival', ''], 82 'PP_Module': ['i', 'PP_Module', 'u.ival', ''],
83 'PP_Resource': ['i', 'PP_Resource', 'u.ival', ''], 83 'PP_Resource': ['i', 'PP_Resource', 'u.ival', ''],
84 'string': ['s', 'char*', 'arrays.str', ''], 84 'string': ['s', 'const char*', 'arrays.str', ''],
85 } 85 }
86 86
87 def AddInclude(name): 87 def AddInclude(name):
88 """Adds an include to the include section of both .cc and .h files.""" 88 """Adds an include to the include section of both .cc and .h files."""
89 EXTRA_INCLUDES.append('#include "%s"' % name) 89 EXTRA_INCLUDES.append('#include "%s"' % name)
90 90
91 91
92 def HeaderFileIncludes(): 92 def HeaderFileIncludes():
93 """Includes are sorted alphabetically.""" 93 """Includes are sorted alphabetically."""
94 EXTRA_INCLUDES.sort() 94 EXTRA_INCLUDES.sort()
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 PrintClientFile(cc_file, h_file_name, specs, thread_check) 458 PrintClientFile(cc_file, h_file_name, specs, thread_check)
459 elif mode == 'server': 459 elif mode == 'server':
460 PrintHeaderFile(h_file, True, include_guard_name, interface_name, specs) 460 PrintHeaderFile(h_file, True, include_guard_name, interface_name, specs)
461 PrintServerFile(cc_file, h_file_name, interface_name, specs) 461 PrintServerFile(cc_file, h_file_name, interface_name, specs)
462 462
463 return 0 463 return 0
464 464
465 465
466 if __name__ == '__main__': 466 if __name__ == '__main__':
467 sys.exit(main(sys.argv)) 467 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « ppapi/native_client/src/shared/ppapi_proxy/upcall_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698