mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 20:33:46 +02:00
Refactor regex and implement UTF8 mode for GRegex
- with non-unicode byte to Private Use Area A mapping - move all ifdefs to iregex.h file only
This commit is contained in:
parent
31b9d115b0
commit
79bbca4644
12 changed files with 327 additions and 132 deletions
52
src/core/iregex.h
Normal file
52
src/core/iregex.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#ifndef __REGEX_H
|
||||
#define __REGEX_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef USE_GREGEX
|
||||
|
||||
#include <glib.h>
|
||||
typedef GRegex Regex;
|
||||
typedef GMatchInfo MatchInfo;
|
||||
|
||||
#define i_match_info_matches g_match_info_matches
|
||||
#define i_match_info_free g_match_info_free
|
||||
|
||||
#else
|
||||
|
||||
#include <regex.h>
|
||||
typedef regex_t Regex;
|
||||
typedef regmatch_t MatchInfo;
|
||||
|
||||
gboolean
|
||||
i_match_info_matches (const MatchInfo *match_info);
|
||||
|
||||
void
|
||||
i_match_info_free (MatchInfo *match_info);
|
||||
|
||||
#endif
|
||||
|
||||
Regex *
|
||||
i_regex_new (const gchar *pattern,
|
||||
GRegexCompileFlags compile_options,
|
||||
GRegexMatchFlags match_options,
|
||||
GError **error);
|
||||
|
||||
void
|
||||
i_regex_unref (Regex *regex);
|
||||
|
||||
gboolean
|
||||
i_regex_match (const Regex *regex,
|
||||
const gchar *string,
|
||||
GRegexMatchFlags match_options,
|
||||
MatchInfo **match_info,
|
||||
const gchar **new_string);
|
||||
|
||||
gboolean
|
||||
i_match_info_fetch_pos (const MatchInfo *match_info,
|
||||
gint match_num,
|
||||
gint *start_pos,
|
||||
gint *end_pos,
|
||||
const gchar *new_string);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue