home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / BMULKEY.ZIP / MULKEY.INC < prev    next >
Encoding:
Text File  |  1988-05-05  |  17.0 KB  |  268 lines

  1. { MULKEY.INC }
  2.  
  3. { Hidden constants and types for Mulkey }
  4.  
  5. CONST
  6.       { --------------------- Btrieve Operation Codes ----------------------- }
  7.  
  8.                                    { Operation codes sent to Btrieve          }
  9.                                    { ---------------------------------------- }
  10.       AbortTransactionOp   = 21;   { Removes all operations performed since   }
  11.                                    {  the beginning of an active transaction  }
  12.                                    {  and terminates the transaction          }
  13.       BeginTransactionOp   = 19;   { Marks the beginning of a set of          }
  14.                                    {  related Btrieve operations              }
  15.       ClearOwnerOp         = 30;   { Removes the owner name associated with a }
  16.                                    {  Btrieve file                            }
  17.       CloseOp              = 1;    { Closes a Btrieve file                    }
  18.       CreateOp             = 14;   { Creates a Btrieve file                   }
  19.       DeleteOp             = 4;    { Removes an existing record from a file   }
  20.       EndTransactionOp     = 20;   { Completes a transaction and makes the    }
  21.                                    {  appropriate changes to affected files   }
  22.       ExtendOp             = 16;   { Divides a file over two logical drives   }
  23.       GetDirectOp          = 23;   { Retrieves the data record positioned at  }
  24.                                    { a specified physical address in the file }
  25.       GetEqualOp           = 5;    { Retrieves a record corresponding to a    }
  26.                                    {  specific key value                      }
  27.       GetGreaterOp         = 8;    { Retrieves a record corresponding to a    }
  28.                                    {  key value greater than that specified   }
  29.       GetGreaterOrEqualOp  = 9;    { Retrieves a record corresponding to a    }
  30.                                    {  key value greater or equal to the value }
  31.                                    {  specified                               }
  32.       GetHighestOp         = 13;   { Retrieves the record corresponding to    }
  33.                                    {  the highest key value in the file       }
  34.       GetKeyOp             = 50;   { Retrieves only the key information*      }
  35.       GetLessThanOp        = 10;   { Retireves a record corresponding to a    }
  36.                                    {  key value less than that specified      }
  37.       GetLessThanOrEqualOp = 11;   { Retireves a record with a key value less }
  38.                                    {  than or equal to that specified         }
  39.       GetLowestOp          = 12;   { Retrieves the record corresponding to    }
  40.                                    {  lowest key value for that key number    }
  41.       GetNextOp            = 6;    { Retrieves the record which follows the   }
  42.                                    {  current record                          }
  43.       GetPositionOp        = 22;   { Returns the physical position of the     }
  44.                                    {  current record                          }
  45.       GetPreviousOp        = 7;    { Retrieves the record which precedes the  }
  46.                                    {  current record                          }
  47.       InsertOp             = 2;    { Inserts a record into a Btrieve file     }
  48.       OpenOp               = 0;    { Opens a Btrieve file                     }
  49.       ResetOp              = 28;   { Releases all resources held by a station }
  50.       SetOwnerOp           = 29;   { Assigns an owner name to a Btrieve file  }
  51.       StatOp               = 15;   { Retrieves the characteristics of a file  }
  52.       StepDirectOp         = 24;   { Retrieves a record in the location       }
  53.                                    {  physically following the current record }
  54.       UnlockOp             = 27;   { Unlocks records previously locked        }
  55.       UpdateOp             = 3;    { Updates an existing record in a file     }
  56.       VersionOp            = 26;   { Returns the current Btrieve version      }
  57.  
  58.       { ----------------------- Bit Number Constants ------------------------ }
  59.  
  60.                                    { File Flags Constants                     }
  61.                                    { ---------------------------------------- }
  62.       VarLenRecsBit        = 0;    { Allow variable length records            }
  63.       BlankCompressBit     = 1;    { Perform blank compression on above       }
  64.       PreAllocateBit       = 2;    { Pre-allocate # pages in Allocation word  }
  65.  
  66.                                    { Key Flags Constants                      }
  67.                                    { ---------------------------------------- }
  68.       AllowDupsBit         = 0;    { Allow duplicate key values               }
  69.       ModifiableBit        = 1;    { Key is modifiable                        }
  70.                                    { Bit 2 is ignored by Btrieve under Mulkey }
  71.       NullValueBit         = 3;    { Key has null value                       }
  72.       SegmentedBit         = 4;    { Key has another segment following        }
  73.       AltColSeqBit         = 5;    { Key uses alternate collating sequence    }
  74.       DescendingSortBit    = 6;    { Key is sorting in descending sequence    }
  75.       SupplementalIndexBit = 7;    { Key is supplemental index - ret by stat  }
  76.       ExtendedTypeBit      = 8;    { Key is extended type - always in Mulkey  }
  77.  
  78.                                    { Owner Flags Constants                    }
  79.                                    { ---------------------------------------- }
  80.       ReadOnlyAccessBit    = 0;    { Allow read only access without owner     }
  81.       EncryptBit           = 1;    { Encrypts the data in the file by owner   }
  82.  
  83.       { -------------------- Btrieve Open Mode Constants -------------------- }
  84.  
  85.                                    { Values to send the open procedure        }
  86.                                    { ---------------------------------------- }
  87.       NormalOpen           = 0;    { Normal value to open a Btrieve file      }
  88.       AcceleratedOpen      = -1;   { Accelerated mode - defeats the automatic }
  89.                                    {  data recovery mode in Btrieve           }
  90.       ReadOnlyOpen         = -2;   { Allows opening a damaged file for reads  }
  91.       DOSVerifyOpen        = -3;   { Same as normal but forces DOS verify on  }
  92.       ExclusiveOpen        = -4;   { Same as normal but locks entire file     }
  93.  
  94.       { -------------------- Extended Key Types Constants ------------------- }
  95.  
  96.                                    { Type of Key (KeyType in KeySpecType)     }
  97.                                    { Mulkey uses only the extended key types, }
  98.                                    {  for more info see MULKEY.DOC            }
  99.                                    { ---------------------------------------- }
  100.       ArrayCharKey         = 0;    { Array of character     1-255 bytes       }
  101.       SignedIntKey         = 1;    { Signed whole number    Even # of bytes   }
  102.       FloatKey             = 2;    { IEEE floating point    4 or 8            }
  103.       DateKey              = 3;    { Date                   4 bytes           }
  104.       TimeKey              = 4;    { Time                   4 bytes           }
  105.       DecimalKey           = 5;    { semi-BCD               1-?? (variable)   }
  106.       MoneyKey             = 6;    { same as Decimal        1-?? (variable)   }
  107.       LogicalKey           = 7;    { Logical key            1 or 2 bytes      }
  108.       NumericKey           = 8;    { Numeric                1-255 variable    }
  109.       BFloatKey            = 9;    { Old Microsoft float    4 or 8 bytes      }
  110.       lStringKey           = 10;   { Pascal string          1-254 (255) bytes }
  111.       NullStringKey        = 11;   { Null terminated string 1-255 bytes       }
  112.       UnsignedIntKey       = 14;   { Unsigned whole number  Even # of bytes   }
  113.  
  114.       { -------------------- Mulkey version 3.00A --------------------------- }
  115.  
  116.                                     { Version Control Constants               }
  117.                                     { --------------------------------------- }
  118.       MajorVersion  = 3;            { This version of Mulkey - major version  }
  119.       MinorVersion  = 0;            { This version of Mulkey - minor version  }
  120.       Revision      = 'A';          { The revision (file layout version)      }
  121.       MulkeyDate    = '5-5-1988';   { The date of the release                 }
  122.       FileVersion   = 'MULKEY';     { The file layout version (owner of file) }
  123.  
  124.       { When opening the master FileDesc file, Mulkey uses a string formed    }
  125.       { by concatenating FileVersion with Revision above as the owner of the  }
  126.       { file.  If you attempt to open a file created under a different        }
  127.       { revision, Btrieve will deny access to the file because of an owner    }
  128.       { mismatch.  Mulkey versions 1 and 2 did not use this method so         }
  129.       { revision A begins with version 3.00.  Make sure FileVersion and       }
  130.       { Revision are not longer than the maximum owner length.                }
  131.  
  132.       { ----------------- Owner and Environment constants ------------------- }
  133.  
  134.                                                 { --------------------------- }
  135.       EnvVar        : STRING[8] = 'FILEDESC';   { Main Environment Variable   }
  136.                                                 {  this is a typed constant   }
  137.                                                 {  for changes in MULKEY.EXE  }
  138.  
  139.       { ----------------- Control and Field Size Constants ------------------ }
  140.  
  141.                             { If certain of these constants are changed, it   }
  142.                             { will affect your master FileDesc file layouts.  }
  143.                             { ----------------------------------------------- }
  144.       MaxKeys       = 24;   { Maximum number of keys or segments in Btrieve   }
  145.       MaxKeyLen     = 255;  { Maximum length in bytes of any key              }
  146.       MaxMulkey     = 40;   { Maximum number of Mulkey files open at once     }
  147.                             { Make sure MULKEY.ASM has same MaxMulkey number! }
  148.       MaxTries      = 5;    { Maximum number of retries for file errors       }
  149.       MinKSize      = 64;   { Minimum size of some data structures            }
  150.       MinVersion    = 4;    { Minimum Btrieve version number this requires    }
  151.       MinRevision   = 10;   { Minimum Btrieve revision number this requires   }
  152.       NoHandle      = 0;    { The handle passed if error occurs during open   }
  153.       FirstHandle   = 1;    { The first valid handle returned at open         }
  154.       PosBlockLen   = 128;  { Length in bytes for Btrieves Position Block     }
  155.       SearchKeyLen  = 50;   { WARNING: This must be >= FDescLen + FSystLen    }
  156.       SpareBytes    = 21;   { Number of spare bytes in a FileDesc record      }
  157.       BtNotFoundErr = 12;   { File not found error number for Btrieve         }
  158.       ExtLaterCode  = 0;    { Extend file when disk is full operation code    }
  159.       ExtNowCode    = 255;  { Extend file now operation code of extend        }
  160.       ColSeqID      = $AC;  { ID byte of an alternate collating sequence      }
  161.       ColNameLen    = 8;    { Length of a Btreive Alt Collating Sequence name }
  162.       ColSeqLen     = 256;  { Number of bytes in an Alt Collating Sequence    }
  163.  
  164.       { -------------------- FDesc Key Number Constants --------------------- }
  165.  
  166.                                  { Key number for GetFileDesc procedure       }
  167.                                  { ------------------------------------------ }
  168.       FDescOnlyKey      = 1;     { Key number for the FDesc string only       }
  169.       SystemOnlyKey     = 2;     { Key number for System name string only     }
  170.       FDescAndSystemKey = 3;     { Key number for both FDesc and Sytem string }
  171.  
  172.       { ------------------------ Error Code Constants ----------------------- }
  173.  
  174.                               { Error codes for MULKEY only - start at 512    }
  175.                               { --------------------------------------------- }
  176.       NoErr         = 0;      { No error occured                              }
  177.       MulkeyInitErr = 512;    { Could not initialize Mulkey                   }
  178.       NoMemoryErr   = 513;    { Not enough memory                             }
  179.       NoHandlesErr  = 514;    { No more Mulkey handles                        }
  180.       GetOpErr      = 515;    { Error in get operation                        }
  181.       BadHandleErr  = 516;    { Handle not active                             }
  182.       NotActiveErr  = 517;    { Mulkey not initialized                        }
  183.       GetDirectErr  = 518;    { Error in get direct                           }
  184.       InvalidKeyErr = 519;    { Bad key number sent                           }
  185.       OwnerMatchErr = 520;    { Owners did not match                          }
  186.  
  187. { ----------------------- Memory and File Layout Types ---------------------- }
  188.  
  189. TYPE
  190.       MKeyRange     = 1..MaxKeys;
  191.       MKeyLenRange  = 1..MaxKeyLen;
  192.       MulkeyRange   = FirstHandle..MaxMulkey;
  193.  
  194.       BtVerType     = RECORD
  195.                           Version : WORD;
  196.                           Revision: WORD;
  197.                           Net     : CHAR;
  198.                       END; {BtVerType}
  199.  
  200.       ColSeqType    = RECORD
  201.                           ColSeqSign: BYTE;              { The signature byte }
  202.                           ColSeqName: ARRAY[1..ColNameLen] OF CHAR;
  203.                           ColSeq    : ARRAY[1..ColSeqLen] OF CHAR;
  204.                       END; {colseqtype}
  205.  
  206.       PosBlockType  = ARRAY[1..PosBlockLen] OF BYTE; { Btrieve position block }
  207.  
  208.       SpareData     = ARRAY[1..SpareBytes] OF BYTE;  { extra space in record  }
  209.  
  210.       KBLType       = BYTE;
  211.  
  212.       KBuf          = RECORD
  213.                           BufferLen: KBLType;
  214.                           KeyBuffer: ARRAY[MKeyLenRange] OF BYTE;
  215.                       END; {Kbuf}
  216.  
  217.       KeyBufType    = ARRAY[MKeyRange] OF ^KBuf;
  218.  
  219.       KeyBufPtr     = ^KeyBufType;
  220.  
  221.       MulkeyTable   = ARRAY[MulkeyRange] OF ^MemFileType;
  222.  
  223.       KeySpecType   = RECORD
  224.                          Position: WORD;                { Offset in data 1..  }
  225.                          Len     : WORD;                { Key length in bytes }
  226.                          Flags   : WORD;                { bit flags for key   }
  227.                          NotUsed : ARRAY[1..4] OF BYTE; { fill with 0's       }
  228.                          KeyType : BYTE;                { Key Type see above  }
  229.                          Reserved: ARRAY[1..5] OF BYTE; { fill with 0's       }
  230.                       END; {KeySpecType}
  231.  
  232.       FileSpecType  = RECORD
  233.                         CASE BYTE OF
  234.                            0: (RecordLen   : WORD;   { Record length in bytes }
  235.                                PageSize    : WORD;   { Page size to use       }
  236.                                NumIndexes  : WORD;   { # of keys NOT segments }
  237.                                NumRecs     : LONGINT;  { # of records in file }
  238.                                FileFlags   : WORD;   { Bit flags for file     }
  239.                                ReservedWord: WORD;   { Fill with $0000        }
  240.                                Allocation  : WORD;   { # pages to preallocate }
  241.                                KeyBuf      : ARRAY[MKeyRange] OF KeySpecType;
  242.                                AltColSeq   : ColSeqType); { Alternate col seq }
  243.                            1: (MinSize     : ARRAY[1..MinKSize] OF BYTE);
  244.                       END; {FileSpecType}
  245.  
  246.       FileDescType  = RECORD                        { Disk file record layout }
  247.                           TypeName: FDescStr;       { Search name             }
  248.                           SysName : FSystStr;       { System name             }
  249.                           Owner   : FOwnerStr;      { Owner for create ops    }
  250.                           AllowRO : BOOLEAN;        { Read Only OK w/o Owner  }
  251.                           Encrypt : BOOLEAN;        { Encrypt the file        }
  252.                           FileData: FileSpecType;   { Btrieve data            }
  253.                           Spare   : SpareData;      { Extra bytes             }
  254.                       END; {FileDescType}
  255.  
  256.       MemFileType   = RECORD                        { In memory file info     }
  257.                           PosBlock : PosBlockType;  { Btrieves position block }
  258.                           FileDesc : FileDescType;  { Memory info of the file }
  259.                           Extension: PathStr;       { Extension file (if any) }
  260.                           FileName : PathStr;       { Path & name of the file }
  261.                           OpenMode : BYTE;          { LO() of open mode       }
  262.                           Changed  : BOOLEAN;       { If file length changed  }
  263.                           LastKey  : BYTE;          { we keep SUCC of lastkey }
  264.                           LockAttr : FLockAttrib;   { File locking attributes }
  265.                           KeyPtr   : KeyBufPtr;     { Pointer to key buffers  }
  266.                           KeysAlloc: BYTE;          { # of keys allocated     }
  267.                       END; {MemFileType}
  268.