On Fri, 2005-10-07 at 14:06 -0400, Alfille, Paul H.,M.D. wrote:
> Sven,
>
> It would be easy to do. The real problem is string handling. We'd have to
> specify buffers and lengths.
Why?
int get_value(const char *path, char **ret, unsigned int *retlen);
Would be adequate and not require a buffer, and if everything is
ASCIIZ-safe, using:
int get_value(const char *path, char **ret);
would be fine too.
> So for a directory listing, you would get either a long string to be parsed,
> or
> an array of strings.
Why not a pointer to an array and a list?
Or an iterator? [think about how opendir() works]
> Also, the return types are multiple, integer, string or floating. It would
> probably be better to get the raw data type rather than have to reparse the
> ascii interpretation.
Why would it? That just makes it complicated.
Since it's already in the string form, parsing it again for me doesn't
help. After all, I might be able to get by with something that becomes
equivelent to:
unsigned int q = *(unsigned int*)ret;
if (q&255) { /* must not be a three-digit number */ }
The user already knows how to use atoi(), and if they want to use it,
this really won't cost them a lot in cpu-time. Nothing compared to
context-switches and the fact that 1wire is already really slow :)
> Choices in C:
I think the real-deal is avoiding the context switches and
code-complexity.
> -----Original Message-----
> From: [EMAIL PROTECTED] on behalf of Sven Geggus
> Sent: Fri 10/7/2005 1:32 PM
> To: [email protected]
> Subject: [Owfs-developers] C-API
>
> Hello all,
>
> I like the simple owfs Interfaces for the major scripting languages. Is
> there something like this for C as well? If so, do you have some simple
> examples besides the sources of owhttpd and such? Unfortunately, the
> example directory of my CVS "working copy" is empty.
>
> Sven
--
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