Home | History | Annotate | Download | only in libevent

Lines Matching defs:Struct

35 STRUCT_REF_RE = re.compile(r"^struct\[(?P<name>[a-zA-Z_][a-zA-Z0-9_]*)\]$")
36 STRUCT_DEF_RE = re.compile(r"^struct +[a-zA-Z_][a-zA-Z0-9_]* *{$")
64 # Holds everything that makes a struct
65 class Struct(object):
70 declare(" Created struct: %s" % name)
99 class StructCCode(Struct):
100 """ Knows how to generate C code for a struct """
103 Struct.__init__(self, name)
115 filep.write("struct %s;\n" % self._name)
119 filep.write("struct %s_access_ {\n" % self._name)
128 filep.write("struct %s {\n" % self._name)
129 filep.write(" struct %s_access_ *base;\n\n" % self._name)
139 """struct %(name)s *%(name)s_new(void);
140 struct %(name)s *%(name)s_new_with_arg(void *);
141 void %(name)s_free(struct %(name)s *);
142 void %(name)s_clear(struct %(name)s *);
143 void %(name)s_marshal(struct evbuffer *, const struct %(name)s *);
144 int %(name)s_unmarshal(struct %(name)s *, struct evbuffer *);
145 int %(name)s_complete(struct %(name)s *);
146 void evtag_marshal_%(name)s(struct evbuffer *, ev_uint32_t,
147 const struct %(name)s *);
148 int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t,
149 struct %(name)s *);\n"""
175 static struct %(name)s_access_ %(name)s_base__ = {
185 """struct %(name)s *
191 struct %(name)s *
194 struct %(name)s *tmp;
195 if ((tmp = malloc(sizeof(struct %(name)s))) == NULL) {
235 %(name)s_clear(struct %(name)s *tmp)
248 %(name)s_free(struct %(name)s *tmp)
267 %(name)s_marshal(struct evbuffer *evbuf, const struct %(name)s *tmp) {
295 %(name)s_unmarshal(struct %(name)s *tmp, struct evbuffer *evbuf)
355 %(name)s_complete(struct %(name)s *msg)
382 evtag_unmarshal_%(name)s(struct evbuffer *evbuf, ev_uint32_t need_tag,
383 struct %(name)s *msg)
388 struct evbuffer *tmp = evbuffer_new();
410 evtag_marshal_%(name)s(struct evbuffer *evbuf, ev_uint32_t tag,
411 const struct %(name)s *msg)
413 struct evbuffer *buf_ = evbuffer_new();
445 def SetStruct(self, struct):
446 self._struct = struct
484 'Entry "%s" does not know which struct it belongs to '
521 "int %s(struct %s *, %s *);" % (funcname, self._struct.Name(), self._ctype)
527 %(parent_name)s_%(name)s_get(struct %(parent_name)s *msg, %(ctype)s *value)
545 "int %s(struct %s *, const %s);"
553 "%(parent_name)s_%(name)s_assign(struct %(parent_name)s *msg,"
610 "int %s(struct
616 "int %s(struct %s *, const %s *);"
630 "%s_%s_get(struct %s *msg, %s **value)"
645 "%s_%s_assign(struct %s *msg, const %s *value)"
816 %(parent_name)s_%(name)s_assign(struct %(parent_name)s *msg,
885 self._ctype = "struct %s*" % refname
910 "struct evbuffer *tmp = NULL;",
938 "%s_%s_get(struct %s *msg, %s *value)"
956 %(parent_name)s_%(name)s_assign(struct %(parent_name)s *msg,
959 struct evbuffer *tmp = NULL;
1078 "int %s(struct %s *, %s *, ev_uint32_t *);"
1085 "int %s(struct %s *, const %s, ev_uint32_t);"
1094 "%s_%s_assign(struct %s *msg, "
1115 "%s_%s_get(struct %s *msg, %s *value, ev_uint32_t *plen)"
1222 "int %(funcname)s(struct %(parent_name)s *, int, %(ctype)s *);"
1229 "int %s(struct %s *, int, const %s);"
1237 "%(funcname)s(struct %(parent_name)s *msg%(optaddarg)s);"
1244 %(parent_name)s_%(name)s_get(struct %(parent_name)s *msg, int offset,
1261 "%(parent_name)s_%(name)s_assign(struct %(parent_name)s *msg, int off,",
1288 "struct %(parent_name)s *msg)",
1303 "%(parent_name)s_%(name)s_add(struct %(parent_name)s *msg%(optaddarg)s)",
1545 # References another struct defined in our file
1562 # We need to encapsulate this entry into a struct
1576 # First three tokens are: 'struct' 'name' '{'
1577 newstruct = factory.Struct(tokens[1])
1656 raise RpcGenError("Missing struct on line %d: %s" % (LINE_COUNT, line))
1662 # We are inside the struct
1669 raise RpcGenError("Trailing garbage after struct on line %d" % LINE_COUNT)
1671 # We found the end of the struct
1689 # Just gets the whole struct nicely formatted
1801 def Struct(name):