Example #1
0
def build_enum(enum, enums):
    if not enum:
        return
    Indenter.enter('typedef enum {')

    first = True
    for name, member in enum.items():
        if not first:
            print(',')
        first = False
        Indenter.printx(_constant_name(member.fullname()))
        value = getattr(member, 'value', None)
        alias = getattr(member, 'alias', None)
        if value is not None:
            val = " = %d" % value
        elif alias is not None:
            val, src, typ = alias
            if src:
                val = enums[src][val].fullname()
            elif typ == 'enum':
                val = enum[val].fullname()
            val = " = %s" % _constant_name(val)
        else:
            val = None
        if val is not None:
            sys.stdout.write(val)
    print('')

    Indenter.leave('} %s;' % _c_type(enum.name))
    print('')
Example #2
0
def build(ipc):
    Indenter.printline("# This module is automatically generated by XMMS2. Do not edit.")
    Indenter.printline("if module?.exports?\n\txmmsclient = require \"./xmmsclient\"")
    Indenter.printline("else\n\txmmsclient = @xmmsclient")

    for object in ipc.objects:
        camel_name = camel_case(object.name)

        Indenter.printline("# %s" % camel_name)
        Indenter.printline("class %s" % camel_name)
        Indenter.enter("")
        Indenter.printline("object_id: %d" % object.id)
        Indenter.printline("constructor: (@client) ->")
        Indenter.printline()

        for method in object.methods:
            emit_method_code(object, method, "")

        for signal in object.signals:
            emit_method_code(object, signal, "signal_")

        for broadcast in object.broadcasts:
            emit_method_code(object, broadcast, "broadcast_")

        Indenter.leave()
        Indenter.printline("xmmsclient.Client.IPC.%s = %s" % (camel_name, camel_name))
        Indenter.printline()
Example #3
0
def build(ipc):
    Indenter.printline("# This module is automatically generated by XMMS2. Do not edit.")
    Indenter.printline("if module?.exports?\n\txmmsclient = require \"./xmmsclient\"")
    Indenter.printline("else\n\txmmsclient = @xmmsclient")

    for object in ipc.objects:
        camel_name = camel_case(object.name)

        Indenter.printline("# %s" % camel_name)
        Indenter.printline("class %s" % camel_name)
        Indenter.enter("")
        Indenter.printline("object_id: %d" % object.id)
        Indenter.printline("constructor: (@client) ->")
        Indenter.printline()

        for method in object.methods:
            emit_method_code(object, method, "")

        for signal in object.signals:
            emit_method_code(object, signal, "signal_")

        for broadcast in object.broadcasts:
            emit_method_code(object, broadcast, "broadcast_")

        Indenter.leave()
        Indenter.printline("xmmsclient.Client.IPC.%s = %s" % (camel_name, camel_name))
        Indenter.printline()
Example #4
0
def build_enum(enum, enums):
	if not enum:
		return
	Indenter.enter('typedef enum {')

	first = True
	for name, member in enum.items():
		if not first:
			print(',')
		first = False
		Indenter.printx(_constant_name(member.fullname()))
		value = getattr(member, 'value', None)
		alias = getattr(member, 'alias', None)
		if value is not None:
			val = " = %d" % value
		elif alias is not None:
			val, src, typ = alias
			if src:
				val = enums[src][val].fullname()
			elif typ == 'enum':
				val = enum[val].fullname()
			val = " = %s" % _constant_name(val)
		else:
			val = None
		if val is not None:
			sys.stdout.write(val)
	print('')

	Indenter.leave('} %s;' % _c_type(enum.name))
	print('')
