m3core/src/C/Common/CstdioC.c
#ifdef _MSC_VER
#pragma optimize("gty", on)
#undef _DLL
#endif
#include "m3core.h"
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
#define M3MODULE Cstdio
M3WRAP1(int, fclose, FILE*)
M3WRAP2_(FILE*, fdopen, int, const char*) /* fileno to FILE* */
M3WRAP1(int, feof, FILE*)
M3WRAP1(int, ferror, FILE*)
M3WRAP1(int, fflush, FILE*)
M3WRAP1(int, fgetc, FILE*)
M3WRAP3(char*, fgets, char*, int, FILE*)
M3WRAP1_(int, fileno, FILE*) /* FILE* to fileno */
M3WRAP2(FILE*, fopen, const char*, const char*)
M3WRAP2(int, fputc, int, FILE*)
M3WRAP2(int, fputs, const char*, FILE*)
M3WRAP4(size_t, fread, void*, size_t, size_t, FILE*)
M3WRAP3(FILE*, freopen, const char*, const char*, FILE*)
M3WRAP3(int, fseek, FILE*, long, int)
M3WRAP1(long, ftell, FILE*)
M3WRAP4(size_t, fwrite, const void*, size_t, size_t, FILE*)
M3WRAP1(int, getc, FILE*)
M3WRAP0(int, getchar)
M3WRAP1_(int, pclose, FILE*) /* close pipe */
M3WRAP2_(FILE*, popen, const char*, const char*) /* open pipe */
M3WRAP2(int, putc, int, FILE*)
M3WRAP1(int, putchar, int)
M3WRAP1(int, puts, const char*) /* put string + "\n" to stdout, atomically */
M3WRAP1(int, remove, const char*)
M3WRAP2(int, rename, const char*, const char*)
M3WRAP4(int, setvbuf, FILE*, char*, int, size_t)
M3WRAP0(FILE*, tmpfile)
M3WRAP2(int, ungetc, int, FILE*)
M3WRAP1_(int, getw, FILE*)
M3WRAP2_(int, putw, int, FILE*)
#define X(name, in, out) void __cdecl Cstdio__##name in { name out; }
#define X1(name, a) X(name, (a i), (i))
#define X2(name, a, b) X(name, (a i, b j), (i, j))
X1(clearerr, FILE*)
X1(perror, const char*) /* print error */
X1(rewind, FILE*)
X2(setbuf, FILE*, char*)
#undef X
#undef X_
#define X(a) const unsigned Cstdio__##a = a;
#define X_(a) const unsigned Cstdio__##a = _##a;
X(BUFSIZ)
X(FILENAME_MAX)
X(FOPEN_MAX)
X_(IOFBF) /* setvbuf full buffered */
X_(IOLBF) /* setvbuf line buffered */
X_(IONBF) /* setvbuf not buffered */
X(L_tmpnam)
X(SEEK_CUR)
X(SEEK_END)
X(SEEK_SET)
X(TMP_MAX)
#undef X
#define X(a) const int Cstdio__##a = a;
X(EOF)
#ifndef _WIN32
/* varying ABI in libcmt.lib and msvcrt.lib so just don't expose them */
#undef X
#define X(a) FILE* __cdecl Cstdio__get_##a(void) { return a; }
X(stdin)
X(stdout)
X(stderr)
#endif
#ifdef __cplusplus
}
#endif