diff options
author | Karl Williamson <public@khwilliamson.com> | 2011-11-28 09:20:12 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-01-13 09:58:36 -0700 |
commit | b2b97e77b954138ae39638e71c2a011953c04525 (patch) | |
tree | 98d6a132a021fd748eb10a7a84d2729003fcc6bc /regcomp.c | |
parent | 69794297b04eebfe2f6020fd71ca6b93abe77286 (diff) | |
download | perl-b2b97e77b954138ae39638e71c2a011953c04525.tar.gz |
regcomp.c: Add _invlist_contents() to compactly dump inversion list
This will be used in future commits for debug traces
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -6861,6 +6861,37 @@ S_invlist_iternext(pTHX_ SV* invlist, UV* start, UV* end) return TRUE; } +#ifndef PERL_IN_XSUB_RE +SV * +Perl__invlist_contents(pTHX_ SV* const invlist) +{ + /* Get the contents of an inversion list into a string SV so that they can + * be printed out. It uses the format traditionally done for debug tracing + */ + + UV start, end; + SV* output = newSVpvs("\n"); + + PERL_ARGS_ASSERT__INVLIST_CONTENTS; + + invlist_iterinit(invlist); + while (invlist_iternext(invlist, &start, &end)) { + if (end == UV_MAX) { + Perl_sv_catpvf(aTHX_ output, "%04"UVXf"\tINFINITY\n", start); + } + else if (end != start) { + Perl_sv_catpvf(aTHX_ output, "%04"UVXf"\t%04"UVXf"\n", + start, end); + } + else { + Perl_sv_catpvf(aTHX_ output, "%04"UVXf"\n", start); + } + } + + return output; +} +#endif + #if 0 void S_invlist_dump(pTHX_ SV* const invlist, const char * const header) |