home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / IO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-08  |  8.2 KB  |  319 lines

  1. #if !defined(__TOPLEVEL_NEXT_COMMON_INCLUDE__)
  2. #define __TOPLEVEL_NEXT_COMMON_INCLUDE__
  3. #define __TOPLEVEL_IO_H_
  4. #include <next_common_defines.h>
  5. #endif /* __TOPLEVEL_NEXT_COMMON_INCLUDE__ */
  6.  
  7. /***
  8. *io.h - declarations for low-level file handling and I/O functions
  9. *
  10. *    Copyright (c) 1985-1995, Microsoft Corporation. All rights reserved.
  11. *
  12. *Purpose:
  13. *    This file contains the function declarations for the low-level
  14. *    file handling and I/O functions.
  15. *
  16. *       [Public]
  17. *
  18. ****/
  19.  
  20. #if _MSC_VER > 1000
  21. #pragma once
  22. #endif
  23.  
  24. #ifndef _INC_IO
  25. #define _INC_IO
  26.  
  27. #if !defined(_WIN32) && !defined(_MAC)
  28. #error ERROR: Only Mac or Win32 targets supported!
  29. #endif
  30.  
  31.  
  32. #ifdef    _MSC_VER
  33. /*
  34.  * Currently, all MS C compilers for Win32 platforms default to 8 byte
  35.  * alignment.
  36.  */
  37. #pragma pack(push,8)
  38. #endif    /* _MSC_VER */
  39.  
  40. #ifndef _POSIX_
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46.  
  47. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  48.  
  49. #ifndef _CRTAPI1
  50. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  51. #define _CRTAPI1 __cdecl
  52. #else
  53. #define _CRTAPI1
  54. #endif
  55. #endif
  56.  
  57.  
  58. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  59.  
  60. #ifndef _CRTAPI2
  61. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  62. #define _CRTAPI2 __cdecl
  63. #else
  64. #define _CRTAPI2
  65. #endif
  66. #endif
  67.  
  68.  
  69. /* Define _CRTIMP */
  70.  
  71. #ifndef _CRTIMP
  72. #ifdef    _NTSDK
  73. /* definition compatible with NT SDK */
  74. #define _CRTIMP
  75. #else    /* ndef _NTSDK */
  76. /* current definition */
  77. #ifdef    _DLL
  78. #define _CRTIMP __declspec(dllimport)
  79. #else    /* ndef _DLL */
  80. #define _CRTIMP
  81. #endif    /* _DLL */
  82. #endif    /* _NTSDK */
  83. #endif    /* _CRTIMP */
  84.  
  85.  
  86. /* Define __cdecl for non-Microsoft compilers */
  87.  
  88. #if    ( !defined(_MSC_VER) && !defined(__cdecl) )
  89. #define __cdecl
  90. #endif
  91.  
  92. #ifndef _MAC
  93. #ifndef _WCHAR_T_DEFINED
  94. typedef unsigned short wchar_t;
  95. #define _WCHAR_T_DEFINED
  96. #endif
  97. #endif /* ndef _MAC */
  98.  
  99. #ifndef _TIME_T_DEFINED
  100. typedef long time_t;        /* time value */
  101. #define _TIME_T_DEFINED     /* avoid multiple def's of time_t */
  102. #endif
  103.  
  104. #ifndef _FSIZE_T_DEFINED
  105. typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
  106. #define _FSIZE_T_DEFINED
  107. #endif
  108.  
  109. #ifndef _MAC
  110.  
  111. #ifndef _FINDDATA_T_DEFINED
  112.  
  113. struct _finddata_t {
  114.     unsigned    attrib;
  115.     time_t    time_create;    /* -1 for FAT file systems */
  116.     time_t    time_access;    /* -1 for FAT file systems */
  117.     time_t    time_write;
  118.     _fsize_t    size;
  119.     char    name[260];
  120. };
  121.  
  122. #if _INTEGRAL_MAX_BITS >= 64
  123. struct _finddatai64_t {
  124.     unsigned    attrib;
  125.     time_t    time_create;    /* -1 for FAT file systems */
  126.     time_t    time_access;    /* -1 for FAT file systems */
  127.     time_t    time_write;
  128.     __int64    size;
  129.     char    name[260];
  130. };
  131. #endif
  132.  
  133. #define _FINDDATA_T_DEFINED
  134. #endif
  135.  
  136. #ifndef _WFINDDATA_T_DEFINED
  137.  
  138. struct _wfinddata_t {
  139.     unsigned    attrib;
  140.     time_t    time_create;    /* -1 for FAT file systems */
  141.     time_t    time_access;    /* -1 for FAT file systems */
  142.     time_t    time_write;
  143.     _fsize_t    size;
  144.     wchar_t    name[260];
  145. };
  146.  
  147. #if _INTEGRAL_MAX_BITS >= 64
  148. struct _wfinddatai64_t {
  149.     unsigned    attrib;
  150.     time_t    time_create;    /* -1 for FAT file systems */
  151.     time_t    time_access;    /* -1 for FAT file systems */
  152.     time_t    time_write;
  153.     __int64    size;
  154.     wchar_t    name[260];
  155. };
  156. #endif
  157.  
  158. #define _WFINDDATA_T_DEFINED
  159. #endif
  160.  
  161. /* File attribute constants for _findfirst() */
  162.  
  163. #define _A_NORMAL    0x00    /* Normal file - No read/write restrictions */
  164. #define _A_RDONLY    0x01    /* Read only file */
  165. #define _A_HIDDEN    0x02    /* Hidden file */
  166. #define _A_SYSTEM    0x04    /* System file */
  167. #define _A_SUBDIR    0x10    /* Subdirectory */
  168. #define _A_ARCH     0x20    /* Archive file */
  169.  
  170. #endif /* ndef _MAC */
  171.  
  172. /* function prototypes */
  173.  
  174. _CRTIMP int __cdecl _access(const char *, int);
  175. _CRTIMP int __cdecl _chmod(const char *, int);
  176. _CRTIMP int __cdecl _chsize(int, long);
  177. _CRTIMP int __cdecl _close(int);
  178. _CRTIMP int __cdecl _commit(int);
  179. _CRTIMP int __cdecl _creat(const char *, int);
  180. _CRTIMP int __cdecl _dup(int);
  181. _CRTIMP int __cdecl _dup2(int, int);
  182. _CRTIMP int __cdecl _eof(int);
  183. _CRTIMP long __cdecl _filelength(int);
  184. #ifndef _MAC
  185. _CRTIMP long __cdecl _findfirst(const char *, struct _finddata_t *);
  186. _CRTIMP int __cdecl _findnext(long, struct _finddata_t *);
  187. _CRTIMP int __cdecl _findclose(long);
  188. #endif /* ndef _MAC */
  189. _CRTIMP int __cdecl _isatty(int);
  190. _CRTIMP int __cdecl _locking(int, int, long);
  191. _CRTIMP long __cdecl _lseek(int, long, int);
  192. _CRTIMP char * __cdecl _mktemp(char *);
  193. _CRTIMP int __cdecl _open(const char *, int, ...);
  194. #ifndef _MAC
  195. _CRTIMP int __cdecl _pipe(int *, unsigned int, int);
  196. #endif /* ndef _MAC */
  197. _CRTIMP int __cdecl _read(int, void *, unsigned int);
  198. _CRTIMP int __cdecl remove(const char *);
  199. _CRTIMP int __cdecl rename(const char *, const char *);
  200. _CRTIMP int __cdecl _setmode(int, int);
  201. _CRTIMP int __cdecl _sopen(const char *, int, int, ...);
  202. _CRTIMP long __cdecl _tell(int);
  203. _CRTIMP int __cdecl _umask(int);
  204. _CRTIMP int __cdecl _unlink(const char *);
  205. _CRTIMP int __cdecl _write(int, const void *, unsigned int);
  206.  
  207. #if _INTEGRAL_MAX_BITS >= 64
  208. _CRTIMP __int64 __cdecl _filelengthi64(int);
  209. _CRTIMP long __cdecl _findfirsti64(const char *, struct _finddatai64_t *);
  210. _CRTIMP int __cdecl _findnexti64(long, struct _finddatai64_t *);
  211. _CRTIMP __int64 __cdecl _lseeki64(int, __int64, int);
  212. _CRTIMP __int64 __cdecl _telli64(int);
  213. #endif
  214.  
  215. #ifndef _MAC
  216. #ifndef _WIO_DEFINED
  217.  
  218. /* wide function prototypes, also declared in wchar.h  */
  219.  
  220. _CRTIMP int __cdecl _waccess(const wchar_t *, int);
  221. _CRTIMP int __cdecl _wchmod(const wchar_t *, int);
  222. _CRTIMP int __cdecl _wcreat(const wchar_t *, int);
  223. _CRTIMP long __cdecl _wfindfirst(const wchar_t *, struct _wfinddata_t *);
  224. _CRTIMP int __cdecl _wfindnext(long, struct _wfinddata_t *);
  225. _CRTIMP int __cdecl _wunlink(const wchar_t *);
  226. _CRTIMP int __cdecl _wrename(const wchar_t *, const wchar_t *);
  227. _CRTIMP int __cdecl _wopen(const wchar_t *, int, ...);
  228. _CRTIMP int __cdecl _wsopen(const wchar_t *, int, int, ...);
  229. _CRTIMP wchar_t * __cdecl _wmktemp(wchar_t *);
  230.  
  231. #if _INTEGRAL_MAX_BITS >= 64
  232. _CRTIMP long __cdecl _wfindfirsti64(const wchar_t *, struct _wfinddatai64_t *);
  233. _CRTIMP int __cdecl _wfindnexti64(long, struct _wfinddatai64_t *);
  234. #endif
  235.  
  236. #define _WIO_DEFINED
  237. #endif
  238. #endif /* ndef _MAC */
  239.  
  240.  
  241. _CRTIMP long __cdecl _get_osfhandle(int);
  242. _CRTIMP int __cdecl _open_osfhandle(long, int);
  243.  
  244. #if    !__STDC__
  245.  
  246. /* Non-ANSI names for compatibility */
  247.  
  248. #ifdef    _NTSDK
  249.  
  250. #ifndef __cplusplus
  251. #define access      _access
  252. #define chmod       _chmod
  253. #define chsize      _chsize
  254. #define close(h)    _close(h)
  255. #define creat       _creat
  256. #define dup         _dup
  257. #define dup2        _dup2
  258. #define eof         _eof
  259. #define filelength  _filelength
  260. #define isatty      _isatty
  261. #define locking     _locking
  262. #define lseek       _lseek
  263. #define mktemp      _mktemp
  264. #define open(f,o,m) _open(f,o,m)
  265. #define read(h,b,c) _read(h,b,c)
  266. #define setmode     _setmode
  267. #define sopen       _sopen
  268. #define tell        _tell
  269. #define umask       _umask
  270. #define unlink(f)      _unlink(f)
  271. #define write(h,b,c) _write(h,b,c)
  272. #endif    /* __cplusplus */
  273.  
  274. #else    /* ndef _NTSDK */
  275.  
  276. _CRTIMP int __cdecl access(const char *, int);
  277. _CRTIMP int __cdecl chmod(const char *, int);
  278. _CRTIMP int __cdecl chsize(int, long);
  279. _CRTIMP int __cdecl close(int);
  280. _CRTIMP int __cdecl creat(const char *, int);
  281. _CRTIMP int __cdecl dup(int);
  282. _CRTIMP int __cdecl dup2(int, int);
  283. _CRTIMP int __cdecl eof(int);
  284. _CRTIMP long __cdecl filelength(int);
  285. _CRTIMP int __cdecl isatty(int);
  286. _CRTIMP int __cdecl locking(int, int, long);
  287. _CRTIMP long __cdecl lseek(int, long, int);
  288. _CRTIMP char * __cdecl mktemp(char *);
  289. _CRTIMP int __cdecl open(const char *, int, ...);
  290. _CRTIMP int __cdecl read(int, void *, unsigned int);
  291. _CRTIMP int __cdecl setmode(int, int);
  292. _CRTIMP int __cdecl sopen(const char *, int, int, ...);
  293. _CRTIMP long __cdecl tell(int);
  294. _CRTIMP int __cdecl umask(int);
  295. _CRTIMP int __cdecl unlink(const char *);
  296. _CRTIMP int __cdecl write(int, const void *, unsigned int);
  297.  
  298. #endif    /* _NTSDK */
  299.  
  300. #endif    /* __STDC__ */
  301.  
  302. #ifdef __cplusplus
  303. }
  304. #endif
  305.  
  306. #endif    /* _POSIX_ */
  307.  
  308. #ifdef    _MSC_VER
  309. #pragma pack(pop)
  310. #endif    /* _MSC_VER */
  311.  
  312. #endif    /* _INC_IO */
  313.  
  314. #if defined(__TOPLEVEL_IO_H_)
  315. #undef __TOPLEVEL_NEXT_COMMON_INCLUDE__
  316. #undef __TOPLEVEL_IO_H_
  317. #include <next_common_undefines.h>
  318. #endif /* __TOPLEVEL_IO_H_ */
  319.