WWALLOC.H 2.5 KB

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