home *** CD-ROM | disk | FTP | other *** search
/ PC Press 1997 July / Sezamfile97_1.iso / msdos / c / cbase11.a03 / CBASE11.ZIP / LSEQ / LSEQ_.H < prev    next >
C/C++ Source or Header  |  1993-01-01  |  3KB  |  102 lines

  1. /*
  2.  *    Copyright (c) 1989-1992 Citadel Software, Inc.
  3.  *    All Rights Reserved
  4.  */
  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 H_LSEQ_            /* prevent multiple includes */
  19. #define H_LSEQ_
  20.  
  21. /* #ident    "@(#)lseq_.h    1.7 - 93/01/01" */
  22.  
  23. #include <port.h>
  24.  
  25. /*#define DEBUG        /* switch to enable debugging for lseq library */
  26.  
  27. #include <bool.h>
  28.  
  29. /* local headers */
  30. #include "lseq.h"
  31.  
  32. /* tables */
  33. extern lseq_t lsb[LSOPEN_MAX];    /* lseq control structure table declaration */
  34.  
  35. /* lshdr_t bit flags */
  36. #define LSHMOD          (01)    /* lseq file being modified */
  37.  
  38. /* lseq_t bit flags */
  39. #define LSOPEN          (03)    /* open status bits */
  40. #define LSREAD          (01)    /* lseq is open for reading */
  41. #define LSWRITE          (02)    /* lseq is open for writing */
  42. #define LSMOD          (04)    /* LSHMOD flag set in file header */
  43. #define LSLOCKS         (030)    /* lock status bits */
  44. #define LSRDLCK         (010)    /* lseq is read locked */
  45. #define LSWRLCK         (020)    /* lseq is write locked */
  46. #define LSERR        (0100)    /* error has occurred on this lseq */
  47.  
  48. /* function declarations */
  49. #ifdef AC_PROTO
  50. int        ls_alloc(lseq_t *lsp);
  51. void        ls_free(lseq_t *lsp);
  52. bool        ls_valid(lseq_t *lsp);
  53.  
  54. lsrec_t *    ls_rcalloc(lseq_t *lsp);
  55. int        ls_rccopy(lseq_t *lsp, lsrec_t *tlsrp, const lsrec_t *slsrp);
  56. void        ls_rcfree(lsrec_t *lsrp);
  57. int        ls_rcget(lseq_t *lsp, lspos_t lspos, lsrec_t *lsrp);
  58. void        ls_rcinit(lseq_t *lsp, lsrec_t *lsrp);
  59. int        ls_rcput(lseq_t *lsp, lspos_t lspos, const lsrec_t *lsrp);
  60. int        ls_rcputf(lseq_t *lsp, lspos_t lspos, size_t offset,
  61.             const void *buf, size_t bufsize);
  62. #else
  63. int        ls_alloc();
  64. void        ls_free();
  65. bool        ls_valid();
  66. lsrec_t *    ls_rcalloc();
  67. int        ls_rccopy();
  68. void        ls_rcfree();
  69. int        ls_rcget();
  70. void        ls_rcinit();
  71. int        ls_rcput();
  72. int        ls_rcputf();
  73. #endif    /* #ifdef AC_PROTO */
  74.  
  75. /* macros */
  76. #define    ls_blksize(LSP)    (offsetof(lsrec_t, recbuf) + (LSP)->lshdr.recsize)
  77.  
  78. /* lseq open types */
  79. #define LS_READ    ("r")
  80. #define LS_RDWR    ("r+")
  81.  
  82. /* error log */
  83. #ifdef DEBUG
  84. #include <errno.h>
  85. #if WINSYS == WS_NONE
  86. #include <stdio.h>
  87. #define    LSERRLOG {                            \
  88.     fprintf(stderr, "*** lseq error line %d of %s. errno = %d.\n",    \
  89.         __LINE__, __FILE__, errno);                \
  90. }
  91. #else
  92. #include <xtend.h>
  93. #define    BERRLOG {                            \
  94.     errlog(__FILE__, __LINE__, "lseq error.");            \
  95. }
  96. #endif
  97. #else
  98. #define LSERRLOG
  99. #endif
  100.  
  101. #endif        /* #ifndef H_LSEQ_ */
  102.