This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert "Configure has a path to less and perl5db.pl can use it"
[perl5.git] / op_reg_common.h
CommitLineData
1850c8f9
KW
1/* op_reg_common.h
2 *
3 * Definitions common to by op.h and regexp.h
4 *
5 * Copyright (C) 2010 by Larry Wall and others
6 *
7 * You may distribute under the terms of either the GNU General Public
8 * License or the Artistic License, as specified in the README file.
9 *
10 */
11
12/* These defines are used in both op.h and regexp.h The definitions use the
5b126c84
KW
13 * shift form so that ext/B/defsubs_h.PL will pick them up.
14 *
15 * Data structures used in the two headers have common fields, and in fact one
16 * is copied onto the other. This makes it easy to keep them in sync */
17
18/* This tells where the first of these bits is. Setting it to 0 saved cycles
19 * and memory. I (khw) think the code will work if changed back, but haven't
20 * tested it */
1e215989 21/* Make sure to update lib/re.pm when changing this! */
5b126c84
KW
22#define RXf_PMf_STD_PMMOD_SHIFT 0
23
24/* The bits need to be ordered so that the msix are contiguous starting at bit
25 * RXf_PMf_STD_PMMOD_SHIFT, followed by the p. See STD_PAT_MODS and
26 * INT_PAT_MODS in regexp.h for the reason contiguity is needed */
1e215989 27/* Make sure to update lib/re.pm when changing these! */
5b126c84
KW
28#define RXf_PMf_MULTILINE (1 << (RXf_PMf_STD_PMMOD_SHIFT+0)) /* /m */
29#define RXf_PMf_SINGLELINE (1 << (RXf_PMf_STD_PMMOD_SHIFT+1)) /* /s */
30#define RXf_PMf_FOLD (1 << (RXf_PMf_STD_PMMOD_SHIFT+2)) /* /i */
31#define RXf_PMf_EXTENDED (1 << (RXf_PMf_STD_PMMOD_SHIFT+3)) /* /x */
32#define RXf_PMf_KEEPCOPY (1 << (RXf_PMf_STD_PMMOD_SHIFT+4)) /* /p */
33#define RXf_PMf_LOCALE (1 << (RXf_PMf_STD_PMMOD_SHIFT+5))
9de15fec 34#define RXf_PMf_UNICODE (1 << (RXf_PMf_STD_PMMOD_SHIFT+6))
1850c8f9 35
3214c85f
KW
36/* Next available bit after the above. Name begins with '_' so won't be
37 * exported by B */
9de15fec 38#define _RXf_PMf_SHIFT_NEXT (RXf_PMf_STD_PMMOD_SHIFT+7)
bb1c6009 39
5b126c84
KW
40/* Mask of the above bits. These need to be transferred from op_pmflags to
41 * re->extflags during compilation */
9de15fec 42#define RXf_PMf_COMPILETIME (RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_LOCALE|RXf_PMf_FOLD|RXf_PMf_EXTENDED|RXf_PMf_KEEPCOPY|RXf_PMf_UNICODE)
bb1c6009
KW
43
44/* These copies need to be numerical or defsubs_h.PL won't know about them. */
45#define PMf_MULTILINE 1<<0
46#define PMf_SINGLELINE 1<<1
47#define PMf_FOLD 1<<2
48#define PMf_EXTENDED 1<<3
49#define PMf_KEEPCOPY 1<<4
50#define PMf_LOCALE 1<<5
51
52#if PMf_MULTILINE != RXf_PMf_MULTILINE || PMf_SINGLELINE != RXf_PMf_SINGLELINE || PMf_FOLD != RXf_PMf_FOLD || PMf_EXTENDED != RXf_PMf_EXTENDED || PMf_KEEPCOPY != RXf_PMf_KEEPCOPY || PMf_LOCALE != RXf_PMf_LOCALE
53# error RXf_PMf defines are wrong
54#endif
5b126c84
KW
55
56#define PMf_COMPILETIME RXf_PMf_COMPILETIME
57
58/* Error check that haven't left something out of this. This isn't done
59 * directly in the #define because doing so confuses regcomp.pl.
60 * (2**n - 1) is n 1 bits, so the below gets the contiguous bits between the
61 * beginning and ending shifts */
62#if RXf_PMf_COMPILETIME != (((1 << (_RXf_PMf_SHIFT_NEXT))-1) \
63 & (~((1 << RXf_PMf_STD_PMMOD_SHIFT)-1)))
64# error RXf_PMf_COMPILETIME is invalid
65#endif