tinyio.h

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 1,980 行 · 第 1/5 页

H
1,980
字号
        tiny_fdate_t    date_stamp;
        tiny_ftime_t    time_stamp;
        char            reserved2[ 9 ];
        uint_8          current_record_num;
        uint_8          random_record_number[ 4 ];
    } extended;
} tiny_fcb_t;

enum {
    TIO_PRSFN_IGN_SEPARATORS    = 0x01, /* if (separators) present ignore them*/
    TIO_PRSFN_DONT_OVW_DRIVE    = 0x02, /* leave drive in FCB unaltered if not*/
    TIO_PRSFN_DONT_OVW_FNAME    = 0x04, /* present in parsed string.  Same for*/
    TIO_PRSFN_DONT_OVW_EXT      = 0x08  /* fname and ext                      */
};

/*
 * type definitions
 */
typedef int             tiny_handle_t;
typedef int_32          tiny_ret_t;

/*
 * macro defintions
 */
#define TINY_ERROR( h )         ((int_32)(h)<0)
#define TINY_OK( h )            ((int_32)(h)>=0)
#define TINY_INFO( h )          ((uint_16)(h))
#define TINY_LINFO( h )          ((uint_32)(h))
/* 5-nov-90 AFS TinySeek returns a 31-bit offset that must be sign extended */
#define TINY_INFO_SEEK( h )     (((int_32)(h)^0xc0000000L)-0xc0000000L)

/*
 * match up functions with proper pragma for memory model
 */
#define TinyFarAccess           _fTinyAccess
#define TinyFarOpen             _fTinyOpen
#define TinyFarCreate           _fTinyCreate
#define TinyFarCreateEx         _fTinyCreateEx
#define TinyFarCreateNew        _fTinyCreateNew
#define TinyFarCreateTemp       _fTinyCreateTemp
#define TinyClose               _TinyClose
#define TinyCommitFile          _TinyCommitFile
#define TinyFarWrite            _fTinyWrite
#define TinyFarRead             _fTinyRead
#define TinyFarAbsWrite         _fTinyAbsWrite
#define TinyFarAbsRead          _fTinyAbsRead
#define TinyFarDelete           _fTinyDelete
#define TinyFarRename           _fTinyRename
#define TinyFarMakeDir          _fTinyMakeDir
#define TinyFarRemoveDir        _fTinyRemoveDir
#define TinyFarChangeDir        _fTinyChangeDir
#define TinyDup                 _TinyDup
#define TinyDup2                _TinyDup2
#define TinyAllocBlock          _TinyAllocBlock
#define TinyTestAllocBlock      _TinyTestAllocBlock
#define TinyMaxAlloc            _TinyMaxAlloc
#define TinyFreeBlock           _TinyFreeBlock
#define TinySetBlock            _TinySetBlock
#define TinyMaxSet              _TinyMaxSet
#define TinyFarGetCWDir         _fTinyGetCWDir
#define TinyGetDeviceInfo       _TinyGetDeviceInfo
#define TinySetDeviceInfo       _TinySetDeviceInfo
#define TinyGetCtrlBreak        _TinyGetCtrlBreak
#define TinySetCtrlBreak        _TinySetCtrlBreak
#define TinyGetDate             _TinyGetDate
#define TinyGetTime             _TinyGetTime
#define TinyGetCurrDrive        _TinyGetCurrDrive
#define TinySetCurrDrive        _TinySetCurrDrive
#define TinyFarSetDTA           _fTinySetDTA
#define TinyFarFindFirst        _fTinyFindFirst
#define TinyFindNext            _TinyFindNext
#define TinyFindNextDTA         _TinyFindNextDTA
#define TinyFindCloseDTA        _TinyFindCloseDTA
#define TinyGetFileStamp        _TinyGetFileStamp
#define TinySetFileStamp        _TinySetFileStamp
#define TinyGetVect             _TinyGetVect
#define TinySetVect             _TinySetVect
#define TinyDOSVersion          _TinyDOSVersion
#define TinyGetCH               _TinyGetCH
#define TinyGetCHE              _TinyGetCHE
#define TinyGetSwitchChar       _TinyGetSwitchChar
#define TinySetSwitchChar       _TinySetSwitchChar
#define TinyFreeSpace           _TinyFreeSpace
#define TinySetCountry          _TinySetCountry
#define TinySetIntr             _TinySetIntr
#define TinyLock                _TinyLock
#define TinyUnlock              _TinyUnlock
#define TinyGetPSP              _TinyGetPSP
#define TinySetPSP              _TinySetPSP
#define TinyCreatePSP           _TinyCreatePSP
#define TinyFarGetFileAttr      _fTinyGetFileAttr
#define TinySeek                _TinySeek
#define TinyLSeek               _TinyLSeek
#define TinyTerminateProcess    _TinyTerminateProcess
#define TinyExit                _TinyTerminateProcess
#define TinyDPMISetRealVect     _TinyDPMISetRealVect
#define TinyDPMIGetRealVect     _TinyDPMIGetRealVect
#define TinyDPMISetProtectVect  _TinyDPMISetProtectVect
#define TinyDPMIGetProtectVect  _TinyDPMIGetProtectVect
#define TinyDPMISetProtectExcpt _TinyDPMISetProtectExcpt
#define TinyDPMIGetProtectExcpt _TinyDPMIGetProtectExcpt
#define TinyDPMIRawRMtoPMAddr   _TinyDPMIRawRMtoPMAddr
#define TinyDPMIRawPMtoRMAddr   _TinyDPMIRawPMtoRMAddr
#define TinyDPMISaveRMStateAddr _TinyDPMISaveRMStateAddr
#define TinyDPMISavePMStateAddr _TinyDPMISavePMStateAddr
#define TinyDPMISaveStateSize   _TinyDPMISaveStateSize
#define TinyDPMIBase            _TinyDPMIBase
#define TinyDPMISetBase         _TinyDPMISetBase
#define TinyDPMISegToSel        _TinyDPMISegToSel
#define TinyDPMICreateSel       _TinyDPMICreateSel
#define TinyDPMICreateCSAlias   _TinyDPMICreateCSAlias
#define TinyDPMIFreeSel         _TinyDPMIFreeSel
#define TinyDPMISetLimit        _TinyDPMISetLimit
#define TinyDPMISetRights       _TinyDPMISetRights
#define TinyDPMIGetDescriptor   _TinyDPMIGetDescriptor
#define TinyDPMISetDescriptor   _TinyDPMISetDescriptor