Example #5
0
def build(object_name, c_type):
	ipc = genipc.parse_xml('../src/ipc.xml')

	Indenter.printline('/* This code is automatically generated from foobar. Do not edit. */')
	Indenter.printline()
	Indenter.printline("#include <xmmsc/xmmsv.h>")

	for object in ipc.objects:
		if object.name == object_name:
			for method in object.methods:
				emit_method_define_code(object, method, c_type)

			Indenter.printline()
			Indenter.printline('static void')
			Indenter.printline('xmms_%s_register_ipc_commands (xmms_object_t *%s_object)' % (object.name, object.name))
			Indenter.enter('{')

			Indenter.printline('xmms_ipc_object_register (%i, %s_object);' % (object.id, object.name))
			Indenter.printline()

			for method in object.methods:
				emit_method_add_code(object, method)

			Indenter.printline()

			for broadcast in object.broadcasts:
				Indenter.printline('xmms_ipc_broadcast_register (%s_object, %i);' % (object.name, broadcast.id))

			Indenter.printline()

			for signal in object.signals:
				Indenter.printline('xmms_ipc_signal_register (%s_object, %i);' % (object.name, signal.id))

			Indenter.leave('}')

			Indenter.printline()
			Indenter.printline('static void')
			Indenter.printline('xmms_%s_unregister_ipc_commands (void)' % object.name)
			Indenter.enter('{')

			for broadcast in object.broadcasts:
				Indenter.printline('xmms_ipc_broadcast_unregister (%i);' % broadcast.id)

			Indenter.printline()

			for signal in object.signals:
				Indenter.printline('xmms_ipc_signal_unregister (%i);' % signal.id)

			Indenter.printline()
			Indenter.printline('xmms_ipc_object_unregister (%i);' % object.id)
			Indenter.leave('}')
Example #6
0
def build(object_name, c_type):
	ipc = genipc.parse_xml('../src/ipc.xml')

	Indenter.printline('/* This code is automatically generated from foobar. Do not edit. */')
	Indenter.printline()
	Indenter.printline("#include <xmmsc/xmmsv.h>")

	for object in ipc.objects:
		if object.name == object_name:
			for method in object.methods:
				emit_method_define_code(object, method, c_type)

			Indenter.printline()
			Indenter.printline('static void')
			Indenter.printline('xmms_%s_register_ipc_commands (xmms_object_t *%s_object)' % (object.name, object.name))
			Indenter.enter('{')

			Indenter.printline('xmms_ipc_object_register (%s, %s_object);' % (_enum_value(object.id), object.name))
			Indenter.printline()

			for method in object.methods:
				emit_method_add_code(object, method)

			Indenter.printline()

			for broadcast in object.broadcasts:
				Indenter.printline('xmms_ipc_broadcast_register (%s_object, %s);' % (object.name, _enum_value(broadcast.id)))

			Indenter.printline()

			for signal in object.signals:
				Indenter.printline('xmms_ipc_signal_register (%s_object, %s);' % (object.name, _enum_value(signal.id)))

			Indenter.leave('}')

			Indenter.printline()
			Indenter.printline('static void')
			Indenter.printline('xmms_%s_unregister_ipc_commands (void)' % object.name)
			Indenter.enter('{')

			for broadcast in object.broadcasts:
				Indenter.printline('xmms_ipc_broadcast_unregister (%s);' % _enum_value(broadcast.id))

			Indenter.printline()

			for signal in object.signals:
				Indenter.printline('xmms_ipc_signal_unregister (%s);' % _enum_value(signal.id))

			Indenter.printline()
			Indenter.printline('xmms_ipc_object_unregister (%s);' % _enum_value(object.id))
			Indenter.leave('}')
Example #7
0
def emit_method_code(object, method, name_prefix):
    method_name = name_prefix + method.name
    arguments = getattr(method, "arguments", [])


    s = ", ".join(a.name for a in arguments)
    if len(arguments) > 0:
        Indenter.enter("%s: (%s) ->" % (method_name, s))
    else:
        Indenter.enter("%s: ->" % method_name)

    Indenter.printline("### %s ###" % method.documentation)

    for a in arguments:
        if len(a.type) > 1:
            subtype = jstype(a.type[1])
            s = "%s = xmmsclient.Message.check_%s %s, \"%s\""
            Indenter.printline(s % (a.name, a.type[0], a.name, subtype))
        else:
            s = "%s = xmmsclient.Message.check_%s %s"
            Indenter.printline(s % (a.name, a.type[0], a.name))

    if arguments:
        Indenter.printline()

    Indenter.printline("message = new xmmsclient.Message()")

    if not name_prefix:
        Indenter.printline("message.object_id = @object_id")
        Indenter.printline("message.command_id = %i" % method.id)
        s = ", ".join(a.name for a in arguments)
        Indenter.printline("message.args = [%s]" % s)
    elif name_prefix == "signal_":
        Indenter.printline("message.object_id = 0")
        Indenter.printline("message.command_id = 32")
        Indenter.printline("message.args = [%i]" % method.id)
    elif name_prefix == "broadcast_":
        Indenter.printline("message.object_id = 0")
        Indenter.printline("message.command_id = 33")
        Indenter.printline("message.args = [%i]" % method.id)

    Indenter.printline()

    if name_prefix == "signal_":
        Indenter.printline("return @client.send_signal_message message, %i" % method.id)
    else:
        Indenter.printline("return @client.send_message message")
    Indenter.leave("")
    Indenter.printline()
