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_parser_process.h
File editor
#ifndef WP_PARSER_PROCESS_H #define WP_PARSER_PROCESS_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 port of the recovered parser_process_token_stream cluster around * 1000:1dfd-22df. The original loop interleaves input buffering, layout * measurement, command replay, and overlay jumps. This module keeps the * observable branch decisions and bounded state side effects while exposing * overlay jumps as counters/route names. */ typedef enum WpParserProcessRoute { WP_PROCESS_ROUTE_NONE = 0, WP_PROCESS_ROUTE_DIRECT_TEXT_APPEND, WP_PROCESS_ROUTE_DIRECT_C0_EXTENDED_APPEND, WP_PROCESS_ROUTE_EMIT_OR_MEASURE_WINDOW, WP_PROCESS_ROUTE_RECORD_FLAGS_MERGE, WP_PROCESS_ROUTE_BOOTSTRAP_SECONDARY_LINE, WP_PROCESS_ROUTE_DEEP_LAYOUT_RECORD, WP_PROCESS_ROUTE_RANGE_AUX_TEXT_OR_CONTROL, WP_PROCESS_ROUTE_RANGE_AUX_FIXED_PACKET, WP_PROCESS_ROUTE_RANGE_AUX_VARIABLE_PACKET, WP_PROCESS_ROUTE_MEASURE_DIRTY_RECONCILE, WP_PROCESS_ROUTE_EMIT_SCRATCH_PACK, WP_PROCESS_ROUTE_SPAN_TABLE_SELECT, WP_PROCESS_ROUTE_COMMAND_VARIANT_FALLBACK, WP_PROCESS_ROUTE_REPLAY_DEPTH_INVOKE } WpParserProcessRoute; typedef enum WpParserProcessFixedDispatch { WP_PROCESS_FIXED_DISPATCH_NONE = 0, WP_PROCESS_FIXED_DISPATCH_TEXT_OR_SINGLE = 0x7994, WP_PROCESS_FIXED_DISPATCH_FIXED = 0x7A3D, WP_PROCESS_FIXED_DISPATCH_VARIABLE = 0x7A5F, WP_PROCESS_FIXED_DISPATCH_COMMAND = 0x2F40 } WpParserProcessFixedDispatch; typedef struct WpParserProcessStep { uint8_t code; uint8_t sub_code; WpCodeType record_type; WpParserProcessRoute route; WpParserProcessFixedDispatch fixed_dispatch; bool prelude_reprocess_gate; bool postprocess_stream_bump; bool token_prepended; bool c0_word_token; bool d4_word_prepend; bool d4_deep_subcommand; bool psp_depth_pulse; bool measured_span_reset_hint; bool postprocess_reconcile_hint; bool update_depth_incremented; bool range_check_aux_called; bool normalized_packet_bytes; bool copied_packet_tail; bool command_variant_called; bool replay_depth_invoked; bool heap_gate_forced_command; bool parse_dirty_set; bool status_extend_set; bool runtime_mismatch_dirty_set; uint16_t packet_copy_bytes; } WpParserProcessStep; typedef struct WpParserProcessStats { size_t records_seen; size_t bytes_consumed; size_t initial_runtime_flag_clears; size_t prelude_reprocess_gates; size_t postprocess_stream_bumps; size_t direct_text_appends; size_t direct_c0_extended_appends; size_t token_prepends; size_t emit_or_measure_windows; size_t record_flags_merges; size_t bootstrap_secondary_lines; size_t deep_layout_records; size_t d4_word_prepends; size_t d4_deep_subcommands; size_t measured_span_reset_hints; size_t postprocess_reconcile_hints; size_t update_depth_increments; size_t range_check_aux_calls; size_t dispatch_text_or_single; size_t dispatch_fixed_packet; size_t dispatch_variable_packet; size_t dispatch_command_parser; size_t normalized_packet_records; size_t copied_packet_tail_bytes; size_t command_variant_calls; size_t measure_dirty_reconcile_calls; size_t emit_scratch_pack_calls; size_t span_table_select_calls; size_t replay_depth_invocations; size_t heap_gate_command_fallbacks; size_t parse_dirty_sets; size_t status_extend_sets; size_t runtime_mismatch_dirty_sets; size_t incomplete_records; size_t mismatched_trailers; uint8_t final_runtime_flags; uint8_t final_parser_runtime_flags; uint8_t final_parse_dirty_flags; uint8_t final_status_extend; int final_update_depth; int final_psp_depth; } WpParserProcessStats; void wp_parser_process_stats_clear(WpParserProcessStats *stats); const char *wp_parser_process_route_name(WpParserProcessRoute route); const char *wp_parser_process_dispatch_name(WpParserProcessFixedDispatch dispatch); bool wp_parser_process_plan_record(WpLayoutGlobals *runtime, const WpRecord *rec, WpParserProcessStep *out_step); bool wp_parser_process_apply_step(WpLayoutGlobals *runtime, const WpParserProcessStep *step, WpParserProcessStats *stats); bool wp_parser_process_apply_record(WpLayoutGlobals *runtime, const WpRecord *rec, WpParserProcessStats *stats); bool wp_parser_process_run_stream(WpLayoutGlobals *wl, WpParserProcessStats *stats); bool wp_parser_process_run_loaded_file(WpLoadedFile *file, WpParserProcessStats *stats); bool wp_parser_process_run_file(const char *filename, WpParserProcessStats *stats); /* Raw ported monolith functions */ uint16_t __cdecl16near parser_process_token_stream(WpLayoutGlobals *wl); uint32_t __cdecl16near parser_inner_token_consume_state_machine(WpLayoutGlobals *wl, uint16_t in_AX, uint16_t in_DX); uint16_t __cdecl16near parser_run_gated_consume_classify_loop(WpLayoutGlobals *wl, uint16_t in_AX, uint16_t in_BX, uint16_t in_CX); void __cdecl16near consume_gated_byte_and_classify(WpLayoutGlobals *wl); void __cdecl16near parser_consume_process_loop_until_pf_clear(WpLayoutGlobals *wl); /* Monolith compatibility wrappers */ void __cdecl16near parser_classify_until_d4_and_no_op(WpLayoutGlobals *wl); uint16_t __cdecl16near parser_bool_expr_eval_order_no_op(WpLayoutGlobals *wl, uint16_t in_AX); void __cdecl16near parser_loop_inner_until_record_checkpoint_matches_ah(WpLayoutGlobals *wl, uint8_t extraout_AH); void __cdecl16near parser_consume_and_prepend_byte_then_return(WpLayoutGlobals *wl, uint8_t in_AL); void __cdecl16near parser_prepend_byte_then_return(WpLayoutGlobals *wl); uint32_t __cdecl16near parser_io_flags_set_4_and_backup_irq(WpLayoutGlobals *wl, uint16_t in_AX, uint16_t in_DX); void __cdecl16near layout_handle_decode_io_flags_bit1(WpLayoutGlobals *wl); void __cdecl16near parser_consume_gated_byte_until_ah_and_loop_pf(WpLayoutGlobals *wl, uint8_t extraout_AH); void __cdecl16near parser_check_al_vs_bl_bh_or_stride(WpLayoutGlobals *wl, uint8_t in_AL, uint8_t in_BL, uint8_t in_BH, uint8_t *out_CF); void __cdecl16near parser_no_op_body_proxy(WpLayoutGlobals *wl); void __cdecl16near parser_unused_void_proxy(WpLayoutGlobals *wl); void __cdecl16near check_layout_state_update_gate(WpLayoutGlobals *wl, uint8_t *in_CF); uint16_t __cdecl16near parser_loop_iteration_eval_order_no_op(WpLayoutGlobals *wl); void __cdecl16near parser_nested_branch_eval_order_no_op(WpLayoutGlobals *wl); uint16_t __cdecl16near parser_parse_and_append_command_token_variant(WpLayoutGlobals *wl); uint16_t __cdecl16near parser_parse_and_append_command_token(WpLayoutGlobals *wl); uint16_t __cdecl16near layout_no_op_span_checkpoint(WpLayoutGlobals *wl, uint16_t in_ax); void __cdecl16near parser_record_replay_depth_increment_and_invoke(WpLayoutGlobals *wl); uint16_t __cdecl16near layout_bootstrap_line_from_secondary_gate(WpLayoutGlobals *wl); uint8_t __cdecl16near layout_scan_memory_stride_3_for_char(WpLayoutGlobals *wl); uint8_t __cdecl16near scan_memory_stride_3_for_char(WpLayoutGlobals *wl); uint8_t __cdecl16near consume_and_prepend_byte_input(WpLayoutGlobals *wl); uint16_t __cdecl16near consume_and_prepend_word_secondary(WpLayoutGlobals *wl); void __cdecl16near layout_table_search_or_scan(WpLayoutGlobals *wl); void __cdecl16near copy_layout_state_words_to_destination(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