OLD | NEW |
1 # -*- python -*- | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 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 | |
22 #import string | |
23 #import StringIO | |
24 import sys | 21 import sys |
25 import os | 22 import os |
26 | 23 |
27 COPYRIGHT_AND_AUTOGEN_COMMENT = """\ | 24 COPYRIGHT_AND_AUTOGEN_COMMENT = """\ |
28 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 25 // 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 | 26 // Use of this source code is governed by a BSD-style license that can be |
30 // found in the LICENSE file. | 27 // found in the LICENSE file. |
31 // | 28 // |
32 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 29 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
33 // | 30 // |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 PrintClientFile(cc_file, h_file_name, specs, thread_check) | 457 PrintClientFile(cc_file, h_file_name, specs, thread_check) |
461 elif mode == 'server': | 458 elif mode == 'server': |
462 PrintHeaderFile(h_file, True, include_guard_name, interface_name, specs) | 459 PrintHeaderFile(h_file, True, include_guard_name, interface_name, specs) |
463 PrintServerFile(cc_file, h_file_name, interface_name, specs) | 460 PrintServerFile(cc_file, h_file_name, interface_name, specs) |
464 | 461 |
465 return 0 | 462 return 0 |
466 | 463 |
467 | 464 |
468 if __name__ == '__main__': | 465 if __name__ == '__main__': |
469 sys.exit(main(sys.argv)) | 466 sys.exit(main(sys.argv)) |
OLD | NEW |