Example #8
0
def emit_method_code(object, method, name_prefix):
    method_name = name_prefix + method.name
    arguments = getattr(method, "arguments", [])

    s = ", ".join(a.name for a in arguments)
    if len(arguments) > 0:
        Indenter.enter("%s: (%s) ->" % (method_name, s))
    else:
        Indenter.enter("%s: ->" % method_name)

    Indenter.printline("### %s ###" % method.documentation)

    for a in arguments:
        if len(a.type) > 1 and a.type[1] != "unknown":
            subtype = jstype(a.type[1])
            s = "%s = xmmsclient.Message.check_%s %s, \"%s\""
            Indenter.printline(s % (a.name, a.type[0], a.name, subtype))
        else:
            s = "%s = xmmsclient.Message.check_%s %s"
            Indenter.printline(s % (a.name, a.type[0], a.name))

    if arguments:
        Indenter.printline()

    Indenter.printline("message = new xmmsclient.Message()")

    if not name_prefix:
        Indenter.printline("message.object_id = @object_id")
        Indenter.printline("message.command_id = %i" % method.id)
        s = ", ".join(a.name for a in arguments)
        Indenter.printline("message.args = [%s]" % s)
    elif name_prefix == "signal_":
        Indenter.printline("message.object_id = 0")
        Indenter.printline("message.command_id = 32")
        Indenter.printline("message.args = [%i]" % method.id)
    elif name_prefix == "broadcast_":
        Indenter.printline("message.object_id = 0")
        Indenter.printline("message.command_id = 33")
        Indenter.printline("message.args = [%i]" % method.id)

    Indenter.printline()

    if name_prefix == "signal_":
        Indenter.printline("return @client.send_signal_message message, %i" % method.id)
    else:
        Indenter.printline("return @client.send_message message")
    Indenter.leave("")
    Indenter.printline()
Example #9
0
def emit_method_define_code(object, method, c_type):
	full_method_name = 'xmms_%s_client_%s' % (object.name, method.name)

	# output a prototype
	#static __XMMS_CMD_DO_RETTYPE_##_rettype() realfunc (argtype0 __XMMS_CMD_DO_ARGTYPE_##argtype1 __XMMS_CMD_DO_ARGTYPE_##argtype2 __XMMS_CMD_DO_ARGTYPE_##argtype3 __XMMS_CMD_DO_ARGTYPE_##argtype4 __XMMS_CMD_DO_ARGTYPE_##argtype5 __XMMS_CMD_DO_ARGTYPE_##argtype6, xmms_error_t *); \


	Indenter.printline("static void")
	Indenter.printline("%s (xmms_object_t *object, xmms_object_cmd_arg_t *arg)" % method_name_to_cname (method.name))
	Indenter.enter("{")

	if method.arguments:
		Indenter.printline("xmmsv_t *t;")

	Indenter.enter("if (xmmsv_list_get_size (arg->args) != %d) {" % len(method.arguments))
	Indenter.printline('XMMS_DBG ("Wrong number of arguments to %s (%%d)", xmmsv_list_get_size (arg->args));' % method.name)
	Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to %s");' % method.name)
	Indenter.printline('return;')
	Indenter.leave("}")

	for i, a in enumerate(method.arguments):
		Indenter.printline("%s argval%d;" % (c_type_map[a.type[0]], i))

	Indenter.printline()

	for i, a in enumerate(method.arguments):
		Indenter.enter("if (!xmmsv_list_get (arg->args, %d, &t)) {" % i)
		Indenter.printline('XMMS_DBG ("Missing arg %d in %s");' % (i, method.name))
		Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg %d in %s");' % (i, method.name))
		Indenter.printline('return;')
		Indenter.leave("}")

		if c_getter_map[a.type[0]] is None:
			Indenter.printline("argval%d = t;" % i)
		else:
			Indenter.enter("if (!%s (t, &argval%d)) {" % (c_getter_map[a.type[0]], i))
			Indenter.printline('XMMS_DBG ("Error parsing arg %d in %s");' % (i, method.name))
			Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg %d in %s");' % (i, method.name))
			Indenter.printline("return;")
			Indenter.leave("}")


	Indenter.printline()

	args = "".join([("argval%d, " % i) for i in  range(len(method.arguments))])
	funccall = "%s ((%s) object, %s&arg->error)" % (full_method_name, c_type, args)
	if method.return_value:
		if c_creator_map[method.return_value.type[0]] is None:
			Indenter.printline("arg->retval = %s;" % (funccall))
		else:
			if c_nullable_type_map[method.return_value.type[0]]:
				Indenter.printline("%s retval = %s;" % (c_nullable_type_map[method.return_value.type[0]], funccall))
				Indenter.enter("if (retval != NULL) {")
				Indenter.printline("arg->retval = %s (retval);" % c_creator_map[method.return_value.type[0]])
				Indenter.leave("}")
			else:
				Indenter.printline("arg->retval = %s (%s);" % (c_creator_map[method.return_value.type[0]], funccall))
	else:
		Indenter.printline("%s;" % funccall)
		Indenter.printline("arg->retval = xmmsv_new_none ();")


	Indenter.leave("}")

	Indenter.printline()
	Indenter.printline()
