2023-11-26 18:49:54 +00:00
|
|
|
|
2023-11-29 18:17:00 +00:00
|
|
|
#ifndef PAC_UTILITY_H
|
|
|
|
#define PAC_UTILITY_H
|
2023-11-26 18:49:54 +00:00
|
|
|
|
|
|
|
typedef signed char i8_t;
|
|
|
|
typedef signed short i16_t;
|
|
|
|
typedef signed int i32_t;
|
|
|
|
typedef signed long i64_t;
|
|
|
|
|
|
|
|
typedef unsigned char u8_t;
|
|
|
|
typedef unsigned short u16_t;
|
|
|
|
typedef unsigned int u32_t;
|
|
|
|
typedef unsigned long u64_t;
|
|
|
|
|
|
|
|
typedef float f32_t;
|
|
|
|
typedef double f64_t;
|
|
|
|
|
|
|
|
typedef u32_t rune_t;
|
|
|
|
typedef u8_t bool_t;
|
|
|
|
|
2023-11-29 18:17:00 +00:00
|
|
|
#ifdef __PAC_32_BIT__
|
2023-11-26 18:49:54 +00:00
|
|
|
typedef u32_t usz_t;
|
|
|
|
typedef i32_t isz_t;
|
|
|
|
#else
|
|
|
|
typedef u64_t usz_t;
|
|
|
|
typedef i64_t isz_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define TRUE (1)
|
|
|
|
#define FALSE (0)
|
|
|
|
|
|
|
|
#define NULL ((void *) 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-28 20:28:57 +00:00
|
|
|
bool_t pac_rune_is_lower_letter (rune_t rune);
|
|
|
|
bool_t pac_rune_is_upper_letter (rune_t rune);
|
|
|
|
bool_t pac_rune_is_letter (rune_t rune);
|
|
|
|
bool_t pac_rune_is_digit (rune_t rune);
|
|
|
|
bool_t pac_rune_is_blank (rune_t rune);
|
|
|
|
bool_t pac_rune_is_sign (rune_t rune);
|
2023-11-26 18:49:54 +00:00
|
|
|
|
2023-11-28 18:23:57 +00:00
|
|
|
|
|
|
|
|
2023-11-28 20:28:57 +00:00
|
|
|
void pac_memory_copy (void *destination, void *source, usz_t length);
|
|
|
|
void pac_memory_fill (void *region, usz_t len_region, u8_t byte);
|
|
|
|
void pac_memory_zero (void *region, usz_t len_region);
|
2023-11-28 18:23:57 +00:00
|
|
|
|
2023-11-28 20:25:20 +00:00
|
|
|
|
|
|
|
|
2023-11-28 20:28:57 +00:00
|
|
|
typedef struct pac_arena pac_arena_s;
|
|
|
|
|
|
|
|
struct pac_arena
|
2023-11-28 20:25:20 +00:00
|
|
|
{
|
|
|
|
usz_t len_allocation;
|
|
|
|
usz_t offset;
|
|
|
|
void *allocation;
|
|
|
|
pac_arena_s *continuation;
|
|
|
|
|
2023-11-28 20:28:57 +00:00
|
|
|
};
|
2023-11-28 20:25:20 +00:00
|
|
|
|
2023-11-28 20:28:57 +00:00
|
|
|
pac_arena_s pac_create_arena (usz_t size);
|
|
|
|
void pac_delete_arena (pac_arena_s arena);
|
2023-11-28 20:25:20 +00:00
|
|
|
|
2023-11-28 20:28:57 +00:00
|
|
|
void pac_free_arena (pac_arena_s *arena);
|
|
|
|
pac_arena_s * pac_new_arena (usz_t size);
|
2023-11-28 20:25:20 +00:00
|
|
|
|
2023-11-28 20:28:57 +00:00
|
|
|
void * pac_arena_alloc (pac_arena_s *arena, usz_t length);
|
2023-11-28 20:25:20 +00:00
|
|
|
|
2023-11-29 18:17:00 +00:00
|
|
|
#endif // PAC_UTILITY_H
|