Wheefun I/O Library  0.0.5
Useful I/O Primitives.
Classes | Typedefs | Enumerations | Functions | Variables
dos.h File Reference

DOS Support. More...

#include <wfio/type.h>

Go to the source code of this file.

Classes

union  wfio_dos_sversion_t
 A DOS version broken out into its components. More...
 
union  wfio_dos_openflags_t
 Open flags supplied to wfio_dos_open() or wfio_dos_openEx(). More...
 
union  wfio_dos_fileattr_t
 
union  wfio_dos_creat_t
 
struct  wfio_dos_open_t
 
struct  wfio_dos_dpmi_regsd_t
 
struct  wfio_dos_dpmi_regsw_t
 
struct  wfio_dos_dpmi_regsb_t
 
union  wfio_dos_dpmi_regs_t
 A register set corresponding to a DPMI interrupt call. More...
 
struct  wfio_dos_farptr_t
 A far pointer. More...
 

Typedefs

typedef wfio_uint16_t wfio_dos_uword_t
 
typedef wfio_sint32_t wfio_dos_sdword_t
 
typedef wfio_uint32_t wfio_dos_udword_t
 
typedef enum wfio_dos_opendir_t wfio_dos_opendir_t
 
typedef enum wfio_dos_share_t wfio_dos_share_t
 
typedef enum wfio_dos_fexist_t wfio_dos_fexist_t
 
typedef union wfio_dos_sversion_t wfio_dos_sversion_t
 A DOS version broken out into its components.
 
typedef wfio_dos_uword_t wfio_dos_version_t
 The integral type of a dos version.
 
typedef union wfio_dos_openflags_t wfio_dos_openflags_t
 Open flags supplied to wfio_dos_open() or wfio_dos_openEx().
 
typedef union wfio_dos_fileattr_t wfio_dos_fileattr_t
 
typedef union wfio_dos_creat_t wfio_dos_creat_t
 
typedef struct wfio_dos_open_t wfio_dos_open_t
 
typedef struct wfio_dos_dpmi_regsd_t wfio_dos_dpmi_regsd_t
 
typedef struct wfio_dos_dpmi_regsw_t wfio_dos_dpmi_regsw_t
 
typedef struct wfio_dos_dpmi_regsb_t wfio_dos_dpmi_regsb_t
 
typedef union wfio_dos_dpmi_regs_t wfio_dos_dpmi_regs_t
 A register set corresponding to a DPMI interrupt call.
 
typedef struct wfio_dos_farptr_t wfio_dos_farptr_t
 A far pointer.
 
typedef union wfio_dos_dpmi_regs_t wfio_dos_regs_t
 The register structure to be passed to wfio_dos_int().
 

Enumerations

enum  wfio_dos_opendir_t { WFIO_DOS_OMODE_RD, WFIO_DOS_OMODE_WR, WFIO_DOS_OMODE_RW, WFIO_DOS_OMODE_BAD }
 
enum  wfio_dos_share_t {
  WFIO_DOS_SMODE_COMPAT, WFIO_DOS_SMODE_RW, WFIO_DOS_SMODE_RDONLY, WFIO_DOS_SMODE_WRONLY,
  WFIO_DOS_SMODE_FULL
}
 
enum  wfio_dos_fexist_t { WFIO_DOS_FEXIST_ERR, WFIO_DOS_FEXIST_OPEN, WFIO_DOS_FEXIST_TRUNC }
 
enum  {
  WFIO_DOS_NEXIST_CREAT = 0x10, WFIO_DOS_VERSION_UNKNOWN = 0, WFIO_DOS_VERSION_HOST = 0, WFIO_DOS_VERSION_1 = 0x100,
  WFIO_DOS_VERSION_1_25 = 0x119, WFIO_DOS_VERSION_2 = 0x200, WFIO_DOS_VERSION_3 = 0x300, WFIO_DOS_VERSION_4 = 0x400,
  WFIO_DOS_VERSION_5 = 0x500, WFIO_DOS_VERSION_6 = 0x600
}
 

