Hi,

2010/5/16, pancake <[email protected]>:
> I'm working on the xmlrpc vapi, but i have some questions about what's the 
> best
Good luck ;-) (when I tried, I gave up before writing anything)

>  way to define such abstractions on C. Attached is the vapi file and a example
>  program.

>  Please, tell me which things will you change, and how can I avoid using 
> cname for
>  each function, because looks like cprefix is ignored.
I think you're not using it correctly:
>       [CCode (cname ="xmlrpc_server_info", cprefix="xmlrpc_server_info_")]
>       public class ServerInfo {
I beleive this should be lower_case_cprefix. And

>               [CCode (cprefix="xmlrpc_")]
>               public int array_append_item(Value a, int idx, ref Value b);
cprefix works on name spaces, not individual symbols. you should set
it in the class to have it apply to its methods/inner classes (but I
think lower_case_cprefix should be used for methods)

>       [Compact]
There is no such thing as a [Compact] struct ;-p (I understand you
have just forgot it)
>       [CCode (cname ="xmlrpc_env", cprefix="xmlrpc_env_", free_function="", 
> destroy_function="")]
no need for a free function, and I think it should be
destroy_function="xmlrpc_env_clean"
>       public struct Env {
> [...]
>               public static void init(out Env env);
This could be simply the constructor (it's a struct).

>       [CCode (cname ="xmlrpc_value", cprefix="xmlrpc_value_", 
> free_function="")]
>       public class Value {
I belive it should be ref_function="xmlrpc_INCREF",
unref_function="xmlrpc_DECREF"
btw, cprefix is not needed here

>  things like env.string_new() vs new XmlRpc.String(env)... are not really 
> nice, but
>  I would like to be able to map all this stuff in the language itself, is 
> this possible
>  with a vapi? like in dbus or soup does?
Why not? I don't see the problem.

>
>  Maybe I should write vala code inside the vapi to provide this abstraction?
I'm not sure what's the best way is, but something I'd like to have in
this "abstraction" is throwing errors (constantly checking for
env.fault_occured isn't nice) but I'm afraid you would end up with a
wrapper library rather than a vapi file :-/

HTH, (read : I hope my incoherent rambling makes sense to you)
Abderrahim
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to