home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / database / cdbms / cdata.h < prev    next >
Encoding:
C/C++ Source or Header  |  1987-06-01  |  3.5 KB  |  148 lines

  1. /* --------------- cdata.h ---------------------- */
  2.  
  3. #define AZTEC        1    /* Manx Aztec C86            */
  4. #define CI_C86         2    /* Computer Innovations C86 */
  5. #define DATALIGHT     3    /* Datalight C                */
  6. #define ECOC         4    /* Eco-C88                    */
  7. #define LATTICE         5   /* Lattice C                */
  8. #define LETSC         6    /* Mark Williams Let's C    */
  9. #define MICROSOFT    7    /* Microsoft C                */
  10. #define TURBOC      8    /* Turbo C                    */
  11. #define WIZARD         9    /* Wizard C                 */
  12.  
  13. #define ERROR -1
  14. #define OK 0
  15.  
  16. #ifndef TRUE
  17. #define TRUE 1
  18. #define FALSE 0
  19. #endif
  20.  
  21. #if COMPILER != LATTICE
  22. #if COMPILER != LETSC
  23. #if COMPILER != CI_C86
  24. #include <errno.h>
  25. #endif
  26. #endif
  27. #endif
  28.  
  29. #if COMPILER != LETSC
  30. #if COMPILER != DATALIGHT
  31. #if COMPILER != CI_C86
  32. #include <fcntl.h>
  33. #endif
  34. #endif
  35. #endif
  36.  
  37. #include <ctype.h>
  38.  
  39. extern int errno;
  40.  
  41. #if COMPILER == MICROSOFT
  42. #include <sys\types.h>
  43. #include <sys\stat.h>
  44. #define OPENMODE O_RDWR+O_BINARY
  45. #undef CMODE
  46. #define CMODE S_IWRITE
  47. #endif
  48.  
  49. #if COMPILER == TURBOC
  50. #include <sys\stat.h>
  51. #define OPENMODE O_RDWR+O_BINARY
  52. #undef CMODE
  53. #define CMODE S_IWRITE
  54. #endif
  55.  
  56. #if COMPILER == CI_C86
  57. #define void int
  58. #define atol atoi
  59. #undef CMODE
  60. #define CMODE BUPDATE
  61. #define OPENMODE BUPDATE
  62. #endif
  63.  
  64. #if COMPILER == LETSC
  65. #define CMODE 0
  66. #define OPENMODE 2
  67. #endif
  68.  
  69. #if COMPILER == DATALIGHT
  70. #define CMODE 0
  71. #define OPENMODE 2
  72. #endif
  73.  
  74. #if COMPILER == WIZARD
  75. #define CMODE 0x8080
  76. #define OPENMODE O_RDWR+O_BINARY
  77. #endif
  78.  
  79. #if COMPILER == LATTICE
  80. #define OPENMODE O_RDWR
  81. #define CMODE 0666
  82. #endif
  83.  
  84. #if COMPILER == AZTEC
  85. #define OPENMODE O_RDWR
  86. #define CMODE 0666
  87. #endif
  88.  
  89. #if COMPILER == ECOC
  90. #define OPENMODE O_RDWR
  91. #define CMODE 0
  92. #endif
  93.  
  94. long lseek();
  95.  
  96. #define NODE 512         /* length of a B-tree node      */
  97. #define RPTR long        /* B-tree node and file address */
  98.  
  99. #define MXFILS   11    /* maximum files in a data base        */
  100. #define MXELE   100    /* maximum data elements in a file    */
  101. #define MXINDEX   5    /* maximum indexes per file            */
  102.  
  103. /* ----------- dbms error codes for errno return ------ */
  104. #define D_NF      1    /* record not found                    */
  105. #define D_PRIOR      2    /* no prior record for this request    */
  106. #define D_EOF      3    /* end of file                        */
  107. #define D_BOF      4    /* beginning of file                */
  108. #define D_DUPL      5    /* primary key already exists        */
  109. #define D_OM      6    /* out of memory                    */
  110. #define D_INDXC   7 /* index corrupted                    */
  111. #define D_IOERR      8 /* i/o error                        */
  112.  
  113. #define MXKEYLEN 80    /* maximum key length for indexes */
  114.  
  115. #ifndef SCHEMA
  116. /* --------- schema as built for the application --------- */
  117. extern char *dbfiles [];        /* file names            */
  118. extern char *denames [];        /* data element names    */
  119. extern char *elmask  [];        /* data element masks    */
  120. extern char eltype [];            /* data element types    */
  121. extern int ellen [];            /* data element lengths    */
  122. extern int *file_ele [];        /* file data elements    */
  123. extern int **index_ele [];        /* index data elements    */
  124.  
  125. void mov_mem(), set_mem(), fatal();
  126. void cls_file();
  127. void build_b();
  128. void put_char(), clear_screen(), cursor();
  129. void error_message(), clear_notice(), post_notice();
  130.  
  131. /* ------------- data base function definitions ---------- */
  132. void db_open(),db_cls(),dberror(),init_rcd(),
  133.      clrrcd(),rcd_fill(),build_index();
  134.  
  135. /* ---------- screen driver function definitions --------- */
  136. void init_screen(),protect(),edit(),
  137.      display_template(),tally(),put_field();
  138. #endif
  139.  
  140. /* ---------- file header --------------- */
  141. typedef struct fhdr    {
  142.     RPTR first_record;
  143.     RPTR next_record;
  144.     int record_length;
  145. } FHEADER;
  146.  
  147.  
  148.