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

Side by Side Diff: mojo/nacl/generator/interface_dsl.py

Issue 776643004: Update NaCl's generator to support new wait APIs. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: The Change Created 6 years 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 class Interface(object): 5 class Interface(object):
6 def __init__(self): 6 def __init__(self):
7 self.functions = [] 7 self.functions = []
8 8
9 def Func(self, name, return_type): 9 def Func(self, name, return_type):
10 f = Function(self, len(self.functions), name, return_type) 10 f = Function(self, len(self.functions), name, return_type)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 self.parent = parent 49 self.parent = parent
50 self.uid = uid 50 self.uid = uid
51 self.name = name 51 self.name = name
52 self.base_type = param_type 52 self.base_type = param_type
53 self.param_type = param_type 53 self.param_type = param_type
54 self.size = None 54 self.size = None
55 self.is_input = False 55 self.is_input = False
56 self.is_output = False 56 self.is_output = False
57 self.is_array = False 57 self.is_array = False
58 self.is_struct = False 58 self.is_struct = False
59 self.is_extensible = False
Mark Seaborn 2014/12/08 22:24:12 Can you explain somewhere what is_extensible/ExtSt
Nick Bray (chromium) 2014/12/09 22:14:31 Done.
59 self.is_optional = False 60 self.is_optional = False
60 61
61 def GetSizeParam(self): 62 def GetSizeParam(self):
62 assert self.size 63 assert self.size
63 return self.parent.param_by_name[self.size] 64 return self.parent.param_by_name[self.size]
64 65
65 def In(self, ty): 66 def In(self, ty):
66 self.base_type = ty 67 self.base_type = ty
67 self.param_type = ty 68 self.param_type = ty
68 self.is_input = True 69 self.is_input = True
69 return self 70 return self
70 71
71 def InArray(self, ty, size): 72 def InArray(self, ty, size):
72 self.base_type = ty 73 self.base_type = ty
73 self.param_type = 'const ' + ty + '*' 74 self.param_type = 'const ' + ty + '*'
74 self.size = size 75 self.size = size
75 self.is_input = True 76 self.is_input = True
76 self.is_array = True 77 self.is_array = True
77 return self 78 return self
78 79
79 def InStruct(self, ty): 80 def InExtStruct(self, ty):
80 self.base_type = ty 81 self.base_type = ty
81 self.param_type = 'const struct ' + ty + '*' 82 self.param_type = 'const struct ' + ty + '*'
82 self.is_input = True 83 self.is_input = True
83 self.is_struct = True 84 self.is_struct = True
85 self.is_extensible = True
84 return self 86 return self
85 87
86 def InOut(self, ty): 88 def InOut(self, ty):
87 self.base_type = ty 89 self.base_type = ty
88 self.param_type = ty + '*' 90 self.param_type = ty + '*'
89 self.is_input = True 91 self.is_input = True
90 self.is_output = True 92 self.is_output = True
91 return self 93 return self
92 94
93 def Out(self, ty): 95 def Out(self, ty):
94 self.base_type = ty 96 self.base_type = ty
95 self.param_type = ty + '*' 97 self.param_type = ty + '*'
96 self.is_output = True 98 self.is_output = True
97 return self 99 return self
98 100
99 def OutArray(self, ty, size): 101 def OutArray(self, ty, size):
100 self.base_type = ty 102 self.base_type = ty
101 self.param_type = ty + '*' 103 self.param_type = ty + '*'
102 self.size = size 104 self.size = size
103 self.is_array = True 105 self.is_array = True
104 self.is_output = True 106 self.is_output = True
105 return self 107 return self
106 108
109 def OutFixedStruct(self, ty):
110 self.base_type = ty
111 self.param_type = 'struct ' + ty + '*'
112 self.is_output = True
113 self.is_struct = True
114 self.is_extensible = False
115 return self
116
107 def Optional(self): 117 def Optional(self):
108 assert not self.IsPassedByValue() 118 assert not self.IsPassedByValue()
109 self.is_optional = True 119 self.is_optional = True
110 return self 120 return self
111 121
112 def IsScalar(self): 122 def IsScalar(self):
113 return not self.is_array and not self.is_struct 123 return not self.is_array and not self.is_struct
114 124
115 def IsPassedByValue(self): 125 def IsPassedByValue(self):
116 return not self.is_output and self.IsScalar() 126 return not self.is_output and self.IsScalar()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698