gmscTextBlockClass
The TextBlock Service Class
Section titled “The TextBlock Service Class”The service class TextBlock contains those methods needed to manage blocked variable length text records via variable data blocks. These data blocks are the lowest level storage medium for relatively short variable length records. Each block views the records it contains as a sequence of relatively short variable length records numbered from 1 to n, where n is the number of records in the block. The block has the following structure:
| Byte | Description of content |
|---|---|
| 0-1 | Number of records currently in block (n) |
| 2-3 | Size of block, or offset of record 0 within block |
| 4-5 | Offset of first record within block |
| 6+ | Offsets of remaining records within block |
| 7+ | Unused space in the block |
| 8+ | Nth record in the block |
| 9+ | Records (n-1) to 2 in the block |
| 10+ | First record in the block |
Note that record numbers within blocks are always expressed relative to one. For insertion requests a record number of zero means to insert before the first record.
The chart below shows a sample block containing 50 bytes. The block contains the following four records (Note this chart assumes little-ender byte sex):
| Seq | Content |
|---|---|
| 1 | Sarah |
| 2 | |
| 3 | George |
| 4 | Fred |
By Con By Con By Con By Con By Con -- --- -- --- -- --- -- --- -- --- 0 4 10 35 20 30 40 e 1 0 11 0 21 31 41 o 2 50 12 22 32 42 r 3 0 13 23 33 43 g 4 45 14 24 34 44 e 5 0 15 25 35 F 45 S 6 45 16 26 36 r 46 a 7 0 17 27 37 e 47 r 8 39 18 28 38 d 48 a 9 0 19 29 39 G 49 hThe block structure used by this service class is designed to deal with highly volital records as quickly as possible. Its orginal implementation was to serve as the basic storage medium for a text editor. All offset values stored in this block are manipulated using packing services; therefore, these blocks are byte-sex neutral and boundary-fault safe. The storage conventions used are a bit tricky, so be extremely careful in making any changes or additions.
The method TextBlock_Change
Section titled “The method TextBlock_Change”Prototype
UBYTE* TextBlock_Change(UBYTE* hBlock,int iRecord,int iStart,int iLength)The TextBlock_Change method Its parameters are:
| Parameter | Description |
|---|
The method TextBlock_Data
Section titled “The method TextBlock_Data”Prototype
UBYTE* TextBlock_Data(UBYTE* hBlock,int iRecord,int* ipLength)The TextBlock_Data method Its parameters are:
| Parameter | Description |
|---|
The method TextBlock_Delete
Section titled “The method TextBlock_Delete”Prototype
int TextBlock_Delete(UBYTE* hBlock,int iRecord)The TextBlock_Delete method Its parameters are:
| Parameter | Description |
|---|
The method TextBlock_Insert
Section titled “The method TextBlock_Insert”Prototype
UBYTE* TextBlock_Insert(UBYTE* hBlock,int iRecord,int len)The TextBlock_Insert method Its parameters are:
| Parameter | Description |
|---|
The method TextBlock_Room
Section titled “The method TextBlock_Room”Prototype
int TextBlock_Room(UBYTE* hBlock,int iInsert)The TextBlock_Room method Its parameters are:
| Parameter | Description |
|---|
The method TextBlock_Split
Section titled “The method TextBlock_Split”Prototype
void TextBlock_Split(UBYTE* hBlock1,UBYTE* hBlock2,int iRecord)The TextBlock_Split method Its parameters are:
| Parameter | Description |
|---|