annotate lib/stdio-impl.h @ 12559:c2cbabec01dd

update nearly all FSF copyright year lists to include 2010 Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
author Jim Meyering <meyering@redhat.com>
date Fri, 01 Jan 2010 10:31:12 +0100
parents b5e42ef33b49
children 1adfe934d629
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.
12559
c2cbabec01dd update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents: 12518
diff changeset
2 Copyright (C) 2007-2010 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
9981
e3d6988a9347 Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 9979
diff changeset
24 #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
25
e3d6988a9347 Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 9979
diff changeset
26 # if defined __DragonFly__ /* DragonFly */
e3d6988a9347 Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 9979
diff changeset
27 /* 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
28 # define fp_ ((struct { struct __FILE_public pub; \
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
29 struct { unsigned char *_base; int _size; } _bf; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
30 void *cookie; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
31 void *_close; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
32 void *_read; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
33 void *_seek; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
34 void *_write; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
35 struct { unsigned char *_base; int _size; } _ub; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
36 int _ur; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
37 unsigned char _ubuf[3]; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
38 unsigned char _nbuf[1]; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
39 struct { unsigned char *_base; int _size; } _lb; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
40 int _blksize; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
41 fpos_t _offset; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
42 /* More fields, not relevant here. */ \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
43 } *) fp)
9981
e3d6988a9347 Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 9979
diff changeset
44 /* 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
45 # define _p pub._p
e3d6988a9347 Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 9979
diff changeset
46 # define _flags pub._flags
e3d6988a9347 Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 9979
diff changeset
47 # define _r pub._r
e3d6988a9347 Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 9979
diff changeset
48 # define _w pub._w
e3d6988a9347 Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 9979
diff changeset
49 # else
e3d6988a9347 Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 9979
diff changeset
50 # define fp_ fp
e3d6988a9347 Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 9979
diff changeset
51 # endif
9979
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 # if defined __NetBSD__ || defined __OpenBSD__ /* NetBSD, OpenBSD */
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 /* 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
55 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
56 struct __sfileext
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 {
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 struct __sbuf _ub; /* ungetc buffer */
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 /* More fields, not relevant here. */
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 };
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
9981
e3d6988a9347 Add tentative support for DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 9979
diff changeset
62 # else /* FreeBSD, DragonFly, MacOS X, Cygwin */
10144
6cbcb13324a6 Fix syntax error on DragonFly BSD.
Bruno Haible <bruno@clisp.org>
parents: 10143
diff changeset
63 # define fp_ub fp_->_ub
9979
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 # endif
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 # define HASUB(fp) (fp_ub._base != NULL)
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 #endif
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 /* SystemV derived implementations. */
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 #if defined _IOERR
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 # 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
76 # define fp_ ((struct { unsigned char *_ptr; \
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
77 unsigned char *_base; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
78 unsigned char *_end; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
79 long _cnt; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
80 int _file; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
81 unsigned int _flag; \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10144
diff changeset
82 } *) fp)
9979
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83 # else
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
84 # define fp_ fp
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 # endif
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 # if defined _SCO_DS /* OpenServer */
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 # define _cnt __cnt
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 # define _ptr __ptr
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 # define _base __base
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 # define _flag __flag
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 # endif
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93
078a5c07126b New private include file lib/stdio-impl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 #endif