[uClibc]rfc: string streams in uClibc

Erik Andersen andersen at lineo.com
Sat Feb 10 04:39:23 UTC 2001


On Wed Feb 07, 2001 at 01:09:13PM -0600, Manuel Novoa III wrote:
> 
> Hello everyone,
> 
> Before I was out of touch for a week, I had been working on stdio stuff in
> uClibc.  I'm about to get back to work on that and I wanted to throw out some
> ideas for comments/feedback.
> 
> While I was working on cleaning up the *s*printf functions that it would be
> fairly easy to implement "string streams" in uClibc similar to those in C++.
> What I had in mind was something like (and this is really just of the top of my
> head):
> 
> FILE *csn_fopen(const char *buffer, size_t bufsize)
>     Simulate a read-only FILE using the supplied buffer of specified size.
> 
> FILE *cs0_fopen(const char *buffer)
>     Simulate a read-only FILE using the supplied nul-terminated string.
> 
> FILE *sn_fopen(char *buffer, size_t bufsize)
>     Simulate a read-write FILE using the supplied buffer of specified size.
>     Note: Something like this is already done implicitly by the *s*printf funcs.
> 
> FILE *sn_fopen(size_t growby)
>     Simulate a read-write FILE which grows dynamically using remalloc.
> 
> FILE *sb_fopen(size_t blocksize)
>     Simulate a read-write FILE using 'blocksize' blocks allocated indendently
> and grouped together in some way -- as a linked list, a tree, etc.  This would
> be useful in a NOMMU environment.
> 
> I foresee very little code size increase for the current stdio functions in
> order to support the above (except possibly for the last function and
> even that shouldn't be that great depending on how you want to group the
> blocks).  Of course, this could alway be made a configurable option.


Hmm.  How much re-use throughout the uClibc library do you anticipate?  Were
you thinking of having these under the hood in stdio just to simplify printf?
Or were you thinking of providing these as uClibc specific extensions exposed
in stdio.h?

 -Erik

--
Erik B. Andersen   email:  andersen at lineo.com
--This message was written using 73% post-consumer electrons--





More information about the uClibc mailing list