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: Russell Shaw
Subject: Re: [avr-gcc-list] Re: [avr-libc-dev] Please have a look at avr-libc patch #3750
Date: Tue, 06 Sep 2005 12:45:00 +1000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050802 Debian/1.7.10-1

Joerg Wunsch wrote:
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.

Maybe instead of "interrupt", you could use "reentrant", to eliminate
confusion that SIGNAL is somehow not an "interrupt" too. Doesn't worry
me either way.

  - 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.

Maybe avrlibc should define the macro EOF to be -2 (if EOF isn't
currently defined).

    . 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




reply via email to

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