stdio.mh

来自「开放源码的编译器open watcom 1.6.0版的源代码」· MH 代码 · 共 738 行 · 第 1/2 页

MH
738
字号
_WCRTLINK extern int    remove( const char *__filename );
_WCRTLINK extern int    rename( const char *__old, const char *__new );
_WCRTLINK extern void   rewind( FILE *__fp );
_WCRTLINK extern int    scanf( const char *__format, ... );
_WCRTLINK extern void   setbuf( FILE *__fp, char *__buf );
_WCRTLINK extern int    setvbuf( FILE *__fp, char *__buf, int __mode,
                                 size_t __size );
_WCRTLINK extern int    sprintf( char *__s, const char *__format, ... );
_WCRTLINK extern int    sscanf( const char *__s, const char *__format, ... );
_WCRTLINK extern FILE   *tmpfile( void );
_WCRTLINK extern char   *tmpnam( char *__s );
_WCRTLINK extern int    ungetc( int __c, FILE *__fp );
_WCRTLINK extern int    vfprintf( FILE *__fp, const char *__format,
                                  __va_list __arg );
_WCRTLINK extern int    vprintf( const char *__format, __va_list __arg );
_WCRTLINK extern int    vsprintf( char *__s, const char *__format,
                                  __va_list __arg );
:: End of namespace std
:segment CNAME
}
:endsegment

:: Implementation specific functions remain in the global namespace.
:segment !SNAP & !SNAPDRV
:segment CNAME
_WCRTLINK extern int        _getw( std::FILE *__fp );
_WCRTLINK extern int        _pclose( std::FILE *__fp );
_WCRTLINK extern std::FILE  *_popen( const char *__command,
                                     const char *__mode );
_WCRTLINK extern int        _putw( int __binint, std::FILE *__fp );
:elsesegment
_WCRTLINK extern int   _getw( FILE *__fp );
_WCRTLINK extern int   _pclose( FILE *__fp );
_WCRTLINK extern FILE  *_popen( const char *__command, const char *__mode );
_WCRTLINK extern int   _putw( int __binint, FILE *__fp );
:endsegment
_WCRTLINK extern char  *_tempnam( char *__dir, char *__prefix );
:endsegment

:: Extensions section.
:include ext.sp
:include wchar_t.sp

:include wctypet.sp

:segment CNAME
#define WEOF  ((std::wint_t)(-1)) /*  EOF equivalent for wide chars   */
:elsesegment
#define WEOF  ((wint_t)(-1))      /*  EOF equivalent for wide chars   */
:endsegment

:segment CNAME
namespace std {
:endsegment
/* These names are in stdio according to C99. */
_WCRTLINK extern int     snprintf( char *__buf, size_t __bufsize,
                                   const char *__fmt, ... );
_WCRTLINK extern int     vfscanf( FILE *__fp, const char *__format,
                                  __va_list __arg );
_WCRTLINK extern int     vscanf( const char *__format, __va_list __arg );
_WCRTLINK extern int     vsnprintf( char *__s, size_t __bufsize,
                                    const char *__format, __va_list __arg );
_WCRTLINK extern int     vsscanf( const char *__s, const char *__format,
                                  __va_list __arg );

:segment !SNAPDRV & !NO_WIDECHAR
/* These names are not in stdio according to C99. */
_WCRTLINK extern wint_t   getwc( FILE * );
_WCRTLINK extern wint_t   getwchar( void );
_WCRTLINK extern wint_t   fgetwc( FILE * );
_WCRTLINK extern wchar_t  *fgetws( wchar_t *, int, FILE * );
_WCRTLINK extern wint_t   fputwc( wint_t, FILE * );
_WCRTLINK extern int      fputws( const wchar_t *, FILE * );
_WCRTLINK extern int      fwprintf( FILE *, const wchar_t *, ... );
_WCRTLINK extern int      fwscanf( FILE *, const wchar_t *, ... );
_WCRTLINK extern wint_t   putwc( wint_t, FILE * );
_WCRTLINK extern wint_t   putwchar( wint_t );
#ifndef swprintf
_WCRTLINK extern int      swprintf( wchar_t *, size_t, const wchar_t *, ... );
#endif
_WCRTLINK extern int      swscanf( const wchar_t *, const wchar_t *, ... );
_WCRTLINK extern wint_t   ungetwc( wint_t, FILE * );
_WCRTLINK extern int      vfwprintf( FILE *, const wchar_t *, __va_list );
_WCRTLINK extern int      vfwscanf( FILE *, const wchar_t *, __va_list );
_WCRTLINK extern int      vswprintf( wchar_t *, size_t, const wchar_t *,
                                     __va_list );
_WCRTLINK extern int      vswscanf( const wchar_t *, const wchar_t *,
                                    __va_list );
_WCRTLINK extern int      vwprintf( const wchar_t *, __va_list );
_WCRTLINK extern int      vwscanf( const wchar_t *, __va_list );
_WCRTLINK extern int      wprintf( const wchar_t *, ... );
_WCRTLINK extern int      wscanf( const wchar_t *, ... );
:endsegment
:segment CNAME
}
:endsegment

/* These names are not part of C89 or C99. */
::
:: The following is generated into cstdio
:segment CNAME
_WCRTLINK extern int           flushall( void );
:segment !SNAPDRV
:segment !QNX & !LINUX
_WCRTLINK extern std::FILE     *_fdopen( int __handle, const char *__mode );
_WCRTLINK extern std::FILE     *fdopen( int __handle, const char *__mode );
:endsegment
_WCRTLINK extern int           _bprintf( char *__buf, std::size_t __bufsize,
                                         const char *__fmt, ... );
_WCRTLINK extern int           _fgetchar( void );
_WCRTLINK extern int           _fileno(std::FILE *);
_WCRTLINK extern int           _fputchar( int __c );
_WCRTLINK extern std::FILE     *_fsopen( const char *__filename,
                                        const char *__mode, int __shflag );
_WCRTLINK extern int           _grow_handles( int __new_count );
_WCRTLINK extern int           _snprintf( char *__buf, std::size_t __bufsize,
                                          const char *__fmt, ... );
_WCRTLINK extern int           _vbprintf( char *__s, std::size_t __bufsize,
                                       const char *__format, __va_list __arg );
_WCRTLINK extern int           _vsnprintf( char *__s, std::size_t __bufsize,
                                       const char *__format, __va_list __arg );
_WCRTLINK extern int           fcloseall( void );
_WCRTLINK extern int           fgetchar( void );
_WCRTLINK extern int           fileno(std::FILE *);
_WCRTLINK extern int           fputchar( int __c );

:segment !NO_WIDECHAR
/* These functions pertain to wide character handling. */
_WCRTLINK extern int           _bwprintf( wchar_t *, std::size_t,
                                          const wchar_t *, ... );
_WCRTLINK extern wchar_t       *_getws( wchar_t * );
_WCRTLINK extern std::wint_t   _fgetwchar( void );
_WCRTLINK extern std::wint_t   _fputwchar( std::wint_t );
_WCRTLINK extern int           _putws( const wchar_t * );
_WCRTLINK extern int           _snwprintf( wchar_t *, std::size_t,
                                           const wchar_t *, ... );
_WCRTLINK extern int           _swprintf( wchar_t *, const wchar_t *, ... );
_WCRTLINK extern int           _vbwprintf( wchar_t *, std::size_t,
                                           const wchar_t *, __va_list );
_WCRTLINK extern int           _vsnwprintf( wchar_t *, std::size_t,
                                            const wchar_t *, __va_list );
_WCRTLINK extern int           _vswprintf( wchar_t *,
                                           const wchar_t *, __va_list );
_WCRTLINK extern std::FILE     *_wfdopen( int, const wchar_t * );
_WCRTLINK extern std::FILE     *_wfopen( const wchar_t *, const wchar_t * );
_WCRTLINK extern std::FILE     *_wfreopen( const wchar_t *,
                                          const wchar_t *, std::FILE * );
_WCRTLINK extern std::FILE     *_wfsopen( const wchar_t *__filename,
                                         const wchar_t *__mode, int __shflag );
_WCRTLINK extern void          _wperror( const wchar_t * );
_WCRTLINK extern std::FILE     *_wpopen( const wchar_t *__command,
                                        const wchar_t *__mode );
_WCRTLINK extern int           _wremove( const wchar_t * );
_WCRTLINK extern int           _wrename( const wchar_t *, const wchar_t * );
_WCRTLINK extern wchar_t       *_wtempnam( wchar_t *__dir, wchar_t *__prefix );
_WCRTLINK extern wchar_t       *_wtmpnam( wchar_t * );
_WCRTLINK extern std::wint_t   fgetwchar( void );
_WCRTLINK extern std::wint_t   fputwchar( std::wint_t );
_WCRTLINK extern wchar_t       *getws( wchar_t * );
_WCRTLINK extern int           putws( const wchar_t * );
:endsegment
:endsegment
::
:: The following is generated into stdio.h
:elsesegment
_WCRTLINK extern int      flushall( void );
:segment !SNAPDRV
:segment !QNX & !LINUX
_WCRTLINK extern FILE     *_fdopen( int __handle, const char *__mode );
_WCRTLINK extern FILE     *fdopen( int __handle, const char *__mode );
:endsegment
_WCRTLINK extern int      _bprintf( char *__buf, size_t __bufsize,
                                    const char *__fmt, ... );
_WCRTLINK extern int      _fgetchar( void );
_WCRTLINK extern int      _fileno(FILE *);
_WCRTLINK extern int      _fputchar( int __c );
_WCRTLINK extern FILE     *_fsopen( const char *__filename, const char *__mode,
                                   int __shflag );
_WCRTLINK extern int      _grow_handles( int __new_count );
_WCRTLINK extern int      _snprintf( char *__buf, size_t __bufsize,
                                     const char *__fmt, ... );
_WCRTLINK extern int      _vbprintf( char *__s, size_t __bufsize,
                                     const char *__format, __va_list __arg );
_WCRTLINK extern int      _vsnprintf( char *__s, size_t __bufsize,
                                      const char *__format, __va_list __arg );
_WCRTLINK extern int      fcloseall( void );
_WCRTLINK extern int      fgetchar( void );
_WCRTLINK extern int      fileno(FILE *);
_WCRTLINK extern int      fputchar( int __c );

:segment !NO_WIDECHAR
/* These functions pertain to wide character handling. */
_WCRTLINK extern int      _bwprintf( wchar_t *, size_t, const wchar_t *, ... );
_WCRTLINK extern wint_t   _fgetwchar( void );
_WCRTLINK extern wint_t   _fputwchar( wint_t );
_WCRTLINK extern wchar_t  *_getws( wchar_t * );
_WCRTLINK extern int      _putws( const wchar_t * );
_WCRTLINK extern int      _snwprintf( wchar_t *, size_t,
                                      const wchar_t *, ... );
_WCRTLINK extern int      _swprintf( wchar_t *, const wchar_t *, ... );
_WCRTLINK extern FILE     *_wfdopen( int, const wchar_t * );
_WCRTLINK extern FILE     *_wfopen( const wchar_t *, const wchar_t * );
_WCRTLINK extern FILE     *_wfreopen( const wchar_t *, const wchar_t *,
                                     FILE * );
_WCRTLINK extern FILE     *_wfsopen( const wchar_t *__filename,
                                   const wchar_t *__mode,  int __shflag );
_WCRTLINK extern void     _wperror( const wchar_t * );
_WCRTLINK extern FILE     *_wpopen( const wchar_t *__command,
                                   const wchar_t *__mode );
_WCRTLINK extern int      _wremove( const wchar_t * );
_WCRTLINK extern int      _wrename( const wchar_t *, const wchar_t * );
_WCRTLINK extern wchar_t  *_wtempnam( wchar_t *__dir, wchar_t *__prefix );
_WCRTLINK extern wchar_t  *_wtmpnam( wchar_t * );
_WCRTLINK extern int      _vbwprintf( wchar_t *, size_t, const wchar_t *,
                                      __va_list );
_WCRTLINK extern int      _vsnwprintf( wchar_t *, size_t, const wchar_t *,
                                       __va_list );
_WCRTLINK extern int      _vswprintf( wchar_t *, const wchar_t *, __va_list );
_WCRTLINK extern wint_t   fgetwchar( void );
_WCRTLINK extern wint_t   fputwchar( wint_t );
_WCRTLINK extern wchar_t  *getws( wchar_t * );
_WCRTLINK extern int      putws( const wchar_t * );
:endsegment
:endsegment
:endsegment

:segment !CNAME
:include saferpro.sp

:include rsizet.sp

:include errnot.sp

_WCRTLINK extern char     *gets_s( char *__s, rsize_t __n );

_WCRTLINK extern int      fprintf_s( FILE * __restrict __stream,
                                     const char * __restrict __format, ... );
_WCRTLINK extern int      fscanf_s( FILE * __restrict __stream,
                                     const char * __restrict __format, ... );
_WCRTLINK extern int      printf_s( const char * __restrict __format, ... );
_WCRTLINK extern int      scanf_s( const char * __restrict __format, ... );
_WCRTLINK extern int      snprintf_s( char * __restrict __s, rsize_t __n,
                                      const char * __restrict __format, ... );
_WCRTLINK extern int      sprintf_s( char * __restrict s, rsize_t __n,
                                     const char * __restrict __format, ... );
_WCRTLINK extern int      sscanf_s( const char * __restrict __s,
                                    const char * __restrict __format, ... );
_WCRTLINK extern int      vfprintf_s( FILE * __restrict __stream,
                                      const char * __restrict __format, __va_list __arg );
_WCRTLINK extern int      vfscanf_s( FILE * __restrict __stream,
                                      const char * __restrict __format, __va_list __arg );
_WCRTLINK extern int      vprintf_s( const char * __restrict __format, __va_list __arg );
_WCRTLINK extern int      vscanf_s( const char * __restrict __format, __va_list __arg );
_WCRTLINK extern int      vsnprintf_s( char * __restrict __s, rsize_t __n,
                                       const char * __restrict __format, __va_list __arg );
_WCRTLINK extern int      vsprintf_s( char * __restrict __s, rsize_t __n,
                                      const char * __restrict __format, __va_list __arg );
_WCRTLINK extern int      vsscanf_s( const char * __restrict __s,
                                     const char * __restrict __format, __va_list __arg );
_WCRTLINK extern errno_t  fopen_s( FILE * __restrict * __restrict __streamptr,
                                   const char * __restrict __filename,
                                   const char * __restrict __mode);
_WCRTLINK extern errno_t  freopen_s( FILE * __restrict * __restrict __newstreamptr,
                                     const char * __restrict __filename,
                                     const char * __restrict __mode, FILE * __restrict __stream );
_WCRTLINK extern errno_t  tmpfile_s( FILE * __restrict * __restrict __streamptr);
_WCRTLINK extern errno_t  tmpnam_s( char *__s, rsize_t __maxsize );

#define TMP_MAX_S   (26*26*26)      /* has to be same as TMP_MAX */

:segment QNX | LINUX
#define L_tmpnam_s  255             /* has to be same as L_tmpnam */
:elsesegment
#define L_tmpnam_s  13              /* has to be same as L_tmpnam */
:endsegment

:segment !NO_WIDECHAR
/* These functions pertain to wide character handling. */
_WCRTLINK extern errno_t _wfopen_s( FILE * __restrict * __restrict __streamptr,
                                    const wchar_t * __restrict __filename,
                                    const wchar_t * __restrict __mode);
_WCRTLINK extern errno_t _wfreopen_s( FILE * __restrict * __restrict __newstreamptr,
                                      const wchar_t * __restrict __filename,
                                      const wchar_t * __restrict __mode,
                                      FILE * __restrict __stream );
_WCRTLINK extern errno_t _wtmpnam_s( wchar_t *__s, rsize_t __maxsize );
:endsegment

:include saferepi.sp
:endsegment

:segment !SNAPDRV & QNX
#ifdef _this_belongs_in_a_private_qnx_header
 extern int _input_line_max;            /* defaults to 20 */
:segment CNAME
 char   *input_line( std::FILE *, char *, int );
:elsesegment
 char   *input_line( FILE *, char *, int );
:endsegment
#endif
:endsegment
#endif /* End of extensions section */

:segment QNX | LINUX
:include unixext.sp
extern char       *ctermid( char * );
extern char       *cuserid( char * );
:segment CNAME
_WCRTLINK extern std::FILE  *fdopen( int __handle, const char *__mode );
_WCRTLINK extern std::FILE  *popen( const char *__filename, const char *__mode );
_WCRTLINK extern int         pclose( std::FILE *__stream );
:elsesegment
_WCRTLINK extern FILE       *fdopen( int __handle, const char *__mode );
_WCRTLINK extern FILE       *popen( const char *__filename, const char *__mode );
_WCRTLINK extern int         pclose( FILE *__stream );
:endsegment
#endif
:endsegment

:: Eliminate all macro versions of these functions from cstdio
:: Eventually they can be re-introduced as proper in-line functions.
:segment !CNAME
#if !defined(__OBSCURE_STREAM_INTERNALS)
#define clearerr(fp)    ((fp)->_flag &= ~(_SFERR|_EOF))
#define feof(fp)        ((fp)->_flag & _EOF)
#define ferror(fp)      ((fp)->_flag & _SFERR)
#define fileno(fp)      ((fp)->_handle)
#define _fileno(fp)     ((fp)->_handle)
#endif
::
#if defined(__SW_BD) || defined(__SW_BM)
#define getc(fp)        fgetc(fp)
#define putc(c,fp)      fputc(c,fp)
#else
#if !defined(__OBSCURE_STREAM_INTERNALS)
#define getc(fp) \
        ((fp)->_cnt<=0 \
:segment !QNX & !LINUX
        || (unsigned)((*(fp)->_ptr)-'\x0d')<=('\x1a'-'\x0d') \
:endsegment
        ? fgetc(fp) \
        : ((fp)->_cnt--,*(fp)->_ptr++))
::
#define putc(c,fp) \
        ((fp)->_flag&_IONBF \
        || (fp)->_bufsize-(fp)->_cnt<=1 \
        ? fputc(c,fp) \
        : ((*(fp)->_ptr=(unsigned char)(c))=='\n') \
        ? fputc('\n',fp) \
        : ((fp)->_flag|=_DIRTY,(fp)->_cnt++,*(fp)->_ptr++))
#endif
#endif
::
#define getchar()       getc(stdin)
#define putchar(c)      putc(c,stdout)
:endsegment

:include poppack.sp
:segment CNAME
:include cplusepi.sp
:endsegment

:: This #endif closes the #ifdef __cplusplus in stdio.h
:segment !CNAME
#endif
:endsegment

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?