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_flow.h
File editor
#ifndef WP_LAYOUT_FLOW_H #define WP_LAYOUT_FLOW_H #include "wp_file_format.h" #include "wp_layout_shared.h" #include "wp_record_parser.h" #include <stdbool.h> #include <stddef.h> #include <stdint.h> /* Host-safe ports of the recovered layout-flow helpers immediately after the * token-stream branch loop: * - layout_variant_balance_check @ 1000:2130 * - layout_emit_measure_line_iteration @ 1000:216f * - layout_aux_word_increment @ 1000:22a3 * - layout_record_flags_merge @ 1000:22bd * - layout_stream_offset_bump @ 1000:22df * - layout_apply_variant_carry_flow @ 1000:2377 * * The original routines are tightly interleaved with overlay calls and PF/ZF * dependent re-entry. These ports preserve the observable state transitions, * byte/word bucket decisions, dirty flags, and gate/carry arithmetic while * exposing unavailable overlay jumps as counters and booleans. */ typedef struct WpLayoutFlowVariantCheckResult { uint8_t token; uint16_t record_length; uint16_t required_secondary_bytes; int secondary_used_before; int secondary_used_after; bool token_consumed_and_prepended; bool packet_token; bool fixed_packet_token; bool variable_packet_token; bool normalized_fixed_packet; bool d0_plus_secondary_space_check; bool secondary_probe_would_run; } WpLayoutFlowVariantCheckResult; typedef struct WpLayoutFlowEmitMeasureResult { uint8_t token; uint16_t metric; uint16_t old_cursor; uint16_t new_cursor; uint16_t old_measure_bound; uint16_t old_measure_extent; uint16_t old_line_extent; uint8_t old_emit_flags; uint8_t new_emit_flags; uint8_t old_parse_dirty_flags; uint8_t new_parse_dirty_flags; uint8_t old_status_extend; uint8_t new_status_extend; bool incremented_cursor; bool below_measure_bound_return; bool cursor_within_line_extent; bool extent_overflow; bool line_window_prepare_would_run; bool heap_escape_would_run; bool postprocess_reconcile_would_run; bool parse_dirty_fallback; } WpLayoutFlowEmitMeasureResult; typedef struct WpLayoutFlowAuxResult { uint8_t input_al; uint16_t old_cursor; uint16_t new_cursor; uint16_t old_span_aux; uint16_t new_span_aux; int old_record_aux; int new_record_aux; bool double_increment; bool command_parser_fallback; } WpLayoutFlowAuxResult; typedef struct WpLayoutFlowRecordFlagsResult { uint16_t input_word; uint16_t checkpoint_word; uint8_t old_record_mode_flags; uint8_t new_record_mode_flags; uint8_t old_status_dirty_flags; uint8_t new_status_dirty_flags; bool consumed_and_prepended_word; bool checkpoint_matched; bool parser_iteration_would_run; } WpLayoutFlowRecordFlagsResult; typedef struct WpLayoutFlowStreamOffsetResult { uint16_t input_ax; uint16_t checkpoint_word; uint8_t loop_result_code; uint8_t old_postprocess_mode; uint16_t old_variant_anchor; uint16_t new_variant_anchor; int16_t old_variant_total; int16_t new_variant_total; bool postprocess_bits_blocked; bool checkpoint_equal; bool update_gate_blocked_return; bool loop_iteration_would_run; bool loop_code_allowed_update; bool variant_anchor_updated; } WpLayoutFlowStreamOffsetResult; typedef struct WpLayoutFlowCarryResult { uint8_t pass_count; uint8_t dh_subcommand; uint16_t gate_mask; uint16_t aligned_start; uint16_t threshold; uint16_t carry_width; uint8_t parser_runtime_before; uint8_t parser_runtime_after; uint8_t status_dirty_before; uint8_t status_dirty_after; uint8_t state_flags_after; uint8_t stream_resume_token_after; size_t parse_field_passes; bool loop_zero_gate_passed; bool gate_allocated; bool parse_until_gate_would_run; bool use_variant_limit; bool threshold_allows_parse_fields; bool feature_extra_pass; bool mode_status_update_would_run; bool gate_freed; bool stream_resume_set; } WpLayoutFlowCarryResult; typedef struct WpLayoutFlowStats { size_t records_seen; size_t bytes_consumed; size_t variant_balance_checks; size_t variant_packet_tokens; size_t variant_fixed_packets; size_t variant_variable_packets; size_t normalized_fixed_packets; size_t secondary_probe_hints; size_t emit_measure_iterations; size_t emit_measure_below_bound; size_t emit_measure_line_extent_hits; size_t emit_measure_window_prepares; size_t emit_measure_heap_escapes; size_t emit_measure_parse_dirty_fallbacks; size_t aux_double_increments; size_t aux_command_fallbacks; size_t record_flags_merges; size_t record_flags_checkpoint_hits; size_t stream_offset_bumps; size_t stream_offset_anchor_updates; size_t stream_offset_postprocess_blocks; size_t carry_flow_calls; size_t carry_flow_gate_allocs; size_t carry_flow_parse_field_passes; size_t carry_flow_feature_extra_passes; size_t carry_flow_stream_resume_sets; size_t incomplete_records; size_t mismatched_trailers; uint8_t final_emit_flags; uint8_t final_parse_dirty_flags; uint8_t final_status_dirty_flags; uint8_t final_status_extend; uint8_t final_parser_runtime_flags; uint16_t final_variant_anchor; int16_t final_variant_total; int final_cursor; int final_record_aux; uint16_t final_span_aux; } WpLayoutFlowStats; void wp_layout_flow_stats_clear(WpLayoutFlowStats *stats); bool wp_layout_flow_variant_balance_check(WpLayoutGlobals *wl, const WpRecord *rec, WpLayoutFlowVariantCheckResult *out_result); bool wp_layout_flow_emit_measure_iteration(WpLayoutGlobals *wl, const WpRecord *rec, WpLayoutFlowEmitMeasureResult *out_result); bool wp_layout_flow_aux_word_increment(WpLayoutGlobals *wl, uint8_t in_al, WpLayoutFlowAuxResult *out_result); bool wp_layout_flow_record_flags_merge(WpLayoutGlobals *wl, uint16_t input_word, WpLayoutFlowRecordFlagsResult *out_result); bool wp_layout_flow_stream_offset_bump(WpLayoutGlobals *wl, uint16_t input_ax, uint8_t loop_result_code, WpLayoutFlowStreamOffsetResult *out_result); bool wp_layout_flow_apply_variant_carry_flow(WpLayoutGlobals *wl, uint8_t pass_count, uint8_t dh_subcommand, bool loop_zero_gate_passed, WpLayoutFlowCarryResult *out_result); bool wp_layout_flow_apply_record(WpLayoutGlobals *runtime, const WpRecord *rec, WpLayoutFlowStats *stats); bool wp_layout_flow_run_stream(WpLayoutGlobals *wl, WpLayoutFlowStats *stats); bool wp_layout_flow_run_loaded_file(WpLoadedFile *file, WpLayoutFlowStats *stats); bool wp_layout_flow_run_file(const char *filename, WpLayoutFlowStats *stats); /* Raw wrappers for monolith compatibility */ uint8_t __cdecl16near layout_variant_balance_check(WpLayoutGlobals *wl); uint16_t __cdecl16near layout_emit_measure_line_iteration(WpLayoutGlobals *wl); void __cdecl16near layout_aux_word_increment(WpLayoutGlobals *wl, uint8_t in_al); uint16_t __cdecl16near layout_record_flags_merge(WpLayoutGlobals *wl); uint16_t __cdecl16near layout_stream_offset_bump(WpLayoutGlobals *wl, uint16_t in_ax); void __cdecl16near layout_apply_variant_carry_flow(WpLayoutGlobals *wl, uint8_t pass_count, uint8_t dh_subcommand); uint16_t __cdecl16near layout_decrement_cursor_and_span_aux_route_stage_1(WpLayoutGlobals *wl); uint16_t __cdecl16near layout_decrement_cursor_and_span_aux_route_stage_2(WpLayoutGlobals *wl); uint16_t __cdecl16near layout_increment_cursor_and_span_aux_route_stage_1(WpLayoutGlobals *wl); uint16_t __cdecl16near layout_increment_cursor_and_span_aux_route_stage_2(WpLayoutGlobals *wl); void __cdecl16near layout_sub_ax_from_variant_anchor_and_total(WpLayoutGlobals *wl); uint16_t __cdecl16near layout_sub_metrics_line_accum_from_variant_anchor_and_total(WpLayoutGlobals *wl); void __cdecl16near layout_heap_control_branch(WpLayoutGlobals *wl); void __cdecl16near layout_update_variant_anchor_state(WpLayoutGlobals *wl); void __cdecl16near layout_reset_cursor_and_record_aux(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