home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / cbase.zip / CBASE10B.ZIP / CBASE.ZIP / CBASE_.H next >
Text File  |  1989-11-08  |  3KB  |  86 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "cbase_.h    1.2 - 89/11/08" */
  5.  
  6. /*man---------------------------------------------------------------------------
  7. NAME
  8.      cbase_.h - private header file for cbase library
  9.  
  10. SYNOPSIS
  11.      #include "cbase_.h"
  12.  
  13. DESCRIPTION
  14.      This is a private header file included by the cbase library
  15.      modules.
  16.  
  17. ------------------------------------------------------------------------------*/
  18. #ifndef CBASE_H_    /* prevent multiple includes */
  19. #define CBASE_H_
  20.  
  21. #define DEBUG        /* switch to enable debugging for cbase library */
  22.  
  23. #include <bool.h>
  24. #include <stdio.h>
  25. #include "cbase.h"
  26.  
  27. /* constants */
  28. #define CBTYPECNT        ((size_t)26)
  29. #define EXPFLDDLM ('|')        /* export field delimiter */
  30. #define EXPRECDLM ('\n')    /* export record delimiter */
  31. #define EXPESC    ('\\')        /* export field escape character */
  32. #define CB_READ    ("r")        /* cbase open types */
  33. #define CB_RDWR    ("r+")
  34.  
  35. /* tables */
  36. #if __STDC__ == 1
  37. extern cbase_t cbb[CBOPEN_MAX];    /* cbase control structure table declaration */
  38. typedef int (*cbcmp_t)(const void *p1, const void *p2, size_t n);
  39. extern cbcmp_t cbcmpv[CBTYPECNT];    /* comparison function table decl. */
  40. typedef int (*cbexp_t)(FILE *fp, const void *p, size_t n);
  41. extern cbexp_t cbexpv[CBTYPECNT];    /* export function table decl. */
  42. typedef int (*cbimp_t)(FILE *fp, const void *p, size_t n);
  43. extern cbimp_t cbimpv[CBTYPECNT];    /* import function table decl. */
  44. #else
  45. extern cbase_t cbb[CBOPEN_MAX];    /* cbase control structure table declaration */
  46. typedef int (*cbcmp_t)();
  47. extern cbcmp_t cbcmpv[CBTYPECNT];    /* comparison function table decl. */
  48. typedef int (*cbexp_t)();
  49. extern cbexp_t cbexpv[CBTYPECNT];    /* export function table decl. */
  50. typedef int (*cbimp_t)();
  51. extern cbimp_t cbimpv[CBTYPECNT];    /* import function table decl. */
  52. #endif    /* #if __STDC__ == 1 */
  53.  
  54. /* cbase_t bit flags */
  55. #define CBOPEN          (03)    /* open status bits */
  56. #define CBREAD          (01)    /* cbase is open for reading */
  57. #define CBWRITE          (02)    /* cbase is open for writing */
  58. #define CBLOCKS         (030)    /* lock status bits */
  59. #define CBRDLCK         (010)    /* cbase is read locked */
  60. #define CBWRLCK         (020)    /* cbase is write locked */
  61. #define CBERR        (0100)    /* error has occurred on this cbase */
  62.  
  63. /* function declarations */
  64. #if __STDC__ == 1
  65. int    cb_alloc(cbase_t *cbp);
  66. void    cb_free(cbase_t *cbp);
  67. bool    cb_fvalid(size_t recsize, int fldc, const cbfield_t fldv[]);
  68. bool    cb_valid(cbase_t cbp);
  69. #else
  70. int    cb_alloc();
  71. void    cb_free();
  72. bool    cb_fvalid();
  73. bool    cb_valid();
  74. #endif    /* #if __STDC__ == 1 */
  75.  
  76. #ifdef DEBUG
  77. #define    CBEPRINT {                            \
  78.     fprintf(stderr, "cbase error line %d of %s. errno = %d.\n",    \
  79.         __LINE__, __FILE__, errno);                \
  80. }
  81. #else
  82. #define CBEPRINT
  83. #endif
  84.  
  85. #endif        /* #ifndef CBASE_H_ */
  86.