/* handle small/large data models */
#if defined( M_I86SM ) || defined( M_I86MM ) || defined( __386__ )
#define TinyAccess              _nTinyAccess
#define TinyOpen                _nTinyOpen
#define TinyCreate              _nTinyCreate
#define TinyCreateEx            _nTinyCreateEx
#define TinyCreateNew           _nTinyCreateNew
#define TinyCreateTemp          _nTinyCreateTemp
#define TinyWrite               _nTinyWrite
#define TinyRead                _nTinyRead
#define TinyDelete              _nTinyDelete
#define TinyRename              _nTinyRename
#define TinyMakeDir             _nTinyMakeDir
#define TinyRemoveDir           _nTinyRemoveDir
#define TinyChangeDir           _nTinyChangeDir
#define TinyGetCWDir            _nTinyGetCWDir
#define TinySetDTA              _nTinySetDTA
#define TinyFindFirst           _nTinyFindFirst
#define TinyFindFirstDTA        _nTinyFindFirstDTA
#define TinyGetFileAttr         _nTinyGetFileAttr
#define TinySetFileAttr         _nTinySetFileAttr
#define TinyGetCountry          _nTinyGetCountry
#define TinyFCBPrsFname         _nTinyFCBPrsFname
#define TinyFCBDeleteFile       _nTinyFCBDeleteFile
#define TinyAbsWrite            _nTinyAbsWrite
#define TinyAbsRead             _nTinyAbsRead
#define TinyDPMIAlloc( x )      _TinyDPMIAlloc( ( x ) >> 16, ( x ) )
#define TinyDPMIRealloc(addr,x) _TinyDPMIRealloc(addr, (x) >> 16, (x))
#define TinyDPMIFree( x )       _TinyDPMIFree(((unsigned)x) >> 16, ((unsigned)x) )
#define TinyCBAlloc             _TinyCBAlloc
#define TinyDPMIDOSAlloc        _TinyDPMIDOSAlloc
#define TinyDPMIDOSFree         _TinyDPMIDOSFree
#define TinyDPMISimulateRealInt _TinyDPMISimulateRealInt
#define TinyDPMICallRealIntFrame _TinyDPMICallRealIntFrame
#define TinyDPMICallRealFarFrame _TinyDPMICallRealFarFrame
#define TinyMemAlloc            _TinyMemAlloc

#else
#define TinyAccess              _fTinyAccess
#define TinyOpen                _fTinyOpen
#define TinyCreate              _fTinyCreate
#define TinyCreateEx            _fTinyCreateEx
#define TinyCreateNew           _fTinyCreateNew
#define TinyCreateTemp          _fTinyCreateTemp
#define TinyWrite               _fTinyWrite
#define TinyRead                _fTinyRead
#define TinyDelete              _fTinyDelete
#define TinyRename              _fTinyRename
#define TinyMakeDir             _fTinyMakeDir
#define TinyRemoveDir           _fTinyRemoveDir
#define TinyChangeDir           _fTinyChangeDir
#define TinyGetCWDir            _fTinyGetCWDir
#define TinySetDTA              _fTinySetDTA
#define TinyFindFirst           _fTinyFindFirst
#define TinyGetFileAttr         _fTinyGetFileAttr
#define TinySetFileAttr         _fTinySetFileAttr
#define TinyGetCountry          _fTinyGetCountry
#define TinyFCBPrsFname         _fTinyFCBPrsFname
#define TinyFCBDeleteFile       _fTinyFCBDeleteFile
#define TinyAbsWrite            _fTinyAbsWrite
#define TinyAbsRead             _fTinyAbsRead

#endif

#define tiny_call

/*
 *  Function prototypes (_f functions not supported under 386)
 *
 *  WARNING! Don't change a _n or _ prototype without verifying that it
 *      won't break the WINDOWS 386 library code!! DJG
 */
tiny_ret_t              _fTinyAccess( const char __far *__n, uint __pmode );
tiny_ret_t  tiny_call   _nTinyAccess( const char __near *__n, uint __pmode );
tiny_ret_t              _fTinyOpen( const char __far *__n, open_attr __ax );
tiny_ret_t  tiny_call   _nTinyOpen( const char __near *__n, open_attr __ax );
tiny_ret_t              _fTinyCreate( const char __far *__n, create_attr __a );
tiny_ret_t  tiny_call   _nTinyCreate( const char __far *__n, create_attr __a );
tiny_ret_t              _fTinyCreateEx( const char __far *__n, open_attr __oa, create_attr __ca, create_action __act );
tiny_ret_t  tiny_call   _nTinyCreateEx( const char __far *__n, open_attr __oa, create_attr __ca, create_action __act );
tiny_ret_t              _fTinyCreateNew( const char __far *__n, create_attr __a );
tiny_ret_t  tiny_call   _nTinyCreateNew( const char __far *__n, create_attr __a );
tiny_ret_t              _fTinyCreateTemp( const char __far *__n, create_attr __a );
tiny_ret_t  tiny_call   _nTinyCreateTemp( const char __far *__n, create_attr __a );
tiny_ret_t  tiny_call   _TinyClose( tiny_handle_t );
tiny_ret_t  tiny_call   _TinyCommitFile( tiny_handle_t );
tiny_ret_t              _fTinyWrite( tiny_handle_t, const void __far *, uint );
tiny_ret_t              _fTinyAbsWrite( uint_8 __drive, uint __sector,
                                uint __sectorcount, const void __far *__buff );
tiny_ret_t              _nTinyAbsWrite( uint_8 __drive, uint __sector,
                                uint __sectorcount, const void __near *__buff );
tiny_ret_t              _fTinyAbsRead( uint_8 __drive, uint __sector,
                                uint __sectorcount, const void __far *__buff );
