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_metrics.h
File editor
#ifndef WP_LAYOUT_METRICS_H #define WP_LAYOUT_METRICS_H #include "wp_layout_shared.h" #include <stdbool.h> #include <stdint.h> /* Host-safe ports of the recovered 1000:51e4 / 1000:5156 / 1000:5371 / * 1000:537a / 1000:59ff / 1000:5a2e family. The original routines update * a dense set of 16-bit DOS data cells while measuring line spans. These * functions keep the same 16-bit wrap/clamp behavior but expose it through * WpLayoutGlobals and small result records. */ typedef struct WpLayoutExtentResult { uint16_t line_span; uint16_t scaled_span; uint16_t candidate_extent; uint16_t measure_extent; uint16_t measure_bound; bool heap_window_used; bool clamped_to_emit_extent; bool render_dirty_set; } WpLayoutExtentResult; typedef struct WpLayoutReconcileResult { uint16_t cursor_delta; uint16_t target_floor; uint16_t span_metric; uint16_t old_span_word; uint16_t new_span_word; uint16_t old_cursor_word; uint16_t new_cursor_word; int16_t span_delta; int16_t cursor_delta_applied; bool target_clamped_to_floor; bool span_word_changed; bool cursor_word_changed; bool status_dirty_set; } WpLayoutReconcileResult; typedef struct WpLayoutVariantResult { uint16_t old_anchor; uint16_t new_anchor; uint16_t old_total; uint16_t new_total; uint16_t delta; bool subtract; bool wrapped_or_borrowed; bool parse_dirty_set; } WpLayoutVariantResult; /* Ported from layout_toggle_record_mode_flag_word, layout_add_compact_metric_delta, * layout_span_metric_side_effect, and the first subtraction stage of * parser_main_record_loop_with_reentry_guard. The DOS code returns DX:AX; the * host port exposes the same packed high/low words plus a 32-bit view for tests * and summaries. */ /* Host-safe result for the recovered variant-balance / reset family * around 1000:6ff0, 1000:7039, and 1000:7099. The original code moves a * signed 16-bit variant_total into variant_balance_51bd, clamps against the * screen extent, borrows from heap_delta_c5b6, and sets status dirty bits. */ typedef struct WpLayoutVariantBalanceResult { int16_t old_variant_total; int16_t new_variant_total; int16_t old_variant_balance; int16_t new_variant_balance; int16_t old_heap_delta; int16_t new_heap_delta; uint16_t old_variant_limit; uint16_t new_variant_limit; uint16_t delta; uint16_t screen_extent_minus_one; uint16_t overflow_amount; uint8_t old_status_dirty_flags; uint8_t new_status_dirty_flags; uint8_t old_status_extend; uint8_t new_status_extend; bool reset_total; bool add_path; bool subtract_path; bool balance_clamped_to_screen; bool heap_borrowed; bool negative_balance; bool variant_limit_updated; bool variant_limit_overflowed; bool far_refresh_would_run; bool secondary_probe_would_run; bool render_dirty_set; } WpLayoutVariantBalanceResult; typedef struct WpLayoutStreamPosition { uint16_t low_word; uint16_t high_word; uint32_t linear; bool carry_from_low_add; } WpLayoutStreamPosition; typedef struct WpLayoutStreamDelta { WpLayoutStreamPosition current; uint16_t saved_low_word; uint16_t saved_high_word; uint16_t delta_low_word; uint16_t delta_high_word; uint32_t delta_linear; bool low_borrow; bool underflow; } WpLayoutStreamDelta; typedef struct WpLayoutMeasuredSpanResetResult { uint16_t old_cursor; uint16_t new_cursor; uint16_t old_span_a; uint16_t new_span_a; uint16_t old_span_b; uint16_t new_span_b; uint8_t old_span_flags; uint8_t new_span_flags; uint8_t old_dirty_flags; uint8_t new_dirty_flags; uint8_t old_total_flags; uint8_t new_total_flags; bool cursor_changed; bool span_a_raised; bool span_b_raised; bool dirty_flags_marked; bool total_flags_marked; bool low_active_flag_cleared; } WpLayoutMeasuredSpanResetResult; typedef struct WpLayoutHeapBranchResult { uint16_t old_record_window_word; uint16_t new_record_window_word; uint16_t old_line_start; uint16_t new_line_start; uint16_t old_line_extent; uint16_t new_line_extent; bool window_changed; bool measure_ran; WpLayoutExtentResult measure_result; } WpLayoutHeapBranchResult; typedef struct WpLayoutFlushSpanResult { uint16_t saved_span_a; uint16_t saved_span_b; uint16_t scaled_width; int return_value; bool spans_temporarily_cleared; bool variant_gate_would_trap; } WpLayoutFlushSpanResult; uint16_t wp_layout_line_start_for_heap_depth(const WpLayoutGlobals *wl); uint16_t wp_layout_line_start_align(const WpLayoutGlobals *wl); uint16_t wp_layout_scale_extent_by_fraction(const WpLayoutGlobals *wl, uint8_t fraction_q8, bool enforce_minimum_span, uint16_t span_basis); bool wp_layout_measure_line_extent_dirty_heap(WpLayoutGlobals *wl, uint8_t fraction_q8, bool enforce_minimum_span, uint16_t span_basis, WpLayoutExtentResult *out_result); bool wp_layout_reconcile_line_build_span_words(WpLayoutGlobals *wl, uint16_t span_metric, WpLayoutReconcileResult *out_result); bool wp_layout_increment_cursor_pack_state(WpLayoutGlobals *wl, uint16_t span_metric, WpLayoutReconcileResult *out_result); bool wp_layout_add_to_variant_anchor_and_total(WpLayoutGlobals *wl, uint16_t delta, WpLayoutVariantResult *out_result); bool wp_layout_sub_from_variant_anchor_and_total(WpLayoutGlobals *wl, uint16_t delta, WpLayoutVariantResult *out_result); bool wp_layout_add_metrics_line_accum_to_variant_anchor_and_total(WpLayoutGlobals *wl, WpLayoutVariantResult *out_result); bool wp_layout_sub_metrics_line_accum_from_variant_anchor_and_total(WpLayoutGlobals *wl, WpLayoutVariantResult *out_result); bool wp_layout_record_stream_position(const WpLayoutGlobals *wl, WpLayoutStreamPosition *out_position); bool wp_layout_secondary_stream_position(const WpLayoutGlobals *wl, WpLayoutStreamPosition *out_position); bool wp_layout_span_metric_side_effect_position(const WpLayoutGlobals *wl, WpLayoutStreamPosition *out_position); bool wp_layout_delta_from_saved_record_offset(const WpLayoutGlobals *wl, WpLayoutStreamDelta *out_delta); int wp_layout_compare_stream_position(uint16_t high_word, uint16_t low_word, const WpLayoutStreamPosition *position); bool wp_layout_reset_cursor_aliases_variant_table(WpLayoutGlobals *wl, WpLayoutMeasuredSpanResetResult *out_result); bool wp_layout_apply_heap_control_branch(WpLayoutGlobals *wl, WpLayoutHeapBranchResult *out_result); bool wp_layout_flush_measured_span_then_scale_width_q8(WpLayoutGlobals *wl, uint8_t fraction_q8, bool enforce_minimum_span, uint16_t span_basis, WpLayoutFlushSpanResult *out_result); bool wp_layout_update_variant_balance_and_flags(WpLayoutGlobals *wl, uint16_t delta, WpLayoutVariantBalanceResult *out_result); bool wp_layout_subtract_from_heap_delta_and_variant_balance(WpLayoutGlobals *wl, uint16_t delta, WpLayoutVariantBalanceResult *out_result); bool wp_layout_reset_variant_total_and_update_dirty_flags(WpLayoutGlobals *wl, WpLayoutVariantBalanceResult *out_result); void __cdecl16near layout_record_wide_temp_lo_hi_route_stage_1(WpLayoutGlobals *wl); uint32_t __cdecl16near layout_add_compact_metric_delta(WpLayoutGlobals *wl, uint16_t delta_high, uint16_t delta_low); uint32_t __cdecl16near layout_cursor_extent_clamp(WpLayoutGlobals *wl); void __cdecl16near layout_measure_line_extent_dirty_heap(WpLayoutGlobals *wl); void __cdecl16near layout_record_wide_temp_lo_hi_route_stage_3(WpLayoutGlobals *wl, bool *bVar2); void __cdecl16near layout_metric_word_adjust(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