2 * Copyright (c) 1990 The Regents of the University of California.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 * %W% (UofMD/Berkeley) %G%
21 * Information local to this implementation of stdio,
22 * in particular, macros and private variables.
30 extern int _EXFUN(__svfscanf_r
,(struct _reent
*,FILE *, _CONST
char *,va_list));
31 extern FILE *_EXFUN(__sfp
,(struct _reent
*));
32 extern int _EXFUN(__sflags
,(struct _reent
*,_CONST
char*, int*));
33 extern int _EXFUN(__srefill
,(FILE *));
34 extern _READ_WRITE_RETURN_TYPE
_EXFUN(__sread
,(void *, char *, int));
35 extern _READ_WRITE_RETURN_TYPE
_EXFUN(__swrite
,(void *, char const *, int));
36 extern _fpos_t
_EXFUN(__sseek
,(void *, _fpos_t
, int));
37 extern int _EXFUN(__sclose
,(void *));
38 extern int _EXFUN(__stextmode
,(int));
39 extern void _EXFUN(__sinit
,(struct _reent
*));
40 extern void _EXFUN(_cleanup_r
,(struct _reent
*));
41 extern void _EXFUN(__smakebuf
,(FILE *));
42 extern int _EXFUN(_fwalk
,(struct _reent
*, int (*)(FILE *)));
43 struct _glue
* _EXFUN(__sfmoreglue
,(struct _reent
*,int n
));
44 extern int _EXFUN(__srefill
,(FILE *fp
));
46 /* Called by the main entry point fns to ensure stdio has been initialized. */
48 #define CHECK_INIT(fp) \
51 if (!_REENT->__sdidinit) \
56 /* Return true iff the given FILE cannot be written now. */
58 #define cantwrite(fp) \
59 ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \
62 /* Test whether the given stdio file has an active ungetc buffer;
63 release such a buffer, without restoring ordinary unread data. */
65 #define HASUB(fp) ((fp)->_ub._base != NULL)
66 #define FREEUB(fp) { \
67 if ((fp)->_ub._base != (fp)->_ubuf) \
68 _free_r(_REENT, (char *)(fp)->_ub._base); \
69 (fp)->_ub._base = NULL; \
72 /* Test for an fgetline() buffer. */
74 #define HASLB(fp) ((fp)->_lb._base != NULL)
75 #define FREELB(fp) { _free_r(_REENT,(char *)(fp)->_lb._base); (fp)->_lb._base = NULL; }
77 /* WARNING: _dcvt is defined in the stdlib directory, not here! */
79 char *_EXFUN(_dcvt
,(struct _reent
*, char *, double, int, int, char, int));
80 char *_EXFUN(_sicvt
,(char *, short, char));
81 char *_EXFUN(_icvt
,(char *, int, char));
82 char *_EXFUN(_licvt
,(char *, long, char));
84 char *_EXFUN(_llicvt
,(char *, long long, char));
87 #define CVT_BUF_SIZE 128
89 #define NDYNAMIC 4 /* add four more whenever necessary */