summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1999-09-22 15:41:30 -0400
committerGurusamy Sarathy <gsar@cpan.org>1999-09-23 06:44:42 +0000
commit17f4a12df9ef6ee2f0a77e96071b3f12999159f0 (patch)
tree8a8b13d7eda2a4df6ff788a2e607177efcfd5a5c /pp.c
parentde0d19685a431728abc301db6a7957ad399d5e5f (diff)
downloadperl-17f4a12df9ef6ee2f0a77e96071b3f12999159f0.tar.gz
change "#" to a comment starter in pack templates; "/" now
used for specifying counted types Message-ID: <19990922194130.A864@monk.mps.ohio-state.edu> Subject: [PATCH 5.005_61] Enable comments in pack()/unpack() templates p4raw-id: //depot/perl@4222
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/pp.c b/pp.c
index 6746aa5994..773626fd7f 100644
--- a/pp.c
+++ b/pp.c
@@ -3288,6 +3288,11 @@ PP(pp_unpack)
#endif
if (isSPACE(datumtype))
continue;
+ if (datumtype == '#') {
+ while (pat < patend && *pat != '\n')
+ pat++;
+ continue;
+ }
if (*pat == '!') {
char *natstr = "sSiIlL";
@@ -3347,16 +3352,16 @@ PP(pp_unpack)
DIE(aTHX_ "x outside of string");
s += len;
break;
- case '#':
+ case '/':
if (oldsp >= SP)
- DIE(aTHX_ "# must follow a numeric type");
+ DIE(aTHX_ "/ must follow a numeric type");
if (*pat != 'a' && *pat != 'A' && *pat != 'Z')
- DIE(aTHX_ "# must be followed by a, A or Z");
+ DIE(aTHX_ "/ must be followed by a, A or Z");
datumtype = *pat++;
if (*pat == '*')
pat++; /* ignore '*' for compatibility with pack */
if (isDIGIT(*pat))
- DIE(aTHX_ "# cannot take a count" );
+ DIE(aTHX_ "/ cannot take a count" );
len = POPi;
/* drop through */
case 'A':
@@ -4345,6 +4350,11 @@ PP(pp_pack)
#endif
if (isSPACE(datumtype))
continue;
+ if (datumtype == '#') {
+ while (pat < patend && *pat != '\n')
+ pat++;
+ continue;
+ }
if (*pat == '!') {
char *natstr = "sSiIlL";
@@ -4371,10 +4381,10 @@ PP(pp_pack)
}
else
len = 1;
- if (*pat == '#') {
+ if (*pat == '/') {
++pat;
if (*pat != 'a' && *pat != 'A' && *pat != 'Z' || pat[1] != '*')
- DIE(aTHX_ "# must be followed by a*, A* or Z*");
+ DIE(aTHX_ "/ must be followed by a*, A* or Z*");
lengthcode = sv_2mortal(newSViv(sv_len(items > 0
? *MARK : &PL_sv_no)));
}