2018-08-18 08:16:52 +00:00
|
|
|
/*
|
|
|
|
4coder_arena.h - Preversioning
|
|
|
|
no warranty implied; use at your own risk
|
|
|
|
|
|
|
|
This software is in the public domain. Where that dedication is not
|
|
|
|
recognized, you are granted a perpetual, irrevocable license to copy,
|
|
|
|
distribute, and modify this file as you see fit.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
|
|
|
#if !defined(FCODER_ARENA_H)
|
|
|
|
#define FCODER_ARENA_H
|
|
|
|
|
2019-06-01 23:58:28 +00:00
|
|
|
#if !defined(Migrating__Arena)
|
2018-08-18 08:16:52 +00:00
|
|
|
struct Partition{
|
|
|
|
char *base;
|
2019-06-01 23:58:28 +00:00
|
|
|
i32 pos;
|
|
|
|
i32 max;
|
2018-08-18 08:16:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Temp_Memory{
|
2019-02-05 00:10:38 +00:00
|
|
|
Partition *part;
|
2019-06-01 23:58:28 +00:00
|
|
|
i32 pos;
|
2018-08-18 08:16:52 +00:00
|
|
|
};
|
|
|
|
|
2019-02-05 00:10:38 +00:00
|
|
|
#if defined(FCODER_CUSTOM_H)
|
|
|
|
|
|
|
|
struct Partition_Chained{
|
|
|
|
Partition_Chained *prev;
|
|
|
|
Partition part;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Arena{
|
|
|
|
struct Application_Links *app;
|
|
|
|
Partition_Chained *part;
|
2019-06-01 23:58:28 +00:00
|
|
|
i32 chunk_size;
|
|
|
|
i32 align;
|
2019-02-05 00:10:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Temp_Memory_Arena{
|
|
|
|
Arena *arena;
|
|
|
|
Partition_Chained *part;
|
2019-06-01 23:58:28 +00:00
|
|
|
i32 pos;
|
2019-02-05 00:10:38 +00:00
|
|
|
};
|
|
|
|
|
2019-02-08 10:03:48 +00:00
|
|
|
struct Temp_Memory_Arena_Light{
|
|
|
|
Partition_Chained *part;
|
2019-06-01 23:58:28 +00:00
|
|
|
i32 pos;
|
2019-02-08 10:03:48 +00:00
|
|
|
};
|
|
|
|
|
2019-04-01 06:14:31 +00:00
|
|
|
struct Scratch_Block{
|
|
|
|
Scratch_Block(Application_Links *app);
|
|
|
|
~Scratch_Block();
|
|
|
|
operator Arena *();
|
|
|
|
|
|
|
|
Arena *scratch;
|
|
|
|
Temp_Memory_Arena temp;
|
|
|
|
};
|
|
|
|
|
2019-02-05 00:10:38 +00:00
|
|
|
#endif
|
|
|
|
|
2018-08-18 08:16:52 +00:00
|
|
|
#endif
|
|
|
|
|
2019-06-01 23:58:28 +00:00
|
|
|
#endif
|
|
|
|
|
2018-08-18 08:16:52 +00:00
|
|
|
// BOTTOM
|
|
|
|
|