NeoMutt  2025-12-11-276-g10b23b
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
private.h
Go to the documentation of this file.
1
22
23#ifndef MUTT_PATTERN_PRIVATE_H
24#define MUTT_PATTERN_PRIVATE_H
25
26#include <stdbool.h>
27#include "mutt/lib.h"
28#include "email/lib.h"
29#include "lib.h"
30
31struct MailboxView;
32
44
61
66{
67 char prefix;
68 char tag;
69 int op;
71
73 char *desc;
74};
75
80{
81 const char *raw;
82 int lgrp;
83 int rgrp;
84 bool ready;
85 regex_t cooked;
86};
87
101
103#define RANGE_NUM_RX "([[:digit:]]+|0x[[:xdigit:]]+)[MmKk]?"
105#define RANGE_REL_SLOT_RX "[[:blank:]]*([.^$]|-?" RANGE_NUM_RX ")?[[:blank:]]*"
107#define RANGE_REL_RX "^" RANGE_REL_SLOT_RX "," RANGE_REL_SLOT_RX
108
110#define RANGE_ABS_SLOT_RX "[[:blank:]]*([.^$]|" RANGE_NUM_RX ")?[[:blank:]]*"
112#define RANGE_ABS_RX "^" RANGE_ABS_SLOT_RX "-" RANGE_ABS_SLOT_RX
113
115#define RANGE_LT_RX "^()[[:blank:]]*(<[[:blank:]]*" RANGE_NUM_RX ")[[:blank:]]*"
117#define RANGE_GT_RX "^()[[:blank:]]*(>[[:blank:]]*" RANGE_NUM_RX ")[[:blank:]]*"
118
120#define RANGE_BARE_RX "^[[:blank:]]*([.^$]|" RANGE_NUM_RX ")[[:blank:]]*"
122#define RANGE_RX_GROUPS 5
123
124#define RANGE_DOT '.'
125#define RANGE_CIRCUM '^'
126#define RANGE_DOLLAR '$'
127#define RANGE_LT '<'
128#define RANGE_GT '>'
129
138
144static inline int email_msgno(struct Email *e)
145{
146 return e->msgno + 1;
147}
148
149#define MUTT_MAXRANGE -1
150
151extern struct RangeRegex RangeRegexes[];
152extern const struct PatternFlags Flags[];
153
154const struct PatternFlags *lookup_op(int op);
155const struct PatternFlags *lookup_tag(char prefix, char tag);
156bool eval_date_minmax(struct Pattern *pat, const char *s, struct Buffer *err);
157bool eat_message_range(struct Pattern *pat, PatternCompFlags flags, struct Buffer *s, struct Buffer *err, struct MailboxView *mv);
158
159#endif /* MUTT_PATTERN_PRIVATE_H */
Structs that make up an email.
bool eat_message_range(struct Pattern *pat, PatternCompFlags flags, struct Buffer *s, struct Buffer *err, struct MailboxView *mv)
Parse a range of message numbers - Implements eat_arg_t -.
Definition message.c:281
Convenience wrapper for the library headers.
const struct PatternFlags Flags[]
Lookup table for all patterns.
Definition flags.c:47
Match patterns to emails.
uint8_t PatternCompFlags
Flags for mutt_pattern_comp(), e.g. MUTT_PC_FULL_MSG.
Definition lib.h:68
RangeSide
Which side of the range.
Definition private.h:134
@ RANGE_S_LEFT
Left side of range.
Definition private.h:135
@ RANGE_S_RIGHT
Right side of range.
Definition private.h:136
bool eval_date_minmax(struct Pattern *pat, const char *s, struct Buffer *err)
Evaluate a date-range pattern against 'now'.
Definition compile.c:544
ExpandoDataPattern
Expando UIDs for Patterns.
Definition private.h:39
@ ED_PAT_DESCRIPTION
PatternEntry.desc.
Definition private.h:40
@ ED_PAT_EXPRESSION
PatternEntry.expr.
Definition private.h:41
@ ED_PAT_NUMBER
PatternEntry.num.
Definition private.h:42
PatternEat
Function to process pattern arguments.
Definition private.h:51
@ EAT_STRING
Process a plain string.
Definition private.h:59
@ EAT_NONE
No arguments required.
Definition private.h:52
@ EAT_RANGE
Process a number (range)
Definition private.h:57
@ EAT_GROUP
Process a group name.
Definition private.h:54
@ EAT_MESSAGE_RANGE
Process a message number (range)
Definition private.h:55
@ EAT_DATE
Process a date (range)
Definition private.h:53
@ EAT_QUERY
Process a query string.
Definition private.h:56
@ EAT_REGEX
Process a regex.
Definition private.h:58
const struct PatternFlags * lookup_tag(char prefix, char tag)
Lookup a pattern modifier.
Definition flags.c:235
const struct PatternFlags * lookup_op(int op)
Lookup the Pattern Flags for an op.
Definition flags.c:258
static int email_msgno(struct Email *e)
Helper to get the Email's message number.
Definition private.h:144
RangeType
Type of range.
Definition private.h:92
@ RANGE_K_REL
Relative range.
Definition private.h:93
@ RANGE_K_ABS
Absolute range.
Definition private.h:94
@ RANGE_K_LT
Less-than range.
Definition private.h:95
@ RANGE_K_INVALID
Range is invalid.
Definition private.h:99
@ RANGE_K_BARE
Single symbol.
Definition private.h:97
@ RANGE_K_GT
Greater-than range.
Definition private.h:96
struct RangeRegex RangeRegexes[]
Set of Regexes for various range types.
Definition pattern.c:60
String manipulation buffer.
Definition buffer.h:36
The envelope/body of an email.
Definition email.h:39
int msgno
Number displayed to the user.
Definition email.h:111
View of a Mailbox.
Definition mview.h:40
Mapping between user character and internal constant.
Definition private.h:66
enum PatternEat eat_arg
Type of function needed to parse flag, e.g. EAT_DATE.
Definition private.h:72
char tag
Character used to represent this operation, e.g. 'A' for '~A'.
Definition private.h:68
char * desc
Description of flag.
Definition private.h:73
PatternCompFlags flags
Pattern flags, e.g. MUTT_PC_FULL_MSG.
Definition private.h:70
int op
Operation to perform, e.g. MUTT_PAT_SCORE.
Definition private.h:69
char prefix
Prefix for this pattern, e.g. '~', '', or '='.
Definition private.h:67
A simple (non-regex) pattern.
Definition lib.h:78
Regular expression representing a range.
Definition private.h:80
int lgrp
Paren group matching the left side.
Definition private.h:82
int rgrp
Paren group matching the right side.
Definition private.h:83
regex_t cooked
Compiled form.
Definition private.h:85
bool ready
Compiled yet?
Definition private.h:84
const char * raw
Regex as string.
Definition private.h:81