avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Re: [avr-libc-dev] Please have a look at avr-libc pat


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Re: [avr-libc-dev] Please have a look at avr-libc patch #3750
Date: Mon, 5 Sep 2005 23:21:44 +0200
User-agent: Mutt/1.4.2.1i

As Joerg Wunsch wrote:

> > ->in stdio.h:
> > #define STDIO_SETUP(stream,buf,put,get,flags) FILE stream={buf,\
> >                    0,\
> >                    flags,\
> >                    sizeof(buf),\
> >                    0,\
> >                    put,\
> >                    get}

> That might basically work, yes.  Seems like a good idea to me.  You
> forgot the buffer for the FP stuff, but that's easy to add the same
> way.

I drafted an implementation of all this.

I updated the preview of the docs at

http://www.sax.de/~joerg/avr-libc-user-manual/

Please have a look at it.

Here's the respective part of the NEWS file:

* Major API changes:

  - The INTERRUPT() macro has been deprecated, and it will be
    removed in a future version.  Use __attribute__((interrupt))
    explicitly if this functionality is really needed.

  - The standard IO facilities API has been enhanced.

    . The backend functions put and get that are passed to fdevopen()
      during the setup of a stream now take the stream itself as an
      additional argument.
    . It is possible to tie user data to a stream using
      fdev_set_udata(), and to retrieve them using fdev_get_udata().
      Together with the additional argument to the backend functions,
      these functions can now e.g. keep track of internal user state,
      or distinguish two different devices using the same backend
      function.
    . The get backend function can now return -2 to indicate an
      end-of-file condition, in addition to -1 for an error condition.
      This will affect the internal state that can be queried using
      the standard feof() and ferror() functions.
    . A new macro fdev_setup_stream() is provided to setup a
      user-supplied stream without the need to call fdevopen(), and
      thus without requiring malloc().  The API has been extended so
      malloc() can even be avoided in the floating-point case, using
      a user-supplied conversion buffer.


No code has been committed to CVS yet, I'm awaiting feedback first.  I
did not run any tests with the new code either.  In case anyone wants
to review the diff against latest CVS, I've put it up for download
under

http://www.sax.de/~joerg/stdio.diff.gz

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

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