Word Unperfect
public
Read
Owner: themaster
Branch: main
Commits: 0
Git CLI clone URL
git clone https://www.xt-emporium.com/git/word-unperfect.git
Fullscreen desktop URL
Code
Commits
History
Branches
Bug Reports
Discussions
Compare
Settings
word-unperfect
/
rev
/
wp_layout_status.h
File editor
#ifndef WP_LAYOUT_STATUS_H #define WP_LAYOUT_STATUS_H #include "wp_layout_shared.h" #include <stdbool.h> #include <stdint.h> #include <stddef.h> /* Host-safe ports of the recovered status/timer/display/cursor helpers around * 1000:127a, 1000:1303, 1000:132c, 1000:13b6, 1000:254e, 1000:26c5, * 1000:26e3, and 1000:29b2. The original routines update DOS data-segment * globals directly and may call overlay/display refresh helpers. These ports * keep the observable 16-bit flag/counter math and expose overlay/display calls * as booleans instead of jumping into unavailable hardware code. */ typedef struct WpLayoutEmitGateResult { int16_t old_variant_total; int16_t new_variant_total; int16_t old_variant_balance; int16_t new_variant_balance; uint8_t old_parse_dirty_flags; uint8_t new_parse_dirty_flags; uint8_t old_status_extend; uint8_t new_status_extend; bool gate_alloc_would_run; bool variant_batch_would_run; bool gate_free_would_run; bool moved_variant_total; } WpLayoutEmitGateResult; typedef struct WpLayoutStatusDirtyResult { WpLayoutEmitGateResult gate; uint8_t old_status_dirty_flags; uint8_t new_status_dirty_flags; bool checked_balance_against_screen; bool balance_less_than_screen_extent; bool dirty_mask_applied; } WpLayoutStatusDirtyResult; typedef struct WpLayoutDisplayOffsetResult { uint8_t old_irq_state; uint8_t irq_timer; uint8_t machine_flags; uint16_t offset; bool machine_metric_enabled; bool double_offset_enabled; } WpLayoutDisplayOffsetResult; typedef struct WpLayoutDisplayUpdateResult { uint16_t input_metric; uint16_t machine_offset; int old_display_metric_44de; int new_display_metric_44de; int old_display_metric_44e4; int new_display_metric_44e4; int computed_limit; uint8_t old_status_dirty_flags; uint8_t new_status_dirty_flags; uint8_t old_render_dirty_flags; uint8_t new_render_dirty_flags; uint8_t old_irq_state; uint8_t new_irq_state; bool zero_input_path; bool palette_guard_blocked; bool refresh_would_run; } WpLayoutDisplayUpdateResult; typedef struct WpLayoutIrqDirtyPulseResult { uint8_t old_irq_timer; uint8_t new_irq_timer; uint8_t old_status_dirty_flags; uint8_t new_status_dirty_flags; uint8_t old_render_dirty_flags; uint8_t new_render_dirty_flags; uint8_t old_status_scratch; uint8_t new_status_scratch; bool timer_decremented; bool display_update_ran; WpLayoutDisplayUpdateResult display_update; } WpLayoutIrqDirtyPulseResult; typedef struct WpLayoutCarryUpdateResult { uint8_t token; int base_span_total; int span_adjustment; uint16_t span_scale_q8; uint16_t scaled_width; int old_carry_width; int new_carry_width; bool used_default_span_total; bool used_newline_adjustment; bool minimum_width_forced; bool saturated_to_zero; } WpLayoutCarryUpdateResult; typedef struct WpLayoutCursorMetricResult { uint8_t token; uint16_t token_word; int metric; int old_cursor_alias; int new_cursor_alias; int old_record_aux; int new_record_aux; uint16_t old_span_aux_word; uint16_t new_span_aux_word; uint16_t old_cursor_alias_shadow; uint16_t new_cursor_alias_shadow; bool metric_lookup_path; bool high_byte_token; bool carry_flag_set; bool cursor_advanced; bool postprocess_reconcile_requested; bool processed_segments_cleared; bool render_dirty_set; } WpLayoutCursorMetricResult; /* Host-safe ports of the deferred parse/emit paths around 1000:70ea through * 1000:72cd. The original routines allocate a layout gate, run one or more * overlay-backed emit/measure passes, clear parse-dirty bits, and update the * status line buffer. The host port keeps the flag arithmetic and bounded * buffer effects while reporting overlay jumps as booleans/counters. */ typedef struct WpLayoutParseCarryResult { uint8_t old_parse_dirty_flags; uint8_t new_parse_dirty_flags; uint8_t old_parser_runtime_flags; uint8_t new_parser_runtime_flags; int16_t variant_balance; int16_t variant_total; int16_t balance_plus_total; int16_t screen_extent; uint8_t variant_count; uint8_t active_variant_index; size_t post_emit_cleanup_calls; uint16_t return_flags; bool gate_alloc_would_run; bool gate_free_would_run; bool threshold_reached; bool no_variants_iteration_would_run; bool variant_decode_would_run; bool active_variant_within_count; bool parse_bit_02_cleared; } WpLayoutParseCarryResult; typedef struct WpLayoutParseDirtyUpdateResult { WpLayoutParseCarryResult carry; uint8_t old_parse_dirty_flags; uint8_t new_parse_dirty_flags; uint8_t old_parser_runtime_flags; uint8_t new_parser_runtime_flags; uint8_t old_status_dirty_flags; uint8_t new_status_dirty_flags; int16_t old_variant_total; int16_t new_variant_total; int16_t old_variant_balance; int16_t new_variant_balance; bool ran; bool skipped_busy; bool parse_busy_bit_set; bool parse_carry_ran; bool dirty_if_balance_ran; bool dirty_if_balance_less_than_screen; bool variant_total_reset_ran; bool status_dirty_mask_applied; bool parser_runtime_bit_04_restored; } WpLayoutParseDirtyUpdateResult; typedef struct WpLayoutStatusLineRefreshResult { uint16_t input_metric; uint16_t runtime_scale; uint16_t scaled_metric; uint16_t divided_metric; uint16_t metrics_window_base; uint16_t buffer_index; uint16_t old_emit_scratch; uint16_t restored_emit_scratch; uint8_t old_buffer_byte; uint8_t new_buffer_byte; bool scale_overflowed; bool scale_clamped_to_input; bool record_path_walk_would_run; bool heap_cursor_rebase_would_run; bool byte_return_wrote; bool irq_or_timer_touch_would_run; bool inside_metrics_window; } WpLayoutStatusLineRefreshResult; typedef struct WpLayoutEmitMeasureResult { WpLayoutStatusLineRefreshResult last_refresh; uint8_t old_render_dirty_flags; uint8_t new_render_dirty_flags; uint16_t machine_offset; uint16_t initial_candidate; uint16_t adjusted_candidate; uint16_t display_limit; uint16_t display_metric_44de; uint16_t old_display_metric_44e4; uint16_t new_display_metric_44e4; uint16_t spaces_written; size_t status_line_refreshes; size_t variant_refresh_iterations; bool display_limit_reached; bool candidate_adjusted_from_e4; bool inside_window; bool scratch_line_written; bool overlay_emit_would_run; bool overlay_tail_would_run; bool render_dirty_bit_cleared; } WpLayoutEmitMeasureResult; bool wp_layout_emit_gate_reset_variant_total(WpLayoutGlobals *wl, WpLayoutEmitGateResult *out_result); bool wp_layout_mark_status_dirty(WpLayoutGlobals *wl, WpLayoutStatusDirtyResult *out_result); bool wp_layout_mark_status_dirty_if_variant_balance_less_than_screen_extent(WpLayoutGlobals *wl, WpLayoutStatusDirtyResult *out_result); bool wp_layout_display_metric_offset(const WpLayoutGlobals *wl, WpLayoutDisplayOffsetResult *out_result); bool wp_layout_update_display_metrics_and_palette_guard(WpLayoutGlobals *wl, uint16_t input_metric, WpLayoutDisplayUpdateResult *out_result); bool wp_layout_decrement_irq_timer_and_dirty_flags(WpLayoutGlobals *wl, WpLayoutIrqDirtyPulseResult *out_result); bool wp_layout_status_extend_update(WpLayoutGlobals *wl, uint8_t token, WpLayoutCarryUpdateResult *out_result); bool wp_layout_token_uses_span_metric_lookup(uint16_t token_word); int wp_layout_lookup_span_metric_host(const WpLayoutGlobals *wl, uint16_t token_word, WpLayoutCursorMetricResult *out_result); bool wp_layout_render_dirty_or_advance_cursor(WpLayoutGlobals *wl, uint16_t token_word, bool carry_flag_set, WpLayoutCursorMetricResult *out_result); bool wp_layout_clean_processed_segments_and_update_cursor_alias(WpLayoutGlobals *wl, uint16_t span_metric, WpLayoutCursorMetricResult *out_result); bool wp_layout_parse_carry_adjust(WpLayoutGlobals *wl, WpLayoutParseCarryResult *out_result); bool wp_layout_update_parse_dirty_flags(WpLayoutGlobals *wl, WpLayoutParseDirtyUpdateResult *out_result); bool wp_layout_status_line_refresh_hub(WpLayoutGlobals *wl, uint16_t metric, WpLayoutStatusLineRefreshResult *out_result); bool wp_layout_execute_emit_or_measure_pass(WpLayoutGlobals *wl, WpLayoutEmitMeasureResult *out_result); /* Raw wrappers for monolith compatibility */ void __cdecl16near layout_mark_status_dirty(WpLayoutGlobals *wl); void __cdecl16near layout_mark_status_dirty_route_stage_1(WpLayoutGlobals *wl); void __cdecl16near layout_mark_status_dirty_route_stage_2(WpLayoutGlobals *wl); void __cdecl16near layout_mark_status_dirty_if_variant_balance_less_than_screen_extent(WpLayoutGlobals *wl); void __cdecl16near layout_decrement_irq_timer_and_dirty_flags(WpLayoutGlobals *wl); void __cdecl16near layout_update_display_metrics_and_palette_guard(WpLayoutGlobals *wl, uint16_t in_AX); void __cdecl16near layout_get_machine_flags_display_offset(WpLayoutGlobals *wl); void __cdecl16near layout_status_extend_update(WpLayoutGlobals *wl, uint8_t in_AL); uint16_t __cdecl16near layout_render_dirty_or_flags(WpLayoutGlobals *wl, uint16_t in_AX, uint8_t in_CF); uint16_t __cdecl16near layout_cursor_metric_fold(WpLayoutGlobals *wl, uint8_t in_AL); uint16_t __cdecl16near backup_and_clear_irq_shadow_flags(WpLayoutGlobals *wl); void __cdecl16near restore_irq_shadow_flags(WpLayoutGlobals *wl); void __cdecl16near layout_check_parser_gate_and_restore_mode(WpLayoutGlobals *wl); void __cdecl16near layout_handle_restore_mode(WpLayoutGlobals *wl); #endif
Commit message
This repository is read-only for this account.
Repository snapshot
Current branch
main
Visibility
public
Your access
Read
Remote
None
File activity
View file history