OLD | NEW |
1 # -*- python -*- | 1 # -*- python -*- |
2 # Copyright 2010 The Native Client Authors. All rights reserved. | 2 # Copyright 2010 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can | 3 # Use of this source code is governed by a BSD-style license that can |
4 # be found in the LICENSE file. | 4 # be 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 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 types = {'bool': ['b', 'bool', 'u.bval', ''], | 64 types = {'bool': ['b', 'bool', 'u.bval', ''], |
65 'char[]': ['C', 'char*', 'arrays.carr', 'u.count'], | 65 'char[]': ['C', 'char*', 'arrays.carr', 'u.count'], |
66 'double': ['d', 'double', 'u.dval', ''], | 66 'double': ['d', 'double', 'u.dval', ''], |
67 'double[]': ['D', 'double*', 'arrays.darr', 'u.count'], | 67 'double[]': ['D', 'double*', 'arrays.darr', 'u.count'], |
68 'handle': ['h', 'NaClSrpcImcDescType', 'u.hval', ''], | 68 'handle': ['h', 'NaClSrpcImcDescType', 'u.hval', ''], |
69 'int32_t': ['i', 'int32_t', 'u.ival', ''], | 69 'int32_t': ['i', 'int32_t', 'u.ival', ''], |
70 'int32_t[]': ['I', 'int32_t*', 'arrays.iarr', 'u.count'], | 70 'int32_t[]': ['I', 'int32_t*', 'arrays.iarr', 'u.count'], |
71 'int64_t': ['l', 'int64_t', 'u.lval', ''], | 71 'int64_t': ['l', 'int64_t', 'u.lval', ''], |
72 'int64_t[]': ['L', 'int64_t', 'arrays.larr', 'u.count'], | 72 'int64_t[]': ['L', 'int64_t', 'arrays.larr', 'u.count'], |
73 'PP_Instance': ['l', 'PP_Instance', 'u.lval', ''], | 73 'PP_Instance': ['l', 'PP_Instance', 'u.ival', ''], |
74 'PP_Module': ['l', 'PP_Module', 'u.lval', ''], | 74 'PP_Module': ['l', 'PP_Module', 'u.ival', ''], |
75 'PP_Resource': ['l', 'PP_Resource', 'u.lval', ''], | 75 'PP_Resource': ['l', 'PP_Resource', 'u.ival', ''], |
76 'string': ['s', 'char*', 'arrays.str', ''], | 76 'string': ['s', 'char*', 'arrays.str', ''], |
77 } | 77 } |
78 | 78 |
79 | 79 |
80 def AddHeader(name): | 80 def AddHeader(name): |
81 """Adds a header to both the .cc and .h files.""" | 81 """Adds a header to both the .cc and .h files.""" |
82 global HEADER_START | 82 global HEADER_START |
83 global SOURCE_FILE_INCLUDES | 83 global SOURCE_FILE_INCLUDES |
84 | 84 |
85 HEADER_START += "#include \"%s\"\n" % name | 85 HEADER_START += "#include \"%s\"\n" % name |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 PrintClientFile(cc_file, h_file_name, specs) | 374 PrintClientFile(cc_file, h_file_name, specs) |
375 elif mode == 'server': | 375 elif mode == 'server': |
376 PrintHeaderFile(h_file, True, include_guard_name, interface_name, specs) | 376 PrintHeaderFile(h_file, True, include_guard_name, interface_name, specs) |
377 PrintServerFile(cc_file, h_file_name, interface_name, specs) | 377 PrintServerFile(cc_file, h_file_name, interface_name, specs) |
378 | 378 |
379 return 0 | 379 return 0 |
380 | 380 |
381 | 381 |
382 if __name__ == '__main__': | 382 if __name__ == '__main__': |
383 sys.exit(main(sys.argv)) | 383 sys.exit(main(sys.argv)) |
OLD | NEW |