⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dos.mh

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 MH
字号:
/*
 *  dos.h       Defines the structs and unions used to handle the input and
 *              output registers for the DOS and 386 DOS Extender interface
 *              routines.
 *
:include crwat.sp
 */
#ifndef _DOS_H_INCLUDED
#define _DOS_H_INCLUDED
:include readonly.sp
:include cpluspro.sp

#ifndef _COMDEF_H_INCLUDED
 #include <_comdef.h>
#endif
#if defined(_M_IX86) && !defined(_I86_H_INCLUDED)
 #include <i86.h>
#endif

#if defined(__DOS__) && defined(__386__)
 #define _DOSFAR _WCFAR
#else
 #define _DOSFAR _WCI86FAR
#endif

:include pshpackl.sp

:include wchar_t.sp

/* dosexterror struct */

struct _DOSERROR {
        int exterror;
        char errclass;
        char action;
        char locus;
};
:: 'class' is a keyword in C++
#ifndef __cplusplus
struct DOSERROR {
        int exterror;
        char class;
        char action;
        char locus;
};
#endif

struct dosdate_t {
        unsigned char day;      /* 1-31 */
        unsigned char month;    /* 1-12 */
        unsigned short year;    /* 1980-2099 */
        unsigned char dayofweek;/* 0-6 (0=Sunday) */
};
#define _dosdate_t dosdate_t

struct dostime_t {
        unsigned char hour;     /* 0-23 */
        unsigned char minute;   /* 0-59 */
        unsigned char second;   /* 0-59 */
        unsigned char hsecond;  /* 1/100 second; 0-99 */
};
#define _dostime_t dostime_t

struct find_t {
        unsigned short cr_time; /* time of file creation      */
        unsigned short cr_date; /* date of file creation      */
        unsigned short ac_time; /* time of last file access   */
        unsigned short ac_date; /* date of last file access   */
        unsigned short lfnax;   /* DOS LFN search handle      */
        unsigned char  lfnsup;  /* DOS LFN support status     */
        char reserved[10];      /* reserved for use by DOS    */
        char attrib;            /* attribute byte for file    */
        unsigned short wr_time; /* time of last write to file */
        unsigned short wr_date; /* date of last write to file */
        unsigned long  size;    /* length of file in bytes    */
#if defined(__OS2__) || defined(__NT__) || defined(__WATCOM_LFN__)
        char name[256];         /* null-terminated filename   */
#else
        char name[13];          /* null-terminated filename   */
#endif
};
struct _wfind_t {
        unsigned short cr_time; /* time of file creation      */
        unsigned short cr_date; /* date of file creation      */
        unsigned short ac_time; /* time of last file access   */
        unsigned short ac_date; /* date of last file access   */
        unsigned short lfnax;   /* DOS LFN search handle      */
        unsigned char  lfnsup;  /* DOS LFN support status     */
        char reserved[10];      /* reserved for use by DOS    */
        char attrib;            /* attribute byte for file    */
        unsigned short wr_time; /* time of last write to file */
        unsigned short wr_date; /* date of last write to file */
        unsigned long  size;    /* length of file in bytes    */
#if defined(__OS2__) || defined(__NT__) || defined(__WATCOM_LFN__)
        wchar_t name[256];      /* null-terminated filename   */
#else
        wchar_t name[13];       /* null-terminated filename   */
#endif
};
#define _find_t find_t

/* Critical error handler equates for _hardresume result parameter */

#define _HARDERR_IGNORE 0       /* Ignore the error */
#define _HARDERR_RETRY  1       /* Retry the operation */
#define _HARDERR_ABORT  2       /* Abort the program */
#define _HARDERR_FAIL   3       /* Fail the system call in progress */

/* File attribute constants for attribute field */

#define _A_NORMAL       0x00    /* Normal file - read/write permitted */
#define _A_RDONLY       0x01    /* Read-only file */
#define _A_HIDDEN       0x02    /* Hidden file */
#define _A_SYSTEM       0x04    /* System file */
#define _A_VOLID        0x08    /* Volume-ID entry */
#define _A_SUBDIR       0x10    /* Subdirectory */
#define _A_ARCH         0x20    /* Archive file */

:include dskfreet.sp

_WCRTLINK extern int      _islfn( const char *__path );
_WCRTLINK extern char     *_lfntosfn( char *__orgname, char *__shortname );
_WCRTLINK extern int      bdos( int __dosfn, unsigned int __dx,
                                unsigned int __al);
