WWALLOC.H 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: F:\projects\c&c0\vcs\code\wwalloc.h_v 4.9 07 May 1996 17:14:00 JOE_BOSTIC $ */
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /*
  23. ** This should be located in the wwlib32.h file, but is located here for
  24. ** test purposes.
  25. */
  26. #ifdef __FLAT__
  27. #define PRIVATE static
  28. #endif
  29. typedef enum MemoryFlagType {
  30. MEM_NORMAL = 0x0000, // Default memory (normal).
  31. MEM_PUBLIC = 0x0000, // Default memory (normal).
  32. MEM_CHIP = 0x0000, // Graphic & sound buffer memory (Amiga).
  33. MEM_UNUSED = 0x0001, // <unused>
  34. MEM_SYSTEM = 0x0002, // Allocate out of system heap (XMS or EMS only).
  35. MEM_RELAXED= 0x0004, // Don't worry about page conservation in EMS.
  36. MEM_TEMP = 0x0008, // Temporary allocation (used by library only).
  37. MEM_CLEAR = 0x0010, // Fill memory with '\0' characters.
  38. MEM_PARA = 0x0020, // Paragraph aligned (IBM only).
  39. MEM_XMS = 0x0040, // XMS memory.
  40. MEM_EMS = 0x0080, // EMS memory (not implemented).
  41. MEM_X = 0x8000 // Here to force this enum to be unsigned sized.
  42. } MemoryFlagType;
  43. MemoryFlagType operator |(MemoryFlagType, MemoryFlagType);
  44. MemoryFlagType operator &(MemoryFlagType, MemoryFlagType);
  45. MemoryFlagType operator ~(MemoryFlagType);
  46. /* Prototypes for functions defined in this file */
  47. void *cdecl Alloc(unsigned long bytes_to_alloc, MemoryFlagType flags);
  48. void cdecl Free(void const *pointer);
  49. void *cdecl Resize_Alloc(void const *original_ptr, unsigned long new_size_in_bytes);
  50. long cdecl Ram_Free(MemoryFlagType flag);
  51. long cdecl Total_Ram_Free(MemoryFlagType flag);
  52. long cdecl Heap_Size(MemoryFlagType flag);
  53. extern unsigned long cdecl MinRam; // Record of least memory at worst case.
  54. extern unsigned long cdecl MaxRam; // Record of total allocated at worst case.
  55. #ifdef __cplusplus
  56. }
  57. #endif