#ifndef _MSL_CSTDIO
#define _MSL_CSTDIO

#include <ansi_params.h>

#if !_MSL_USING_MW_C_HEADERS
    #include <stdio.h>

    #if _MSL_PUT_THIRD_PARTY_C_IN_STD
        #include <msl_cpp_std_stdio.h>
    #endif
#else

#include <size_t.h>
#include <null.h>
#include <eof.h>
#include <va_list.h>

#if _MSL_WFILEIO_AVAILABLE
    #include <wchar_t.h>
#endif

#include <msl_secure.h>
#include <msl_rsize_t.h>
#include <file_struc.h>
#include <stdio_api.h>

#if _MSL_POSIX
    #include <stdio.posix.h>
#endif

#ifndef RC_INVOKED

#pragma options align=native

_MSL_BEGIN_NAMESPACE_STD
_MSL_BEGIN_EXTERN_C

_MSL_IMP_EXP_C void _MSL_CDECL setbuf(FILE * _MSL_RESTRICT, char * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL setvbuf(FILE * _MSL_RESTRICT, char * _MSL_RESTRICT, int, size_t) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL fclose(FILE *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL fflush(FILE *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL fscanf(FILE * _MSL_RESTRICT, const char * _MSL_RESTRICT, ...) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL scanf(const char * _MSL_RESTRICT, ...) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL sprintf(char * _MSL_RESTRICT, const char * _MSL_RESTRICT, ...) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL snprintf(char * _MSL_RESTRICT, size_t, const char * _MSL_RESTRICT, ...) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL sscanf(const char * _MSL_RESTRICT, const char * _MSL_RESTRICT, ...) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL vfscanf(FILE * _MSL_RESTRICT, const char * _MSL_RESTRICT, va_list) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL vsscanf(const char * _MSL_RESTRICT, const char * _MSL_RESTRICT, va_list) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL vscanf(const char * _MSL_RESTRICT, va_list) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL vfprintf(FILE * _MSL_RESTRICT, const char * _MSL_RESTRICT, va_list) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL vprintf(const char * _MSL_RESTRICT, va_list) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL vsprintf(char * _MSL_RESTRICT, const char * _MSL_RESTRICT, va_list) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL vsnprintf(char * _MSL_RESTRICT, size_t, const char * _MSL_RESTRICT, va_list) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL fgetc(FILE *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C char * _MSL_CDECL fgets(char * _MSL_RESTRICT, int, FILE * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL fputc(int, FILE *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL fputs(const char * _MSL_RESTRICT, FILE * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C char * _MSL_CDECL gets(char *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL puts(const char *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL ungetc(int, FILE *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C size_t _MSL_CDECL fread(void * _MSL_RESTRICT, size_t, size_t, FILE * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C size_t _MSL_CDECL fwrite(const void * _MSL_RESTRICT, size_t, size_t, FILE * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL fgetpos(FILE * _MSL_RESTRICT, fpos_t * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C long _MSL_CDECL ftell(FILE *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL fsetpos(FILE *, const fpos_t *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL fseek(FILE *, long, int) _MSL_CANT_THROW;
_MSL_IMP_EXP_C void _MSL_CDECL rewind(FILE *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C void _MSL_CDECL clearerr(FILE *) _MSL_CANT_THROW;

#if _MSL_OS_DISK_FILE_SUPPORT
_MSL_IMP_EXP_C void _MSL_CDECL perror(const char *) _MSL_CANT_THROW;
#endif

#if defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
_MSL_IMP_EXP_C int _MSL_CDECL fscanf_s(FILE * _MSL_RESTRICT, const char * _MSL_RESTRICT, ...) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL scanf_s(const char * _MSL_RESTRICT, ...) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL sscanf_s(const char * _MSL_RESTRICT, const char * _MSL_RESTRICT, ...) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL vfscanf_s(FILE * _MSL_RESTRICT, const char * _MSL_RESTRICT, va_list) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL vsscanf_s(const char * _MSL_RESTRICT, const char * _MSL_RESTRICT, va_list) _MSL_CANT_THROW;
_MSL_IMP_EXP_C char * _MSL_CDECL gets_s(char *, rsize_t) _MSL_CANT_THROW;
#endif

#if _MSL_OS_DISK_FILE_SUPPORT
_MSL_IMP_EXP_C int _MSL_CDECL remove(const char *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL rename(const char *, const char *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C char * _MSL_CDECL tmpnam(char *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C FILE * _MSL_CDECL tmpfile(void) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL fprintf(FILE * _MSL_RESTRICT, const char * _MSL_RESTRICT, ...) _MSL_CANT_THROW;

_MSL_IMP_EXP_C FILE * _MSL_CDECL fopen(const char * _MSL_RESTRICT, const char * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C FILE * _MSL_CDECL freopen(const char * _MSL_RESTRICT, const char * _MSL_RESTRICT, FILE * _MSL_RESTRICT) _MSL_CANT_THROW;
#if defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
_MSL_IMP_EXP_C errno_t _MSL_CDECL fopen_s(FILE * _MSL_RESTRICT * _MSL_RESTRICT, const char * _MSL_RESTRICT, const char * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C errno_t _MSL_CDECL freopen_s(FILE * _MSL_RESTRICT * _MSL_RESTRICT, const char * _MSL_RESTRICT, const char * _MSL_RESTRICT, FILE * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C errno_t _MSL_CDECL tmpfile_s(FILE * *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C errno_t _MSL_CDECL tmpnam_s(char *, rsize_t) _MSL_CANT_THROW;
#endif
#if _MSL_WFILEIO_AVAILABLE
_MSL_IMP_EXP_C int _MSL_CDECL _wremove(const wchar_t *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL _wrename(const wchar_t *, const wchar_t *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C wchar_t * _MSL_CDECL _wtmpnam(wchar_t *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C FILE * _MSL_CDECL _wfopen(const wchar_t * _MSL_RESTRICT, const wchar_t * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C FILE * _MSL_CDECL _wfreopen(const wchar_t * _MSL_RESTRICT, const wchar_t * _MSL_RESTRICT, FILE * _MSL_RESTRICT) _MSL_CANT_THROW;
#if defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
_MSL_IMP_EXP_C errno_t _MSL_CDECL _wfopen_s(FILE * _MSL_RESTRICT * _MSL_RESTRICT, const wchar_t * _MSL_RESTRICT, const wchar_t * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C errno_t _MSL_CDECL _wfreopen_s(FILE * _MSL_RESTRICT * _MSL_RESTRICT, const wchar_t * _MSL_RESTRICT, const wchar_t * _MSL_RESTRICT, FILE * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C errno_t _MSL_CDECL _wtmpnam_s(wchar_t *, rsize_t) _MSL_CANT_THROW;
#endif
#endif
#endif

#if _MSL_CONSOLE_SUPPORT
_MSL_IMP_EXP_C int _MSL_CDECL printf(const char * _MSL_RESTRICT, ...) _MSL_CANT_THROW;
#endif

#ifdef __cplusplus

#if _MSL_THREADSAFE
_MSL_IMP_EXP_C int _MSL_CDECL getc(FILE *);
_MSL_IMP_EXP_C int _MSL_CDECL putc(int c, FILE *);

_MSL_END_EXTERN_C
#else
_MSL_END_EXTERN_C

inline int _MSL_CDECL getc (FILE * file) _MSL_CANT_THROW {
    return __getc(file);
}

inline int _MSL_CDECL putc (int c, FILE * file) _MSL_CANT_THROW {
    return __putc(c, file);
}
#endif

inline int _MSL_CDECL getchar () _MSL_CANT_THROW {
    return getc(stdin);
}

inline int _MSL_CDECL putchar (int c) _MSL_CANT_THROW {
    return putc(c, stdout);
}

inline int _MSL_CDECL feof (FILE * file) _MSL_CANT_THROW {
    return file->state.eof;
}

inline int _MSL_CDECL ferror (FILE * file) _MSL_CANT_THROW {
    return file->state.error;
}

#else

_MSL_IMP_EXP_C int _MSL_CDECL getc(FILE *);
_MSL_IMP_EXP_C int _MSL_CDECL putc(int c, FILE *);

#if !_MSL_THREADSAFE
    #define getc(file) __getc(file)
    #define putc(c, file) __putc(c, file)
#endif

_MSL_IMP_EXP_C int _MSL_CDECL getchar(void);
_MSL_IMP_EXP_C int _MSL_CDECL putchar(int c);

    #define getchar() __std(getc)(stdin)
    #define putchar(c) __std(putc)(c, stdout)

_MSL_IMP_EXP_C int _MSL_CDECL feof(FILE *);
_MSL_IMP_EXP_C int _MSL_CDECL ferror(FILE *);

    #define feof(file) ((file)->state.eof)
    #define ferror(file) ((file)->state.error)

#endif

_MSL_END_NAMESPACE_STD

#pragma options align=reset

#endif

#endif

#endif