:: extra 'register' is used to prevent C++ compiler from entering a parser
:: disambiguation stage (i.e., it has a use, so don't delete it) AFS
_WCRTLINK extern void     _chain_intr( register void
                                      (_WCINTERRUPT _DOSFAR *__handler)() );
#if defined(__NT__) || ( defined(__OS2__) && (defined(__386__)||defined(__PPC__)) )
_WCRTLINK extern unsigned _dos_allocmem( unsigned __size, void **__storage );
#else
_WCRTLINK extern unsigned _dos_allocmem( unsigned __size,
                                         unsigned short *__seg );
#endif
_WCRTLINK extern unsigned _dos_close( int __handle );
_WCRTLINK extern unsigned _dos_commit( int __handle );
_WCRTLINK extern unsigned _dos_creat( const char *__path,
                                      unsigned __attr, int *__handle );
_WCRTLINK extern unsigned _dos_creatnew( const char *__path,
                                         unsigned __attr, int *__handle );
_WCRTLINK extern unsigned _dos_findfirst( const char *__path,
                                          unsigned __attr,
                                          struct find_t *__buf );
_WCRTLINK extern unsigned _dos_findnext( struct find_t *__buf );
_WCRTLINK extern unsigned _dos_findclose( struct find_t *__buf );
#if defined(__NT__) || ( defined(__OS2__) && (defined(__386__)||defined(__PPC__)) )
_WCRTLINK extern unsigned _dos_freemem( void *__storage );
#else
_WCRTLINK extern unsigned _dos_freemem( unsigned short __seg );
#endif
_WCRTLINK extern void     _dos_getdate( struct dosdate_t *__date );
_WCRTLINK extern unsigned _dos_getdiskfree( unsigned __drive,
                                            struct _diskfree_t *__diskspace );
_WCRTLINK extern unsigned _getdiskfree( unsigned __drive,
                                        struct _diskfree_t *__diskspace );
_WCRTLINK extern void     _dos_getdrive( unsigned *__drive );
_WCRTLINK extern unsigned _getdrive( void );
_WCRTLINK extern unsigned _dos_getfileattr( const char *__path,
                                            unsigned *__attr );
_WCRTLINK extern unsigned _dos_getftime( int __handle, unsigned short *__date,
                                         unsigned short *__time );
_WCRTLINK extern void     _dos_gettime( struct dostime_t *__time );
_WCRTLINK extern void     (_WCINTERRUPT _DOSFAR *_dos_getvect( int __intnum ))();
_WCRTLINK extern void     _dos_keep( unsigned __retcode, unsigned __memsize );

_WCRTLINK extern unsigned _dos_open( const char *__path, unsigned __mode,
                                     int *__handle );
_WCRTLINK extern unsigned _dos_read( int __handle, void _DOSFAR *__buf,
                                     unsigned __count, unsigned *__bytes );
_WCRTLINK extern unsigned _dos_setblock( unsigned __size, unsigned short __seg,
                                         unsigned  *__maxsize );
_WCRTLINK extern unsigned _dos_setdate( struct dosdate_t *__date );
_WCRTLINK extern void     _dos_setdrive( unsigned __drivenum,
                                         unsigned *__drives );
_WCRTLINK extern unsigned _dos_setfileattr( const char *__path,
                                            unsigned __attr );
_WCRTLINK extern unsigned _dos_setftime( int __handle, unsigned short __date,
                                         unsigned short __time );
_WCRTLINK extern unsigned _dos_settime( struct dostime_t *__time );
_WCRTLINK extern void     _dos_setvect( int __intnum, void
                                       (_WCINTERRUPT _DOSFAR *__handler)() );
_WCRTLINK extern unsigned _dos_write( int __handle, void const _DOSFAR *__buf,
                                      unsigned __count, unsigned *__bytes );
_WCRTLINK extern int      dosexterr( struct _DOSERROR * );
:: extra 'register' is used to prevent C++ compiler from entering a parser
:: disambiguation stage (i.e., it has a use, so don't delete it) AFS
_WCRTLINK extern void     _harderr( register int (_DOSFAR *__func)(
                                    unsigned __deverr, unsigned __errcode,
                                    unsigned _DOSFAR *__devhdr));
_WCRTLINK extern void     _hardresume( int __result );
_WCRTLINK extern void     _hardretn( int __error );
#if defined(_M_IX86)
_WCRTLINK extern int      intdos( union REGS *, union REGS * );
_WCRTLINK extern int      intdosx( union REGS *, union REGS *, struct SREGS * );
#endif
_WCRTLINK extern unsigned sleep( unsigned __seconds );

_WCRTLINK extern unsigned _wdos_findfirst( const wchar_t *__path,
                                           unsigned __attr,
                                           struct _wfind_t *__buf );
_WCRTLINK extern unsigned _wdos_findnext( struct _wfind_t *__buf );
_WCRTLINK extern unsigned _wdos_findclose( struct _wfind_t *__buf );

:include poppack.sp

#undef _DOSFAR

:include cplusepi.sp
#endif

⌨️ 快捷键说明

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