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

  1. ;*      FILE.INC
  2. ;*
  3. ;* High-level 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. ;/***************************************************************************\
  17. ;*       struct fileFile
  18. ;*       ---------------
  19. ;* Description:  File state structure
  20. ;\***************************************************************************/
  21.  
  22. STRUC   fileFile
  23.         rf              rfHandle        ?
  24. ENDS
  25.  
  26.  
  27.  
  28. ;/***************************************************************************\
  29. ;*       typedef fileHandle
  30. ;*       ------------------
  31. ;* Description: High-level file I/O file handle
  32. ;\***************************************************************************/
  33.  
  34. TYPEDEF fileHandle dword
  35.  
  36.  
  37.  
  38. ;/***************************************************************************\
  39. ;*       enum fileOpenMode
  40. ;*       -----------------
  41. ;* Description:  File opening mode. Used by fileOpen()
  42. ;\***************************************************************************/
  43.  
  44. ENUM    fileOpenMode \
  45.         fileOpenRead = 1, \             ; open file for reading
  46.         fileOpenWrite = 2, \            ; open file for writing
  47.         fileOpenReadWrite = 3           ; open file for both reading and
  48.                                         ; writing
  49.  
  50.  
  51.  
  52. ;/***************************************************************************\
  53. ;*       enum fileSeekMode
  54. ;*       -----------------
  55. ;* Description:  File seeking mode. Used by fileSeek()
  56. ;\***************************************************************************/
  57.  
  58. ENUM    fileSeekMode \
  59.         fileSeekAbsolute = 1, \         ; seek to an absolute position from
  60.                               \         ; the beginning of the file
  61.         fileSeekRelative = 2, \         ; seek to a position relative to
  62.                                         ; current position
  63.         fileSeekEnd = 3                 ; seek relative to the end of file
  64.  
  65.  
  66.  
  67.  
  68. ;/***************************************************************************\
  69. ;*
  70. ;* Function:     int fileOpen(char *fileName, int openMode, fileHandle *file);
  71. ;*
  72. ;* Description:  Opens a file for reading or writing
  73. ;*
  74. ;* Input:        char *fileName          name of file
  75. ;*               int openMode            file opening mode, see enum
  76. ;*                                       rfOpenMode
  77. ;*               fileHandle *file        pointer to file handle
  78. ;*
  79. ;* Returns:      MIDAS error code.
  80. ;*               File handle is stored in *file.
  81. ;*
  82. ;\***************************************************************************/
  83.  
  84. GLOBAL  LANG fileOpen : far
  85.  
  86.  
  87.  
  88.  
  89. ;/***************************************************************************\
  90. ;*
  91. ;* Function:     int fileClose(fileHandle file);
  92. ;*
  93. ;* Description:  Closes a file opened with fileOpen().
  94. ;*
  95. ;* Input:        fileHandle file         handle of an open file
  96. ;*
  97. ;* Returns:      MIDAS error code
  98. ;*
  99. ;\***************************************************************************/
  100.  
  101. GLOBAL  LANG fileClose : far
  102.  
  103.  
  104.  
  105.  
  106. ;/***************************************************************************\
  107. ;*
  108. ;* Function:     int fileGetSize(fileHandle file, long *fileSize);
  109. ;*
  110. ;* Description:  Get the size of a file
  111. ;*
  112. ;* Input:        fileHandle file         handle of an open file
  113. ;*               ulong *fileSize         pointer to file size
  114. ;*
  115. ;* Returns:      MIDAS error code.
  116. ;*               File size is stored in *fileSize.
  117. ;*
  118. ;\***************************************************************************/
  119.  
  120. GLOBAL  LANG fileGetSize : far
  121.  
  122.  
  123.  
  124.  
  125. ;/***************************************************************************\
  126. ;*
  127. ;* Function:     int fileRead(fileHandle file, void *buffer, ulong numBytes);
  128. ;*
  129. ;* Description:  Reads binary data from a file
  130. ;*
  131. ;* Input:        fileHandle file         file handle
  132. ;*               void *buffer            reading buffer
  133. ;*               ulong numBytes          number of bytes to read
  134. ;*
  135. ;* Returns:      MIDAS error code.
  136. ;*               Read data is stored in *buffer, which must be large enough
  137. ;*               for it.
  138. ;*
  139. ;\***************************************************************************/
  140.  
  141. GLOBAL  LANG fileRead : far
  142.  
  143.  
  144.  
  145.  
  146. ;/***************************************************************************\
  147. ;*
  148. ;* Function:     int fileWrite(fileHandle file, void *buffer, ulong numBytes);
  149. ;*
  150. ;* Description:  Writes binary data to a file
  151. ;*
  152. ;* Input:        fileHandle file         file handle
  153. ;*               void *buffer            pointer to data to be written
  154. ;*               ulong numBytes          number of bytes to write
  155. ;*
  156. ;* Returns:      MIDAS error code
  157. ;*
  158. ;\***************************************************************************/
  159.  
  160. GLOBAL  LANG fileWrite : far
  161.  
  162.  
  163.  
  164.  
  165. ;/***************************************************************************\
  166. ;*
  167. ;* Function:     int fileSeek(fileHandle file, long newPosition,
  168. ;*                       int seekMode);
  169. ;*
  170. ;* Description:  Seeks to a new position in file. Subsequent reads and writes
  171. ;*               go to the new position.
  172. ;*
  173. ;* Input:        fileHandle file         file handle
  174. ;*               long newPosition        new file position
  175. ;*               int seekMode            file seek mode, see enum rfSeekMode
  176. ;*
  177. ;* Returns:      MIDAS error code
  178. ;*
  179. ;\***************************************************************************/
  180.  
  181. GLOBAL  LANG fileSeek : far
  182.  
  183.  
  184.  
  185.  
  186. ;/***************************************************************************\
  187. ;*
  188. ;* Function:     int fileGetPosition(fileHandle file, long *position);
  189. ;*
  190. ;* Description:  Reads the current position in a file
  191. ;*
  192. ;* Input:        fileHandle file         file handle
  193. ;*               long *position          pointer to file position
  194. ;*
  195. ;* Returns:      MIDAS error code.
  196. ;*               Current file position is stored in *position.
  197. ;*
  198. ;\***************************************************************************/
  199.  
  200. GLOBAL  LANG fileGetPosition : far
  201.