local.h (92991) | local.h (101776) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)local.h 8.3 (Berkeley) 7/3/94 | 1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)local.h 8.3 (Berkeley) 7/3/94 |
37 * $FreeBSD: head/lib/libc/stdio/local.h 92991 2002-03-22 23:42:05Z obrien $ | 37 * $FreeBSD: head/lib/libc/stdio/local.h 101776 2002-08-13 09:30:41Z tjr $ |
38 */ 39 40#include <sys/types.h> /* for off_t */ 41#include <pthread.h> | 38 */ 39 40#include <sys/types.h> /* for off_t */ 41#include <pthread.h> |
42#include <string.h> 43#include <wchar.h> |
|
42 43/* 44 * Information local to this implementation of stdio, 45 * in particular, macros and private variables. 46 */ 47 48extern int _sread(FILE *, char *, int); 49extern int _swrite(FILE *, char const *, int); --- 23 unchanged lines hidden (view full) --- 73 74 75/* hold a buncha junk that would grow the ABI */ 76struct __sFILEX { 77 unsigned char *_up; /* saved _p when _p is doing ungetc data */ 78 pthread_mutex_t fl_mutex; /* used for MT-safety */ 79 pthread_t fl_owner; /* current owner */ 80 int fl_count; /* recursive lock count */ | 44 45/* 46 * Information local to this implementation of stdio, 47 * in particular, macros and private variables. 48 */ 49 50extern int _sread(FILE *, char *, int); 51extern int _swrite(FILE *, char const *, int); --- 23 unchanged lines hidden (view full) --- 75 76 77/* hold a buncha junk that would grow the ABI */ 78struct __sFILEX { 79 unsigned char *_up; /* saved _p when _p is doing ungetc data */ 80 pthread_mutex_t fl_mutex; /* used for MT-safety */ 81 pthread_t fl_owner; /* current owner */ 82 int fl_count; /* recursive lock count */ |
83 int orientation; /* orientation for fwide() */ 84#ifdef notdef 85 /* 86 * XXX These are not used yet -- they will be used to store the 87 * multibyte conversion state for writing and reading when 88 * stateful encodings are supported by the locale framework. 89 */ 90 mbstate_t wstate; /* write conversion state */ 91 mbstate_t rstate; /* read conversion state */ 92#endif |
|
81}; 82 83/* 84 * Return true iff the given FILE cannot be written now. 85 */ 86#define cantwrite(fp) \ 87 ((((fp)->_flags & __SWR) == 0 || \ 88 ((fp)->_bf._base == NULL && ((fp)->_flags & __SSTR) == 0)) && \ --- 19 unchanged lines hidden (view full) --- 108 (fp)->_lb._base = NULL; \ 109} 110 111#define INITEXTRA(fp) { \ 112 (fp)->_extra->_up = NULL; \ 113 (fp)->_extra->fl_mutex = PTHREAD_MUTEX_INITIALIZER; \ 114 (fp)->_extra->fl_owner = NULL; \ 115 (fp)->_extra->fl_count = 0; \ | 93}; 94 95/* 96 * Return true iff the given FILE cannot be written now. 97 */ 98#define cantwrite(fp) \ 99 ((((fp)->_flags & __SWR) == 0 || \ 100 ((fp)->_bf._base == NULL && ((fp)->_flags & __SSTR) == 0)) && \ --- 19 unchanged lines hidden (view full) --- 120 (fp)->_lb._base = NULL; \ 121} 122 123#define INITEXTRA(fp) { \ 124 (fp)->_extra->_up = NULL; \ 125 (fp)->_extra->fl_mutex = PTHREAD_MUTEX_INITIALIZER; \ 126 (fp)->_extra->fl_owner = NULL; \ 127 (fp)->_extra->fl_count = 0; \ |
128 (fp)->_extra->orientation = 0; \ 129 /* memset(&(fp)->_extra->wstate, 0, sizeof(mbstate_t)); */ \ 130 /* memset(&(fp)->_extra->rstate, 0, sizeof(mbstate_t)); */ \ |
|
116} | 131} |
132 133/* 134 * Set the orientation for a stream. If o > 0, the stream has wide- 135 * orientation. If o < 0, the stream has byte-orientation. 136 */ 137#define ORIENT(fp, o) do { \ 138 if ((fp)->_extra->orientation == 0) \ 139 (fp)->_extra->orientation = (o); \ 140} while (0) 141#ifdef FLOCKFILE 142#define ORIENTLOCK(fp, o) do { \ 143 FLOCKFILE(fp); \ 144 ORIENT(fp, o); \ 145 FUNLOCKFILE(fp); \ 146} while (0) 147#endif |
|