home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / midas / rawfile.inc < prev    next >
Text File  |  1994-08-06  |  7KB  |  216 lines

  1. ;*      RAWFILE.INC
  2. ;*
  3. ;* Raw file I/O for MIDAS Sound System
  4. ;*
  5. ;* Copyright 1994 Petteri Kangaslampi and Jarno Paananen
  6. ;*
  7. ;* This file is part of the MIDAS Sound System, and may only be
  8. ;* used, modified and distributed under the terms of the MIDAS
  9. ;* Sound System license, LICENSE.TXT. By continuing to use,
  10. ;* modify or distribute this file you indicate that you have
  11. ;* read the license and understand and accept it fully.
  12. ;*
  13.  
  14.  
  15. ;/***************************************************************************\
  16. ;*       struct rfFile
  17. ;*       -------------
  18. ;* Description:  File state structure
  19. ;\***************************************************************************/
  20.  
  21. STRUC   rfFile
  22.         handle          DW      ?
  23. ENDS
  24.  
  25.  
  26.  
  27. ;/***************************************************************************\
  28. ;*       typedef rfHandle
  29. ;*       ----------------
  30. ;* Description: Raw file I/O file handle
  31. ;\***************************************************************************/
  32.  
  33. TYPEDEF rfHandle dword
  34.  
  35.  
  36.  
  37.  
  38. ;/***************************************************************************\
  39. ;*       enum rfOpenMode
  40. ;*       ---------------
  41. ;* Description:  File opening mode. Used by rfOpen()
  42. ;\***************************************************************************/
  43.  
  44. ENUM    rfOpenMode \
  45.         rfOpenRead = 1, \               ; open file for reading
  46.         rfOpenWrite = 2, \              ; open file for writing
  47.         rfOpenReadWrite = 3             ; open file for both reading and
  48.                                         ; writing
  49.  
  50.  
  51.  
  52. ;/***************************************************************************\
  53. ;*       enum rfSeekMode
  54. ;*       ---------------
  55. ;* Description:  File seeking mode. Used by rfSeek()
  56. ;\***************************************************************************/
  57.  
  58. ENUM    rfSeekMode \
  59.         rfSeekAbsolute = 1, \           ; seek to an absolute position from
  60.                             \           ; the beginning of the file
  61.         rfSeekRelative = 2, \           ; seek to a position relative to
  62.                             \           ; current position
  63.         rfSeekEnd = 3                   ; seek relative to the end of file
  64.  
  65.  
  66.  
  67. ;/***************************************************************************\
  68. ;*
  69. ;* Function:     int rfOpen(char *fileName, int openMode, rfHandle *file);
  70. ;*
  71. ;* Description:  Opens a file for reading or writing
  72. ;*
  73. ;* Input:        char *fileName          name of file
  74. ;*               int openMode            file opening mode, see enum rfOpenMode
  75. ;*               rfHandle *file          pointer to file handle
  76. ;*
  77. ;* Returns:      MIDAS error code.
  78. ;*               File handle is stored in *file.
  79. ;*
  80. ;\***************************************************************************/
  81.  
  82. GLOBAL  LANG rfOpen : far
  83.  
  84.  
  85.  
  86.  
  87. ;/***************************************************************************\
  88. ;*
  89. ;* Function:     int rfClose(rfHandle file);
  90. ;*
  91. ;* Description:  Closes a file opened with rfOpen().
  92. ;*
  93. ;* Input:        rfHandle file           handle of an open file
  94. ;*
  95. ;* Returns:      MIDAS error code
  96. ;*
  97. ;\***************************************************************************/
  98.  
  99. GLOBAL  LANG rfClose : far
  100.  
  101.  
  102.  
  103.  
  104. ;/***************************************************************************\
  105. ;*
  106. ;* Function:     int rfGetSize(rfHandle file, long *fileSize);
  107. ;*
  108. ;* Description:  Get the size of a file
  109. ;*
  110. ;* Input:        rfHandle file           handle of an open file
  111. ;*               ulong *fileSize         pointer to file size
  112. ;*
  113. ;* Returns:      MIDAS error code.
  114. ;*               File size is stored in *fileSize.
  115. ;*
  116. ;\***************************************************************************/
  117.  
  118. GLOBAL  LANG rfGetSize : far
  119.  
  120.  
  121.  
  122.  
  123. ;/***************************************************************************\
  124. ;*
  125. ;* Function:     int rfRead(rfHandle file, void *buffer, ulong numBytes);
  126. ;*
  127. ;* Description:  Reads binary data from a file
  128. ;*
  129. ;* Input:        rfHandle file           file handle
  130. ;*               void *buffer            reading buffer
  131. ;*               ulong numBytes          number of bytes to read
  132. ;*
  133. ;* Returns:      MIDAS error code.
  134. ;*               Read data is stored in *buffer, which must be large enough
  135. ;*               for it.
  136. ;*
  137. ;\***************************************************************************/
  138.  
  139. GLOBAL  LANG rfRead : far
  140.  
  141.  
  142.  
  143.  
  144. ;/***************************************************************************\
  145. ;*
  146. ;* Function:     int rfWrite(rfHandle file, void *buffer, ulong numBytes);
  147. ;*
  148. ;* Description:  Writes binary data to a file
  149. ;*
  150. ;* Input:        rfHandle file           file handle
  151. ;*               void *buffer            pointer to data to be written
  152. ;*               ulong numBytes          number of bytes to write
  153. ;*
  154. ;* Returns:      MIDAS error code
  155. ;*
  156. ;\***************************************************************************/
  157.  
  158. GLOBAL  LANG rfWrite : far
  159.  
  160.  
  161.  
  162.  
  163. ;/***************************************************************************\
  164. ;*
  165. ;* Function:     int rfSeek(rfHandle file, long newPosition, int seekMode);
  166. ;*
  167. ;* Description:  Seeks to a new position in file. Subsequent reads and writes
  168. ;*               go to the new position.
  169. ;*
  170. ;* Input:        rfHandle file           file handle
  171. ;*               long newPosition        new file position
  172. ;*               int seekMode            file seek mode, see enum rfSeekMode
  173. ;*
  174. ;* Returns:      MIDAS error code
  175. ;*
  176. ;\***************************************************************************/
  177.  
  178. GLOBAL  LANG rfSeek : far
  179.  
  180.  
  181.  
  182.  
  183. ;/***************************************************************************\
  184. ;*
  185. ;* Function:     int rfGetPosition(rfHandle file, long *position);
  186. ;*
  187. ;* Description:  Reads the current position in a file
  188. ;*
  189. ;* Input:        rfHandle file           file handle
  190. ;*               long *position          pointer to file position
  191. ;*
  192. ;* Returns:      MIDAS error code.
  193. ;*               Current file position is stored in *position.
  194. ;*
  195. ;\***************************************************************************/
  196.  
  197. GLOBAL  LANG rfGetPosition : far
  198.  
  199.  
  200.  
  201.  
  202. ;/***************************************************************************\
  203. ;*       enum rfFunctIDs
  204. ;*       ---------------
  205. ;* Description:  ID numbers for raw file I/O functions
  206. ;\***************************************************************************/
  207.  
  208. ENUM    rfFunctIDs \
  209.         ID_rfOpen = ID_rf, \
  210.         ID_rfClose, \
  211.         ID_rfGetSize, \
  212.         ID_rfRead, \
  213.         ID_rfWrite, \
  214.         ID_rfSeek, \
  215.         ID_rfGetPosition
  216.