#ifndef MS_LARGE_FILES_H
#define MS_LARGE_FILES_H
//------------------------------------------------------------------------------
// This header has been created by merging several of ms's header files for the
// purpose of implimenting large file support under boralnd compilers by linking
// with msvcrt.dll.
//
// Note that the names will clash with the borland names, so you can't do both
// borland and ms i/o in the same object file. However, the linking names don't
// clash, so you can compile those seperate object files into the same exe/dll.
//
// The file is provided as-is, no liability will be provided for anything this
// file does. Note that taking ms data out of ms copyrighted headers is legal
// under my countrys laws (i.e. I've taken far, far less than 10% of the original
// headers), however, this may not be the case in your country, though its very
// questionable that ms would actually care - just be warned. You should probably
// install the ms Visual C++ toolkit so you've clicked through there license for
// these files - its freely avaliable if you search msdn.microsoft.com.

#ifdef __cplusplus
extern "C" {
#endif
//------------------------------------------------------------------------------

// The functions, taken from io.h...
int __cdecl chsize(int, long);
int __cdecl close(int);
int __cdecl commit(int);
int __cdecl creat(const char *, int);
int __cdecl dup(int);
int __cdecl dup2(int, int);
int __cdecl eof(int);
long __cdecl filelength(int);
__int64 __cdecl filelengthi64(int);
long __cdecl _lseek(int, long, int);
__int64 __cdecl lseeki64(int, __int64, int); // Use the borland constants in stdio - there the same.
int __cdecl open(const char *, int, ...);
int __cdecl read(int, void *, unsigned int);
int __cdecl sopen(const char *, int, int, ...);
long __cdecl _tell(int);
__int64 __cdecl telli64(int);
int __cdecl umask(int);
int __cdecl write(int, const void *, unsigned int);

// The assorted constants passed into above, taken from fcntl.h...
// Been changed to not clash with borland. There actually the same
// constants according to my rather unreliable memory anyway.
#define MS_RDONLY       0x0000  /* open for reading only */
#define MS_WRONLY       0x0001  /* open for writing only */
#define MS_RDWR         0x0002  /* open for reading and writing */
#define MS_APPEND       0x0008  /* writes done at eof */
#define MS_CREAT        0x0100  /* create and open file */
#define MS_TRUNC        0x0200  /* open and truncate */
#define MS_EXCL         0x0400  /* open only if file doesn't already exist */
#define MS_TEXT         0x4000  /* file mode is text (translated) */
#define MS_BINARY       0x8000  /* file mode is binary (untranslated) */
#define MS_NOINHERIT    0x0080  /* child process doesn't inherit file */
#define MS_TEMPORARY    0x0040  /* temporary file bit */
#define MS_SHORT_LIVED  0x1000  /* temporary storage file, try not to flush */
#define MS_SEQUENTIAL   0x0020  /* file access is primarily sequential */
#define MS_RANDOM       0x0010  /* file access is primarily random */

// Thesse have been taken from sys/stat.h, for setting permission of file on creation...
#define MS_IREAD        0000400         /* read permission, owner */
#define MS_IWRITE       0000200         /* write permission, owner */

// From stdio.h...
#define MS_SEEK_CUR    1
#define MS_SEEK_END    2
#define MS_SEEK_SET    0

//------------------------------------------------------------------------------
#ifdef __cplusplus
}
#endif
#endif //LARGE_FILES_H

