Back to index

glibc  2.9
strfile.h
Go to the documentation of this file.
00001 /* Copyright (C) 1993, 1997, 1998, 1999, 2005 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.
00018 
00019    As a special exception, if you link the code in this file with
00020    files compiled with a GNU compiler to produce an executable,
00021    that does not cause the resulting executable to be covered by
00022    the GNU Lesser General Public License.  This exception does not
00023    however invalidate any other reasons why the executable file
00024    might be covered by the GNU Lesser General Public License.
00025    This exception applies to code released by its copyright holders
00026    in files containing the exception.  */
00027 
00028 #include <libio.h>
00029 #ifdef TODO
00030 Merge into  libio.h ?
00031 #endif
00032 
00033 typedef void *(*_IO_alloc_type) (_IO_size_t);
00034 typedef void (*_IO_free_type) (void*);
00035 
00036 struct _IO_str_fields
00037 {
00038   _IO_alloc_type _allocate_buffer;
00039   _IO_free_type _free_buffer;
00040 };
00041 
00042 /* This is needed for the Irix6 N32 ABI, which has a 64 bit off_t type,
00043    but a 32 bit pointer type.  In this case, we get 4 bytes of padding
00044    after the vtable pointer.  Putting them in a structure together solves
00045    this problem.  */
00046 
00047 struct _IO_streambuf
00048 {
00049   struct _IO_FILE _f;
00050   const void *_vtable;
00051 };
00052 
00053 typedef struct _IO_strfile_
00054 {
00055   struct _IO_streambuf _sbf;
00056   struct _IO_str_fields _s;
00057 } _IO_strfile;
00058 
00059 /* dynamic: set when the array object is allocated (or reallocated)  as
00060    necessary to hold a character sequence that can change in length. */
00061 #define _IO_STR_DYNAMIC(FP) ((FP)->_s._allocate_buffer != (_IO_alloc_type)0)
00062 
00063 /* frozen: set when the program has requested that the array object not
00064    be altered, reallocated, or freed. */
00065 #define _IO_STR_FROZEN(FP) ((FP)->_f._IO_file_flags & _IO_USER_BUF)
00066 
00067 typedef struct
00068 {
00069   _IO_strfile f;
00070   /* This is used for the characters which do not fit in the buffer
00071      provided by the user.  */
00072   char overflow_buf[64];
00073 } _IO_strnfile;
00074 
00075 extern const struct _IO_jump_t _IO_strn_jumps attribute_hidden;
00076 
00077 
00078 typedef struct
00079 {
00080   _IO_strfile f;
00081   /* This is used for the characters which do not fit in the buffer
00082      provided by the user.  */
00083   wchar_t overflow_buf[64];
00084 } _IO_wstrnfile;
00085 
00086 extern const struct _IO_jump_t _IO_wstrn_jumps attribute_hidden;