+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
/* 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
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
}
# 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
/* 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
/* 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
/* 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
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
/* 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
+ (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;
/* 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
#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
/* 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
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. */
/* 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
# 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."
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
/* 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
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!
/* 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
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
/* 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
#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