Lines Matching refs:self
34 def __init__(self, typename, **kwargs): argument
35 self.namespace = kwargs.setdefault('namespace',
37 self._hidden = kwargs.setdefault('hidden', _get_default_hidden())
38 self.dir = kwargs.setdefault('dir', DIR_BOTH)
39 if self.dir not in [DIR_NONE, DIR_IN, DIR_OUT, DIR_BOTH]:
42 self.passby = kwargs.setdefault('passby', PASS_BY_VALUE)
43 if self.passby not in [PASS_BY_VALUE, PASS_BY_REFERENCE]:
46 self.private = kwargs.setdefault('private', False)
49 self.typename = None
50 self.rawname = None
51 elif self.namespace is None: # e.g. system provided types
52 self.typename = typename
53 self.rawname = typename
55 self.typename = self.namespace + typename
56 self.rawname = typename
58 if self.typename is not None:
59 self.dispose_fn = kwargs.setdefault('dispose_fn', self.typename + "_dispose")
61 self.dispose_fn = kwargs.setdefault('dispose_fn', None)
63 self.autogenerate_dispose_fn = kwargs.setdefault('autogenerate_dispose_fn', True)
65 if self.typename is not None:
66 self.copy_fn = kwargs.setdefault('copy_fn', self.typename + "_copy")
68 self.copy_fn = kwargs.setdefault('copy_fn', None)
70 self.autogenerate_copy_fn = kwargs.setdefault('autogenerate_copy_fn', True)
72 self.init_fn = kwargs.setdefault('init_fn', None)
73 self.init_val = kwargs.setdefault('init_val', None)
74 self.autogenerate_init_fn = kwargs.setdefault('autogenerate_init_fn', False)
76 self.check_default_fn = kwargs.setdefault('check_default_fn', None)
77 self.copy_deprecated_fn = kwargs.setdefault('copy_deprecated_fn',
80 if self.typename is not None and not self.private:
81 self.json_gen_fn = kwargs.setdefault('json_gen_fn', self.typename + "_gen_json")
82 self.json_parse_type = kwargs.setdefault('json_parse_type', "JSON_ANY")
83 if self.namespace is not None:
84 self.json_parse_fn = kwargs.setdefault('json_parse_fn',
85 … self.namespace + "_" + self.rawname + "_parse_json")
87 self.json_parse_fn = kwargs.setdefault('json_parse_fn',
88 self.typename + "_parse_json")
90 self.json_gen_fn = kwargs.setdefault('json_gen_fn', None)
91 self.json_parse_type = kwargs.setdefault('json_parse_type', None)
92 self.json_parse_fn = kwargs.setdefault('json_parse_fn', None)
94 self.autogenerate_json = kwargs.setdefault('autogenerate_json', True)
96 def marshal_in(self): argument
97 return self.dir in [DIR_IN, DIR_BOTH]
98 def marshal_out(self): argument
99 return self.dir in [DIR_OUT, DIR_BOTH]
101 def hidden(self): argument
102 if self._hidden:
107 def make_arg(self, n, passby=None): argument
108 if passby is None: passby = self.passby
111 return "%s *%s" % (self.typename, n)
113 return "%s %s" % (self.typename, n)
115 def pass_arg(self, n, isref=None, passby=None): argument
116 if passby is None: passby = self.passby
117 if isref is None: isref = self.passby == PASS_BY_REFERENCE
132 def __init__(self, typename, **kwargs): argument
136 Type.__init__(self, typename, **kwargs)
139 def __init__(self, ctype, **kwargs): argument
148 self.signed = kwargs['signed']
149 Builtin.__init__(self, ctype, **kwargs)
152 def __init__(self, w, **kwargs): argument
157 Number.__init__(self, "uint%d_t" % w, **kwargs)
159 self.width = w
162 def __init__(self, enum, value, name, **kwargs): argument
163 self.enum = enum
165 self.valuename = str.upper(name)
166 self.rawname = str.upper(enum.rawname) + "_" + self.valuename
167 self.name = str.upper(enum.value_namespace) + self.rawname
168 self.value = value
171 def __init__(self, typename, values, **kwargs): argument
175 Type.__init__(self, typename, **kwargs)
177 self.value_namespace = kwargs.setdefault('value_namespace',
178 self.namespace)
180 self.values = []
184 self.values.append(EnumerationValue(self, num, name,
185 typename=self.rawname))
186 def lookup(self, name): argument
187 for v in self.values:
194 def __init__(self, type, name, **kwargs): argument
195 self.type = type
196 self.name = name
197 self.const = kwargs.setdefault('const', False)
198 self.enumname = kwargs.setdefault('enumname', None)
199 self.init_val = kwargs.setdefault('init_val', None)
200 self.deprecated_by = kwargs.setdefault('deprecated_by', None)
204 def __init__(self, kind, typename, fields, **kwargs): argument
206 Type.__init__(self, typename, **kwargs)
208 if self.typename is not None:
209 self.init_fn = kwargs.setdefault('init_fn', self.typename + "_init")
211 self.init_fn = kwargs.setdefault('init_fn', None)
213 self.autogenerate_init_fn = kwargs.setdefault('autogenerate_init_fn', True)
215 self.kind = kind
217 self.fields = []
229 self.fields.append(Field(t,n,**kw))
238 def member(self, v, f, isref): argument
250 def __init__(self, name, fields, **kwargs): argument
252 Aggregate.__init__(self, "struct", name, fields, **kwargs)
254 def has_fields(self): argument
255 return len(self.fields) != 0
258 def __init__(self, name, fields, **kwargs): argument
264 Aggregate.__init__(self, "union", name, fields, **kwargs)
268 def __init__(self, name, keyvar_type, keyvar_name, fields, **kwargs): argument
269 Aggregate.__init__(self, "union", name, [], **kwargs)
276 self.keyvar = Field(keyvar_type, keyvar_name, **kv_kwargs)
283 self.fields.append(Field(ty, e, enumname=en))
315 def __init__(self, elem_type, lenvar_name, **kwargs): argument
318 … Type.__init__(self, namespace=elem_type.namespace, typename=elem_type.rawname + " *", **kwargs)
322 self.lenvar = Field(integer, lenvar_name, **lv_kwargs)
323 self.elem_type = elem_type
330 def __init__(self): argument
331 dict.__init__(self)
332 self.__ordered = []
334 def __setitem__(self, key, value): argument
336 self.__ordered.remove(key)
340 self.__ordered.append(key)
341 dict.__setitem__(self, key, value)
343 def ordered_keys(self): argument
344 return self.__ordered
345 def ordered_values(self): argument
346 return [self[x] for x in self.__ordered]
347 def ordered_items(self): argument
348 return [(x,self[x]) for x in self.__ordered]