#!/usr/bin/env bash set -euo pipefail workspace_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd -P) test_build_dir=$(mktemp -d /tmp/tdkpin-c-tests.XXXXXX) trap 'rm -f -- "$test_build_dir/resource-test" "$test_build_dir/runtime-ui-test" "$test_build_dir/string-test" "$test_build_dir/shortstring-test" "$test_build_dir/random-test" "$test_build_dir/object-windows-test" "$test_build_dir/object-windows-handlers-test" "$test_build_dir/window-advanced-test" "$test_build_dir/window-creation-test" "$test_build_dir/game-windows-test" "$test_build_dir/highscores-test" "$test_build_dir/gameplay-helpers-test" "$test_build_dir/ball-render-test" "$test_build_dir/ball-restore-test" "$test_build_dir/ball-sweep-test" "$test_build_dir/player-sprite-test" "$test_build_dir/scoring-test" "$test_build_dir/player-state-test" "$test_build_dir/turn-state-test" "$test_build_dir/mechanism-render-test" "$test_build_dir/collision-events-test" "$test_build_dir/panel-animation-test" "$test_build_dir/game-setup-test" "$test_build_dir/flippers-test" "$test_build_dir/flipper-bitmap-geometry-test" "$test_build_dir/flipper-collision-test" "$test_build_dir/physics-test" "$test_build_dir/timer-tick-test" "$test_build_dir/key-input-test" "$test_build_dir/key-release-test" "$test_build_dir/arithmetic-test" "$test_build_dir/command-line-test" "$test_build_dir/heap-reserve-test" "$test_build_dir/numeric-test" "$test_build_dir/multimedia-test" "$test_build_dir/multimedia-startup-test" "$test_build_dir/multimedia-paths-test" "$test_build_dir/program-entry-test" "$test_build_dir/collision-records-test" "$test_build_dir/heap-core-test" "$test_build_dir/heap-paths-test" "$test_build_dir/global-memory-test" "$test_build_dir/borland-objects-test" "$test_build_dir/stack-test" "$test_build_dir/system-timer-test" "$test_build_dir/dispatch-test" "$test_build_dir/bound-thunks-test" "$test_build_dir/application-test" "$test_build_dir/message-dispatch-test" "$test_build_dir/application-loop-test" "$test_build_dir/application-windows-test" "$test_build_dir/window-messages-test" "$test_build_dir/window-command-test" "$test_build_dir/object-list-test" "$test_build_dir/window-destroy-test" "$test_build_dir/class-registration-test" "$test_build_dir/object-lifecycle-test" "$test_build_dir/child-validation-test" "$test_build_dir/message-pump-test" "$test_build_dir/dialog-test" "$test_build_dir/runtime-input-test" "$test_build_dir/runtime-lifecycle-test" "$test_build_dir/runtime-minmax-test" "$test_build_dir/borland-records-test" "$test_build_dir/borland-files-test" "$test_build_dir/borland-startup-test" "$test_build_dir/tpwincrt-text-test" "$test_build_dir/tpwincrt-lifecycle-test" "$test_build_dir/tables-test" "$test_build_dir/sound-test" "$test_build_dir/real48-test" "$test_build_dir/palette-test" "$test_build_dir/palette-gdi-test" "$test_build_dir/bitmap-loader-test" "$test_build_dir/game-assets-test" "$test_build_dir/overlay-setup-test" "$test_build_dir/board-overlay-test" "$test_build_dir/asset-initializer-test" "$test_build_dir/asset-cleanup-test" "$test_build_dir/render-test" "$test_build_dir/score-render-test" "$test_build_dir/status-render-test" "$test_build_dir/claw-render-test" "$test_build_dir/palette-messages-test" "$test_build_dir/palette-window-messages-test" "$test_build_dir/window-lifecycle-test" "$test_build_dir/window-placement-test" "$test_build_dir/game-application-test"; rmdir -- "$test_build_dir"' EXIT python3 "$workspace_dir/tools/generate_game_setup_collision_data.py" --check python3 "$workspace_dir/tools/promote_verified_imports.py" --check python3 "$workspace_dir/tools/promote_verified_data.py" --check python3 "$workspace_dir/tools/promote_verified_resources.py" --check python3 "$workspace_dir/tools/verify_extracted_assets.py" while IFS= read -r source_unit; do source_name=$(basename -- "$source_unit") rg -Fq -- "$source_name" "$workspace_dir/tools/test_reconstructed_c.sh" done < <(find "$workspace_dir/reconstructed" -maxdepth 1 -name '*.c' -print) clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_initialization.c" \ "$workspace_dir/reconstructed/tests/test_initialization.c" \ -o "$test_build_dir/resource-test" "$test_build_dir/resource-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_resources.c" \ "$workspace_dir/reconstructed/tests/test_resources.c" \ -o "$test_build_dir/resource-test" "$test_build_dir/resource-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_runtime_ui.c" \ "$workspace_dir/reconstructed/tdkpin_data.c" \ "$workspace_dir/reconstructed/tests/test_runtime_ui.c" \ -Wl,--gc-sections \ -o "$test_build_dir/runtime-ui-test" "$test_build_dir/runtime-ui-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_strings.c" \ "$workspace_dir/reconstructed/tests/test_strings.c" \ -Wl,--gc-sections \ -o "$test_build_dir/string-test" "$test_build_dir/string-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_shortstrings.c" \ "$workspace_dir/reconstructed/tests/test_shortstrings.c" \ -Wl,--gc-sections \ -o "$test_build_dir/shortstring-test" "$test_build_dir/shortstring-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_random.c" \ "$workspace_dir/reconstructed/tests/test_random.c" \ -Wl,--gc-sections \ -o "$test_build_dir/random-test" "$test_build_dir/random-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_object_windows.c" \ "$workspace_dir/reconstructed/tests/test_object_windows.c" \ -Wl,--gc-sections \ -o "$test_build_dir/object-windows-test" "$test_build_dir/object-windows-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_window_messages.c" \ "$workspace_dir/reconstructed/tdkpin_dialog.c" \ "$workspace_dir/reconstructed/tests/test_object_windows_handlers.c" \ -Wl,--gc-sections \ -o "$test_build_dir/object-windows-handlers-test" "$test_build_dir/object-windows-handlers-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_window_messages.c" \ "$workspace_dir/reconstructed/tests/test_window_advanced_handlers.c" \ -Wl,--gc-sections \ -o "$test_build_dir/window-advanced-test" "$test_build_dir/window-advanced-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_window_placement.c" \ "$workspace_dir/reconstructed/tests/test_window_creation.c" \ -Wl,--gc-sections \ -o "$test_build_dir/window-creation-test" "$test_build_dir/window-creation-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_game_windows.c" \ "$workspace_dir/reconstructed/tests/test_game_windows.c" \ -Wl,--gc-sections \ -o "$test_build_dir/game-windows-test" "$test_build_dir/game-windows-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_arithmetic.c" \ "$workspace_dir/reconstructed/tdkpin_borland_runtime.c" \ "$workspace_dir/reconstructed/tdkpin_shortstrings.c" \ "$workspace_dir/reconstructed/tdkpin_strings.c" \ "$workspace_dir/reconstructed/tdkpin_numeric.c" \ "$workspace_dir/reconstructed/tdkpin_highscores.c" \ "$workspace_dir/reconstructed/tests/test_highscores.c" \ -Wl,--gc-sections \ -o "$test_build_dir/highscores-test" "$test_build_dir/highscores-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_arithmetic.c" \ "$workspace_dir/reconstructed/tdkpin_gameplay_helpers.c" \ "$workspace_dir/reconstructed/tests/test_gameplay_helpers.c" \ -Wl,--gc-sections \ -o "$test_build_dir/gameplay-helpers-test" "$test_build_dir/gameplay-helpers-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_arithmetic.c" \ "$workspace_dir/reconstructed/tdkpin_gameplay_helpers.c" \ "$workspace_dir/reconstructed/tests/test_ball_render.c" \ -Wl,--gc-sections \ -o "$test_build_dir/ball-render-test" "$test_build_dir/ball-render-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_arithmetic.c" \ "$workspace_dir/reconstructed/tdkpin_gameplay_helpers.c" \ "$workspace_dir/reconstructed/tests/test_ball_restore.c" \ -Wl,--gc-sections \ -o "$test_build_dir/ball-restore-test" "$test_build_dir/ball-restore-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_arithmetic.c" \ "$workspace_dir/reconstructed/tdkpin_gameplay_helpers.c" \ "$workspace_dir/reconstructed/tests/test_ball_sweep.c" \ -Wl,--gc-sections \ -o "$test_build_dir/ball-sweep-test" "$test_build_dir/ball-sweep-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_gameplay_helpers.c" \ "$workspace_dir/reconstructed/tests/test_player_sprite.c" \ -Wl,--gc-sections \ -o "$test_build_dir/player-sprite-test" "$test_build_dir/player-sprite-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_arithmetic.c" \ "$workspace_dir/reconstructed/tdkpin_gameplay_helpers.c" \ "$workspace_dir/reconstructed/tests/test_scoring.c" \ -Wl,--gc-sections \ -o "$test_build_dir/scoring-test" "$test_build_dir/scoring-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_player_state.c" \ "$workspace_dir/reconstructed/tests/test_player_state.c" \ -Wl,--gc-sections \ -o "$test_build_dir/player-state-test" "$test_build_dir/player-state-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_turn_state.c" \ "$workspace_dir/reconstructed/tests/test_turn_state.c" \ -Wl,--gc-sections \ -o "$test_build_dir/turn-state-test" "$test_build_dir/turn-state-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_mechanism_render.c" \ "$workspace_dir/reconstructed/tests/test_mechanism_render.c" \ -Wl,--gc-sections \ -o "$test_build_dir/mechanism-render-test" "$test_build_dir/mechanism-render-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_collision_events.c" \ "$workspace_dir/reconstructed/tests/test_collision_events.c" \ -Wl,--gc-sections \ -o "$test_build_dir/collision-events-test" "$test_build_dir/collision-events-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_panel_animation.c" \ "$workspace_dir/reconstructed/tests/test_panel_animation.c" \ -Wl,--gc-sections \ -o "$test_build_dir/panel-animation-test" "$test_build_dir/panel-animation-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_game_setup.c" \ "$workspace_dir/reconstructed/tests/test_game_setup.c" \ -Wl,--gc-sections \ -o "$test_build_dir/game-setup-test" "$test_build_dir/game-setup-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_flippers.c" \ "$workspace_dir/reconstructed/tests/test_flippers.c" \ -Wl,--gc-sections \ -o "$test_build_dir/flippers-test" "$test_build_dir/flippers-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_flipper_bitmap_geometry.c" \ "$workspace_dir/reconstructed/tests/test_flipper_bitmap_geometry.c" \ -Wl,--gc-sections \ -o "$test_build_dir/flipper-bitmap-geometry-test" "$test_build_dir/flipper-bitmap-geometry-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_arithmetic.c" \ "$workspace_dir/reconstructed/tdkpin_real48.c" \ "$workspace_dir/reconstructed/tdkpin_flipper_collision.c" \ "$workspace_dir/reconstructed/tests/test_flipper_collision.c" \ -Wl,--gc-sections \ -o "$test_build_dir/flipper-collision-test" "$test_build_dir/flipper-collision-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_arithmetic.c" \ "$workspace_dir/reconstructed/tdkpin_real48.c" \ "$workspace_dir/reconstructed/tdkpin_physics.c" \ "$workspace_dir/reconstructed/tests/test_physics.c" \ -Wl,--gc-sections \ -o "$test_build_dir/physics-test" "$test_build_dir/physics-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_arithmetic.c" \ "$workspace_dir/reconstructed/tdkpin_real48.c" \ "$workspace_dir/reconstructed/tdkpin_timer_tick.c" \ "$workspace_dir/reconstructed/tests/test_timer_tick.c" \ -Wl,--gc-sections \ -o "$test_build_dir/timer-tick-test" "$test_build_dir/timer-tick-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_key_input.c" \ "$workspace_dir/reconstructed/tests/test_key_input.c" \ -Wl,--gc-sections \ -o "$test_build_dir/key-input-test" "$test_build_dir/key-input-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_key_input.c" \ "$workspace_dir/reconstructed/tests/test_key_release.c" \ -Wl,--gc-sections \ -o "$test_build_dir/key-release-test" "$test_build_dir/key-release-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_arithmetic.c" \ "$workspace_dir/reconstructed/tests/test_arithmetic.c" \ -o "$test_build_dir/arithmetic-test" "$test_build_dir/arithmetic-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_arithmetic.c" \ "$workspace_dir/reconstructed/tdkpin_real48.c" \ "$workspace_dir/reconstructed/tdkpin_collision_records.c" \ "$workspace_dir/reconstructed/tests/test_collision_records.c" \ -Wl,--gc-sections \ -o "$test_build_dir/collision-records-test" "$test_build_dir/collision-records-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_command_line.c" \ "$workspace_dir/reconstructed/tests/test_command_line.c" \ -o "$test_build_dir/command-line-test" "$test_build_dir/command-line-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_borland_runtime.c" \ "$workspace_dir/reconstructed/tests/test_heap_reserve.c" \ -Wl,--gc-sections \ -o "$test_build_dir/heap-reserve-test" "$test_build_dir/heap-reserve-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_numeric.c" \ "$workspace_dir/reconstructed/tests/test_numeric.c" \ -o "$test_build_dir/numeric-test" "$test_build_dir/numeric-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_multimedia.c" \ "$workspace_dir/reconstructed/tests/test_multimedia.c" \ -Wl,--gc-sections \ -o "$test_build_dir/multimedia-test" "$test_build_dir/multimedia-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_strings.c" \ "$workspace_dir/reconstructed/tdkpin_shortstrings.c" \ "$workspace_dir/reconstructed/tdkpin_multimedia_startup.c" \ "$workspace_dir/reconstructed/tests/test_multimedia_startup.c" \ -Wl,--gc-sections \ -o "$test_build_dir/multimedia-startup-test" "$test_build_dir/multimedia-startup-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_strings.c" \ "$workspace_dir/reconstructed/tdkpin_multimedia_paths.c" \ "$workspace_dir/reconstructed/tests/test_multimedia_paths.c" \ -Wl,--gc-sections \ -o "$test_build_dir/multimedia-paths-test" "$test_build_dir/multimedia-paths-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_program_entry.c" \ "$workspace_dir/reconstructed/tests/test_program_entry.c" \ -Wl,--gc-sections \ -o "$test_build_dir/program-entry-test" "$test_build_dir/program-entry-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_heap.c" \ "$workspace_dir/reconstructed/tests/test_heap_core.c" \ -Wl,--gc-sections \ -o "$test_build_dir/heap-core-test" "$test_build_dir/heap-core-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_heap.c" \ "$workspace_dir/reconstructed/tests/test_heap_paths.c" \ -Wl,--gc-sections \ -o "$test_build_dir/heap-paths-test" "$test_build_dir/heap-paths-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_global_memory.c" \ "$workspace_dir/reconstructed/tests/test_global_memory.c" \ -o "$test_build_dir/global-memory-test" "$test_build_dir/global-memory-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_borland_objects.c" \ "$workspace_dir/reconstructed/tests/test_borland_objects.c" \ -Wl,--gc-sections \ -o "$test_build_dir/borland-objects-test" "$test_build_dir/borland-objects-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_stack.c" \ "$workspace_dir/reconstructed/tests/test_stack.c" \ -Wl,--gc-sections \ -o "$test_build_dir/stack-test" "$test_build_dir/stack-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_stack.c" \ "$workspace_dir/reconstructed/tdkpin_borland_objects.c" \ "$workspace_dir/reconstructed/tdkpin_system_timer.c" \ "$workspace_dir/reconstructed/tests/test_system_timer.c" \ -Wl,--gc-sections \ -o "$test_build_dir/system-timer-test" "$test_build_dir/system-timer-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_dispatch.c" \ "$workspace_dir/reconstructed/tests/test_dispatch.c" \ -Wl,--gc-sections \ -o "$test_build_dir/dispatch-test" "$test_build_dir/dispatch-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_borland_runtime.c" \ "$workspace_dir/reconstructed/tdkpin_object_windows.c" \ "$workspace_dir/reconstructed/tests/test_bound_thunks.c" \ -Wl,--gc-sections \ -o "$test_build_dir/bound-thunks-test" "$test_build_dir/bound-thunks-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_borland_objects.c" \ "$workspace_dir/reconstructed/tdkpin_application.c" \ "$workspace_dir/reconstructed/tests/test_application.c" \ -Wl,--gc-sections \ -o "$test_build_dir/application-test" "$test_build_dir/application-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_object_windows.c" \ "$workspace_dir/reconstructed/tests/test_message_dispatch.c" \ -Wl,--gc-sections \ -o "$test_build_dir/message-dispatch-test" "$test_build_dir/message-dispatch-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_application.c" \ "$workspace_dir/reconstructed/tests/test_application_loop.c" \ -Wl,--gc-sections \ -o "$test_build_dir/application-loop-test" "$test_build_dir/application-loop-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_application.c" \ "$workspace_dir/reconstructed/tests/test_application_windows.c" \ -Wl,--gc-sections \ -o "$test_build_dir/application-windows-test" "$test_build_dir/application-windows-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_object_windows.c" \ "$workspace_dir/reconstructed/tdkpin_application.c" \ "$workspace_dir/reconstructed/tdkpin_window_messages.c" \ "$workspace_dir/reconstructed/tests/test_window_messages.c" \ -Wl,--gc-sections \ -o "$test_build_dir/window-messages-test" "$test_build_dir/window-messages-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_object_windows.c" \ "$workspace_dir/reconstructed/tdkpin_window_messages.c" \ "$workspace_dir/reconstructed/tests/test_window_command.c" \ -Wl,--gc-sections \ -o "$test_build_dir/window-command-test" "$test_build_dir/window-command-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_object_list.c" \ "$workspace_dir/reconstructed/tests/test_object_list.c" \ -o "$test_build_dir/object-list-test" "$test_build_dir/object-list-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_object_list.c" \ "$workspace_dir/reconstructed/tdkpin_window_messages.c" \ "$workspace_dir/reconstructed/tests/test_window_destroy.c" \ -Wl,--gc-sections \ -o "$test_build_dir/window-destroy-test" "$test_build_dir/window-destroy-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_window_messages.c" \ "$workspace_dir/reconstructed/tests/test_class_registration.c" \ -Wl,--gc-sections \ -o "$test_build_dir/class-registration-test" "$test_build_dir/class-registration-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_object_lifecycle.c" \ "$workspace_dir/reconstructed/tests/test_object_lifecycle.c" \ -Wl,--gc-sections \ -o "$test_build_dir/object-lifecycle-test" "$test_build_dir/object-lifecycle-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_object_list.c" \ "$workspace_dir/reconstructed/tests/test_child_validation.c" \ -o "$test_build_dir/child-validation-test" "$test_build_dir/child-validation-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_message_pump.c" \ "$workspace_dir/reconstructed/tests/test_message_pump.c" \ -Wl,--gc-sections \ -o "$test_build_dir/message-pump-test" "$test_build_dir/message-pump-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_dialog.c" \ "$workspace_dir/reconstructed/tests/test_dialog.c" \ -Wl,--gc-sections \ -o "$test_build_dir/dialog-test" "$test_build_dir/dialog-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_runtime_ui.c" \ "$workspace_dir/reconstructed/tdkpin_data.c" \ "$workspace_dir/reconstructed/tests/test_runtime_input.c" \ -Wl,--gc-sections \ -o "$test_build_dir/runtime-input-test" "$test_build_dir/runtime-input-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_runtime_ui.c" \ "$workspace_dir/reconstructed/tests/test_runtime_lifecycle.c" \ -Wl,--gc-sections \ -o "$test_build_dir/runtime-lifecycle-test" "$test_build_dir/runtime-lifecycle-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_runtime_ui.c" \ "$workspace_dir/reconstructed/tests/test_runtime_minmax.c" \ -Wl,--gc-sections \ -o "$test_build_dir/runtime-minmax-test" "$test_build_dir/runtime-minmax-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_borland_records.c" \ "$workspace_dir/reconstructed/tests/test_borland_records.c" \ -o "$test_build_dir/borland-records-test" "$test_build_dir/borland-records-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_borland_files.c" \ "$workspace_dir/reconstructed/tests/test_borland_files.c" \ -o "$test_build_dir/borland-files-test" "$test_build_dir/borland-files-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_borland_startup.c" \ "$workspace_dir/reconstructed/tests/test_borland_startup.c" \ -o "$test_build_dir/borland-startup-test" "$test_build_dir/borland-startup-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_tpwincrt_text.c" \ "$workspace_dir/reconstructed/tests/test_tpwincrt_text.c" \ -Wl,--gc-sections \ -o "$test_build_dir/tpwincrt-text-test" "$test_build_dir/tpwincrt-text-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_tpwincrt_lifecycle.c" \ "$workspace_dir/reconstructed/tests/test_tpwincrt_lifecycle.c" \ -Wl,--gc-sections \ -o "$test_build_dir/tpwincrt-lifecycle-test" "$test_build_dir/tpwincrt-lifecycle-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_tables.c" \ "$workspace_dir/reconstructed/tests/test_tables.c" \ -o "$test_build_dir/tables-test" "$test_build_dir/tables-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_data.c" \ "$workspace_dir/reconstructed/tdkpin_command_line.c" \ "$workspace_dir/reconstructed/tdkpin_strings.c" \ "$workspace_dir/reconstructed/tdkpin_shortstrings.c" \ "$workspace_dir/reconstructed/tdkpin_sound.c" \ "$workspace_dir/reconstructed/tests/test_sound.c" \ -Wl,--gc-sections \ -o "$test_build_dir/sound-test" "$test_build_dir/sound-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -fsanitize=address,undefined \ "$workspace_dir/reconstructed/tdkpin_real48.c" \ "$workspace_dir/reconstructed/tests/test_real48.c" \ -o "$test_build_dir/real48-test" "$test_build_dir/real48-test" "$workspace_dir/tools/probe_real48_reference.sh" >/dev/null clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_palette.c" \ "$workspace_dir/reconstructed/tests/test_palette.c" \ -Wl,--gc-sections \ -o "$test_build_dir/palette-test" "$test_build_dir/palette-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_palette.c" \ "$workspace_dir/reconstructed/tests/test_palette_gdi.c" \ -Wl,--gc-sections \ -o "$test_build_dir/palette-gdi-test" "$test_build_dir/palette-gdi-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_palette.c" \ "$workspace_dir/reconstructed/tests/test_bitmap_loader.c" \ -Wl,--gc-sections \ -o "$test_build_dir/bitmap-loader-test" "$test_build_dir/bitmap-loader-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_game_assets.c" \ "$workspace_dir/reconstructed/tests/test_game_assets.c" \ -Wl,--gc-sections \ -o "$test_build_dir/game-assets-test" "$test_build_dir/game-assets-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_game_assets.c" \ "$workspace_dir/reconstructed/tests/test_overlay_setup.c" \ -Wl,--gc-sections \ -o "$test_build_dir/overlay-setup-test" "$test_build_dir/overlay-setup-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_game_assets.c" \ "$workspace_dir/reconstructed/tests/test_board_overlay.c" \ -Wl,--gc-sections \ -o "$test_build_dir/board-overlay-test" "$test_build_dir/board-overlay-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_asset_initializer.c" \ "$workspace_dir/reconstructed/tests/test_asset_initializer.c" \ -o "$test_build_dir/asset-initializer-test" "$test_build_dir/asset-initializer-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_asset_cleanup.c" \ "$workspace_dir/reconstructed/tests/test_asset_cleanup.c" \ -o "$test_build_dir/asset-cleanup-test" "$test_build_dir/asset-cleanup-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_render.c" \ "$workspace_dir/reconstructed/tests/test_render.c" \ -Wl,--gc-sections \ -o "$test_build_dir/render-test" "$test_build_dir/render-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_render.c" \ "$workspace_dir/reconstructed/tests/test_score_render.c" \ -Wl,--gc-sections \ -o "$test_build_dir/score-render-test" "$test_build_dir/score-render-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_status_render.c" \ "$workspace_dir/reconstructed/tests/test_status_render.c" \ -o "$test_build_dir/status-render-test" "$test_build_dir/status-render-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_claw_render.c" \ "$workspace_dir/reconstructed/tests/test_claw_render.c" \ -o "$test_build_dir/claw-render-test" "$test_build_dir/claw-render-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_game_assets.c" \ "$workspace_dir/reconstructed/tests/test_palette_messages.c" \ -Wl,--gc-sections \ -o "$test_build_dir/palette-messages-test" "$test_build_dir/palette-messages-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_game_assets.c" \ "$workspace_dir/reconstructed/tests/test_palette_window_messages.c" \ -Wl,--gc-sections \ -o "$test_build_dir/palette-window-messages-test" "$test_build_dir/palette-window-messages-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_window_lifecycle.c" \ "$workspace_dir/reconstructed/tests/test_window_lifecycle.c" \ -Wl,--gc-sections \ -o "$test_build_dir/window-lifecycle-test" "$test_build_dir/window-lifecycle-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ -ffunction-sections -fdata-sections \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_window_placement.c" \ "$workspace_dir/reconstructed/tests/test_window_placement.c" \ -Wl,--gc-sections \ -o "$test_build_dir/window-placement-test" "$test_build_dir/window-placement-test" clang -std=c11 -Wall -Wextra -Werror -pedantic \ "$workspace_dir/reconstructed/tdkpin_segmented.c" \ "$workspace_dir/reconstructed/tdkpin_game_application.c" \ "$workspace_dir/reconstructed/tests/test_game_application.c" \ -o "$test_build_dir/game-application-test" "$test_build_dir/game-application-test" echo "Reconstructed C tests passed"