]> git.ipfire.org Git - thirdparty/glibc.git/blame - libio/strfile.h
Update.
[thirdparty/glibc.git] / libio / strfile.h
CommitLineData
40a55d20
UD
1/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
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. */
96aa2d94
RM
25
26#include <libio.h>
27#ifdef TODO
28Merge into libio.h ?
29#endif
30
40a55d20
UD
31typedef void *(*_IO_alloc_type) __P ((_IO_size_t));
32typedef void (*_IO_free_type) __P ((void*));
96aa2d94
RM
33
34struct _IO_str_fields
35{
96aa2d94
RM
36 _IO_alloc_type _allocate_buffer;
37 _IO_free_type _free_buffer;
38};
39
f65fd747
UD
40/* This is needed for the Irix6 N32 ABI, which has a 64 bit off_t type,
41 but a 32 bit pointer type. In this case, we get 4 bytes of padding
42 after the vtable pointer. Putting them in a structure together solves
43 this problem. */
44
45struct _IO_streambuf
96aa2d94
RM
46{
47 struct _IO_FILE _f;
48 const void *_vtable;
f65fd747
UD
49};
50
51typedef struct _IO_strfile_
52{
53 struct _IO_streambuf _sbf;
96aa2d94
RM
54 struct _IO_str_fields _s;
55} _IO_strfile;
f65fd747
UD
56
57/* dynamic: set when the array object is allocated (or reallocated) as
58 necessary to hold a character sequence that can change in length. */
59#define _IO_STR_DYNAMIC(FP) ((FP)->_s._allocate_buffer != (_IO_alloc_type)0)
60
61/* frozen: set when the program has requested that the array object not
62 be altered, reallocated, or freed. */
63#define _IO_STR_FROZEN(FP) ((FP)->_f._IO_file_flags & _IO_USER_BUF)