tiny_ret_t              _nTinyAbsRead( uint_8 __drive, uint __sector,
                                uint __sectorcount, const void __near *__buff );
tiny_ret_t  tiny_call   _nTinyWrite( tiny_handle_t, const void __near *, uint );
tiny_ret_t              _fTinyRead( tiny_handle_t, void __far *, uint );
tiny_ret_t  tiny_call   _nTinyRead( tiny_handle_t, void __near *, uint );
tiny_ret_t  tiny_call   _TinySeek( tiny_handle_t, uint_32, uint_16 __ax );
tiny_ret_t  tiny_call   _TinyLSeek( tiny_handle_t, uint_32, uint_16 __ax, uint_32 __near * );
tiny_ret_t              _fTinyDelete( const char __far * );
tiny_ret_t  tiny_call   _nTinyDelete( const char __near * );
tiny_ret_t              _fTinyRename( const char __far *__o,
                                const char __far *__n );
tiny_ret_t  tiny_call   _nTinyRename( const char __near *__o,
                                const char __near *__n);
tiny_ret_t              _fTinyMakeDir( const char __far *__name );
tiny_ret_t  tiny_call   _nTinyMakeDir( const char __near *__name );
tiny_ret_t              _fTinyRemoveDir( const char __far *__name );
tiny_ret_t  tiny_call   _nTinyRemoveDir( const char __near *__name );
tiny_ret_t              _fTinyChangeDir( const char __far *__name );
tiny_ret_t  tiny_call   _nTinyChangeDir( const char __near *__name );
tiny_ret_t  tiny_call   _TinyDup( tiny_handle_t );
tiny_ret_t  tiny_call   _TinyDup2( tiny_handle_t __exist,tiny_handle_t __alias);
tiny_ret_t  tiny_call   _TinyAllocBlock( uint __paras );
tiny_ret_t  tiny_call   _TinyTestAllocBlock( uint __paras );
uint        tiny_call   _TinyMaxAlloc( void );
tiny_ret_t  tiny_call   _TinyFreeBlock( uint __seg );
tiny_ret_t  tiny_call   _TinySetBlock( uint __paras, uint __seg );
uint        tiny_call   _TinyMaxSet( uint __seg );
tiny_ret_t              _fTinyGetCWDir( char __far *__buff, uint_8 __drive );
tiny_ret_t  tiny_call   _nTinyGetCWDir( char __near *__buff, uint_8 __drive );
tiny_ret_t  tiny_call   _TinyGetDeviceInfo( tiny_handle_t __dev );
tiny_ret_t  tiny_call   _TinySetDeviceInfo( tiny_handle_t __dev, uint_8 __info);
uint_8      tiny_call   _TinyGetCtrlBreak( void );
void        tiny_call   _TinySetCtrlBreak( uint_8 __new_setting );
void        tiny_call   _TinyTerminateProcess( uint_16 __ax );
tiny_date_t tiny_call   _TinyGetDate( void );
tiny_time_t tiny_call   _TinyGetTime( void );
uint_8      tiny_call   _TinyGetCurrDrive( void );
void        tiny_call   _TinySetCurrDrive( uint_8 );
void                    _fTinySetDTA( void __far * );
void        tiny_call   _nTinySetDTA( void __near * );
tiny_ret_t              _fTinyFindFirst( const char __far *__pattern,
                                create_attr __attr);
tiny_ret_t  tiny_call   _nTinyFindFirst( const char __near *, create_attr );
tiny_ret_t  tiny_call   _nTinyFindFirstDTA( const char __near *, create_attr,
                                void * );
tiny_ret_t  tiny_call   _TinyFindNext( void );
tiny_ret_t  tiny_call   _TinyFindNextDTA( void * );
tiny_ret_t  tiny_call   _TinyFindCloseDTA( void * );
tiny_ret_t  tiny_call   _TinyGetFileStamp( tiny_handle_t );
#ifdef _OLD_TINYIO_
tiny_ret_t  tiny_call   _TinySetFileStamp( tiny_handle_t, uint __p_hms,
                                uint __p_ymd );
