home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / c / cbase.zoo / lseq101.zoo / lseq_.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-20  |  2.3 KB  |  85 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "@(#)lseq_.h    1.4 - 90/06/20" */
  5.  
  6. /*man---------------------------------------------------------------------------
  7. NAME
  8.      lseq_.h - private header file for lseq library
  9.  
  10. SYNOPSIS
  11.      #include "lseq_.h"
  12.  
  13. DESCRIPTION
  14.      This is a private header file included by the lseq library
  15.      modules.
  16.  
  17. ------------------------------------------------------------------------------*/
  18. #ifndef LSEQ_H_            /* prevent multiple includes */
  19. #define LSEQ_H_
  20.  
  21. /*#define DEBUG        /* switch to enable debugging for lseq library */
  22.  
  23. #include <bool.h>
  24. #include "lseq.h"
  25.  
  26. /* tables */
  27. extern lseq_t lsb[LSOPEN_MAX];    /* lseq control structure table declaration */
  28.  
  29. /* lshdr_t bit flags */
  30. #define LSHMOD          (01)    /* lseq file being modified */
  31.  
  32. /* lseq_t bit flags */
  33. #define LSOPEN          (03)    /* open status bits */
  34. #define LSREAD          (01)    /* lseq is open for reading */
  35. #define LSWRITE          (02)    /* lseq is open for writing */
  36. #define LSLOCKS         (030)    /* lock status bits */
  37. #define LSRDLCK         (010)    /* lseq is read locked */
  38. #define LSWRLCK         (020)    /* lseq is write locked */
  39. #define LSERR        (0100)    /* error has occurred on this lseq */
  40.  
  41. /* function declarations */
  42. #ifdef AC_PROTO
  43. int        ls_alloc(lseq_t *lsp);
  44. void        ls_free(lseq_t *lsp);
  45. bool        ls_valid(lseq_t *lsp);
  46.  
  47. lsrec_t *    ls_rcalloc(lseq_t *lsp);
  48. int        ls_rccopy(lseq_t *lsp, lsrec_t *tlsrp, const lsrec_t *slsrp);
  49. void        ls_rcfree(lsrec_t *lsrp);
  50. int        ls_rcget(lseq_t *lsp, lspos_t lspos, lsrec_t *lsrp);
  51. void        ls_rcinit(lseq_t *lsp, lsrec_t *lsrp);
  52. int        ls_rcput(lseq_t *lsp, lspos_t lspos, const lsrec_t *lsrp);
  53. int        ls_rcputf(lseq_t *lsp, lspos_t lspos, size_t offset,
  54.             const void *buf, size_t bufsize);
  55. #else
  56. int        ls_alloc();
  57. void        ls_free();
  58. bool        ls_valid();
  59. lsrec_t *    ls_rcalloc();
  60. int        ls_rccopy();
  61. void        ls_rcfree();
  62. int        ls_rcget();
  63. void        ls_rcinit();
  64. int        ls_rcput();
  65. int        ls_rcputf();
  66. #endif    /* #ifdef AC_PROTO */
  67.  
  68. /* macros */
  69. #define    ls_blksize(LSP)    (offsetof(lsrec_t, recbuf) + (LSP)->lshdr.recsize)
  70.  
  71. /* lseq open types */
  72. #define LS_READ    ("r")
  73. #define LS_RDWR    ("r+")
  74.  
  75. #ifdef DEBUG
  76. #define    LSEPRINT {                            \
  77.     fprintf(stderr, "lseq error line %d of %s. errno = %d.\n",    \
  78.         __LINE__, __FILE__, errno);                \
  79. }
  80. #else
  81. #define LSEPRINT
  82. #endif
  83.  
  84. #endif        /* #ifndef LSEQ_H_ */
  85.