'}', 13, # loopexop
);
+my %OP_IS_SOCKET;
+my %OP_IS_FILETEST;
+
for (@ops) {
$argsum = 0;
$flags = $flags{$_};
$argsum |= $opclass{$1} << 9;
$mul = 0x2000; # 2 ^ OASHIFT
for $arg (split(' ',$args{$_})) {
+ if ($arg =~ /^F/) {
+ $OP_IS_SOCKET{$_} = 1 if $arg =~ s/s//;
+ $OP_IS_FILETEST{$_} = 1 if $arg =~ s/-//;
+ }
$argnum = ($arg =~ s/\?//) ? 8 : 0;
+ die "op = $_, arg = $arg\n" unless length($arg) == 1;
$argnum += $argnum{$arg};
warn "# Conflicting bit 32 for '$_'.\n"
if $argnum & 8 and $mul == 0x10000000;
END_EXTERN_C
END
+if (keys %OP_IS_SOCKET) {
+ print ON "\n#define OP_IS_SOCKET(op) \\\n\t(";
+ print ON join(" || \\\n\t ",
+ map { "(op) == OP_" . uc() } sort keys %OP_IS_SOCKET);
+ print ON ")\n\n";
+}
+
+if (keys %OP_IS_FILETEST) {
+ print ON "\n#define OP_IS_FILETEST(op) \\\n\t(";
+ print ON join(" || \\\n\t ",
+ map { "(op) == OP_" . uc() } sort keys %OP_IS_FILETEST);
+ print ON ")\n\n";
+}
+
close OC or die "Error closing opcode.h: $!";
close ON or die "Error closing opnames.h: $!";
sysread sysread ck_fun imst@ F R S S?
syswrite syswrite ck_fun imst@ F S S? S?
-send send ck_fun imst@ F S S S?
-recv recv ck_fun imst@ F R S S
+send send ck_fun imst@ Fs S S S?
+recv recv ck_fun imst@ Fs R S S
eof eof ck_eof is% F?
tell tell ck_fun st% F?
# Sockets.
-socket socket ck_fun is@ F S S S
-sockpair socketpair ck_fun is@ F F S S S
+socket socket ck_fun is@ Fs S S S
+sockpair socketpair ck_fun is@ Fs Fs S S S
-bind bind ck_fun is@ F S
-connect connect ck_fun is@ F S
-listen listen ck_fun is@ F S
-accept accept ck_fun ist@ F F
-shutdown shutdown ck_fun ist@ F S
+bind bind ck_fun is@ Fs S
+connect connect ck_fun is@ Fs S
+listen listen ck_fun is@ Fs S
+accept accept ck_fun ist@ Fs Fs
+shutdown shutdown ck_fun ist@ Fs S
-gsockopt getsockopt ck_fun is@ F S S
-ssockopt setsockopt ck_fun is@ F S S S
+gsockopt getsockopt ck_fun is@ Fs S S
+ssockopt setsockopt ck_fun is@ Fs S S S
-getsockname getsockname ck_fun is% F
-getpeername getpeername ck_fun is% F
+getsockname getsockname ck_fun is% Fs
+getpeername getpeername ck_fun is% Fs
# Stat calls.
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
-ftis -e ck_ftst isu- F
-fteowned -O ck_ftst isu- F
-ftrowned -o ck_ftst isu- F
-ftzero -z ck_ftst isu- F
-ftsize -s ck_ftst istu- F
-ftmtime -M ck_ftst stu- F
-ftatime -A ck_ftst stu- F
-ftctime -C ck_ftst stu- F
-ftsock -S ck_ftst isu- F
-ftchr -c ck_ftst isu- F
-ftblk -b ck_ftst isu- F
-ftfile -f ck_ftst isu- F
-ftdir -d ck_ftst isu- F
-ftpipe -p ck_ftst isu- F
-ftlink -l ck_ftst isu- F
-ftsuid -u ck_ftst isu- F
-ftsgid -g ck_ftst isu- F
-ftsvtx -k ck_ftst isu- F
-fttty -t ck_ftst is- F
-fttext -T ck_ftst isu- F
-ftbinary -B 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-
+fteowned -O ck_ftst isu- F-
+ftrowned -o ck_ftst isu- F-
+ftzero -z ck_ftst isu- F-
+ftsize -s ck_ftst istu- F-
+ftmtime -M ck_ftst stu- F-
+ftatime -A ck_ftst stu- F-
+ftctime -C ck_ftst stu- F-
+ftsock -S ck_ftst isu- F-
+ftchr -c ck_ftst isu- F-
+ftblk -b ck_ftst isu- F-
+ftfile -f ck_ftst isu- F-
+ftdir -d ck_ftst isu- F-
+ftpipe -p ck_ftst isu- F-
+ftlink -l ck_ftst isu- F-
+ftsuid -u ck_ftst isu- F-
+ftsgid -g ck_ftst isu- F-
+ftsvtx -k ck_ftst isu- F-
+fttty -t ck_ftst is- F-
+fttext -T ck_ftst isu- F-
+ftbinary -B ck_ftst isu- F-
# File calls.
#define MAXO 351
+
+#define OP_IS_SOCKET(op) \
+ ((op) == OP_ACCEPT || \
+ (op) == OP_BIND || \
+ (op) == OP_CONNECT || \
+ (op) == OP_GETPEERNAME || \
+ (op) == OP_GETSOCKNAME || \
+ (op) == OP_GSOCKOPT || \
+ (op) == OP_LISTEN || \
+ (op) == OP_RECV || \
+ (op) == OP_SEND || \
+ (op) == OP_SHUTDOWN || \
+ (op) == OP_SOCKET || \
+ (op) == OP_SOCKPAIR || \
+ (op) == OP_SSOCKOPT)
+
+
+#define OP_IS_FILETEST(op) \
+ ((op) == OP_FTATIME || \
+ (op) == OP_FTBINARY || \
+ (op) == OP_FTBLK || \
+ (op) == OP_FTCHR || \
+ (op) == OP_FTCTIME || \
+ (op) == OP_FTDIR || \
+ (op) == OP_FTEEXEC || \
+ (op) == OP_FTEOWNED || \
+ (op) == OP_FTEREAD || \
+ (op) == OP_FTEWRITE || \
+ (op) == OP_FTFILE || \
+ (op) == OP_FTIS || \
+ (op) == OP_FTLINK || \
+ (op) == OP_FTMTIME || \
+ (op) == OP_FTPIPE || \
+ (op) == OP_FTREXEC || \
+ (op) == OP_FTROWNED || \
+ (op) == OP_FTRREAD || \
+ (op) == OP_FTRWRITE || \
+ (op) == OP_FTSGID || \
+ (op) == OP_FTSIZE || \
+ (op) == OP_FTSOCK || \
+ (op) == OP_FTSUID || \
+ (op) == OP_FTSVTX || \
+ (op) == OP_FTTEXT || \
+ (op) == OP_FTTTY || \
+ (op) == OP_FTZERO)
+