diff options
author | Graham Barr <gbarr@pobox.com> | 1998-07-12 14:57:47 -0500 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-13 02:44:30 +0000 |
commit | 8782bef2aa2ca158fdd0d7436e68ae3ac2b01ff7 (patch) | |
tree | 5014b290517414faa6839abd622ed81e17116829 /sv.c | |
parent | c70c8a0a59777ed7fb7075471185210bc2169b49 (diff) | |
download | perl-8782bef2aa2ca158fdd0d7436e68ae3ac2b01ff7.tar.gz |
added patch, tweaked PERL_OBJECT things
Message-Id: <19980712195747.C493@pobox.com>
Subject: [ PATCH perl5.004_72] patch to add qr//
p4raw-id: //depot/perl@1461
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 31 |
1 files changed, 27 insertions, 4 deletions
@@ -1710,10 +1710,33 @@ sv_2pv(register SV *sv, STRLEN *lp) regexp *re = (regexp *)mg->mg_obj; if (!mg->mg_ptr) { - mg->mg_len = re->prelen + 4; - New(616, mg->mg_ptr, mg->mg_len + 1, char); - Copy("(?:", mg->mg_ptr, 3, char); - Copy(re->precomp, mg->mg_ptr+3, re->prelen, char); + char *fptr = "msix"; + char reflags[6]; + char ch; + int left = 0; + int right = 4; + U16 reganch = (re->reganch & PMf_COMPILETIME) >> 12; + + while(ch = *fptr++) { + if(reganch & 1) { + reflags[left++] = ch; + } + else { + reflags[right--] = ch; + } + reganch >>= 1; + } + if(left != 4) { + reflags[left] = '-'; + left = 5; + } + + mg->mg_len = re->prelen + 4 + left; + New(616, mg->mg_ptr, mg->mg_len + 1 + left, char); + Copy("(?", mg->mg_ptr, 2, char); + Copy(reflags, mg->mg_ptr+2, left, char); + Copy(":", mg->mg_ptr+left+2, 1, char); + Copy(re->precomp, mg->mg_ptr+3+left, re->prelen, char); mg->mg_ptr[mg->mg_len - 1] = ')'; mg->mg_ptr[mg->mg_len] = 0; } |