Mercurial > hg > octave-lyh > gnulib-hg
changeset 11236:d4475bf2a2bf
Add tentative support for FreeMiNT.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 28 Feb 2009 21:24:24 +0100 |
parents | 6d6cc28a5313 |
children | 2bd541cd96ac |
files | ChangeLog lib/fbufmode.c lib/fflush.c lib/fpurge.c lib/freadable.c lib/freadahead.c lib/freading.c lib/freadptr.c lib/freadseek.c lib/fseeko.c lib/fseterr.c lib/fwritable.c lib/fwriting.c |
diffstat | 13 files changed, 85 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2009-02-28 Bruno Haible <bruno@clisp.org> + + Add tentative support for FreeMiNT. + * lib/fbufmode.c (fbufmode) [__MINT__]: Add conditional code. + * lib/fflush.c (clear_ungetc_buffer): Likewise. + * lib/fpurge.c (fpurge): Likewise. + * lib/freadable.c (freadable): Likewise. + * lib/freading.c (freading): Likewise. + * lib/freadptr.c (freadptr): Likewise. + * lib/freadseek.c (freadptrinc): Likewise. + * lib/fseeko.c (rpl_fseeko): Likewise. + * lib/fseterr.c (fseterr): Likewise. + * lib/fwritable.c (fwritable): Likewise. + * lib/fwriting.c (fwriting): Likewise. + * lib/freadahead.c (freadahead): Likewise, based on code by Alan + Hourihane. + Reported by Alan Hourihane <alanh@fairlite.co.uk>. + 2009-02-28 Bruno Haible <bruno@clisp.org> * lib/wait-process.h (wait_subprocess): Clarify restriction regarding
--- a/lib/fbufmode.c +++ b/lib/fbufmode.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -73,6 +73,10 @@ if (fp->_Mode & 0x800 /* _MNBF */) return _IONBF; return _IOFBF; +#elif defined __MINT__ /* Atari FreeMiNT */ + if (fp->__linebuf) + return _IOLBF; + return (fp->__bufsize > 0 ? _IOFBF : _IONBF); #else #error "Please port gnulib fbufmode.c to your platform! Look at the setvbuf implementation." #endif
--- a/lib/fflush.c +++ b/lib/fflush.c @@ -63,6 +63,12 @@ } # elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ /* Nothing to do. */ +# elif defined __MINT__ /* Atari FreeMiNT */ + if (fp->__pushed_back) + { + fp->__bufp = fp->__pushback_bufp; + fp->__pushed_back = 0; + } # else /* other implementations */ fseek (fp, 0, SEEK_CUR); # endif
--- a/lib/fpurge.c +++ b/lib/fpurge.c @@ -1,5 +1,5 @@ /* Flushing buffers of a FILE stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -114,6 +114,16 @@ /* fp->_Buf <= fp->_Next <= fp->_Rend */ fp->_Rend = fp->_Next; return 0; +# elif defined __MINT__ /* Atari FreeMiNT */ + if (fp->__pushed_back) + { + fp->__bufp = fp->__pushback_bufp; + fp->__pushed_back = 0; + } + fp->__bufp = fp->__buffer; + fp->__get_limit = fp->__bufp; + fp->__put_limit = fp->__bufp; + return 0; # else #error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib." # endif
--- a/lib/freadable.c +++ b/lib/freadable.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,6 +37,8 @@ return (fp->_flag & (_IORW | _IOREAD)) != 0; #elif defined __QNX__ /* QNX */ return (fp->_Mode & 0x1 /* _MOPENR */) != 0; +#elif defined __MINT__ /* Atari FreeMiNT */ + return fp->__mode.__read; #else #error "Please port gnulib freadable.c to your platform! Look at the definition of fopen, fdopen on your system, then report this to bug-gnulib." #endif
--- a/lib/freadahead.c +++ b/lib/freadahead.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,6 +70,12 @@ + (fp->_Mode & 0x4000 /* _MBYTE */ ? (fp->_Back + sizeof (fp->_Back)) - fp->_Rback : 0); +#elif defined __MINT__ /* Atari FreeMiNT */ + if (!fp->__mode.__read) + return 0; + return (fp->__pushed_back + ? fp->__get_limit - fp->__pushback_bufp + 1 + : fp->__get_limit - fp->__bufp); #elif defined SLOW_BUT_NO_HACKS /* users can define this */ abort (); return 0;
--- a/lib/freading.c +++ b/lib/freading.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,6 +46,11 @@ #elif defined __QNX__ /* QNX */ return ((fp->_Mode & 0x2 /* _MOPENW */) == 0 || (fp->_Mode & 0x1000 /* _MREAD */) != 0); +#elif defined __MINT__ /* Atari FreeMiNT */ + return (!fp->__mode.__write + || (fp->__mode.__read + && (fp->__buffer < fp->__get_limit + /*|| fp->__bufp == fp->__put_limit ??*/))); #else #error "Please port gnulib freading.c to your platform!" #endif
--- a/lib/freadptr.c +++ b/lib/freadptr.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -85,6 +85,14 @@ return NULL; *sizep = size; return (const char *) fp->_Next; +#elif defined __MINT__ /* Atari FreeMiNT */ + if (!fp->__mode.__read) + return NULL; + size = fp->__get_limit - fp->__bufp; + if (size == 0) + return NULL; + *sizep = size; + return fp->__bufp; #elif defined SLOW_BUT_NO_HACKS /* users can define this */ /* This implementation is correct on any ANSI C platform. It is just awfully slow. */
--- a/lib/freadseek.c +++ b/lib/freadseek.c @@ -1,5 +1,5 @@ /* Skipping input from a FILE stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,6 +53,8 @@ # endif #elif defined __QNX__ /* QNX */ fp->_Next += increment; +#elif defined __MINT__ /* Atari FreeMiNT */ + fp->__bufp += increment; #elif defined SLOW_BUT_NO_HACKS /* users can define this */ #else #error "Please port gnulib freadseek.c to your platform! Look at the definition of getc, getc_unlocked on your system, then report this to bug-gnulib."
--- a/lib/fseeko.c +++ b/lib/fseeko.c @@ -82,6 +82,11 @@ if ((fp->_Mode & _MWRITE ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend) && fp->_Rback == fp->_Back + sizeof (fp->_Back) && fp->_Rsave == NULL) +#elif defined __MINT__ /* Atari FreeMiNT */ + if (fp->__bufp == fp->__buffer + && fp->__get_limit == fp->__bufp + && fp->__put_limit == fp->__bufp + && !fp->__pushed_back) #else #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib." #endif
--- a/lib/fseterr.c +++ b/lib/fseterr.c @@ -1,5 +1,5 @@ /* Set the error indicator of a stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,6 +41,8 @@ fp->__modeflags |= __FLAG_ERROR; #elif defined __QNX__ /* QNX */ fp->_Mode |= 0x200 /* _MERR */; +#elif defined __MINT__ /* Atari FreeMiNT */ + fp->__error = 1; #elif 0 /* unknown */ /* Portable fallback, based on an idea by Rich Felker. Wow! 6 system calls for something that is just a bit operation!
--- a/lib/fwritable.c +++ b/lib/fwritable.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,6 +37,8 @@ return (fp->_flag & (_IORW | _IOWRT)) != 0; #elif defined __QNX__ /* QNX */ return (fp->_Mode & 0x2 /* _MOPENW */) != 0; +#elif defined __MINT__ /* Atari FreeMiNT */ + return fp->__mode.__write; #else #error "Please port gnulib fwritable.c to your platform! Look at the definition of fopen, fdopen on your system, then report this to bug-gnulib." #endif
--- a/lib/fwriting.c +++ b/lib/fwriting.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,6 +40,11 @@ #elif defined __QNX__ /* QNX */ return ((fp->_Mode & 0x1 /* _MOPENR */) == 0 || (fp->_Mode & 0x2000 /* _MWRITE */) != 0); +#elif defined __MINT__ /* Atari FreeMiNT */ + return (!fp->__mode.__read + || (fp->__mode.__write + && (fp->__buffer < fp->__put_limit + /*|| fp->__bufp == fp->__get_limit ??*/))); #else #error "Please port gnulib fwriting.c to your platform!" #endif