#else
tiny_ret_t  tiny_call   _TinySetFileStamp( tiny_handle_t, tiny_ftime_t __hms,
                                tiny_fdate_t __ymd );
#endif
tiny_ret_t  tiny_call   _nTinyGetFileAttr( const char __near *__file );
tiny_ret_t              _fTinyGetFileAttr( const char __far *__file );
tiny_ret_t  tiny_call   _nTinySetFileAttr( const char __near *__file,
                                create_attr );
tiny_ret_t              _fTinySetFileAttr( const char __far *__file,
                                create_attr );
void        tiny_call   _TinySetIntr( uint_8, uint );
#ifndef __WINDOWS_386__
void        tiny_call   _TinySetVect(uint_8, void (__far __interrupt *__f)());
void  (__far __interrupt * tiny_call _TinyGetVect( uint_8 ))();
#else
void        tiny_call   _TinySetVect( uint_8, void __near * );
void *      tiny_call   _TinyGetVect( uint_8 );
#endif
tiny_dos_version  tiny_call _TinyDOSVersion( void );
char        tiny_call   _TinyGetCH( void );
char        tiny_call   _TinyGetCHE( void );
char        tiny_call   _TinyGetSwitchChar( void );
void        tiny_call   _TinySetSwitchChar( char );
uint_32     tiny_call   _TinyFreeSpace( uint_8 );
tiny_ret_t  tiny_call   _nTinyGetCountry( const tiny_country_info __near * );
tiny_ret_t              _fTinyGetCountry( const tiny_country_info __far * );
tiny_ret_t  tiny_call   _TinySetCountry( uint_16 );
tiny_ret_t  tiny_call   _nTinyFCBPrsFname( const char __near *__str,
                                tiny_fcb_t __far *__fcb, uint_8 __ctrl );
tiny_ret_t  tiny_call   _fTinyFCBPrsFname( const char __far *__str,
                                tiny_fcb_t __far *__fcb, uint_8 __ctrl );
tiny_ret_t  tiny_call   _nTinyFCBDeleteFile( tiny_fcb_t __near *__fcb );
tiny_ret_t              _fTinyFCBDeleteFile( tiny_fcb_t __far *__fcb );
tiny_ret_t  tiny_call   _TinyLock(tiny_handle_t,uint_32 __start,uint_32 __l);
tiny_ret_t  tiny_call   _TinyUnlock(tiny_handle_t,uint_32 __start,uint_32 __l);
uint        tiny_call   _TinyGetPSP( void );
void        tiny_call   _TinySetPSP( uint_16 __seg );
void        tiny_call   _TinyCreatePSP( uint_16 __seg );
void *      tiny_call   _TinyDPMIAlloc( uint_16 __hiw, uint_16 __low );
void *      tiny_call   _TinyDPMIRealloc( void *__addr, uint_16 __hiw, uint_16 __low );
void        tiny_call   _TinyDPMIFree( uint_16 __hiw, uint_16 __low );
void *      tiny_call   _TinyCBAlloc( uint_32 );
unsigned    tiny_call   _TinyDPMIDOSAlloc( uint_16 __paras );
void        tiny_call   _TinyDPMIDOSFree( uint_16 __sel );
uint_32     tiny_call   _TinyDPMIBase( uint_16 __sel );
void __far *tiny_call   _TinyDPMIGetProtectVect( uint_8 __intr );
tiny_ret_t  tiny_call   _TinyDPMISetProtectVect( uint_8 __intr,
                                    void ( __far __interrupt *__f )() );
void __far *tiny_call   _TinyDPMIGetProtectExcpt( uint_8 __intr );
tiny_ret_t  tiny_call   _TinyDPMISetProtectExcpt( uint_8 __intr,
                                    void ( __far __interrupt *__f )() );
uint_32     tiny_call   _TinyDPMIGetRealVect( uint_8 __intr );
tiny_ret_t  tiny_call   _TinyDPMISetRealVect( uint_8 __intr,
                                    uint_16 __seg, uint_16 __offs );
tiny_ret_t  tiny_call   _TinyDPMISimulateRealInt( uint_8 __intr,
                                    uint_8 __flags, uint_16 __copy,
                                    call_struct __far *__struct );
