]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Stdio/local.h
Add Socket Libraries.
[mirror_edk2.git] / StdLib / LibC / Stdio / local.h
CommitLineData
2aa62f2b 1/** @file\r
2 Information local to this implementation of stdio,\r
3 in particular, function declarations and macros.\r
4\r
5 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
6 This program and the accompanying materials are licensed and made available\r
7 under the terms and conditions of the BSD License that accompanies this\r
8 distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14 Copyright (c) 1990, 1993\r
15 The Regents of the University of California. All rights reserved.\r
16\r
17 This code is derived from software contributed to Berkeley by\r
18 Chris Torek.\r
19\r
20 Redistribution and use in source and binary forms, with or without\r
21 modification, are permitted provided that the following conditions\r
22 are met:\r
23 - Redistributions of source code must retain the above copyright\r
24 notice, this list of conditions and the following disclaimer.\r
25 - Redistributions in binary form must reproduce the above copyright\r
26 notice, this list of conditions and the following disclaimer in the\r
27 documentation and/or other materials provided with the distribution.\r
28 - Neither the name of the University nor the names of its contributors\r
29 may be used to endorse or promote products derived from this software\r
30 without specific prior written permission.\r
31\r
32 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
33 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
34 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
35 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE\r
36 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
37 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
38 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
40 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
41 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
42 POSSIBILITY OF SUCH DAMAGE.\r
43\r
44 NetBSD: local.h,v 1.20 2005/05/14 23:51:02 christos Exp\r
45 local.h 8.3 (Berkeley) 7/3/94\r
46**/\r
47\r
48#include "wcio.h"\r
49#include "fileext.h"\r
50\r
51extern int __sflush(FILE *);\r
52extern FILE *__sfp(void);\r
53extern int __srefill(FILE *);\r
54extern int __sread(void *, char *, int);\r
55extern int __swrite(void *, char const *, int);\r
56extern fpos_t __sseek(void *, fpos_t, int);\r
57extern int __sclose(void *);\r
58extern void __sinit(void);\r
59extern void _cleanup(void);\r
60//extern void (*__cleanup)(void); // Now in MainData.h. Ref. as gMD->cleanup\r
61extern void __smakebuf(FILE *);\r
62extern int __swhatbuf(FILE *, size_t *, int *);\r
63extern int _fwalk(int (*)(FILE *));\r
64extern char *_mktemp(char *);\r
65extern int __swsetup(FILE *);\r
66extern int __sflags(const char *, int *);\r
d7ce7006 67extern int __svfscanf(FILE * __restrict, const char * __restrict, va_list)\r
2aa62f2b 68 __attribute__((__format__(__scanf__, 2, 0)));\r
d7ce7006 69extern int __svfscanf_unlocked(FILE * __restrict, const char * __restrict, va_list)\r
2aa62f2b 70 __attribute__((__format__(__scanf__, 2, 0)));\r
d7ce7006 71extern int __vfprintf_unlocked(FILE * __restrict, const char * __restrict, va_list);\r
2aa62f2b 72\r
73\r
74extern int __sdidinit;\r
75\r
76extern int __gettemp(char *, int *, int);\r
77\r
78extern wint_t __fgetwc_unlock(FILE *);\r
79extern wint_t __fputwc_unlock(wchar_t, FILE *);\r
80\r
81extern char *__fgetstr(FILE * __restrict, size_t * __restrict, int);\r
82extern int __slbexpand(FILE *, size_t);\r
d7ce7006 83extern int __vfwprintf_unlocked(FILE *, const wchar_t *, va_list);\r
84extern int __vfwscanf_unlocked(FILE * __restrict, const wchar_t * __restrict, va_list);\r
2aa62f2b 85\r
86/*\r
87 * Return true iff the given FILE cannot be written now.\r
88 */\r
89#define cantwrite(fp) \\r
90 ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && __swsetup(fp))\r
91\r
92/*\r
93 * Test whether the given stdio file has an active ungetc buffer;\r
94 * release such a buffer, without restoring ordinary unread data.\r
95 */\r
96#define HASUB(fp) (_UB(fp)._base != NULL)\r
97#define FREEUB(fp) { \\r
98 if (_UB(fp)._base != (fp)->_ubuf) \\r
99 free((char *)_UB(fp)._base); \\r
100 _UB(fp)._base = NULL; \\r
101 }\r
102\r
103/*\r
104 * test for an fgetln() buffer.\r
105 */\r
106#define HASLB(fp) ((fp)->_lb._base != NULL)\r
107#define FREELB(fp) { \\r
108 free((char *)(fp)->_lb._base); \\r
109 (fp)->_lb._base = NULL; \\r
110 }\r
111\r
112extern void __flockfile_internal (FILE *, int);\r
113extern void __funlockfile_internal(FILE *, int);\r