sv_catpv(tmpsv, ",HUSH_VMSISH");
}
else if (PL_check[optype] != MEMBER_TO_FPTR(Perl_ck_ftst)) {
- if (OP_IS_FILETEST_ACCESS(o) && o->op_private & OPpFT_ACCESS)
+ if (OP_IS_FILETEST_ACCESS(o->op_type) && o->op_private & OPpFT_ACCESS)
sv_catpv(tmpsv, ",FT_ACCESS");
if (o->op_private & OPpFT_STACKED)
sv_catpv(tmpsv, ",FT_STACKED");
sv_catpv(tmpsv, ",HUSH_VMSISH");
}
else if (PL_check[o->op_type] != MEMBER_TO_FPTR(Perl_ck_ftst)) {
- if (OP_IS_FILETEST_ACCESS(o) && o->op_private & OPpFT_ACCESS)
+ if (OP_IS_FILETEST_ACCESS(o->op_type) && o->op_private & OPpFT_ACCESS)
sv_catpv(tmpsv, ",FT_ACCESS");
if (o->op_private & OPpFT_STACKED)
sv_catpv(tmpsv, ",FT_STACKED");
/* Private for OP_FTXXX */
#define OPpFT_ACCESS 2 /* use filetest 'access' */
#define OPpFT_STACKED 4 /* stacked filetest, as in "-f -x $f" */
-#define OP_IS_FILETEST_ACCESS(op) \
- (((op)->op_type) == OP_FTRREAD || \
- ((op)->op_type) == OP_FTRWRITE || \
- ((op)->op_type) == OP_FTREXEC || \
- ((op)->op_type) == OP_FTEREAD || \
- ((op)->op_type) == OP_FTEWRITE || \
- ((op)->op_type) == OP_FTEEXEC)
/* Private for OP_(MAP|GREP)(WHILE|START) */
#define OPpGREP_LEX 2 /* iterate over lexical $_ */
my %OP_IS_SOCKET;
my %OP_IS_FILETEST;
+my %OP_IS_FT_ACCESS;
my $OCSHIFT = 9;
my $OASHIFT = 13;
# record opnums of these opnames
$OP_IS_SOCKET{$op} = $opnum{$op} if $arg =~ s/s//;
$OP_IS_FILETEST{$op} = $opnum{$op} if $arg =~ s/-//;
+ $OP_IS_FT_ACCESS{$op} = $opnum{$op} if $arg =~ s/\+//;
}
my $argnum = ($arg =~ s/\?//) ? 8 : 0;
die "op = $op, arg = $arg\n"
gen_op_is_macro( \%OP_IS_SOCKET, 'OP_IS_SOCKET');
gen_op_is_macro( \%OP_IS_FILETEST, 'OP_IS_FILETEST');
+gen_op_is_macro( \%OP_IS_FT_ACCESS, 'OP_IS_FILETEST_ACCESS');
sub gen_op_is_macro {
my ($op_is, $macname) = @_;
} keys %$op_is;
my $last = pop @rest; # @rest slurped, get its last
-
+ die "invalid range of ops: $first .. $last" unless $last;
+
+ print ON "#define $macname(op) \\\n\t(";
+
# verify that op-ct matches 1st..last range (and fencepost)
# (we know there are no dups)
if ( $op_is->{$last} - $op_is->{$first} == scalar @rest + 1) {
# contiguous ops -> optimized version
- print ON "#define $macname(op) \\\n\t(";
print ON "(op) >= OP_" . uc($first) . " && (op) <= OP_" . uc($last);
print ON ")\n\n";
}
else {
- print ON "\n#define $macname(op) \\\n\t(";
print ON join(" || \\\n\t ",
- map { "(op) == OP_" . uc() } sort keys %OP_IS_SOCKET);
+ map { "(op) == OP_" . uc() } sort keys %$op_is);
print ON ")\n\n";
}
}
# Values for the operands are:
# scalar - S list - L array - A
# hash - H sub (CV) - C file - F
-# socket - Fs filetest - F- reference - R
+# socket - Fs filetest - F- filetest_access - F-+
+
+# reference - R
# "?" denotes an optional operand.
# Nothing.
lstat lstat ck_ftst u- F
stat stat ck_ftst u- F
-ftrread -R ck_ftst isu- F-
-ftrwrite -W ck_ftst isu- F-
-ftrexec -X ck_ftst isu- F-
-fteread -r ck_ftst isu- F-
-ftewrite -w ck_ftst isu- F-
-fteexec -x ck_ftst isu- F-
+ftrread -R ck_ftst isu- F-+
+ftrwrite -W ck_ftst isu- F-+
+ftrexec -X ck_ftst isu- F-+
+fteread -r ck_ftst isu- F-+
+ftewrite -w ck_ftst isu- F-+
+fteexec -x ck_ftst isu- F-+
ftis -e ck_ftst isu- F-
ftsize -s ck_ftst istu- F-
ftmtime -M ck_ftst stu- F-