Example #10
0
def emit_method_define_code(object, method, c_type):
	full_method_name = 'xmms_%s_client_%s' % (object.name, method.name)

	# output a prototype
	#static __XMMS_CMD_DO_RETTYPE_##_rettype() realfunc (argtype0 __XMMS_CMD_DO_ARGTYPE_##argtype1 __XMMS_CMD_DO_ARGTYPE_##argtype2 __XMMS_CMD_DO_ARGTYPE_##argtype3 __XMMS_CMD_DO_ARGTYPE_##argtype4 __XMMS_CMD_DO_ARGTYPE_##argtype5 __XMMS_CMD_DO_ARGTYPE_##argtype6, xmms_error_t *); \


	Indenter.printline("static void")
	Indenter.printline("%s (xmms_object_t *object, xmms_object_cmd_arg_t *arg)" % method_name_to_cname (method.name))
	Indenter.enter("{")

	if method.arguments:
		Indenter.printline("xmmsv_t *t;")

	Indenter.enter("if (xmmsv_list_get_size (arg->args) != %d) {" % len(method.arguments))
	Indenter.printline('XMMS_DBG ("Wrong number of arguments to %s (%%d)", xmmsv_list_get_size (arg->args));' % method.name)
	Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to %s");' % method.name)
	Indenter.printline('return;')
	Indenter.leave("}")

	for i, a in enumerate(method.arguments):
		Indenter.printline("%s argval%d;" % (get_type(a.type[0]), i))

	Indenter.printline()

	for i, a in enumerate(method.arguments):
		Indenter.enter("if (!xmmsv_list_get (arg->args, %d, &t)) {" % i)
		Indenter.printline('XMMS_DBG ("Missing arg %d in %s");' % (i, method.name))
		Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg %d in %s");' % (i, method.name))
		Indenter.printline('return;')
		Indenter.leave("}")

		if a.type[0] == 'list' and len(a.type) > 1 and has_xmmsv_type(a.type[1]):
			Indenter.enter('if (!xmmsv_list_restrict_type (t, %s)) {' % (get_xmmsv_type(a.type[1])))
			Indenter.printline('XMMS_DBG("Wrong list content (not %s) for arg %d in %s.");' % (a.type[1], i, method.name))
			Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong list content (not %s) for arg %d in %s.");' % (a.type[1], i, method.name))
			Indenter.leave('}')

		if get_getter(a.type[0]) is None:
			Indenter.printline("argval%d = t;" % i)
		else:
			if get_cast(a.type[0]) is None:
				Indenter.enter("if (!%s (t, &argval%d)) {" % (get_getter(a.type[0]), i))
			else:
				Indenter.printline("if (!%s (t, (%s *) &argval%d)) {" %(get_getter(a.type[0]), get_cast(a.type[0]), i))
			Indenter.printline('XMMS_DBG ("Error parsing arg %d in %s");' % (i, method.name))
			Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg %d in %s");' % (i, method.name))
			Indenter.printline("return;")
			Indenter.leave("}")


	Indenter.printline()

	# Assemble a list of arguments for the function call
	args = []

	args.append("(%s) object" % c_type)
	args.extend("argval%d" % i for i in range(len(method.arguments)))

	if method.need_client:
		args.append("arg->client")
	if method.need_cookie:
		args.append("arg->cookie")

	args.append("&arg->error")

	funccall = "%s (%s)" % (full_method_name, ", ".join(args))
	if method.return_value:
		if get_creator(method.return_value.type[0]) is None:
			Indenter.printline("arg->retval = %s;" % (funccall))
		else:
			if get_nullable(method.return_value.type[0]):
				Indenter.printline("%s retval = %s;" % (get_nullable(method.return_value.type[0]), funccall))
				Indenter.enter("if (retval != NULL) {")
				Indenter.printline("arg->retval = %s (retval);" % get_creator(method.return_value.type[0]))
				Indenter.leave("}")
			else:
				Indenter.printline("arg->retval = %s (%s);" % (get_creator(method.return_value.type[0]), funccall))
	else:
		Indenter.printline("%s;" % funccall)
		if method.noreply:
			Indenter.printline("arg->retval = NULL;")
		else:
			Indenter.printline("arg->retval = xmmsv_new_none ();")


	Indenter.leave("}")

	Indenter.printline()
	Indenter.printline()
