home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / EMSLB221.ZIP / EMSLIB.HPP < prev    next >
C/C++ Source or Header  |  1991-10-10  |  5KB  |  164 lines

  1. /***************************************************************************
  2. *   EMSLIB.HPP                                                             *
  3. *   HEADER FOR EMSLIB                                                      *
  4. *   OS:        DOS                                                         *
  5. *   VERSION:   1.11                                                        *
  6. *   DATE:      10/10/91                                                    *
  7. *                                                                          *
  8. *   Copyright (c) 1991 James W. Birdsall. All Rights Reserved.             *
  9. *   Thanks to Bob Parsons of Parsons Technology for vers 1.0 of this file. *
  10. *                                                                          *
  11. ***************************************************************************/
  12.  
  13. #ifndef EMSLIB_H
  14. #define EMSLIB_H
  15.  
  16. /*
  17. ** system includes <>
  18. */
  19.  
  20. /*
  21. ** custom includes ""
  22. */
  23.  
  24. /*
  25. ** local #defines
  26. */
  27.  
  28. /* fake an invalidate function */
  29. #define _EMMinval()         if (_EMMframecache != 0) _EMMenc(); else _EMMdisc()
  30.  
  31. /*
  32. ** EMMicopyfrom() and EMMicopyto() used to be functions, these
  33. ** macros provided for compatibility.
  34. */
  35. #define EMMicopyfrom(n,e,b,h,f,d)  _EMMicopyfrom((n),(e),(b),(h),(f),(d),(b))
  36. #define EMMicopyto(n,e,b,s,h,f)    _EMMicopyto((n),(e),(b),(s),(h),(f),(b))
  37.  
  38. /* error returns */
  39. #define EMMOOPS       -1
  40. #define NOEMM         -2
  41.  
  42.  
  43. /* EMM library errors */
  44.  
  45. #define EMM_BADVERS         0x40
  46. #define EMM_BADOFFSET       0x41
  47. #define EMM_NOFRAME         0x42
  48. #define EMM_NOINIT          0x43
  49. #define EMM_FEWFRAMES       0x44
  50. #define EMM_NOSR            0x45
  51. #define EMM_MEMNULL         0x46
  52. #define EMM_ELTOOBIG        0x47
  53. #define EMM_SKTOOBIG        0x48
  54.  
  55.  
  56. /* EMM driver errors */
  57.  
  58. #define EMM_SOFTERROR       0x80
  59. #define EMM_HARDERROR       0x81
  60. #define EMM_BUSY            0x82
  61. #define EMM_BADHANDLE       0x83
  62. #define EMM_UNIMP           0x84
  63. #define EMM_NOFREEHAN       0x85
  64. #define EMM_CONTEXTERR      0x86
  65. #define EMM_WAYTOOBIG       0x87
  66. #define EMM_TOOBIG          0x88
  67. #define EMM_TOOSMALL        0x89
  68. #define EMM_BADLOGPAGE      0x8A
  69. #define EMM_BADFRAMENO      0x8B
  70. #define EMM_HSTATESAVFULL   0x8C
  71. #define EMM_MSTATESAVFULL   0x8D
  72. #define EMM_MSTATERESTERR   0x8E
  73. #define EMM_UNIMPSUB        0x8F
  74. #define EMM_BADATTRIB       0x90
  75. #define EMM_NOFEATURE       0x91
  76. #define EMM_SRCOVERWRITE    0x92
  77. #define EMM_BADLENGTH       0x93
  78. #define EMM_CONEMSOVERLAP   0x94
  79. #define EMM_OFFPAGE         0x95
  80. #define EMM_TOOLONG         0x96
  81. #define EMM_EMSEMSOVERLAP   0x97
  82. #define EMM_LOST            0x98
  83. #define EMM_UNUSED          0x99
  84. #define EMM_BADALTREG       0x9A
  85. #define EMM_NOFREEALTREG    0x9B
  86. #define EMM_NOALTREG        0x9C
  87. #define EMM_BADALTREG2      0x9D
  88. #define EMM_NODEDDMA        0x9E
  89. #define EMM_BADDEDDMA       0x9F
  90. #define EMM_UNKNAME         0xA0
  91. #define EMM_NAMETAKEN       0xA1
  92. #define EMM_ADDRWRAP        0xA2
  93. #define EMM_BADPTR          0xA3
  94. #define EMM_FORBIDDENFUNC   0xA4
  95.  
  96.  
  97. /*
  98. ** misc: copyright strings, version macros, etc.
  99. */
  100.  
  101. /*
  102. ** typedefs
  103. */
  104.  
  105. typedef struct a {             /* return type from EMMgetframeaddr() */
  106.    unsigned int segaddr;
  107.    unsigned int frameno;
  108.    } frameinfo;
  109.  
  110.  
  111. /*
  112. ** global variables
  113. */
  114.  
  115. extern unsigned char const _EMMerror;       /* EMS error variable */
  116. extern unsigned char const _EMMversion;     /* EMS version, BCD */
  117. extern unsigned char const _EMMframecache;  /* caching flag for copy funcs */
  118.  
  119. extern char const emslib_vers_vers[];
  120. extern char const emslib_vers_date[];
  121. extern char const emslib_vers_time[];
  122.  
  123.  
  124. /*
  125. ** function prototypes
  126. */
  127.  
  128. extern "C" int EMMlibinit(void);
  129. extern "C" int EMMgetversion(void);
  130.  
  131. extern "C" unsigned long EMMcoreleft(void);
  132. extern "C" int EMMalloc(unsigned long bytes);
  133. extern "C" int EMMfree(int handle);
  134.  
  135. extern "C" int EMMgetnumframe(void);
  136. extern "C" unsigned int EMMgetsinfraddr(int frame);
  137. extern "C" int EMMgetframeaddr(frameinfo *buffer);
  138. extern "C" int EMMmappage(int frameno, int handle, int logpage);
  139. extern "C" int EMMallocpages(int pages);
  140.  
  141. extern "C" int EMMcopyto(unsigned long copylen, unsigned char far *source,
  142.                                             int handle, unsigned long foffset);
  143. extern "C" int EMMcopyfrom(unsigned long copylen, int handle,
  144.                                unsigned long foffset, unsigned char far *dest);
  145. extern "C" int _EMMicopyto(unsigned long nelem, int elsize,
  146.                    unsigned int srcskip, unsigned char far *source,
  147.                    int handle, unsigned long foffset, unsigned int destskip);
  148. extern "C" int _EMMicopyfrom(unsigned long nelem, int elsize,
  149.                    unsigned int srcskip, int handle, unsigned long foffset,
  150.                    unsigned char far *dest, unsigned int destskip);
  151.  
  152. extern "C" int EMMsrinit(void *(*mallocfunc)(size_t));
  153. extern "C" void *EMMsave(void);
  154. extern "C" int EMMrestore(void *saveblock);
  155.  
  156. extern "C" int EMMsetname(int handle, char *name);
  157. extern "C" int EMMgetname(int handle, char *name);
  158.  
  159. extern "C" void _EMMenc(void);
  160. extern "C" void _EMMdisc(void);
  161.  
  162. #endif
  163.  
  164.