Functions

WFIO_ALWAYS_INLINE wfio_dos_farptr_t wfio_dos_farptr (wfio_dos_uword_t segment, wfio_dos_uword_t offset)
 Construct a new far pointer.
 
WFIO_DLL_FASTCALL int wfio_dos_dpmi_int (int vector, wfio_dos_dpmi_regs_t *regs)
 
WFIO_DLL_FASTCALL int wfio_dos_int (int vector, wfio_dos_regs_t *regs)
 
WFIO_ALWAYS_INLINE int wfio_dos_syscall (wfio_dos_regs_t *regs)
 Invoke a DOS system call. More...
 
WFIO_DLL_FASTCALL wfio_dos_version_t wfio_dos_version ()
 Obtain the current DOS version. More...
 
WFIO_DLL_FASTCALL int wfio_dos_open3C (const char *path, wfio_dos_fileattr_t attrs, int *error)
 Open a new file handle by invoking DOS system call 0x3C. More...
 
WFIO_DLL_FASTCALL int wfio_dos_open3D (const char *path, wfio_dos_openflags_t flags, int *error)
 Open a new file handle by invoking DOS system call 0x3D. More...
 
WFIO_DLL_FASTCALL int wfio_dos_open6C (const char *path, wfio_dos_open_t flags, int *error)
 Open a new file handle by invoking DOS system call 0x3C. More...
 
WFIO_DLL_FASTCALL int wfio_dos_openEx (const char *path, wfio_dos_open_t flags, wfio_dos_version_t ver, int *error)
 Open a new file by invoking the appropriate DOS system call and by specifying the version. More...
 
WFIO_ALWAYS_INLINE int wfio_dos_open (const char *path, wfio_dos_open_t flags, int *error)
 Open a new file by invoking the appropriate DOS system call and by specifying the version. More...
 
WFIO_DLL_FASTCALL wfio_openmode_t wfio_dos_openToWFIO (wfio_dos_open_t flags)
 Convert a DOS open mode to a WFIO open mode. More...
 
WFIO_DLL_FASTCALL wfio_dos_open_t wfio_dos_wfioToOpen (wfio_openmode_t flags)
 

Variables

WFIO_C_BEGIN typedef wfio_sint16_t wfio_dos_sword_t
 

Detailed Description

DOS Support.

This file contains an implementation of functions which are specific to MS-DOS. In support of another library, the Wheefun DOS Multimedia Framework, the functions listed here are exported to all hosts.

Author
Phillip Kilgore
Since
0.0.1
Note
This file includes type.h

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
WFIO_DOS_VERSION_UNKNOWN 

The DOS version is not known.

WFIO_DOS_VERSION_HOST 

The DOS version of the host.

WFIO_DOS_VERSION_1 

DOS version 1.0.

WFIO_DOS_VERSION_1_25 

DOS version 1.25.

WFIO_DOS_VERSION_2 

DOS version 2.0.

WFIO_DOS_VERSION_3 

DOS version 3.0.

WFIO_DOS_VERSION_4 

DOS version 4.0.

WFIO_DOS_VERSION_5 

DOS version 4.0.

WFIO_DOS_VERSION_6 

DOS version 5.0.

Function Documentation

◆ wfio_dos_open()

WFIO_ALWAYS_INLINE int wfio_dos_open ( const char *  path,
wfio_dos_open_t  flags,
int *  error 
)

Open a new file by invoking the appropriate DOS system call and by specifying the version.

This function either invokes the appropriate DOS system call or emulates it in order to open a new file handle as specified in this call.

Parameters
pathThe path of the file to create.
flagsThe DOS open flags.
errorAn optional error indicator.
Returns
The file handle on success; otherwise, WFIO_BAD_FD.

◆ wfio_dos_open3C()

WFIO_DLL_FASTCALL int wfio_dos_open3C ( const char *  path,
wfio_dos_fileattr_t  attrs,
int *  error 
)

