Xft support under OpenMotif 2.3.3 - I've been using this for quite a while on
[nedit.git] / source / regularExp.h
bloba9bf52829d33b14be60a467980376a77797a6aab
1 /* $Id: regularExp.h,v 1.16 2008/01/04 22:11:04 yooden Exp $ */
2 /*******************************************************************************
3 * *
4 * regularExp.h -- Nirvana Editor Regular Expression Package Header File *
5 * *
6 * Copyright 2002 The NEdit Developers *
7 * *
8 * This is free software; you can redistribute it and/or modify it under the *
9 * terms of the GNU General Public License as published by the Free Software *
10 * Foundation; either version 2 of the License, or (at your option) any later *
11 * version. In addition, you may distribute versions of this program linked to *
12 * Motif or Open Motif. See README for details. *
13 * *
14 * This software is distributed in the hope that it will be useful, but WITHOUT *
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
17 * more details. *
18 * *
19 * You should have received a copy of the GNU General Public License along with *
20 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
21 * Place, Suite 330, Boston, MA 02111-1307 USA *
22 * *
23 * Nirvana Text Editor *
24 * July 31, 2001 *
25 * *
26 *******************************************************************************/
28 #include <X11/Intrinsic.h>
30 #ifndef NEDIT_REGULAREXP_H_INCLUDED
31 #define NEDIT_REGULAREXP_H_INCLUDED
33 /* Number of text capturing parentheses allowed. */
35 #define NSUBEXP 50
37 /* Structure to contain the compiled form of a regular expression plus
38 pointers to matched text. `program' is the actual compiled regex code. */
40 typedef struct regexp {
41 char *startp [NSUBEXP]; /* Captured text starting locations. */
42 char *endp [NSUBEXP]; /* Captured text ending locations. */
43 char *extentpBW; /* Points to the maximum extent of text scanned by
44 ExecRE in front of the string to achieve a match
45 (needed because of positive look-behind.) */
46 char *extentpFW; /* Points to the maximum extent of text scanned by
47 ExecRE to achieve a match (needed because of
48 positive look-ahead.) */
49 int top_branch; /* Zero-based index of the top branch that matches.
50 Used by syntax highlighting only. */
51 char match_start; /* Internal use only. */
52 char anchor; /* Internal use only. */
53 char program [1]; /* Unwarranted chumminess with compiler. */
54 } regexp;
56 /* Flags for CompileRE default settings (Markus Schwarzenberg) */
58 typedef enum {
59 REDFLT_STANDARD = 0,
60 REDFLT_CASE_INSENSITIVE = 1
61 /* REDFLT_MATCH_NEWLINE = 2 Currently not used. */
62 } RE_DEFAULT_FLAG;
64 /* Compiles a regular expression into the internal format used by `ExecRE'. */
66 regexp * CompileRE (
67 const char *exp, /* String containing the regex specification. */
68 char **errorText, /* Text of any error message produced. */
69 int defaultFlags); /* Flags for default RE-operation */
71 /* Match a `regexp' structure against a string. */
73 int ExecRE (
74 regexp *prog, /* Compiled regex. */
75 const char *string, /* Text to search within. */
76 const char *end, /* Pointer to the end of `string'. If NULL will
77 scan from `string' until '\0' is found. */
78 int reverse, /* Backward search. */
79 char prev_char, /* Character immediately prior to `string'. Set
80 to '\n' or '\0' if true beginning of text. */
81 char succ_char, /* Character immediately after `end'. Set
82 to '\n' or '\0' if true beginning of text. */
83 const char *delimiters, /* Word delimiters to use (NULL for default) */
84 const char *look_behind_to,/* Boundary for look-behind; defaults to
85 "string" if NULL */
86 const char *match_till); /* Boundary to where match can extend.
87 \0 is assumed to be the boundary if not
88 set. Lookahead can cross the boundary. */
90 /* Perform substitutions after a `regexp' match. */
91 Boolean SubstituteRE(const regexp* prog, const char* source, char* dest,
92 const int max);
94 /* Builds a default delimiter table that persists across `ExecRE' calls that
95 is identical to `delimiters'. Pass NULL for "default default" set of
96 delimiters. */
98 void SetREDefaultWordDelimiters (
99 char *delimiters);
101 #endif /* NEDIT_REGULAREXP_H_INCLUDED */