Mercurial > hg > octave-shane > gnulib-hg
annotate lib/stdio-impl.h @ 16433:ddc2bee9e4f8
roundl-ieee tests: More tests.
* tests/test-roundl-ieee.c: Include isnanl-nolibm.h, infinity.h, nan.h.
(main): Add tests for [MX] shaded specification in POSIX.
* modules/roundl-ieee-tests (Files): Add tests/infinity.h, tests/nan.h.
(Depends-on): Add isnanl-nolibm.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 26 Feb 2012 14:27:44 +0100 |
parents | ecfc57537d99 |
children | 498a2211d839 |
rev | line source |
---|---|
9979
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 /* Implementation details of FILE streams. |
16201
8250f2777afc
maint: update all copyright year number ranges
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
2 Copyright (C) 2007-2008, 2010-2012 Free Software Foundation, Inc. |
9979
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 This program is free software: you can redistribute it and/or modify |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 the Free Software Foundation; either version 3 of the License, or |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 (at your option) any later version. |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 GNU General Public License for more details. |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 /* Many stdio implementations have the same logic and therefore can share |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 the same implementation of stdio extension API, except that some fields |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 have different naming conventions, or their access requires some casts. */ |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 /* BSD stdio derived implementations. */ |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 |
13151
1adfe934d629
Port extended stdio to NetBSD 1.5.
Hauke Fath <hauke@espresso.rhein-neckar.de>
parents:
12559
diff
changeset
|
24 #if defined __NetBSD__ /* NetBSD */ |
1adfe934d629
Port extended stdio to NetBSD 1.5.
Hauke Fath <hauke@espresso.rhein-neckar.de>
parents:
12559
diff
changeset
|
25 /* Get __NetBSD_Version__. */ |
1adfe934d629
Port extended stdio to NetBSD 1.5.
Hauke Fath <hauke@espresso.rhein-neckar.de>
parents:
12559
diff
changeset
|
26 # include <sys/param.h> |
1adfe934d629
Port extended stdio to NetBSD 1.5.
Hauke Fath <hauke@espresso.rhein-neckar.de>
parents:
12559
diff
changeset
|
27 #endif |
1adfe934d629
Port extended stdio to NetBSD 1.5.
Hauke Fath <hauke@espresso.rhein-neckar.de>
parents:
12559
diff
changeset
|
28 |
16344
ecfc57537d99
stdioext: Add tentative support for Plan9.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
29 #include <errno.h> /* For detecting Plan9. */ |
ecfc57537d99
stdioext: Add tentative support for Plan9.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
30 |
9981
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
31 #if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ |
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
32 |
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
33 # if defined __DragonFly__ /* DragonFly */ |
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
34 /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ |
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
35 # define fp_ ((struct { struct __FILE_public pub; \ |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
36 struct { unsigned char *_base; int _size; } _bf; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
37 void *cookie; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
38 void *_close; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
39 void *_read; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
40 void *_seek; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
41 void *_write; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
42 struct { unsigned char *_base; int _size; } _ub; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
43 int _ur; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
44 unsigned char _ubuf[3]; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
45 unsigned char _nbuf[1]; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
46 struct { unsigned char *_base; int _size; } _lb; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
47 int _blksize; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
48 fpos_t _offset; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
49 /* More fields, not relevant here. */ \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
50 } *) fp) |
9981
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
51 /* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ |
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
52 # define _p pub._p |
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
53 # define _flags pub._flags |
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
54 # define _r pub._r |
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
55 # define _w pub._w |
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
56 # else |
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
57 # define fp_ fp |
e3d6988a9347
Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
9979
diff
changeset
|
58 # endif |
9979
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 |
13151
1adfe934d629
Port extended stdio to NetBSD 1.5.
Hauke Fath <hauke@espresso.rhein-neckar.de>
parents:
12559
diff
changeset
|
60 # if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ /* NetBSD >= 1.5ZA, OpenBSD */ |
9979
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
62 and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */ |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
63 struct __sfileext |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
64 { |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 struct __sbuf _ub; /* ungetc buffer */ |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
66 /* More fields, not relevant here. */ |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
67 }; |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
68 # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub |
13151
1adfe934d629
Port extended stdio to NetBSD 1.5.
Hauke Fath <hauke@espresso.rhein-neckar.de>
parents:
12559
diff
changeset
|
69 # else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, MacOS X, Cygwin */ |
10144
6cbcb13324a6
Fix syntax error on DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents:
10143
diff
changeset
|
70 # define fp_ub fp_->_ub |
9979
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
71 # endif |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
72 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
73 # define HASUB(fp) (fp_ub._base != NULL) |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
74 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
75 #endif |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
76 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
77 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
78 /* SystemV derived implementations. */ |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
79 |
13997
6fa9f46e6153
Port extended stdio modules to HP NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13151
diff
changeset
|
80 #ifdef __TANDEM /* NonStop Kernel */ |
6fa9f46e6153
Port extended stdio modules to HP NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13151
diff
changeset
|
81 # ifndef _IOERR |
6fa9f46e6153
Port extended stdio modules to HP NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13151
diff
changeset
|
82 /* These values were determined by the program 'stdioext-flags' at |
6fa9f46e6153
Port extended stdio modules to HP NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13151
diff
changeset
|
83 <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */ |
6fa9f46e6153
Port extended stdio modules to HP NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13151
diff
changeset
|
84 # define _IOERR 0x40 |
6fa9f46e6153
Port extended stdio modules to HP NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13151
diff
changeset
|
85 # define _IOREAD 0x80 |
6fa9f46e6153
Port extended stdio modules to HP NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13151
diff
changeset
|
86 # define _IOWRT 0x4 |
6fa9f46e6153
Port extended stdio modules to HP NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13151
diff
changeset
|
87 # define _IORW 0x100 |
6fa9f46e6153
Port extended stdio modules to HP NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13151
diff
changeset
|
88 # endif |
6fa9f46e6153
Port extended stdio modules to HP NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13151
diff
changeset
|
89 #endif |
6fa9f46e6153
Port extended stdio modules to HP NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents:
13151
diff
changeset
|
90 |
9979
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
91 #if defined _IOERR |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
92 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
93 # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
94 # define fp_ ((struct { unsigned char *_ptr; \ |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
95 unsigned char *_base; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
96 unsigned char *_end; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
97 long _cnt; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
98 int _file; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
99 unsigned int _flag; \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10144
diff
changeset
|
100 } *) fp) |
9979
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
101 # else |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
102 # define fp_ fp |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
103 # endif |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
104 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
105 # if defined _SCO_DS /* OpenServer */ |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
106 # define _cnt __cnt |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
107 # define _ptr __ptr |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
108 # define _base __base |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
109 # define _flag __flag |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
110 # endif |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
111 |
078a5c07126b
New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
112 #endif |