]>
Commit | Line | Data |
---|---|---|
acd1ba4c | 1 | /* Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc. |
dbfcb4be BK |
2 | This file is part of the GNU IO Library. |
3 | ||
4 | This library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU General Public License as | |
6 | published by the Free Software Foundation; either version 2, or (at | |
7 | your option) any later version. | |
8 | ||
9 | This library is distributed in the hope that it will be useful, but | |
10 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
15 | along with this library; see the file COPYING. If not, write to | |
16 | the Free Software Foundation, 59 Temple Place - Suite 330, Boston, | |
17 | MA 02111-1307, USA. | |
18 | ||
19 | As a special exception, if you link this library with files | |
20 | compiled with a GNU compiler to produce an executable, this does | |
21 | not cause the resulting executable to be covered by the GNU General | |
22 | Public License. This exception does not however invalidate any | |
23 | other reasons why the executable file might be covered by the GNU | |
24 | General Public License. */ | |
6599da04 JM |
25 | |
26 | #include <libio.h> | |
27 | #ifdef TODO | |
28 | Merge into libio.h ? | |
29 | #endif | |
30 | ||
acd1ba4c UD |
31 | #ifndef __PMT |
32 | # ifdef __STDC__ | |
33 | # define __PMT(p) p | |
34 | # else | |
35 | # define __PMT(p) () | |
36 | # endif | |
37 | #endif /*!__P*/ | |
38 | ||
887e3058 AJ |
39 | typedef void *(*_IO_alloc_type) __PMT ((_IO_size_t)); |
40 | typedef void (*_IO_free_type) __PMT ((void*)); | |
6599da04 JM |
41 | |
42 | struct _IO_str_fields | |
43 | { | |
44 | _IO_alloc_type _allocate_buffer; | |
45 | _IO_free_type _free_buffer; | |
46 | }; | |
47 | ||
48 | /* This is needed for the Irix6 N32 ABI, which has a 64 bit off_t type, | |
49 | but a 32 bit pointer type. In this case, we get 4 bytes of padding | |
50 | after the vtable pointer. Putting them in a structure together solves | |
51 | this problem. */ | |
52 | ||
53 | struct _IO_streambuf | |
54 | { | |
55 | struct _IO_FILE _f; | |
56 | const void *_vtable; | |
57 | }; | |
58 | ||
59 | typedef struct _IO_strfile_ | |
60 | { | |
61 | struct _IO_streambuf _sbf; | |
62 | struct _IO_str_fields _s; | |
63 | } _IO_strfile; | |
64 | ||
65 | /* dynamic: set when the array object is allocated (or reallocated) as | |
66 | necessary to hold a character sequence that can change in length. */ | |
67 | #define _IO_STR_DYNAMIC(FP) ((FP)->_s._allocate_buffer != (_IO_alloc_type)0) | |
68 | ||
69 | /* frozen: set when the program has requested that the array object not | |
70 | be altered, reallocated, or freed. */ | |
71 | #define _IO_STR_FROZEN(FP) ((FP)->_f._IO_file_flags & _IO_USER_BUF) |