libsnobol4 1.0.2
High-performance SNOBOL4-style pattern matching library
Loading...
Searching...
No Matches
snobol_batch_result Struct Reference

Result from snobol_pattern_search_batch(). More...

#include <snobol.h>

Public Attributes

size_t match_count
size_t * positions
size_t * lengths
size_t var_count
size_t ** captures
char * outputs
size_t * output_lens
bool eligible

Detailed Description

Result from snobol_pattern_search_batch().

Contains all non-overlapping matches found in a single pass, stored as flat C arrays. All array memory is allocated with snobol_malloc; the caller must free via snobol_batch_result_free().

When no captures are present, var_count is 0 and captures is NULL. outputs is NULL when no match produced EMIT output. Each output segment is NUL-terminated; the final segment is followed by an empty-string sentinel so callers can iterate outputs without needing output_lens.

eligible distinguishes "no matches but the pattern was batch-eligible" (true, zero matches) from "the pattern was not batch-eligible" (false). Callers must check eligible: a false return with eligible == true means the search completed with zero matches (DONE) — do NOT re-run the search. A false return with eligible == false means the pattern must fall back to the per-call loop. eligible is set true for every batch-eligible pattern regardless of match count, and false (the safe default) for early-outs.

Definition at line 156 of file snobol.h.

Member Data Documentation

◆ captures

size_t** snobol_batch_result::captures

[var_count][match_count * 2]: each row stores [start0, len0, start1, len1, ...].

Definition at line 161 of file snobol.h.

◆ eligible

bool snobol_batch_result::eligible

True when the pattern was batch-eligible (zero matches still sets this).

Definition at line 166 of file snobol.h.

◆ lengths

size_t* snobol_batch_result::lengths

[match_count] match byte lengths.

Definition at line 159 of file snobol.h.

◆ match_count

size_t snobol_batch_result::match_count

Number of matches found (0 when return false).

Definition at line 157 of file snobol.h.

◆ output_lens

size_t* snobol_batch_result::output_lens

[match_count] byte length of each output.

Definition at line 165 of file snobol.h.

◆ outputs

char* snobol_batch_result::outputs

Concatenated NUL-terminated output strings, one per match, final sentinel is empty.

Definition at line 163 of file snobol.h.

◆ positions

size_t* snobol_batch_result::positions

[match_count] match start offsets.

Definition at line 158 of file snobol.h.

◆ var_count

size_t snobol_batch_result::var_count

Number of capture registers (0 = no captures).

Definition at line 160 of file snobol.h.


The documentation for this struct was generated from the following file: