| 117 self.flush() |
117 self.flush() |
| 118 |
118 |
| 119 |
119 |
| 120 def processinput(self, type, name): |
120 def processinput(self, type, name): |
| 121 const = False |
121 const = False |
| |
122 unsigned = False |
| 122 if type[0] == "const": |
123 if type[0] == "const": |
| 123 type = type[1:] |
124 type = type[1:] |
| 124 const = True |
125 const = True |
| 125 |
126 |
| |
127 if type[0] == "unsigned": |
| |
128 type = type[1:] |
| |
129 unsigned = True |
| |
130 |
| 126 if len(type) == 1: |
131 if len(type) == 1: |
| 127 # simple types (int, gboolean, etc.) and enums |
132 # simple types (int, gboolean, etc.) and enums |
| 128 if (type[0] in simpletypes) or ((type[0].startswith("Purple") and not type[0].endswith("Callback"))): |
133 if (type[0] in simpletypes) or ((type[0].startswith("Purple") and not type[0].endswith("Callback"))): |
| 129 return self.inputsimple(type, name) |
134 return self.inputsimple(type, name, unsigned) |
| 130 |
135 |
| 131 # pointers ... |
136 # pointers ... |
| 132 if (len(type) == 2) and (type[1] == pointer): |
137 if (len(type) == 2) and (type[1] == pointer): |
| 133 # strings |
138 # strings |
| 134 if type[0] in ["char", "gchar"]: |
139 if type[0] in ["char", "gchar"]: |
| 230 if (self.headersonly) and (type[0] not in self.knowntypes): |
235 if (self.headersonly) and (type[0] not in self.knowntypes): |
| 231 print "struct _%s;" % type[0] |
236 print "struct _%s;" % type[0] |
| 232 print "typedef struct _%s %s;" % (type[0], type[0]) |
237 print "typedef struct _%s %s;" % (type[0], type[0]) |
| 233 self.knowntypes.append(type[0]) |
238 self.knowntypes.append(type[0]) |
| 234 |
239 |
| 235 def inputsimple(self, type, name): |
240 def inputsimple(self, type, name, us): |
| 236 self.paramshdr.append("%s %s" % (type[0], name)) |
241 self.paramshdr.append("%s %s" % (type[0], name)) |
| 237 self.inputparams.append(("G_TYPE_INT", name)) |
242 if us: |
| |
243 self.inputparams.append(("G_TYPE_UINT", name)) |
| |
244 else: |
| |
245 self.inputparams.append(("G_TYPE_INT", name)) |
| 238 |
246 |
| 239 def inputstring(self, type, name): |
247 def inputstring(self, type, name): |
| 240 self.paramshdr.append("const char *%s" % name) |
248 self.paramshdr.append("const char *%s" % name) |
| 241 self.inputparams.append(("G_TYPE_STRING", name)) |
249 self.inputparams.append(("G_TYPE_STRING", name)) |
| 242 |
250 |
| 346 self.addstring("out", type, name) |
354 self.addstring("out", type, name) |
| 347 |
355 |
| 348 |
356 |
| 349 # input parameters |
357 # input parameters |
| 350 |
358 |
| 351 def inputsimple(self, type, name): |
359 def inputsimple(self, type, name, us): |
| 352 self.cdecls.append("\tdbus_int32_t %s;" % name) |
360 if us: |
| 353 self.cparams.append(("INT32", name)) |
361 self.cdecls.append("\tdbus_int32_t %s;" % name) |
| 354 self.addintype("i", name) |
362 self.cparams.append(("INT32", name)) |
| |
363 self.addintype("i", name) |
| |
364 else: |
| |
365 self.cdecls.append("\tdbus_uint32_t %s;" % name) |
| |
366 self.cparams.append(("UINT32", name)) |
| |
367 self.addintype("u", name) |
| 355 |
368 |
| 356 def inputstring(self, type, name): |
369 def inputstring(self, type, name): |
| 357 self.cdecls.append("\tconst char *%s;" % name) |
370 self.cdecls.append("\tconst char *%s;" % name) |
| 358 self.cparams.append(("STRING", name)) |
371 self.cparams.append(("STRING", name)) |
| 359 self.ccode .append("\tNULLIFY(%s);" % name) |
372 self.ccode .append("\tNULLIFY(%s);" % name) |