ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
grep.h
Go to the documentation of this file.
1
6#pragma once
7
9#include <stdbool.h>
10#include <stddef.h>
11#include <stdint.h>
12
29
45
55asciichat_error_t grep_init(const char *pattern);
56
68bool grep_should_output(const char *log_line, size_t *match_start, size_t *match_len);
69
81const char *grep_highlight(const char *log_line, size_t match_start, size_t match_len);
82
92const char *grep_highlight_colored(const char *colored_text, const char *plain_text, size_t match_start,
93 size_t match_len);
94
107char *grep_highlight_colored_copy(const char *colored_text, const char *plain_text, size_t match_start,
108 size_t match_len);
109
116void grep_destroy(void);
117
128
139
147void grep_clear_patterns(void);
148
154int grep_get_pattern_count(void);
155
165const char *grep_get_last_pattern(void);
⚠️‼️ Comprehensive thread-local error context system for ascii-chat
asciichat_error_t grep_restore_patterns(void)
Restore previously saved filter patterns.
Definition grep.c:1265
asciichat_error_t grep_save_patterns(void)
Save current filter patterns for later restoration.
Definition grep.c:1215
char * grep_highlight_colored_copy(const char *colored_text, const char *plain_text, size_t match_start, size_t match_len)
Highlight matches in colored text, returning a new allocated copy.
Definition grep.c:741
const char * grep_get_last_pattern(void)
Get the last (most recent) filter pattern string.
Definition grep.c:1326
const char * grep_highlight(const char *log_line, size_t match_start, size_t match_len)
Highlight matched portion with background color.
Definition grep.c:1074
void grep_clear_patterns(void)
Clear all filter patterns.
Definition grep.c:1315
int grep_get_pattern_count(void)
Get number of active filter patterns.
Definition grep.c:1322
asciichat_error_t grep_init(const char *pattern)
Initialize log filtering with PCRE2 regex pattern.
Definition grep.c:498
void grep_destroy(void)
Clean up filter resources.
Definition grep.c:1177
bool grep_should_output(const char *log_line, size_t *match_start, size_t *match_len)
Check if log line should be output (matches filter)
Definition grep.c:597
grep_parse_result_t grep_parse_pattern(const char *input)
Parse pattern in /pattern/flags format or plain regex format.
Definition grep.c:351
const char * grep_highlight_colored(const char *colored_text, const char *plain_text, size_t match_start, size_t match_len)
Highlight matches in colored text while preserving original colors.
Definition grep.c:755
unsigned int uint32_t
Definition common.h:58
asciichat_error_t
Error and exit codes - unified status values (0-255)
Definition error_codes.h:49
ClangTool/LibTooling compatibility shim for stdbool.h.
Parsed pattern result from /pattern/flags syntax.
Definition grep.h:18
int context_before
Lines before match (B<n> flag)
Definition grep.h:25
bool global_flag
Highlight all matches (g flag)
Definition grep.h:24
bool is_fixed_string
True if fixed string (not regex)
Definition grep.h:21
bool invert
Invert match (I flag)
Definition grep.h:23
bool case_insensitive
Case-insensitive (i flag)
Definition grep.h:22
bool valid
True if parsing succeeded.
Definition grep.h:27
int context_after
Lines after match (A<n> flag)
Definition grep.h:26
uint32_t pcre2_options
PCRE2 compile options.
Definition grep.h:20