|
@@ -20,66 +20,96 @@
|
|
|
#ifndef _STDIO_H_
|
|
|
#define _STDIO_H_
|
|
|
|
|
|
+#include <mlcrt.h>
|
|
|
#include <stdlib.h>
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
#define EOF -1
|
|
|
|
|
|
-#define getc(s) fgetc(s)
|
|
|
-#define getchar() fgetc(stdin)
|
|
|
-#define putc(c, s) fputc(c, s)
|
|
|
-#define putchar(c) fputc(c, stdout)
|
|
|
-
|
|
|
-#define getc_unlocked(s) fgetc_unlocked(s)
|
|
|
-#define getchar_unlocked() fgetc_unlocked(stdin)
|
|
|
-#define putc_unlocked(c, s) fputc_unlocked(c, s)
|
|
|
-#define putchar_unlocked(c) fputc(c, stdout)
|
|
|
-
|
|
|
-struct __crt_file;
|
|
|
-typedef struct __crt_file FILE;
|
|
|
-
|
|
|
-extern FILE *stdin;
|
|
|
-extern FILE *stdout;
|
|
|
-extern FILE *stderr;
|
|
|
-
|
|
|
-int fgetc(FILE *stream);
|
|
|
-int fputc(int c, FILE *stream);
|
|
|
-char *fgets(char *s, int size, FILE *stream);
|
|
|
-int fputs(const char *s, FILE *stream);
|
|
|
-int ungetc(int c, FILE *stream);
|
|
|
-char *gets(char *s);
|
|
|
-int puts(const char *s);
|
|
|
-
|
|
|
-int fgetc_unlocked(FILE *stream);
|
|
|
-int fputc_unlocked(int c, FILE *stream);
|
|
|
-char *fgets_unlocked(char *s, int size, FILE *stream);
|
|
|
-int fputs_unlocked(const char *s, FILE *stream);
|
|
|
-
|
|
|
-FILE *fopen(const char *pathname, const char *mode);
|
|
|
-FILE *fdopen(int fd, const char *mode);
|
|
|
-FILE *fmemopen(void *buf, size_t size, const char *mode);
|
|
|
-int fclose(FILE *stream);
|
|
|
+struct __CRT_PRIVATE(file);
|
|
|
+typedef struct __CRT_PRIVATE(file) FILE;
|
|
|
+
|
|
|
+extern FILE *__CRT_PUBLIC(stdin);
|
|
|
+extern FILE *__CRT_PUBLIC(stdout);
|
|
|
+extern FILE *__CRT_PUBLIC(stderr);
|
|
|
+
|
|
|
+int __CRT_PUBLIC(fgetc)(FILE *stream);
|
|
|
+int __CRT_PUBLIC(fputc)(int c, FILE *stream);
|
|
|
+char *__CRT_PUBLIC(fgets)(char *s, int size, FILE *stream);
|
|
|
+int __CRT_PUBLIC(fputs)(const char *s, FILE *stream);
|
|
|
+int __CRT_PUBLIC(ungetc)(int c, FILE *stream);
|
|
|
+char *__CRT_PUBLIC(gets)(char *s);
|
|
|
+int __CRT_PUBLIC(puts)(const char *s);
|
|
|
+
|
|
|
+static inline int __CRT_PUBLIC(getc)(FILE *stream)
|
|
|
+{
|
|
|
+ return __CRT_PUBLIC(fgetc)(stream);
|
|
|
+}
|
|
|
+
|
|
|
+static inline int __CRT_PUBLIC(getchar)(void)
|
|
|
+{
|
|
|
+ return __CRT_PUBLIC(fgetc)(__CRT_PUBLIC(stdin));
|
|
|
+}
|
|
|
+
|
|
|
+static inline int __CRT_PUBLIC(putc)(int c, FILE *stream)
|
|
|
+{
|
|
|
+ return __CRT_PUBLIC(fputc)(c, stream);
|
|
|
+}
|
|
|
+
|
|
|
+static inline int __CRT_PUBLIC(putchar)(int c)
|
|
|
+{
|
|
|
+ return __CRT_PUBLIC(fputc)(c, __CRT_PUBLIC(stdout));
|
|
|
+}
|
|
|
+
|
|
|
+int __CRT_PUBLIC(fgetc_unlocked)(FILE *stream);
|
|
|
+int __CRT_PUBLIC(fputc_unlocked)(int c, FILE *stream);
|
|
|
+char *__CRT_PUBLIC(fgets_unlocked)(char *s, int size, FILE *stream);
|
|
|
+int __CRT_PUBLIC(fputs_unlocked)(const char *s, FILE *stream);
|
|
|
+
|
|
|
+static inline int __CRT_PUBLIC(getc_unlocked)(FILE *stream)
|
|
|
+{
|
|
|
+ return __CRT_PUBLIC(fgetc_unlocked)(stream);
|
|
|
+}
|
|
|
+
|
|
|
+static inline int __CRT_PUBLIC(getchar_unlocked)(void)
|
|
|
+{
|
|
|
+ return __CRT_PUBLIC(fgetc_unlocked)(__CRT_PUBLIC(stdin));
|
|
|
+}
|
|
|
+
|
|
|
+static inline int __CRT_PUBLIC(putc_unlocked)(int c, FILE *stream)
|
|
|
+{
|
|
|
+ return __CRT_PUBLIC(fputc_unlocked)(c, stream);
|
|
|
+}
|
|
|
+
|
|
|
+static inline int __CRT_PUBLIC(putchar_unlocked)(int c)
|
|
|
+{
|
|
|
+ return __CRT_PUBLIC(fputc)(c, __CRT_PUBLIC(stdout));
|
|
|
+}
|
|
|
+
|
|
|
+FILE *__CRT_PUBLIC(fopen)(const char *pathname, const char *mode);
|
|
|
+FILE *__CRT_PUBLIC(fdopen)(int fd, const char *mode);
|
|
|
+FILE *__CRT_PUBLIC(fmemopen)(void *buf, size_t size, const char *mode);
|
|
|
+int __CRT_PUBLIC(fclose)(FILE *stream);
|
|
|
|
|
|
#define BUFSIZ 4096
|
|
|
#define _IOFBF 0
|
|
|
#define _IOLBF 1
|
|
|
#define _IONBF 2
|
|
|
|
|
|
-int setvbuf(FILE *stream, char *buf, int mode, size_t size);
|
|
|
-void setbuf(FILE *stream, char *buf);
|
|
|
-void setbuffer(FILE *stream, char *buf, size_t size);
|
|
|
-void setlinebuf(FILE *stream);
|
|
|
-
|
|
|
-int printf(const char *format, ...);
|
|
|
-int fprintf(FILE *stream, const char *format, ...);
|
|
|
-int dprintf(int fd, const char *format, ...);
|
|
|
-int sprintf(char *str, const char *format, ...);
|
|
|
-int snprintf(char *str, size_t size, const char *format, ...);
|
|
|
-int vprintf(const char *format, va_list ap);
|
|
|
-int vfprintf(FILE *stream, const char *format, va_list ap);
|
|
|
-int vdprintf(int fd, const char *format, va_list ap);
|
|
|
-int vsprintf(char *str, const char *format, va_list ap);
|
|
|
-int vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
|
|
+int __CRT_PUBLIC(setvbuf)(FILE *stream, char *buf, int mode, size_t size);
|
|
|
+void __CRT_PUBLIC(setbuf)(FILE *stream, char *buf);
|
|
|
+void __CRT_PUBLIC(setbuffer)(FILE *stream, char *buf, size_t size);
|
|
|
+void __CRT_PUBLIC(setlinebuf)(FILE *stream);
|
|
|
|
|
|
+int __CRT_PUBLIC(printf)(const char *format, ...);
|
|
|
+int __CRT_PUBLIC(fprintf)(FILE *stream, const char *format, ...);
|
|
|
+int __CRT_PUBLIC(dprintf)(int fd, const char *format, ...);
|
|
|
+int __CRT_PUBLIC(sprintf)(char *str, const char *format, ...);
|
|
|
+int __CRT_PUBLIC(snprintf)(char *str, size_t size, const char *format, ...);
|
|
|
+int __CRT_PUBLIC(vprintf)(const char *format, va_list ap);
|
|
|
+int __CRT_PUBLIC(vfprintf)(FILE *stream, const char *format, va_list ap);
|
|
|
+int __CRT_PUBLIC(vdprintf)(int fd, const char *format, va_list ap);
|
|
|
+int __CRT_PUBLIC(vsprintf)(char *str, const char *format, va_list ap);
|
|
|
+int __CRT_PUBLIC(vsnprintf)(char *str, size_t size, const char *format, va_list ap);
|
|
|
|
|
|
#endif
|