#ifndef TDKPIN_BORLAND_RUNTIME_H #define TDKPIN_BORLAND_RUNTIME_H #include "tdkpin_segmented.h" #include Win16FarPtr borland_get_mem(uint16_t bytes); /* 1020:012d */ Win16FarPtr borland_global_allocate(uint16_t bytes); /* 1020:0222 */ void borland_free_mem(Win16FarPtr block, uint16_t bytes); /* 1020:0147 */ void borland_fill_bytes( Win16FarPtr destination, uint16_t count, uint8_t value); /* 1020:16c9 */ void borland_move_bytes( Win16FarPtr destination, Win16FarPtr source, uint16_t count); /* 1020:16a5 */ void borland_copy_typed_record( uint16_t descriptor_field_offset, Win16FarPtr destination, Win16FarPtr source); /* 1020:046c */ _Noreturn void borland_runtime_exit(uint16_t status); /* 1020:0061 */ _Noreturn void borland_runtime_error(uint16_t code); /* 1020:005d */ void borland_run_exit_procedures(void); /* 1020:00d2 */ extern Win16FarPtr g_borland_exit_proc; /* 1028:0712/0714 */ extern uint16_t g_borland_error_offset; /* 1028:0718 */ extern uint16_t g_borland_error_segment; /* 1028:071a */ extern uint16_t g_borland_heap_reserve_bytes; /* 1028:06f4 */ extern Win16FarPtr g_borland_heap_reserve; /* 1028:06f6/06f8 */ extern uint8_t g_borland_heap_reserve_disabled; /* 1028:06fa */ extern Win16FarPtr g_borland_heap_error_handler; /* 1028:070e/0710 */ extern uint16_t g_borland_global_alloc_flags; /* 1028:070c */ bool borland_heap_reserve_is_unallocated(void); /* 1008:2de0 */ void borland_ensure_heap_reserve(void); /* 1008:2dff */ uint16_t borland_release_heap_reserve_on_oom(uint16_t requested_bytes); /* 1008:2e22 */ void borland_initialize_heap_reserve(void); /* 1008:2e76 */ extern _Atomic uint16_t g_borland_io_result; /* 1028:071e */ _Static_assert(sizeof(g_borland_io_result) == 2, "Borland IOResult width drift"); uint16_t borland_take_io_result(void); /* 1020:0388 */ void borland_require_io_success(void); /* 1020:038f */ typedef struct { int32_t minimum; int32_t maximum; } BorlandInt32Range; void borland_check_int32_range( int32_t value, const BorlandInt32Range *range); /* 1020:039d */ _Noreturn void borland_runtime_error_215(void); /* 1020:03c5 */ typedef struct { Win16FarPtr block; bool failed; } BorlandAllocationAttempt; BorlandAllocationAttempt borland_try_get_mem(uint16_t bytes); /* 1020:01ca */ bool borland_try_free_mem(Win16FarPtr block, uint16_t bytes); /* 1020:02d7 */ #endif