mldonkey-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mldonkey-users] Contributions in C to mldonkey


From: Sylvain LE GALL
Subject: Re: [Mldonkey-users] Contributions in C to mldonkey
Date: Sat, 1 Feb 2003 14:56:00 +0100
User-agent: Mutt/1.5.3i

On Fri, Jan 31, 2003 at 12:47:41PM +0100, MLdonkey wrote:
> 
> mldonkey really suffers from its lack of developers. Since the main
> problem is that a lot of people don't know ocaml, I think there is
> still a way for them to contribute to mldonkey development: simply by
> writting C code to perform the actions they want. The only problem
> will be that:
> 
> - the C code has no access to mldonkey internals
> - the C code cannot communicate (open sockets, read/write, etc)
> 
> However, a lot of things can be performed this way: for example, a
> parser for jigle pages or sharereactor html pages could be done like that:
> 
> a structure (a C struct) containing the search would be passed to a
> first C function to generate the url to be queried:
> 
> struct search {
>   search_keywords: char*;
>   search_num : int;
> };
> 
> void search_jiggle(struct search *s){
>    char *url;
>    ...
> 
>    ... save somewhere the url with the search_num associated ...
>    mldonkey_download_url(url, "jiggle_callback");
>    free(url);
> }
> 
> We suppose here that mldonkey provides a function
> 'mldonkey_download_url' to declare urls to
> be downloaded in the future.
> 
> void jiggle_callback(char *url, char *page)
> {
>   ... the page is the one that would be returned by wget for example ...
> 
>   ... some code to find the search_num associated with the url ... 
> 
> 
>   while(1){
>     ... parsing the page ...
>     mldonkey_add_search_result(search_num, result);
>     free_result(result)
>   }
> }
> 
> where we suppose that mldonkey provides a function
> 'mldonkey_add_search_result' to add results to a search. Of course,
> the jiggle_callback function could also recall 'mldonkey_download_url'
> to recursively fetch other urls (but these urls will not be downloaded
> immediatly !)
> 
> Such 'mldonkey_' functions could easily be written by ocaml devs (on C
> devs requests), while the C code would be written by C devs. The stubs
> to call the C functions from the ocaml code would also be written by
> ocaml devs.  So, no need of ocaml knowledge to do that. The only
> requirements are:
> 
> - The C functions must be called with well-defined arguments (strings,
>   int, simple structs)
> - The 'mldonkey_' functions cannot do anything except storing the
>   results, until the C function code is completely executed (in this
>   example, the URL will be downloaded after 'search_jiggle' has been
>   executed, and the results will really be added when
>   'jiggle_callback' has completely been executed).
> - The C code is responsible for desallocating any data allocated by
>   itself. 
> 
> I don't know if this short explanation can help some contributors, but
> if you have ideas about how to use this scheme, just ask (I'll be back
> on monday :)
> 
> - MLDonkey
> 
> 
> _______________________________________________
> Mldonkey-users mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/mldonkey-users
> 

Well,

I think you can collaborate with C module, but when you begin with it
you will get all the other languages with it ( perl, python, ruby,
forte... ). I don't think it is a good way to help the project. When
ocaml will require 4 or 5 compiler to get all the source compiled, it
will be very fun...

If you really want to collaborate with third party language, use a plugin
system ( communicate through RPC, SOAP... ). I think it will be more
easy.

Kind regard
Sylvain LE GALL




reply via email to

[Prev in Thread] Current Thread [Next in Thread]