|
Wing Commander II
Reconstructed Win32 source (1996)
|
Near heap allocator. More...
Go to the source code of this file.
Macros | |
| #define | NEARHEAP_C |
Functions | |
| short | MergeAdjacentNearHeapBlocks (int descriptorAddress) |
| int | ReleaseNearHeapBlock (int descriptorAddress) |
| void | PurgeNearHeapBlocks (short flags) |
| unsigned short | InitializeNearHeap (void) |
| void | ShutdownNearHeap (void) |
| void * | AllocateNearHeapBlockFromEnd (int size, short flags) |
| void * | AllocateNearHeapBlockByFlags (int size, short flags) |
| void | FreeNearHeapBlock (void *pointer) |
| int | GetNearHeapBlockSize (void *pointer) |
Variables | |
| volatile short | g_nNearHeapActive = 0 |
| volatile short | g_nNearHeapMaxDescriptors = 0x80 |
| volatile int | g_nNearHeapRelocationBytes = 0 |
| volatile int | g_nNearArenaSize |
| volatile int | g_1_nNearHeapBase |
| int | g_nNearHeapFirstDescriptor |
| void *volatile | g_1_pNearHeapAllocationPtr |
Near heap allocator.
Definition in file nearheap.c.
| #define NEARHEAP_C |
Definition at line 6 of file nearheap.c.
| void * AllocateNearHeapBlockByFlags | ( | int | size, |
| short | flags ) |
Definition at line 229 of file nearheap.c.
References NearHeapBlock::address, AllocateNearHeapBlockByFlags(), AllocateNearHeapBlockFromEnd(), DosNearPtrToFar(), g_1_nNearHeapBase, g_nNearArenaSize, g_nNearHeapFirstDescriptor, g_nNearHeapMaxDescriptors, and NearHeapBlock::sizeAndFlags.
Referenced by AllocateNearHeapBlockByFlags().
| void * AllocateNearHeapBlockFromEnd | ( | int | size, |
| short | flags ) |
Definition at line 144 of file nearheap.c.
References NearHeapBlock::address, AllocateNearHeapBlockFromEnd(), DosNearPtrToFar(), g_1_nNearHeapBase, g_nNearArenaSize, g_nNearHeapFirstDescriptor, g_nNearHeapMaxDescriptors, and NearHeapBlock::sizeAndFlags.
Referenced by AllocateNearHeapBlockByFlags(), and AllocateNearHeapBlockFromEnd().
Definition at line 319 of file nearheap.c.
References NearHeapBlock::address, DosFarPtrToNear(), DosNearPtrToFar(), FreeNearHeapBlock(), g_1_nNearHeapBase, g_nNearArenaSize, g_nNearHeapFirstDescriptor, ReleaseNearHeapBlock(), and NearHeapBlock::sizeAndFlags.
Referenced by FreeNearHeapBlock(), and UpdateShipTurretGuns().
| int GetNearHeapBlockSize | ( | void * | pointer | ) |
Definition at line 341 of file nearheap.c.
References NearHeapBlock::address, DosFarPtrToNear(), DosNearPtrToFar(), g_1_nNearHeapBase, g_nNearArenaSize, g_nNearHeapFirstDescriptor, GetNearHeapBlockSize(), and NearHeapBlock::sizeAndFlags.
Referenced by GetNearHeapBlockSize(), and UpdateShipTurretGuns().
| unsigned short InitializeNearHeap | ( | void | ) |
Definition at line 86 of file nearheap.c.
References AllocateTaggedMemory(), DosFarPtrToNear(), DosMemmove(), DosNearPtrToFar(), FreeIfNotNull(), g_1_nNearHeapBase, g_1_pNearHeapAllocationPtr, g_nNearArenaSize, g_nNearHeapActive, g_nNearHeapMaxDescriptors, g_nNearHeapRelocationBytes, GetNavRangeSentinel(), InitializeNearHeap(), and PurgeNearHeapBlocks().
Referenced by InitializeNearHeap().
| short MergeAdjacentNearHeapBlocks | ( | int | descriptorAddress | ) |
Definition at line 15 of file nearheap.c.
References NearHeapBlock::address, DosNearPtrToFar(), g_nNearHeapFirstDescriptor, MergeAdjacentNearHeapBlocks(), and NearHeapBlock::sizeAndFlags.
Referenced by MergeAdjacentNearHeapBlocks(), and ReleaseNearHeapBlock().
| void PurgeNearHeapBlocks | ( | short | flags | ) |
Definition at line 57 of file nearheap.c.
References NearHeapBlock::address, DosNearPtrToFar(), g_1_nNearHeapBase, g_nNearArenaSize, g_nNearHeapActive, g_nNearHeapFirstDescriptor, g_nNearHeapMaxDescriptors, PurgeNearHeapBlocks(), ReleaseNearHeapBlock(), and NearHeapBlock::sizeAndFlags.
Referenced by InitializeNearHeap(), and PurgeNearHeapBlocks().
| int ReleaseNearHeapBlock | ( | int | descriptorAddress | ) |
Definition at line 39 of file nearheap.c.
References DosNearPtrToFar(), g_1_nNearHeapBase, g_nNearArenaSize, g_nNearHeapFirstDescriptor, MergeAdjacentNearHeapBlocks(), ReleaseNearHeapBlock(), and NearHeapBlock::sizeAndFlags.
Referenced by FreeNearHeapBlock(), PurgeNearHeapBlocks(), and ReleaseNearHeapBlock().
Definition at line 127 of file nearheap.c.
References DosMemmove(), DosNearPtrToFar(), FreeIfNotNull(), g_1_nNearHeapBase, g_1_pNearHeapAllocationPtr, g_nNearArenaSize, g_nNearHeapActive, g_nNearHeapRelocationBytes, and ShutdownNearHeap().
Referenced by DrawTextAt(), and ShutdownNearHeap().
| volatile int g_1_nNearHeapBase |
Definition at line 374 of file nearheap.c.
Referenced by AllocateNearHeapBlockByFlags(), AllocateNearHeapBlockFromEnd(), FreeNearHeapBlock(), GetAvailableMainMemory(), GetLargestMainMemoryBlock(), GetNearHeapBlockSize(), InitializeNearHeap(), PurgeNearHeapBlocks(), ReleaseNearHeapBlock(), and ShutdownNearHeap().
| void* volatile g_1_pNearHeapAllocationPtr |
Definition at line 376 of file nearheap.c.
Referenced by InitializeNearHeap(), and ShutdownNearHeap().
| volatile int g_nNearArenaSize |
Definition at line 373 of file nearheap.c.
Referenced by AllocateNearHeapBlockByFlags(), AllocateNearHeapBlockFromEnd(), FreeNearHeapBlock(), GetAvailableMainMemory(), GetLargestMainMemoryBlock(), GetNearHeapBlockSize(), InitializeNearHeap(), PurgeNearHeapBlocks(), ReleaseNearHeapBlock(), and ShutdownNearHeap().
| volatile short g_nNearHeapActive = 0 |
Definition at line 9 of file nearheap.c.
Referenced by InitializeNearHeap(), PurgeNearHeapBlocks(), and ShutdownNearHeap().
| int g_nNearHeapFirstDescriptor |
Definition at line 375 of file nearheap.c.
Referenced by AllocateNearHeapBlockByFlags(), AllocateNearHeapBlockFromEnd(), FreeNearHeapBlock(), GetAvailableMainMemory(), GetLargestMainMemoryBlock(), GetNearHeapBlockSize(), MergeAdjacentNearHeapBlocks(), PurgeNearHeapBlocks(), and ReleaseNearHeapBlock().
| volatile short g_nNearHeapMaxDescriptors = 0x80 |
Definition at line 10 of file nearheap.c.
Referenced by AllocateNearHeapBlockByFlags(), AllocateNearHeapBlockFromEnd(), InitializeNearHeap(), LoadOriginFxDrivers(), and PurgeNearHeapBlocks().
| volatile int g_nNearHeapRelocationBytes = 0 |
Definition at line 11 of file nearheap.c.
Referenced by InitializeNearHeap(), and ShutdownNearHeap().