xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame^] | 1 | /* Copyright (C) 1993-2016 Free Software Foundation, Inc. |
| 2 | This file is part of the GNU C Library. |
| 3 | |
| 4 | The GNU C Library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with the GNU C Library; if not, see |
| 16 | <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | As a special exception, if you link the code in this file with |
| 19 | files compiled with a GNU compiler to produce an executable, |
| 20 | that does not cause the resulting executable to be covered by |
| 21 | the GNU Lesser General Public License. This exception does not |
| 22 | however invalidate any other reasons why the executable file |
| 23 | might be covered by the GNU Lesser General Public License. |
| 24 | This exception applies to code released by its copyright holders |
| 25 | in files containing the exception. */ |
| 26 | |
| 27 | #include <libio.h> |
| 28 | #ifdef TODO |
| 29 | Merge into libio.h ? |
| 30 | #endif |
| 31 | |
| 32 | typedef void *(*_IO_alloc_type) (_IO_size_t); |
| 33 | typedef void (*_IO_free_type) (void*); |
| 34 | |
| 35 | struct _IO_str_fields |
| 36 | { |
| 37 | _IO_alloc_type _allocate_buffer; |
| 38 | _IO_free_type _free_buffer; |
| 39 | }; |
| 40 | |
| 41 | /* This is needed for the Irix6 N32 ABI, which has a 64 bit off_t type, |
| 42 | but a 32 bit pointer type. In this case, we get 4 bytes of padding |
| 43 | after the vtable pointer. Putting them in a structure together solves |
| 44 | this problem. */ |
| 45 | |
| 46 | struct _IO_streambuf |
| 47 | { |
| 48 | struct _IO_FILE _f; |
| 49 | const struct _IO_jump_t *vtable; |
| 50 | }; |
| 51 | |
| 52 | typedef struct _IO_strfile_ |
| 53 | { |
| 54 | struct _IO_streambuf _sbf; |
| 55 | struct _IO_str_fields _s; |
| 56 | } _IO_strfile; |
| 57 | |
| 58 | /* dynamic: set when the array object is allocated (or reallocated) as |
| 59 | necessary to hold a character sequence that can change in length. */ |
| 60 | #define _IO_STR_DYNAMIC(FP) ((FP)->_s._allocate_buffer != (_IO_alloc_type)0) |
| 61 | |
| 62 | /* frozen: set when the program has requested that the array object not |
| 63 | be altered, reallocated, or freed. */ |
| 64 | #define _IO_STR_FROZEN(FP) ((FP)->_f._IO_file_flags & _IO_USER_BUF) |
| 65 | |
| 66 | typedef struct |
| 67 | { |
| 68 | _IO_strfile f; |
| 69 | /* This is used for the characters which do not fit in the buffer |
| 70 | provided by the user. */ |
| 71 | char overflow_buf[64]; |
| 72 | } _IO_strnfile; |
| 73 | |
| 74 | extern const struct _IO_jump_t _IO_strn_jumps attribute_hidden; |
| 75 | |
| 76 | |
| 77 | typedef struct |
| 78 | { |
| 79 | _IO_strfile f; |
| 80 | /* This is used for the characters which do not fit in the buffer |
| 81 | provided by the user. */ |
| 82 | wchar_t overflow_buf[64]; |
| 83 | } _IO_wstrnfile; |
| 84 | |
| 85 | extern const struct _IO_jump_t _IO_wstrn_jumps attribute_hidden; |