home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / database / dbf / xbase3a.inc < prev   
Encoding:
Text File  |  1986-01-03  |  5.6 KB  |  122 lines

  1. (* xdbase3.inc - Turbo Pascal Definitions for DB3 Records *)
  2.  
  3. (*  xdbfhdr3.inc = definitions for dbase3 headers and fld defs *)
  4.  
  5. const
  6.  
  7. xmaxflds = 128;  (* Maximum number of DB3 Fields in a DBF *)
  8. xdbhsize = 32;   (* Size of DBF Header before Field Definitions *)
  9.  
  10. type
  11.  
  12. xflddef3 = array [1..32] of byte;
  13.  
  14. xflddef = record
  15.      (* Layout of DB3 Field Descriptor Entry *)
  16.              fldname: array [1..11] of char;
  17.              fldtype: char;
  18.              fldlocn: integer; (* excess 7 or 15 x'0f' from recrd start *)
  19.                                (* whatever is displacement of 1st field *)
  20.                                (* Delete Flag field - 1 byte must be    *)
  21.                                (* assumed as 1st true field in Record   *)
  22.              fldgarb: integer; (* reserved - loaded with garbage *)
  23.              fldsize: byte;
  24.              flddec:  byte;
  25.              fldrsv2: array [1..14] of byte;
  26.            end;
  27.  
  28. xdbfhdr = record
  29.             dbvers:    byte; (* Dbase Version Number, 2 or 3 *)
  30.              (* True Hex values for last yy/mm/dd of change *)
  31.             chgyy:     byte;
  32.             chgmm:     byte;
  33.             chgdd:     byte;
  34.  
  35.             numrecs:  integer; (* Number of records in DBF *)
  36.             numrecsh: integer; (* high order bytes of 32 bit integer *)
  37.             frstrcd:  integer; (* 0-rel byte locn of 1st record in file *)
  38.                                (* It will point at start of Record's delete *)
  39.                                (* Flag *)
  40.             rcdlgth:  integer; (* Record Length of fixed length DBF Records *)
  41.             resrvd0:  integer;
  42.             resrvd1:  integer;
  43.             resrvd2:  array [1..16] of byte;
  44.             flddef:   xflddef;    (* first field definition *)
  45.             (* 1 32 byte entry for each defined field *)
  46.             (* Last field entry starts with all x'00' *)
  47.             (* 1st DBF Record follows *)
  48.           end;
  49.  
  50. (* If blockio is used, then physical blocksize is irrelevant to record
  51.    location in file; records are written with no slack space between.
  52.    A ^Z (x'1a') follows the last record. Recommend minimum block of 1024
  53.    bytes  - should otherwise be multiple of 128, programmer can choose *)
  54. (* End of xdbfhdr3 definition *)
  55.  
  56. (* xndxhdr3.inc - DB3 Index Header and Record Definitions *)
  57.  
  58. (* DBASE 3 Index File Header - Anchor Block *)
  59.  
  60. (* observe xxxxh variable names - dB3 is either using or is planning to
  61.    use 32 bit integers *)                                                -
  62.  
  63. (* All dB3 Index Blocks are 512 bytes *)
  64.  
  65. type
  66.   xndxhdr  = record
  67.                frstblk:    integer;    (* 1st Index Block/Node - 0 rel *)
  68.                frstbklkh:  integer;    (* filler / may contain junk *)
  69.                nxtalloc:   integer;    (* block number of next to allocate *)
  70.                                        (* 0-rel to start of file *)
  71.                nxtalloch:  integer;    (* filler / may contain junk *)
  72.                fillerxx:   array [1..2] of integer;  (* usually 0's *)
  73.                keylgth:    byte;       (* length of key part of Index/Node *)
  74.                ntrylgth:   byte;   (* dB3 - does not set, dB2 does *)
  75.                                    (* actual value is keylgth + 8 in DB3  *)
  76.                maxents:    integer; (* Maximum number of entries dB3 will *)
  77.                                     (* create in a Node during Update/Create *)
  78.              (* Remaining area includes the
  79.                                    "Index on" Descriptor and garbage *)
  80.              (* Total blocksize is 512 bytes *)
  81.             end;
  82.  
  83.   xndxrcd  = record
  84.              (* Description applies to both Index Node Entries and to Index *)
  85.              (*  records *)
  86.                DnNode:     integer; (* Next Node "down" - 0 rel file block *)
  87.                                     (*  0 --> real index rcrd *)
  88.                DnNodeH:    integer; (* May be filler or hi-order 16 bits *)
  89.                rcdno:      integer; (* dB3 corresponding DBF Record No.  *)
  90.                                     (* will be 0 if this is Node entry   *)
  91.                rcdnoh:     integer; (* high order 16 bits - 32 bit integer *)
  92.                rcdKey:     array [1..100] of char; (* reserve max allowable *)
  93.                                                    (* key size *)
  94. (* Beware of pure numberic keys: dB3 converts all to 64 bit reals with *)
  95. (* 12 bit exponents and "normalized" 48 bit mantissas *)
  96. (* dB2 creates 32 bit BCD reals *)
  97. (* Both systems do this even when no positions to right of decimal point *)
  98. (* are specified in the database field definition *)
  99. (* None are directly compatible with Turbo, Turbo 8087 or Turbo BCD reals *)
  100.  
  101.             end;
  102.  
  103.   xndxblk =   record
  104.      (* Describes Node and Index Record Block  *)
  105.                 numents:   byte; (* will contain true number of entries *)
  106.                                  (* in the 512 byte block, if DnNode,   *)
  107.                                  (* is non-zero;                        *)
  108.                                  (* Otherwise it is one less than true  *)
  109.                                  (* number of entries; furthermore, if  *)
  110.                                  (* DnNode of 1st Block Entry is non-zero*)
  111.                                  (* then all entries have non-zero       *)
  112.                                  (* DnNode values, and vice versa *)
  113.                 fillerh:   array [1..3]   of byte; (* can include junk *)
  114.                 DnNode:    integer; (* DnNode of 1st Block Entry *)
  115.                 blkdata:   array [0..505] of byte;
  116.              end;
  117.  
  118. 
  119.             end;
  120.  
  121.   xndxrcd  = record
  122.              (* Description applies to both Index Nod