home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR41
/
EMSIF24.ZIP
/
EMSIF.H
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-21
|
7KB
|
223 lines
/***************************************************************************
* EMSIF.H *
* HEADER FOR EMSIF *
* OS: DOS *
* VERSION: 3.0 *
* DATE: 06/21/93 *
* *
* Copyright (c) 1991, 1993 James W. Birdsall. All Rights Reserved. *
* *
***************************************************************************/
#ifndef EMSIF_H
#define EMSIF_H
/*
** system includes <>
*/
/*
** custom includes ""
*/
/*
** local #defines
*/
#ifndef __cplusplus
/* fake an invalidate function */
#define _EMMinval() if (_EMMframecache != 0) _EMMenc(); else _EMMdisc()
/*
** EMMicopyfrom() and EMMicopyto() used to be functions, these
** macros provided for compatibility.
*/
#define EMMicopyfrom(n,e,b,h,f,d) _EMMicopyfrom((n),(e),(b),(h),(f),(d),(b))
#define EMMicopyto(n,e,b,s,h,f) _EMMicopyto((n),(e),(b),(s),(h),(f),(b))
#endif /* !__cplusplus */
/* error returns */
#define EMMOOPS -1
#define NOEMM -2
/* EMM library errors */
#define EMM_BADVERS 0x40
#define EMM_BADOFFSET 0x41
#define EMM_NOFRAME 0x42
#define EMM_NOINIT 0x43
#define EMM_FEWFRAMES 0x44
#define EMM_NOSR 0x45
#define EMM_MEMNULL 0x46
#define EMM_ELTOOBIG 0x47
#define EMM_SKTOOBIG 0x48
/* EMM driver errors */
#define EMM_SOFTERROR 0x80
#define EMM_HARDERROR 0x81
#define EMM_BUSY 0x82
#define EMM_BADHANDLE 0x83
#define EMM_UNIMP 0x84
#define EMM_NOFREEHAN 0x85
#define EMM_CONTEXTERR 0x86
#define EMM_WAYTOOBIG 0x87
#define EMM_TOOBIG 0x88
#define EMM_TOOSMALL 0x89
#define EMM_BADLOGPAGE 0x8A
#define EMM_BADFRAMENO 0x8B
#define EMM_HSTATESAVFULL 0x8C
#define EMM_MSTATESAVFULL 0x8D
#define EMM_MSTATERESTERR 0x8E
#define EMM_UNIMPSUB 0x8F
#define EMM_BADATTRIB 0x90
#define EMM_NOFEATURE 0x91
#define EMM_SRCOVERWRITE 0x92
#define EMM_BADLENGTH 0x93
#define EMM_CONEMSOVERLAP 0x94
#define EMM_OFFPAGE 0x95
#define EMM_TOOLONG 0x96
#define EMM_EMSEMSOVERLAP 0x97
#define EMM_LOST 0x98
#define EMM_UNUSED 0x99
#define EMM_BADALTREG 0x9A
#define EMM_NOFREEALTREG 0x9B
#define EMM_NOALTREG 0x9C
#define EMM_BADALTREG2 0x9D
#define EMM_NODEDDMA 0x9E
#define EMM_BADDEDDMA 0x9F
#define EMM_UNKNAME 0xA0
#define EMM_NAMETAKEN 0xA1
#define EMM_ADDRWRAP 0xA2
#define EMM_BADPTR 0xA3
#define EMM_FORBIDDENFUNC 0xA4
/*
** misc: copyright strings, version macros, etc.
*/
/*
** typedefs
*/
typedef struct a { /* return type from EMMgetframeaddr() */
unsigned int segaddr;
unsigned int frameno;
} frameinfo;
/*
** global variables
*/
#if (defined(_MSC_VER) && (_MSC_VER == 800) && defined(M_I86HM))
/*
** This little bit of cruft is necessary for the benefit of MSC 8.0
** (found in Microsoft Visual C++ 1.0) in huge model, because otherwise
** it loses track of the fact that these variables are in a far data segment.
*/
extern unsigned char const __far _EMMerror; /* EMS error variable */
extern unsigned char const __far _EMMversion; /* EMS version, BCD */
extern unsigned char const __far _EMMframecache; /* caching flag, copy funcs */
extern char const __far emsif_vers_vers[];
extern char const __far emsif_vers_date[];
extern char const __far emsif_vers_time[];
#else
extern unsigned char const _EMMerror; /* EMS error variable */
extern unsigned char const _EMMversion; /* EMS version, BCD */
extern unsigned char const _EMMframecache; /* caching flag for copy funcs */
extern char const emsif_vers_vers[];
extern char const emsif_vers_date[];
extern char const emsif_vers_time[];
#endif
/*
** function prototypes
*/
#ifdef __cplusplus
extern "C"
{
#define extern
#endif /* __cplusplus */
extern int EMMlibinit(void);
extern int EMMgetversion(void);
extern unsigned long EMMcoreleft(void);
extern int EMMalloc(unsigned long bytes);
extern int EMMrealloc(int handle, unsigned long bytes);
extern int EMMfree(int handle);
extern int EMMgetnumframe(void);
extern unsigned int EMMgetsinfraddr(int frame);
extern int EMMgetframeaddr(frameinfo *buffer);
extern int EMMmappage(int frameno, int handle, int logpage);
extern int EMMunmapframe(int frameno);
extern int EMMallocpages(int pages);
extern int EMMreallocpages(int handle, int pages);
extern int EMMcopyto(unsigned long copylen, unsigned char far *source,
int handle, unsigned long foffset);
extern int EMMcopyfrom(unsigned long copylen, int handle,
unsigned long foffset, unsigned char far *dest);
extern int _EMMicopyto(unsigned long nelem, int elsize,
unsigned int srcskip, unsigned char far *source,
int handle, unsigned long foffset, unsigned int destskip);
extern int _EMMicopyfrom(unsigned long nelem, int elsize,
unsigned int srcskip, int handle, unsigned long foffset,
unsigned char far *dest, unsigned int destskip);
extern int EMMsrinit(void *(*mallocfunc)(size_t));
extern void *EMMsave(void);
extern int EMMrestore(void *saveblock);
extern int EMMsetname(int handle, char *name);
extern int EMMgetname(int handle, char *name);
extern void _EMMenc(void);
extern void _EMMdisc(void);
#ifdef __cplusplus
}
#undef extern
inline void _EMMinval()
{
if (_EMMframecache != 0) _EMMenc(); else _EMMdisc();
}
inline int EMMicopyfrom(unsigned long nelem, int elsize,
unsigned int skip, int handle, unsigned long foffset,
unsigned char far *dest)
{
return _EMMicopyfrom(nelem, elsize, skip, handle, foffset, dest, skip);
}
inline int EMMicopyto(unsigned long nelem, int elsize,
unsigned int skip, unsigned char far *source,
int handle, unsigned long foffset)
{
return _EMMicopyto(nelem, elsize, skip, source, handle, foffset, skip);
}
#endif /* __cplusplus */
#endif /* EMSIF */