This module implements item arrays and string trees. It also contains implementations of memory arrays and item stacks, which utilize item arrays in their implementation. Item arrays are dynamic data structures for storing related data, which can grow as items are added to them. String trees are like hash tables; their functions allow strings to be referenced as keys which can be used for very fast lookup and retrieval of strings. Each string can also store pieces of data associated with them, making them act like hash tables.
Definition in file itemarr.h.
#include "user.h"
Go to the source code of this file.
Data Structures | |
| struct | _ITEMLINK |
| struct | ITEMARRAY |
| Item array structure. More... | |
| struct | ITEMSTACK |
| Item stack structure. More... | |
| struct | STRINGTREEITEM |
| struct | STRINGTREE |
| String tree structure. More... | |
Defines | |
| #define | ISARRAY(a, type) (a && (a)->szItem==sizeof(type)) |
| Determines whether the item array's item size is equal to that of _type_. | |
| #define | ItemArrayClear(a) ((a) ? 0 : ((a)->length=0)) |
| Clears an item array by setting its length to 0. | |
| #define | ItemArrayInit(ia, sz) ItemArrayInitEx(ia,sz,0,0) |
| Initializes an item array of the specified size. | |
| #define | ItemArrayInitFixed(ia, sz) ItemArrayInitFixedEx(ia,sz,128,256) |
| Initializes an item array of the specified size, where each item occupies a fixed position in memory and doesn't move even when the array grows in size. | |
| #define | StringTreeInit(ia, init, grow) StringTreeInitEx(ia,0,init,grow,FALSE) |
| Initializes a new string tree with initial size _init_ and growth size _grow_. | |
| #define | MemArrayAlloc(ia, sz) MemArrayReAlloc(ia,NULL,sz) |
| Allocates memory and stores the memory pointer in a memory array. | |
Typedefs | |
| typedef _ITEMLINK | ITEMLINK |
Functions | |
| LPVOID | ItemArrayPtr (ITEMARRAY *ia, int i) |
| Returns a pointer to an item within the item array. | |
| BOOL | ItemArrayInitEx (ITEMARRAY *ia, DWORD sz, DWORD init, DWORD grow) |
| Initializes an item array of the specified size. | |
| BOOL | ItemArrayInitFixedEx (ITEMARRAY *ia, DWORD sz, DWORD init, DWORD grow) |
| Initializes an item array of the specified size, where each item occupies a fixed position in memory and doesn't move even when the array grows in size. | |
| void | ItemArrayRemoveItem (ITEMARRAY *ia, LONG idx) |
| Removes an item from an item array. | |
| LPVOID | ItemArraySearch (ITEMARRAY *ia, LPVOID key, int(*cmp)(LPVOID, LPVOID)) |
| Searches for an item within an item array and returns a pointer to the first item found. | |
| LONG | ItemArraySearchIndex (ITEMARRAY *ia, LPVOID key, int(*cmp)(LPVOID, LPVOID)) |
| Searches for an item within an item array and returns the index to the first item found. | |
| LPVOID | ItemArrayAllocOnePtr (ITEMARRAY *ia) |
| Adds a single item to the item array and returns a pointer to that item. | |
| LONG | ItemArrayAllocOne (ITEMARRAY *ia) |
| Adds a single item to the item array and returns an index to that item. | |
| LPVOID | ItemArrayAllocManyPtr (ITEMARRAY *ia, DWORD sz) |
| Adds a number of items at once to the item array and returns a pointer to those items. | |
| LONG | ItemArrayAllocMany (ITEMARRAY *ia, DWORD sz) |
| Adds a number of items at once to the item array. | |
| void | ItemArrayFree (ITEMARRAY *ia) |
| Frees an item array. | |
| LPVOID | StringTreeGetData (STRINGTREE *st, LONG i) |
| Gets a pointer to the data in a string tree in index _i_. | |
| LPVOID | StringTreeFindData (STRINGTREE *st, LPCTSTR str) |
| Finds the item with the string _str_ in a string tree and returns its data. | |
| BOOL | StringTreeInitEx (STRINGTREE *st, DWORD szItem, DWORD init, DWORD grow, BOOL ignoreCase) |
| Initializes a new string tree with data size _szItem_, initial size _init_ and growth size _grow_. | |
| LONG | StringTreeFindString (STRINGTREE *st, LPCTSTR str) |
| Finds the item with the string _str_ in a string tree and returns its index. | |
| LPBYTE | StringTreeGetString (STRINGTREE *st, LONG i) |
| Finds the string with the index _i_ in a string tree. | |
| LONG | StringTreeAddString (STRINGTREE *st, LPCTSTR str) |
| Adds a string to a string tree and returns its index. | |
| BOOL | StringTreeFree (STRINGTREE *st) |
| Frees a string tree's memory. | |
| void | ItemArraySort (ITEMARRAY *ia, int(*cmp)(LPVOID, LPVOID)) |
| Sorts the items found in an item array. | |
| LPVOID | MemArrayReAlloc (ITEMARRAY *ia, LPVOID pv, DWORD sz) |
| Changes the size of a memory pointer within a memory array. | |
| void | MemArrayFreePtr (ITEMARRAY *ia, LPVOID pv) |
| Frees a memory pointer within a memory array. | |
| void | MemArrayFreeAll (ITEMARRAY *ia) |
| Frees all memory pointers within a memory array. | |
| BOOL | ItemStackInit (ITEMSTACK *stack, DWORD sz) |
| Initializes an item stack, a special kind of item array. | |
| LPVOID | ItemStackGet (ITEMSTACK *stack) |
| Gets a pointer to the last item in the item stack. | |
| LPVOID | ItemStackPush (ITEMSTACK *stack, LPVOID p) |
| Pushes memory to the item stack. | |
| void | ItemStackPop (ITEMSTACK *stack) |
| Frees the last item stored in the item stack and pops it out of it. | |
| void | ItemStackFree (ITEMSTACK *stack) |
| Frees the item stack and all its pointers. | |
|
|
Determines whether the item array's item size is equal to that of _type_.
|
|
|
Clears an item array by setting its length to 0.
|
|
|
Initializes an item array of the specified size.
|
|
|
Initializes an item array of the specified size, where each item occupies a fixed position in memory and doesn't move even when the array grows in size.
|
|
|
Allocates memory and stores the memory pointer in a memory array.
|
|
|
Initializes a new string tree with initial size _init_ and growth size _grow_. Strings in the tree will be case sensitive. A string tree is a multipurpose binary tree of strings, like a hash table. |
|
|
|
|
||||||||||||
|
Adds a number of items at once to the item array.
|
|
||||||||||||
|
Adds a number of items at once to the item array and returns a pointer to those items.
|
|
|
Adds a single item to the item array and returns an index to that item.
|
|
|
Adds a single item to the item array and returns a pointer to that item.
|
|
|
Frees an item array.
|
|
||||||||||||||||||||
|
Initializes an item array of the specified size.
|
|
||||||||||||||||||||
|
Initializes an item array of the specified size, where each item occupies a fixed position in memory and doesn't move even when the array grows in size.
|
|
||||||||||||
|
Returns a pointer to an item within the item array.
|
|
||||||||||||
|
Removes an item from an item array. This function has no effect on a fixed-memory array. The size of the array will also be adjusted and any items after the removed item shifted in position.
|
|
||||||||||||||||
|
Searches for an item within an item array and returns a pointer to the first item found.
|
|
||||||||||||||||
|
Searches for an item within an item array and returns the index to the first item found.
|
|
||||||||||||
|
Sorts the items found in an item array. This function has no effect on a fixed-memory array.
|
|
|
Frees the item stack and all its pointers.
|
|
|
Gets a pointer to the last item in the item stack.
|
|
||||||||||||
|
Initializes an item stack, a special kind of item array.
|
|
|
Frees the last item stored in the item stack and pops it out of it. This function will do nothing if the stack is NULL or is empty.
|
|
||||||||||||
|
Pushes memory to the item stack.
|
|
|
Frees all memory pointers within a memory array. The memory array itself is not freed.
|
|
||||||||||||
|
Frees a memory pointer within a memory array.
|
|
||||||||||||||||
|
Changes the size of a memory pointer within a memory array.
|
|
||||||||||||
|
Adds a string to a string tree and returns its index.
|
|
||||||||||||
|
Finds the item with the string _str_ in a string tree and returns its data.
|
|
||||||||||||
|
Finds the item with the string _str_ in a string tree and returns its index.
|
|
|
Frees a string tree's memory.
|
|
||||||||||||
|
Gets a pointer to the data in a string tree in index _i_.
|
|
||||||||||||
|
Finds the string with the index _i_ in a string tree.
|
|
||||||||||||||||||||||||
|
Initializes a new string tree with data size _szItem_, initial size _init_ and growth size _grow_. If _ignoreCase_ is true, strings in the string tree are not case sensitive. |
1.4.6-NO