[Python-Dev] sre.c and sre_match() (original) (raw)
Jack Diederich jack@performancedrivers.com
Wed, 16 Apr 2003 09:55:00 -0400
- Previous message: [Python-Dev] sre.c and sre_match()
- Next message: [Python-Dev] sre.c and sre_match()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Apr 15, 2003 at 11:22:42PM -0400, Tim Peters wrote:
[Jack Diederich] > I can't find srematch() anywhere in the source
It's in sre.c, here: LOCAL(int) SREMATCH(SRESTATE* state, SRECODE* pattern, int level) SREMATCH is a macro, and expands to either srematch or sreumatch, depending on whether Unicode support is enabled. Note that sre.c arranges to compile itself twice, via its #define SRERECURSIVE #include "sre.c" #undef SRERECURSIVE This is to get both 8-bit and Unicode versions of the basic routines when Unicode support is enabled.
My god, its full of stars.
Ah, that explains how both sre_umatch() and sre_umatch() get defined and make the if (state.charsize == 1) switches possible.
the SRE_RECURSIVE isn't hard to understand once you know it is there, but might it be tidier to breakout the stuff parsed twice into another file?
The current layout of the _sre.c is
<stuff done once, setup stuff> <stuff done twice, via #include "_sre.c"> <stuff done once, object stuff>
mv to _sre_twice.c
#define SRE_MATCH sre_match #include "_sre_twice.c" /* defines the symbols sre_match, sre_search .. / #define SRE_MATCH sre_umatch #include "_sre_twice.c" / defines the symbols sre_umatch, sre_usearch .. */
You probably don't get random people walking around _sre.c much, but it would have gotten me where I need to go (or at least a better chance).
thanks,
-jack
- Previous message: [Python-Dev] sre.c and sre_match()
- Next message: [Python-Dev] sre.c and sre_match()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]