Bag.
typedef struct Bag { uint sig; byte wobj[256]; } Bag;

Bag key.
typedef struct BagKey { int i, v; } BagKey;

Is key valid.
API bool BagIsKeyValid(Bag *bag, BagKey key);
bag: Bag.
key: Key.
returns: True if bag is valid.

Get item count.
API uint BagGetItemCount(Bag *bag);
bag: Bag.
returns: Item count.

Get blocks per item.
API float BagGetRatio(Bag *bag);
bag: Bag.
returns: Blocks per item.

Get caller defined item type.
API uint BagGetItemType(Bag *bag, BagKey key);
bag: Bag.
key: Key.
returns: Caller defined item type.

Get first item.
API void *BagGetFirstItem(Bag *bag, BagKey *key);
bag: Bag.
key: Var for bag key.
returns: Item or 0.

Get last item.
API void *BagGetLastItem(Bag *bag, BagKey *key);
bag: Bag.
key: Var for bag key.
returns: Item or 0.

Get previous item.
API void *BagGetPrevItem(Bag *bag, BagKey *key);
bag: Bag.
key: Var for bag key.
returns: Item or 0.

Get next item.
API void *BagGetNextItem(Bag *bag, BagKey *key);
bag: Bag.
key: Var for bag key.
returns: Item or 0.

Get item.
API void *BagGetItem(Bag *bag, BagKey key);
bag: Bag.
key: Key.
returns: Item or 0.

Add item.
API void *BagAddItem(Bag *bag, BagKey *key, uint type, uint itemSize, FDestructCB Destruct, BagKey *dep);
bag: Bag.
key: Key.
type: Caller defined type.
itemSize: Item size.
Destruct: Destruct callback or 0.
dep: Dependency. Added item must follow this item in memory, or 0.
returns: Item memory.

Delete item.
API void BagDelItem(Bag *bag, BagKey key);
bag: Bag.
key: Key.

Delete all items.
API void BagClear(Bag *bag);
bag: Bag.

Initialize bag.
API void BagInit(Bag *bag, uint blockSize, uint incr);
bag: Bag.
itemSize: Block size.
incr: Increment.

Release bag.
API void BagRel(Bag *bag);
bag: Bag.