home *** CD-ROM | disk | FTP | other *** search
- {*************************************************************************
- **
- ** Copyright 1982-1997 Pervasive Software Inc. All Rights Reserved
- **
- *************************************************************************}
- {***********************************************************************
- BLOBHDR.PAS
- This is the Pascal constants unit required for Btrieve chunk
- operations for Btrieve 6.x. This module is required when making
- a 16-bit protected mode application, whether or not you use Blobs.
-
- ************************************************************************}
- UNIT blobhdr;
-
- INTERFACE
- CONST
- {*
- **
- ** Extractors are used for both Get and Put operations. Every Get Extractor
- ** has a parallel Put Extractor; the only Put Extractor without a Get
- ** counterpart is Truncate.
- **
- ** There are two ways to classify all Extractors except Truncate:
- **
- ** 1) Do they define chunks by Offset and Len, or do they instruct
- ** Btrieve to define chunks based on the notion of a rectangle?
- **
- ** 2) Do they read/write user's data directly from/to the data buffer,
- ** or do they use pointers in the data buffer as source/destination?
- **
- *}
-
- { "Actions" or opcodes for ProcessIndirect() }
- PREPROCESS_BLOBGET = 0;
- PREPROCESS_BLOBPUT = 1;
- POSTPROCESS_BLOBGET = 2;
- INDIRECT_BIT = $00000001;
- RECTANGLE_BIT = $00000002;
- TRUNC_BIT = $00000004;
-
-
- TYPE
-
- CHUNK_REC = RECORD
- ChunkOffset: LONGINT;
- ChunkLen: LONGINT;
- dataP: PChar; { When used w/ "direct" api, init to nil }
- end;
-
- XTRACTR = RECORD
- Signature: LONGINT;
- NumChunks: LONGINT;
- Chunk: CHUNK_REC;
- end;
-
- BRECTANGLE = RECORD
- Signature: LONGINT;
- NumRows: LONGINT;
- Offset: LONGINT;
- BytesPerRow: LONGINT;
- BtrDistanceBetweenRows: LONGINT; { Btrieve's count of bytes between }
- { beginning of two consecutive rows. }
- dataP: ^Char;
- AppDistanceBetweenRows: LONGINT; { App's count of bytes between }
- { beginning of two consecutive rows. }
- end;
-
- {============================================================================
-
- Chunk PUT APIs:
-
- ============================================================================}
-
- {*
- ** 1. Update a chunk at Offset, Len bytes. New bytes are in data buffer,
- ** following the entire extractor. Initialize the dummy Source ptr to
- ** NULL.
- *}
-
-
- {#define XTRACTR_DIRECT_SIGN 0x80000000L}
-
-
- PUT_XTRACTR = RECORD
- Signature: LONGINT; { XTRACTR_DIRECT_SIGN }
- NumChunks: LONGINT;
- Chunk: CHUNK_REC;
- end;
-
-
- {
- ** 2. Update a chunk at Offset, Len bytes. Get new bytes by using a ptr(s)
- ** in the extractor. Use PUT_XTRACTR, but initialize the Signature
- ** field to XTRACTR_INDIRECT_SIGN. Initialize the Source ptr(s) to
- ** point to the chunks.
- }
-
- { #define XTRACTR_INDIRECT_SIGN 0x80000001L }
-
- {
- ** 3. Update a rectangle. A series of NumRows chunks, beginning at Offset,
- ** bytesPerRow number of bytes per chunk. Between rows (chunks),
- ** increment previous Offset by BtrDistanceBetweenRows to position
- ** into record for next chunk. Data is sent in the data buffer.
- ** Initialize the dummy Destination ptr to NULL. The
- ** AppDistanceBetweenRows field will be ignored.
- }
-
- { #define RECTANGLE_DIRECT_SIGN 0x80000002L }
-
- PUT_RECTANGLE = RECORD
- Signature: LONGINT; { RECTANGLE_DIRECT_SIGN }
- NumRows: LONGINT;
- Offset: LONGINT;
- BytesPerRow: LONGINT;
- BtrDistanceBetweenRows: LONGINT; { Btrieve's count of bytes between }
- { beginning of two consecutive rows. }
- dataP: ^Char;
- AppDistanceBetweenRows : LONGINT; { App's count of bytes between }
- { beginning of two consecutive rows. }
- end;
-
-
- {
- ** 4. Update a rectangle - same as above except that the data is read from
- ** an address specified by the Source ptr in the incoming data buffer,
- ** following the rectangle definition. Also, AppDistanceBetweenRows
- ** is specified as a value to use to increment the Destination ptr
- ** between rows (chunks). Use the PUT_RECTANGLE struct, but init
- ** the Signature field to RECTANGLE_INDIRECT_SIGN.
- }
-
-
- { #define RECTANGLE_INDIRECT_SIGN 0x80000003L }
-
- {
- ** 5. Truncate at Offset.
- }
-
- { #define TRUNC_SIGN 0x80000004L }
-
- PUT_TRUNC = RECORD
- Signature: LONGINT; { TRUNC_SIGN }
- ChunkOffset: LONGINT;
- end;
-
-
- {
- ** 6. Put Next. Combine with each option above, by biasing the signature
- ** with NEXT_IN_BLOB. In each case, the Offset chunk is irrelevant,
- ** because it is computed by Btrieve, based on current position in
- ** record. For the first two put options, if more than one chunk is
- ** used, each chunk's offset is computed by Btrieve. For the "put a
- ** rectangle" options, the first Offset is computed from the current
- ** position in the record; computation of subsequent "row's"
- ** offsets is based on BtrDistanceBetweenRows.
- }
-
- { #define NEXT_IN_BLOB 0x40000000L }
-
- {
- ** 7. Append. Combine with the first four options above, by biasing the
- ** signature with APPEND_TO_BLOB. Behaves like Put Next in that Btrieve
- ** computes the same offset chunks as are computed with Put Next. The
- ** difference is that value used for the offset is one byte beyond the end
- ** of record. May not be used with the Put Next bias.
- }
-
- { #define APPEND_TO_BLOB 0x20000000L }
-
-
- {============================================================================
-
- Chunk Get APIs:
-
- ============================================================================}
-
- {
- **
- ** 1. Get a chunk(s) at Offset, Len bytes. Data returned is placed into the
- ** data buffer. Remember to initialize Chunk[x].dataP to NULL
- ** and set the Signature field to XTRACTR_DIRECT_SIGN.
- }
-
-
- GET_XTRACTR = RECORD
- RecordAddress: LONGINT;
- Signature: LONGINT;
- NumChunks: LONGINT;
- Chunk: CHUNK_REC;
- end;
-
- {
- **
- ** 2. Get a chunk(s) at Offset, Len bytes. Data returned is placed into a
- ** buffer whose address is given by a pointer sent by the application.
- ** Use the GET_XTRACTR. Set the Signature field to XTRACTR_INDIRECT_SIGN.
- }
-
-
- {
- ** 3. Get a rectangle. A series of NumRows chunks, beginning at Offset,
- ** bytesPerRow number of bytes per chunk. Between rows (chunks),
- ** increment previous Offset by BtrDistanceBetweenRows to position
- ** into record for next chunk. Data is returned in the data buffer.
- ** Initialize the dummy Destination ptr to NULL. The
- ** AppDistanceBetweenRows field will be ignored. Set the Signature
- ** field to RECTANGLE_DIRECT_SIGN.
- }
-
- GET_RECTANGLE = RECORD
- RecordAddress: LONGINT;
- Signature: LONGINT;
- NumRows: LONGINT;
- Offset: LONGINT;
- BytesPerRow: LONGINT;
- BtrDistanceBetweenRows: LONGINT; { Btrieve's count of bytes between }
- { beginning of two consecutive rows. }
- dataP: ^Char;
- AppDistanceBetweenRows: LONGINT; { App's count of bytes between }
- { beginning of two consecutive rows. }
- end;
-
- {
- **
- ** 4. Get a rectangle - same as above except that the data is returned to an
- ** address specified by the Destination pointer in the incoming data
- ** buffer, following the rectangle definition. Also,
- ** AppDistanceBetweenRows is specified as a value to use to increment
- ** the Destination pointer between rows. Set the Signature field to
- ** RECTANGLE_INDIRECT_SIGN.
- }
-
- {
- **
- ** 5. Get Next Chunk. Combine with each option above, by biasing the
- ** signature with NEXT_IN_BLOB. In each case, the Offset chunk is
- ** irrelevant. See details under Put Next Chunk, above.
- **
- }
-
-
- IMPLEMENTATION
- END.
-