#include "../tdkpin_window_lifecycle.h" #include static uint8_t g_dgroup[0x1000]; static uint8_t g_objects[0x400]; static Win16FarPtr g_window; static Win16FarPtr g_peer; static Win16FarPtr g_attached; static Win16FarPtr g_title; static unsigned g_step; static bool g_board_mode; BOOL16 DeleteObject16(HGDIOBJ16 object) { assert(++g_step == 1 && object == 0x7777); if (g_board_mode) { assert(win16_read_far_pointer(g_window, 0x41) == 0); assert(win16_read_far_pointer(g_peer, 0x45) == 0); } else { assert(win16_read_far_pointer(g_window, 0x41) == g_peer); assert(win16_read_far_pointer(g_peer, 0x41) == g_window); } return 1; } void borland_far_strdispose(Win16FarPtr string) { assert(++g_step == 2 && string == g_title); } void borland_dispose_object(Win16FarPtr object) { assert(++g_step == 3 && object == g_attached); } void object_windows_object_destruct( Win16FarPtr object, uint16_t vmt) { assert(++g_step == 4 && object == g_window && vmt == 0); } void borland_finish_object_destructor( BorlandObjectCallFrame *frame, uint16_t vmt_field_offset) { assert(frame->object == g_window && vmt_field_offset == 0); if (++g_step == 5) { assert(frame->vmt_argument == 0); } else { assert(g_step == 6 && frame->vmt_argument == 0x9999); } } int main(void) { win16_reset_segment_bindings(); win16_bind_segment(0x5000, g_dgroup, sizeof(g_dgroup), true); win16_bind_segment(0x6000, g_objects, sizeof(g_objects), true); win16_set_dgroup_selector(0x5000); g_window = win16_make_far_pointer(0x6000, 0); g_peer = win16_make_far_pointer(0x6000, 0x100); g_attached = win16_make_far_pointer(0x6000, 0x200); g_title = win16_make_far_pointer(0x6000, 0x300); win16_write_u16(win16_make_far_pointer(0x5000, 0x0867), 0, 0x7777); win16_write_u32(g_window, 0x1d, g_title); win16_write_u32(g_window, 0x3b, g_attached); win16_write_u32(g_window, 0x41, g_peer); win16_write_u32(g_peer, 0x41, g_window); g_board_mode = false; tdkpin_overlay_window_destruct(g_window, 0x9999); assert(g_step == 6); assert(win16_read_far_pointer(g_window, 0x3b) == 0); assert(win16_read_far_pointer(g_window, 0x41) == 0); assert(win16_read_far_pointer(g_peer, 0x41) == 0); g_step = 0; g_board_mode = true; win16_write_u32(g_window, 0x1d, g_title); win16_write_u32(g_window, 0x3b, g_attached); win16_write_u32(g_window, 0x41, g_peer); win16_write_u32(g_peer, 0x45, g_window); tdkpin_board_window_destruct(g_window, 0x9999); assert(g_step == 6); assert(win16_read_far_pointer(g_window, 0x3b) == 0); assert(win16_read_far_pointer(g_window, 0x41) == 0); assert(win16_read_far_pointer(g_peer, 0x45) == 0); return 0; }