home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Science / Science.zip / imdisp79.zip / EMSIF.H < prev    next >
C/C++ Source or Header  |  1991-12-01  |  5KB  |  162 lines

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