On Wed, 2005-10-12 at 08:17 +0000, Sven Geggus wrote:
> I would propose some kind of filehandle for the above functions and the swig
> Interface which would permit us using more than one bus from a given
> program.
I don't know how straightforward this is.
> I think this could look like this (for your C-API example):
>
> int OW_init( const char * device, int *ow_handle );
>
> OW_init may also return the handle.
>
> int OW_get( const char * path, char * buffer, int buffer_length, int
> ow_handle ) ;
> int OW_put( const char * path, const char * buffer, int buffer_length, int
> ow_handle );
> void OW_finish( int ow_handle ) ;
It should be the return of OW_init() instead of a extra parameter.
OW_get(), put, finish, etc should take it as the first argument.
Putting integers like this at the end makes reading something like this:
OW_get_buffer("/temp",buf,p,q);
somewhat tricky to read, but:
OW_get_buffer(q,"/temp",buf,p);
is much easier (and follows read() better).
If this is possible (and hunting is possible), one should be able to:
while ((h=OW_init(NULL)) > -1) {
__add_handle(h);
}
and make sure we don't hit the same device twice on accident.
--
Internet Connection High Quality Web Hosting
http://www.internetconnection.net/
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers