--- mstools/h/io.h 2018/08/09 18:20:34 1.1.1.2 +++ mstools/h/io.h 2018/08/09 18:23:09 1.1.1.4 @@ -1,7 +1,7 @@ /*** *io.h - declarations for low-level file handling and I/O functions * -* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved. +* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved. * *Purpose: * This file contains the function declarations for the low-level @@ -11,24 +11,43 @@ #ifndef _INC_IO +#ifndef _POSIX_ + #ifdef __cplusplus extern "C" { #endif -#ifndef MIPS -#if (_MSC_VER <= 600) -#define __cdecl _cdecl -#endif +/* + * Conditional macro definition for function calling type and variable type + * qualifiers. + */ +#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) ) + +/* + * Definitions for MS C8-32 (386/486) compiler + */ +#define _CRTAPI1 __cdecl +#define _CRTAPI2 __cdecl + +#else + +/* + * Other compilers (e.g., MIPS) + */ +#define _CRTAPI1 +#define _CRTAPI2 + #endif + #ifndef _TIME_T_DEFINED typedef long time_t; /* time value */ #define _TIME_T_DEFINED /* avoid multiple def's of time_t */ #endif #ifndef _FSIZE_T_DEFINED -typedef unsigned long _fsize_t; // Could be 64 bits for Win32 +typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */ #define _FSIZE_T_DEFINED #endif @@ -36,11 +55,11 @@ typedef unsigned long _fsize_t; // C struct _finddata_t { unsigned attrib; - time_t time_create; // -1 for FAT file systems - time_t time_access; // -1 for FAT file systems + time_t time_create; /* -1 for FAT file systems */ + time_t time_access; /* -1 for FAT file systems */ time_t time_write; _fsize_t size; - char name[256]; + char name[260]; }; #define _FINDDATA_T_DEFINED @@ -57,76 +76,41 @@ struct _finddata_t { #define _A_ARCH 0x20 /* Archive file */ /* function prototypes */ -#ifdef _POSIX_ -int access(const char *, int); -int chmod(const char *, int); -int chsize(int, long); -int close(int); -int commit(int); -int creat(const char *, int); -int dup(int); -int dup2(int, int); -int eof(int); -long filelength(int); -int isatty(int); -int locking(int, int, long); -long lseek(int, long, int); -char * mktemp(char *); -int open(const char *, int, ...); -int pipe(int *); /* POSIX pipe */ -int read(int, void *, unsigned int); -int remove(const char *); -int rename(const char *, const char *); -int setmode(int, int); -long tell(int); -int umask(int); -int unlink(const char *); -int write(int, const void *, unsigned int); -#else -int _access(const char *, int); -int _chmod(const char *, int); -int _chsize(int, long); -int _close(int); -int _commit(int); -int _creat(const char *, int); -int _dup(int); -int _dup2(int, int); -int _eof(int); -long _filelength(int); -int _isatty(int); -int _locking(int, int, long); -long _lseek(int, long, int); -char * _mktemp(char *); -int _open(const char *, int, ...); -int _pipe(int *, unsigned int, int); -int _read(int, void *, unsigned int); -int remove(const char *); -int rename(const char *, const char *); -int _setmode(int, int); -int _sopen(const char *, int, int, ...); -long _tell(int); -int _umask(int); -int _unlink(const char *); -int _write(int, const void *, unsigned int); -#endif /* _POSIX_ */ - -#ifdef _POSIX_ -#define _chsize_lk(fh,size) _chsize(fh,size) -#define _close_lk(fh) close(fh) -#define _lseek_lk(fh,offset,origin) lseek(fh,offset,origin) -#define _setmode_lk(fh,mode) _setmode(fh,mode) -#define _read_lk(fh,buff,count) read(fh,buff,count) -#define _write_lk(fh,buff,count) write(fh,buff,count) -#endif /* POSIX */ -long _findfirst(char *, struct _finddata_t *); -int _findnext(long, struct _finddata_t *); -int _findclose(long); + +int _CRTAPI1 _access(const char *, int); +int _CRTAPI1 _chmod(const char *, int); +int _CRTAPI1 _chsize(int, long); +int _CRTAPI1 _close(int); +int _CRTAPI1 _commit(int); +int _CRTAPI1 _creat(const char *, int); +int _CRTAPI1 _dup(int); +int _CRTAPI1 _dup2(int, int); +int _CRTAPI1 _eof(int); +long _CRTAPI1 _filelength(int); +long _CRTAPI1 _findfirst(char *, struct _finddata_t *); +int _CRTAPI1 _findnext(long, struct _finddata_t *); +int _CRTAPI1 _findclose(long); +int _CRTAPI1 _isatty(int); +int _CRTAPI1 _locking(int, int, long); +long _CRTAPI1 _lseek(int, long, int); +char * _CRTAPI1 _mktemp(char *); +int _CRTAPI2 _open(const char *, int, ...); +int _CRTAPI1 _pipe(int *, unsigned int, int); +int _CRTAPI1 _read(int, void *, unsigned int); +int _CRTAPI1 remove(const char *); +int _CRTAPI1 rename(const char *, const char *); +int _CRTAPI1 _setmode(int, int); +int _CRTAPI2 _sopen(const char *, int, int, ...); +long _CRTAPI1 _tell(int); +int _CRTAPI1 _umask(int); +int _CRTAPI1 _unlink(const char *); +int _CRTAPI1 _write(int, const void *, unsigned int); -long _get_osfhandle(int); -int _open_osfhandle(long, int); +long _CRTAPI1 _get_osfhandle(int); +int _CRTAPI1 _open_osfhandle(long, int); -#if !(__STDC__ || defined(_POSIX_)) +#if !(__STDC__ || defined(__cplusplus)) /* Non-ANSI names for compatibility */ #define access _access #define chmod _chmod @@ -155,5 +139,8 @@ int _open_osfhandle(long, int); } #endif + +#endif /* _POSIX_ */ + #define _INC_IO #endif /* _INC_IO */