Open a new file handle by invoking DOS system call 0x3C.

This function invokes int 21h, function 0x3C on DOS or emulates it in other operating systems. Specifically, this function create the file if it doesn't exist and truncates it if it does. In the case of DOS, this function is only successful if the DOS version is 2.0 or greater. The file is opened in read-write mode.

Parameters
pathThe path of the file to create.
attrsThe DOS file attributes to assign to the newly created file.
errorAn optional error indicator.
Returns
The file handle on success; otherwise, WFIO_BAD_FD.
Warning
For general file I/O, it is better to use wfio_dos_open or wfio_dos_openEx.

◆ wfio_dos_open3D()

WFIO_DLL_FASTCALL int wfio_dos_open3D ( const char *  path,
wfio_dos_openflags_t  flags,
int *  error 
)

Open a new file handle by invoking DOS system call 0x3D.

This function invokes int 21h, function 0x3D on DOS or emulates it in other operating systems. Specifically, this opens the file if it exists using the specified open mode. In the case of DOS, this function is only successful if the DOS version is 2.0 or greater.

Parameters
pathThe path of the file to create.
flagsThe DOS open mode to use when opening the file.
errorAn optional error indicator.
Returns
The file handle on success; otherwise, WFIO_BAD_FD.
Warning
For general file I/O, it is better to use wfio_dos_open or wfio_dos_openEx.

◆ wfio_dos_open6C()

WFIO_DLL_FASTCALL int wfio_dos_open6C ( const char *  path,
wfio_dos_open_t  flags,
int *  error 
)

Open a new file handle by invoking DOS system call 0x3C.

This function invokes int 21h, function 0x6C on DOS or emulates it in other operating systems. Specifically, this function create the file if it doesn't exist and truncates it if it does. In the case of DOS, this function is only successful if the DOS version is 4.0 or greater.

Parameters
pathThe path of the file to create.
flagsThe DOS open flags.
errorAn optional error indicator.
Returns
The file handle on success; otherwise, WFIO_BAD_FD.
Warning
For general file I/O, it is better to use wfio_dos_open or wfio_dos_openEx.

◆ wfio_dos_openEx()

WFIO_DLL_FASTCALL int wfio_dos_openEx ( const char *  path,
wfio_dos_open_t  flags,
wfio_dos_version_t  ver,
int *  error 
)

Open a new file by invoking the appropriate DOS system call and by specifying the version.

This function either invokes the appropriate DOS system call or emulates it in order to open a new file handle as specified in this call. If ver is equal to WFIO_DOS_HOST, then the best available method is used. Otherwise, a method corresponding to the supplied DOS version is used.

Parameters
pathThe path of the file to create.
flagsThe DOS open flags.
verThe DOS version to use.
errorAn optional error indicator.
Returns
The file handle on success; otherwise, WFIO_BAD_FD.

◆ wfio_dos_openToWFIO()

WFIO_DLL_FASTCALL wfio_openmode_t wfio_dos_openToWFIO ( wfio_dos_open_t  flags)

Convert a DOS open mode to a WFIO open mode.

Parameters
TheDOS openmode to convert.
Returns
The resulting WFIO open mode.

◆ wfio_dos_syscall()

WFIO_ALWAYS_INLINE int wfio_dos_syscall ( wfio_dos_regs_t regs)

Invoke a DOS system call.

This function is synonymous with wfio_dos_int(0x21, regs).

Parameters
regsThe registers to pass to the system call.
Returns
-1 if not implemented, 0 if bad system call; otherwise, nonzero.

◆ wfio_dos_version()

WFIO_DLL_FASTCALL wfio_dos_version_t wfio_dos_version ( )

Obtain the current DOS version.

On a DOS system, this function yields the reported DOS version. On other operating systems, WFIO_DOS_VERSION_UNKNOWN is reported.

Returns
The reported DOS version of the host on success; otherwise, WFIO_VERSION_UNKNOWN.