Example #11
0
def emit_method_define_code(object, method, c_type):
	full_method_name = 'xmms_%s_client_%s' % (object.name, method.name)

	# output a prototype
	#static __XMMS_CMD_DO_RETTYPE_##_rettype() realfunc (argtype0 __XMMS_CMD_DO_ARGTYPE_##argtype1 __XMMS_CMD_DO_ARGTYPE_##argtype2 __XMMS_CMD_DO_ARGTYPE_##argtype3 __XMMS_CMD_DO_ARGTYPE_##argtype4 __XMMS_CMD_DO_ARGTYPE_##argtype5 __XMMS_CMD_DO_ARGTYPE_##argtype6, xmms_error_t *); \


	Indenter.printline("static void")
	Indenter.printline("%s (xmms_object_t *object, xmms_object_cmd_arg_t *arg)" % method_name_to_cname (method.name))
	Indenter.enter("{")

	if method.arguments:
		Indenter.printline("xmmsv_t *t;")

	Indenter.enter("if (xmmsv_list_get_size (arg->args) != %d) {" % len(method.arguments))
	Indenter.printline('XMMS_DBG ("Wrong number of arguments to %s (%%d)", xmmsv_list_get_size (arg->args));' % method.name)
	Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to %s");' % method.name)
	Indenter.printline('return;')
	Indenter.leave("}")

	for i, a in enumerate(method.arguments):
		Indenter.printline("%s argval%d;" % (get_type(a.type[0]), i))

	Indenter.printline()

	for i, a in enumerate(method.arguments):
		Indenter.enter("if (!xmmsv_list_get (arg->args, %d, &t)) {" % i)
		Indenter.printline('XMMS_DBG ("Missing arg %d in %s");' % (i, method.name))
		Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg %d in %s");' % (i, method.name))
		Indenter.printline('return;')
		Indenter.leave("}")

		if a.type[0] == 'list' and len(a.type) > 1 and has_xmmsv_type(a.type[1]):
			Indenter.enter('if (!xmmsv_list_restrict_type (t, %s)) {' % (get_xmmsv_type(a.type[1])))
			Indenter.printline('XMMS_DBG("Wrong list content (not %s) for arg %d in %s.");' % (a.type[1], i, method.name))
			Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong list content (not %s) for arg %d in %s.");' % (a.type[1], i, method.name))
			Indenter.leave('}')

		if get_getter(a.type[0]) is None:
			Indenter.printline("argval%d = t;" % i)
		else:
			Indenter.enter("if (!%s (t, &argval%d)) {" % (get_getter(a.type[0]), i))
			Indenter.printline('XMMS_DBG ("Error parsing arg %d in %s");' % (i, method.name))
			Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg %d in %s");' % (i, method.name))
			Indenter.printline("return;")
			Indenter.leave("}")


	Indenter.printline()

	# Assemble a list of arguments for the function call
	args = []

	args.append("(%s) object" % c_type)
	args.extend("argval%d" % i for i in range(len(method.arguments)))

	if method.need_client:
		args.append("arg->client")
	if method.need_cookie:
		args.append("arg->cookie")

	args.append("&arg->error")

	funccall = "%s (%s)" % (full_method_name, ", ".join(args))
	if method.return_value:
		if get_creator(method.return_value.type[0]) is None:
			Indenter.printline("arg->retval = %s;" % (funccall))
		else:
			if get_nullable(method.return_value.type[0]):
				Indenter.printline("%s retval = %s;" % (get_nullable(method.return_value.type[0]), funccall))
				Indenter.enter("if (retval != NULL) {")
				Indenter.printline("arg->retval = %s (retval);" % get_creator(method.return_value.type[0]))
				Indenter.leave("}")
			else:
				Indenter.printline("arg->retval = %s (%s);" % (get_creator(method.return_value.type[0]), funccall))
	else:
		Indenter.printline("%s;" % funccall)
		if method.noreply:
			Indenter.printline("arg->retval = NULL;")
		else:
			Indenter.printline("arg->retval = xmmsv_new_none ();")


	Indenter.leave("}")

	Indenter.printline()
	Indenter.printline()
