1 /*-------------------------------------------------------------------------
2    stdio.h - ANSI functions forward declarations
3 
4    Copyright (C) 1998, Sandeep Dutta . sandeep.dutta@usa.net
5 
6    This library is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by the
8    Free Software Foundation; either version 2, or (at your option) any
9    later version.
10 
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this library; see the file COPYING. If not, write to the
18    Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
19    MA 02110-1301, USA.
20 
21    As a special exception, if you link this library with other files,
22    some of which are compiled with SDCC, to produce an executable,
23    this library does not by itself cause the resulting executable to
24    be covered by the GNU General Public License. This exception does
25    not however invalidate any other reasons why the executable file
26    might be covered by the GNU General Public License.
27 -------------------------------------------------------------------------*/
28 
29 #ifndef __SDC51_STDIO_H
30 #define __SDC51_STDIO_H 1
31 
32 #include <stdarg.h>
33 
34 #ifdef __ds390
35 #include <tinibios.h>
36 #endif
37 
38 #include <sdcc-lib.h>
39 
40 #ifndef EOF
41   #define EOF (-1)
42 #endif
43 
44 #ifndef NULL
45   #define NULL (void *)0
46 #endif
47 
48 #ifndef __SIZE_T_DEFINED
49 #define __SIZE_T_DEFINED
50   typedef unsigned int size_t;
51 #endif
52 
53 /* Bounds-checking interfaces from annex K of the C11 standard. */
54 #if defined (__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__
55 
56 #ifndef __RSIZE_T_DEFINED
57 #define __RSIZE_T_DEFINED
58 typedef size_t rsize_t;
59 #endif
60 
61 #ifndef __ERRNO_T_DEFINED
62 #define __ERRNO_T_DEFINED
63 typedef int errno_t;
64 #endif
65 
66 #endif
67 
68 typedef void (*pfn_outputchar)(char c, void* p) _REENTRANT;
69 
70 extern int _print_format (pfn_outputchar pfn, void* pvoid, const char *format, va_list ap);
71 
72 /*-----------------------------------------------------------------------*/
73 
74 extern void printf_small (char *,...) _REENTRANT;
75 extern int printf (const char *,...);
76 extern int vprintf (const char *, va_list);
77 extern int sprintf (char *, const char *, ...);
78 extern int vsprintf (char *, const char *, va_list);
79 extern int puts(const char *);
80 
81 #if __STDC_VERSION__ < 201112L
82 extern char *gets(char *);
83 #endif
84 
85 extern int getchar(void);
86 extern int putchar(int);
87 
88 #if defined(__SDCC_mcs51) && !defined(__SDCC_USE_XSTACK)
89 extern void printf_fast(__code const char *fmt, ...) _REENTRANT;
90 extern void printf_fast_f(__code const char *fmt, ...) _REENTRANT;
91 extern void printf_tiny(__code const char *fmt, ...) _REENTRANT;
92 #endif
93 
94 #endif /* __SDC51_STDIO_H */
95