home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / CBASE101.ZIP / BLKIO112.ZIP / BLKIO_.H < prev    next >
Text File  |  1990-06-20  |  3KB  |  110 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "@(#)blkio_.h    1.4 - 90/06/20" */
  5.  
  6. /*man---------------------------------------------------------------------------
  7. NAME
  8.      blkio_.h - private header for blkio library
  9.  
  10. SYNOPSIS
  11.      #include "blkio_.h"
  12.  
  13. DESCRIPTION
  14.      This is a private header file included by the blkio library
  15.      modules.
  16.  
  17. ------------------------------------------------------------------------------*/
  18. #ifndef BLKIO_H_    /* prevent multiple includes */
  19. #define BLKIO_H_
  20.  
  21. /*#define DEBUG        /* switch to enable debugging for blkio library */
  22.  
  23. /* The HOST macro specifies the host operating system.  Currently supported   */
  24. /* systems are:                                                               */
  25. #define UNIX    (1)    /* UNIX */
  26. #define MS_DOS    (2)    /* MS-DOS */
  27. #define HOST    MS_DOS
  28.  
  29. /* The MSDOSC macro specifies the MS-DOS C compiler being used.  Currently    */
  30. /* supported compilers are:                                                   */
  31. #define TURBOC    (1)    /* Borland Turbo C */
  32. #define MSC    (2)    /* Microsoft C */
  33. #define MSQC    (3)    /* Microsoft Quick C */
  34. #define MSDOSC    TURBOC
  35.  
  36. #include <bool.h>
  37. #include "blkio.h"
  38.  
  39. /* tables */
  40. extern BLKFILE biob[BOPEN_MAX];    /* BLKFILE control struct table declaration */
  41.  
  42. /* BLKFILE bit flags */
  43. #define BIOOPEN          (03)    /* open status bits */
  44. #define BIOREAD          (01)    /* block file is open for reading */
  45. #define BIOWRITE      (02)    /* block file is open for writing */
  46. #define BIOUSRBUF      (04)    /* user supplied buffer */
  47. #define BIOERR        (0100)    /* error has occurred on this block file */
  48.  
  49. /* block_t bit flags */
  50. #define BLKREAD          (01)    /* block can be read */
  51. #define BLKWRITE      (02)    /* block needs to be written to disk */
  52. #define BLKERR        (0100)    /* error has occurred on this block */
  53.  
  54. /* function declarations */
  55. #ifdef AC_PROTO
  56. int    b_alloc(BLKFILE *bp);
  57. void    b_free(BLKFILE *bp);
  58. int    b_get(BLKFILE *bp, size_t i);
  59. int    b_initlist(BLKFILE *bp);
  60. int    b_mkmru(BLKFILE *bp, size_t i);
  61. int    b_put(BLKFILE *bp, size_t i);
  62. bool    b_valid(const BLKFILE *bp);
  63.  
  64. int    b_uclose(BLKFILE *bp);
  65. int    b_uendblk(BLKFILE *bp, bpos_t *endblkp);
  66. int    b_ugetf(BLKFILE *bp, bpos_t bn, size_t offset, void *buf, size_t bufsize);
  67. int    b_uopen(BLKFILE *bp, const char *filename, const char *type);
  68. int    b_uputf(BLKFILE *bp, bpos_t bn, size_t offset, const void *buf, size_t bufsize);
  69. #else
  70. int    b_alloc();
  71. void    b_free();
  72. int    b_get();
  73. int    b_initlist();
  74. int    b_mkmru();
  75. int    b_put();
  76. bool    b_valid();
  77.  
  78. int    b_uclose();
  79. int    b_uendblk();
  80. int    b_ugetf();
  81. int    b_uopen();
  82. int    b_uputf();
  83. #endif    /* #ifdef AC_PROTO */
  84.  
  85. /* macros */
  86. #define    b_blkbuf(BP, N) ((void *)(                    \
  87.         (char *)(BP)->blkbuf +                    \
  88.         ((N) == 0 ? 0 : (BP)->hdrsize + ((N) - 1) * (BP)->blksize)\
  89. ))
  90. #define    b_blockp(BP, N) ((block_t *)(                    \
  91.         (char *)(BP)->blockp +    (N) * sizeof(block_t)        \
  92. ))
  93.  
  94. /* block file open types */
  95. #define BF_READ        ("r")
  96. #define BF_RDWR        ("r+")
  97. #define BF_CRTR        ("w+")
  98. #define BF_CREATE    ("c")
  99.  
  100. #ifdef DEBUG
  101. #define    BEPRINT {                            \
  102.     fprintf(stderr, "*** blkio error line %d of %s. errno = %d.\n",    \
  103.         __LINE__, __FILE__, errno);                \
  104. }
  105. #else
  106. #define BEPRINT
  107. #endif
  108.  
  109. #endif    /* #ifndef BLKIO_H_ */
  110.