def emit_method_define_code(object, method, c_type):
	full_method_name = 'xmms_%s_client_%s' % (object.name, method.name)

	argument_types = [c_map[a.type[0]] for a in method.arguments]

	while len(argument_types) < 6:
		argument_types.append('XMMSV_TYPE_NONE')

	# output a prototype
	#static __XMMS_CMD_DO_RETTYPE_##_rettype() realfunc (argtype0 __XMMS_CMD_DO_ARGTYPE_##argtype1 __XMMS_CMD_DO_ARGTYPE_##argtype2 __XMMS_CMD_DO_ARGTYPE_##argtype3 __XMMS_CMD_DO_ARGTYPE_##argtype4 __XMMS_CMD_DO_ARGTYPE_##argtype5 __XMMS_CMD_DO_ARGTYPE_##argtype6, xmms_error_t *); \


	Indenter.printline("static void")
	Indenter.printline("%s (xmms_object_t *object, xmms_object_cmd_arg_t *arg)" % method_name_to_cname (method.name))
	Indenter.enter("{")

	if method.arguments:
		Indenter.printline("xmmsv_t *t;")

	Indenter.enter("if (xmmsv_list_get_size (arg->args) != %d) {" % len(method.arguments))
	Indenter.printline('XMMS_DBG ("Wrong number of arguments to %s (%%d)", xmmsv_list_get_size (arg->args));' % method.name)
	Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to %s");' % method.name)
	Indenter.printline('return;')
	Indenter.leave("}")

	for i, a in enumerate(method.arguments):
		Indenter.printline("%s argval%d;" % (c_type_map[a.type[0]], i))

	Indenter.printline()

	for i, a in enumerate(method.arguments):
		Indenter.enter("if (!xmmsv_list_get (arg->args, %d, &t)) {" % i)
		Indenter.printline('XMMS_DBG ("Missing arg %d in %s");' % (i, method.name))
		Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg %d in %s");' % (i, method.name))
		Indenter.printline('return;')
		Indenter.leave("}")

		if c_getter_map[a.type[0]] is None:
			Indenter.printline("argval%d = t;" % i)
		else:
			Indenter.enter("if (!%s (t, &argval%d)) {" % (c_getter_map[a.type[0]], i))
			Indenter.printline('XMMS_DBG ("Error parsing arg %d in %s");' % (i, method.name))
			Indenter.printline('xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg %d in %s");' % (i, method.name))
			Indenter.printline("return;")
			Indenter.leave("}")
			

	Indenter.printline()

	args = "".join([("argval%d, " % i) for i in  range(len(method.arguments))])
	funccall = "%s ((%s) object, %s&arg->error)" % (full_method_name, c_type, args)
	if method.return_value:
		if c_creator_map[method.return_value.type[0]] is None:
			Indenter.printline("arg->retval = %s;" % (funccall))
		else:
			Indenter.printline("arg->retval = %s (%s);" % (c_creator_map[method.return_value.type[0]], funccall))
	else:
		Indenter.printline("%s;" % funccall)
		Indenter.printline("arg->retval = xmmsv_new_none ();")


	Indenter.leave("}")

	Indenter.printline()
	Indenter.printline()