tiny_ret_t  tiny_call   _TinyDPMICallRealIntFrame( uint_8 __flags,
                                    uint_16 __copy,
                                    call_struct __far *__struct );
tiny_ret_t  tiny_call   _TinyDPMICallRealFarFrame( uint_8 __flags,
                                    uint_16 __copy,
                                    call_struct __far *__struct );
void __far  *tiny_call  _TinyDPMIRawPMtoRMAddr( void );
uint_32     tiny_call   _TinyDPMIRawRMtoPMAddr( void );
void __far  *tiny_call  _TinyDPMISaveRMStateAddr( void );
uint_32     tiny_call   _TinyDPMISavePMStateAddr( void );
uint_16     tiny_call   _TinyDPMISaveStateSize( void );
uint_16     tiny_call   _TinyDPMICreateCSAlias( uint_16 __sel );
tiny_ret_t  tiny_call   _TinyDPMIFreeSel( uint_16 __sel );
uint_16     tiny_call   _TinyDPMISegToSel( uint_16 __sel );
uint_16     tiny_call   _TinyDPMICreateSel( uint_16 __nbsels );
tiny_ret_t  tiny_call   _TinyDPMISetBase( uint_16 __sel, uint_32 );
tiny_ret_t  tiny_call   _TinyDPMISetLimit( uint_16 __sel, uint_32 );
tiny_ret_t  tiny_call   _TinyDPMISetRights( uint_16 __sel, uint_16 );
tiny_ret_t  tiny_call   _TinyDPMIGetDescriptor( uint_16 __sel, void __far * );
tiny_ret_t  tiny_call   _TinyDPMISetDescriptor( uint_16 __sel, void __far * );
uint_32                 _TinyMemAlloc( uint_32 __size );

/*
 * machine code instructions
 */
#define _PUSH_CS        0x0e
#define _PUSH_DS        0x1e
#define _POP_DS         0x1f
#define _PUSH_ES        0x06
#define _POP_ES         0x07
#define _PUSH_SS        0x16
#define _POP_SS         0x17
#define _PUSHF          0x9c
#define _POPF           0x9d

#define _STC            0xf9
#define _CLC            0xf8

#define _CBW            0x98
#define _CWD            0x99

#define _MOV_AL         0xb0
#define _MOV_AH         0xb4
#define _MOV_AX         0xb8
#define _MOV_ES_AX      0x8e 0xc0
#define _MOV_ES_CX      0x8e 0xc1
#define _MOV_ES_DX      0x8e 0xc2
#define _MOV_CX_AX      0x89 0xc1
#define _MOV_CX_DX      0x8b 0xca
#define _MOV_CX_SI      0x89 0xf1
#define _MOV_BX_CX      0x89 0xcb
#define _MOV_DX_AX      0x8b 0xd0
#define _MOV_DX_CX      0x89 0xca
#define _MOV_AX_BX      0x89 0xd8
#define _MOV_AX_CX      0x89 0xc8
#define _MOV_AX_DX      0x8b 0xc2
#define _MOV_AX_ES      0x8c 0xc0
#define _MOV_DS_AX      0x8e 0xd8
#define _MOV_DS_DX      0x8e 0xda
#define _MOV_AX_SS      0x8c 0xd0
#define _MOV_CH_AL      0x88 0xc5
#define _MOV_AL_BL      0x88 0xd8
#define _MOV_DI_SI      0x89 0xf7

#define _NOT_AX         0xf7 0xd0
#define _NOT_BX         0xf7 0xd3
#define _DEC_AX         0x48
#define _DEC_BX         0x4b
#define _DEC_DX         0x4a
#define _SUB_CX_N       0x81 0xe9
#define _SBB_DX_DX      0x19 0xd2
#define _SBB_CX_CX      0x19 0xc9
#define _SBB_BX_BX      0x19 0xdb
#define _SBB_AX_AX      0x19 0xc0
#define _AND_AX_BX      0x21 0xd8
#define _OR_DX_BX       0x09 0xda
#define _XOR_AX_AX      0x31 0xc0

⌨️ 快捷键说明

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