summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST19
-rwxr-xr-xMakefile.SH64
-rw-r--r--Porting/exec-bit.txt1
-rw-r--r--pod/perlutil.pod62
-rw-r--r--t/x2p/find2perl.t229
-rw-r--r--t/x2p/s2p.t892
-rw-r--r--utils.lst3
-rw-r--r--vms/descrip_mms.template67
-rw-r--r--win32/Makefile46
-rw-r--r--win32/makefile.mk51
-rw-r--r--x2p/.gitignore7
-rw-r--r--x2p/EXTERN.h21
-rw-r--r--x2p/INTERN.h23
-rwxr-xr-xx2p/Makefile.SH178
-rw-r--r--x2p/a2p.c2941
-rw-r--r--x2p/a2p.h462
-rw-r--r--x2p/a2p.pod175
-rw-r--r--x2p/a2p.y432
-rw-r--r--x2p/a2py.c1300
-rw-r--r--x2p/find2perl.PL919
-rw-r--r--x2p/hash.c149
-rw-r--r--x2p/hash.h47
-rw-r--r--x2p/s2p.PL2072
-rw-r--r--x2p/str.c260
-rw-r--r--x2p/str.h41
-rw-r--r--x2p/util.c196
-rw-r--r--x2p/util.h32
-rw-r--r--x2p/walk.c2055
28 files changed, 19 insertions, 12725 deletions
diff --git a/MANIFEST b/MANIFEST
index 9bd07458a7..f2eab2c7cb 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5374,8 +5374,6 @@ t/win32/runenv.t Test if Win* perl honors its env variables
t/win32/signal.t Test Win32 signal emulation
t/win32/system.t See if system works in Win*
t/win32/system_tests Test runner for system.t
-t/x2p/find2perl.t Test find2perl
-t/x2p/s2p.t See if s2p/psed work
uconfig64.sh Configuration script for microperl for LP64
uconfig.h Configuration header for microperl
uconfig.sh Configuration script for microperl
@@ -5491,21 +5489,4 @@ win32/wince.c WinCE port
win32/wince.h WinCE port
win32/wincesck.c WinCE port
write_buildcustomize.pl Generate lib/buildcustomize.pl
-x2p/a2p.c Output of a2p.y run through byacc
-x2p/a2p.h Global declarations
-x2p/a2p.pod Pod for awk to perl translator
-x2p/a2p.y A yacc grammar for awk
-x2p/a2py.c Awk compiler, sort of
-x2p/EXTERN.h Same as above
-x2p/find2perl.PL A find to perl translator
-x2p/hash.c Hashes again
-x2p/hash.h Public declarations for the above
-x2p/INTERN.h Same as above
-x2p/Makefile.SH Precursor to Makefile
-x2p/s2p.PL Sed to perl translator
-x2p/str.c String handling package
-x2p/str.h Public declarations for the above
-x2p/util.c Utility routines
-x2p/util.h Public declarations for the above
-x2p/walk.c Parse tree walker
XSUB.h Include file for extension subroutines
diff --git a/Makefile.SH b/Makefile.SH
index 727a76304c..72878530b7 100755
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -435,7 +435,7 @@ SH_to_target() {
echo $@ | sed -e s/\\\.SH//g -e s/_/./g
}
-SH='Makefile.SH cflags.SH config_h.SH makedepend.SH myconfig.SH runtests.SH pod/Makefile.SH x2p/Makefile.SH'
+SH='Makefile.SH cflags.SH config_h.SH makedepend.SH myconfig.SH runtests.SH pod/Makefile.SH'
shextract=`SH_to_target $SH`
## In the following dollars and backticks do not need the extra backslash.
@@ -589,30 +589,15 @@ perl$(OBJ_EXT): git_version.h
case "$usedl$static_cwd" in
defineundef)
util_deps='$(MINIPERL_EXE) $(CONFIGPM) lib/auto/Cwd/Cwd$(DLSUFFIX) FORCE'
- x2p_deps="\$(MINIPERL_EXE) \$(CONFIGPM) \$(dynamic_ext) x2p/$firstmakefile FORCE"
;;
definedefine)
util_deps='$(PERL_EXE) $(CONFIGPM) FORCE'
- x2p_deps="\$(PERL_EXE) \$(CONFIGPM) \$(dynamic_ext) x2p/$firstmakefile FORCE"
;;
*) util_deps='$(PERL_EXE) $(CONFIGPM) FORCE'
- x2p_deps="\$(PERL_EXE) \$(CONFIGPM) x2p/$firstmakefile FORCE"
;;
esac
$spitshell >>$Makefile <<!GROK!THIS!
-x2p/$firstmakefile: makedepend
- cd x2p; \$(MAKE) depend
-
-translators: $x2p_deps
- @echo " "; echo " Making x2p stuff"; cd x2p; \$(LDLIBPTH) \$(MAKE) all
-
-x2p/s2p: $x2p_deps
- cd x2p; \$(LDLIBPTH) \$(MAKE) s2p
-
-x2p/find2perl: $x2p_deps
- cd x2p; \$(LDLIBPTH) \$(MAKE) find2perl
-
utils/Makefile: \$(MINIPERL_EXE) \$(CONFIGPM) utils/Makefile.PL
\$(MINIPERL) -Ilib utils/Makefile.PL
@@ -1269,7 +1254,6 @@ _mopup:
_tidy:
-cd pod; $(LDLIBPTH) $(MAKE) clean
-cd utils; $(LDLIBPTH) $(MAKE) clean
- -cd x2p; $(LDLIBPTH) $(MAKE) clean
-rm -f lib/Config_git.pl git_version.h
-@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
$(MINIPERL) make_ext.pl --target=clean $$x MAKE=$(MAKE) ; \
@@ -1279,7 +1263,6 @@ _cleaner1:
-cd os2; rm -f Makefile
-cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
-cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
- -cd x2p; $(LDLIBPTH) $(MAKE) $(CLEAN)
-@if test -f $(MINIPERL_EXE) ; then \
for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
$(MINIPERL) make_ext.pl --target=$(CLEAN) $$x MAKE=$(MAKE) ; \
@@ -1409,15 +1392,14 @@ test_prep_pre: preplibrary utilities $(nonxs_ext)
case "$targethost" in
'') $spitshell >>$Makefile <<'!NO!SUBS!'
test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \
- $(dynamic_ext) $(TEST_PERL_DLL) runtests x2p/s2p x2p/find2perl \
- $(generated_pods)
+ $(dynamic_ext) $(TEST_PERL_DLL) runtests $(generated_pods)
cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
!NO!SUBS!
;;
*) $spitshell >>$Makefile <<!GROK!THIS!
test_prep test-prep: test_prep_pre \$(MINIPERL_EXE) \$(unidatafiles) \$(PERL_EXE) \
- \$(dynamic_ext) \$(TEST_PERL_DLL) runtests x2p/s2p x2p/find2perl \
+ \$(dynamic_ext) \$(TEST_PERL_DLL) runtests \
\$(generated_pods)
$to libperl.*
$to t/*
@@ -1454,8 +1436,6 @@ test_prep test-prep: test_prep_pre \$(MINIPERL_EXE) \$(unidatafiles) \$(PERL_EXE
# --- For Module::Build
$to cpan/Module-Build/lib/*
$to *.h
-# --- For t/x2p/s2p.t
- $to x2p
# --- For t/TEST
$to config.sh
# --- For lib/diagnostics.t with -Duseshrplib
@@ -1608,44 +1588,6 @@ define)
echo "This is an EBCDIC system, checking if any parser files need regenerating." >&2
case "$osname" in
os390|posix-bc)
- if cd x2p
- then
- rm -f y.tab.c y.tab.h
- case "$osname" in
- posix-bc)
- # we are using two different yaccs in BS2000 Posix!
- byacc a2p.y >/dev/null 2>&1
- ;;
- *) # e.g. os390
- yacc a2p.y >/dev/null 2>&1
- ;;
- esac
- if cmp -s y.tab.c a2p.c
- then
- rm -f y.tab.c
- else
- echo "a2p.y -> a2p.c" >&2
- mv -f y.tab.c a2p.c
- chmod u+w a2p.c
- sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
- -e 's|^static void __YY_YACC_MAIN.*BS2000.*|/*static main deleted*/|' \
- -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
- xxx="$xxx a2p.c"
- fi
- # In case somebody yacc -d:ed the a2p.y.
- if test -f y.tab.h
- then
- if cmp -s y.tab.h a2p.h
- then
- rm -f y.tab.h
- else
- echo "a2p.h -> a2p.h" >&2
- mv -f y.tab.h a2p.h
- xxx="$xxx a2p.h"
- fi
- fi
- cd ..
- fi
;;
*)
echo "'$osname' is an EBCDIC system I don't know that well." >&4
diff --git a/Porting/exec-bit.txt b/Porting/exec-bit.txt
index 1dd17baa42..a89d496104 100644
--- a/Porting/exec-bit.txt
+++ b/Porting/exec-bit.txt
@@ -27,7 +27,6 @@ regen/regcharclass.pl
regen/uconfig_h.pl
runtests.SH
t/TEST
-x2p/Makefile.SH
Porting/Maintainers.pl
Porting/add-package.pl
Porting/bisect.pl
diff --git a/pod/perlutil.pod b/pod/perlutil.pod
index ed73229ffc..4047b42e85 100644
--- a/pod/perlutil.pod
+++ b/pod/perlutil.pod
@@ -76,56 +76,9 @@ typeset PostScript or text file of the whole lot.
=head2 Converters
-To help you convert legacy programs to Perl, we've included three
-conversion filters:
-
-=over 3
-
-=item L<a2p|a2p>
-
-F<a2p> converts F<awk> scripts to Perl programs; for example, C<a2p -F:>
-on the simple F<awk> script C<{print $2}> will produce a Perl program
-based around this code:
-
- while (<>) {
- ($Fld1,$Fld2) = split(/[:\n]/, $_, -1);
- print $Fld2;
- }
-
-=item L<s2p|s2p> and L<psed>
-
-Similarly, F<s2p> converts F<sed> scripts to Perl programs. F<s2p> run
-on C<s/foo/bar> will produce a Perl program based around this:
-
- while (<>) {
- chomp;
- s/foo/bar/g;
- print if $printit;
- }
-
-When invoked as F<psed>, it behaves as a F<sed> implementation, written in
-Perl.
-
-=item L<find2perl|find2perl>
-
-Finally, F<find2perl> translates C<find> commands to Perl equivalents which
-use the L<File::Find|File::Find> module. As an example,
-C<find2perl . -user root -perm 4000 -print> produces the following callback
-subroutine for C<File::Find>:
-
- sub wanted {
- my ($dev,$ino,$mode,$nlink,$uid,$gid);
- (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
- $uid == $uid{'root'}) &&
- (($mode & 0777) == 04000);
- print("$name\n");
- }
-
-=back
-
-As well as these filters for converting other languages, the
-L<pl2pm|pl2pm> utility will help you convert old-style Perl 4 libraries to
-new-style Perl5 modules.
+To help you convert legacy programs to more modern Perl, the
+L<pl2pm|pl2pm> utility will help you convert old-style Perl 4 libraries
+to new-style Perl5 modules.
=head2 Administration
@@ -284,10 +237,9 @@ validate your packlists and even create a tarball from an installed module.
L<perldoc|perldoc>, L<pod2man|pod2man>, L<perlpod>,
L<pod2html|pod2html>, L<pod2usage|pod2usage>, L<podselect|podselect>,
L<podchecker|podchecker>, L<splain|splain>, L<perldiag>,
-C<roffitall|roffitall>, L<a2p|a2p>, L<s2p|s2p>, L<find2perl|find2perl>,
-L<File::Find|File::Find>, L<pl2pm|pl2pm>, L<perlbug|perlbug>,
-L<h2ph|h2ph>, L<c2ph|c2ph>, L<h2xs|h2xs>, L<enc2xs>, L<xsubpp>,
-L<cpan>, L<instmodsh>, L<piconv>, L<prove>,
-L<corelist>, L<ptar>, L<ptardiff>, L<shasum>, L<zipdetails>
+C<roffitall|roffitall>, L<File::Find|File::Find>, L<pl2pm|pl2pm>,
+L<perlbug|perlbug>, L<h2ph|h2ph>, L<c2ph|c2ph>, L<h2xs|h2xs>, L<enc2xs>,
+L<xsubpp>, L<cpan>, L<instmodsh>, L<piconv>, L<prove>, L<corelist>, L<ptar>,
+L<ptardiff>, L<shasum>, L<zipdetails>
=cut
diff --git a/t/x2p/find2perl.t b/t/x2p/find2perl.t
deleted file mode 100644
index f0dfa03929..0000000000
--- a/t/x2p/find2perl.t
+++ /dev/null
@@ -1,229 +0,0 @@
-#!./perl
-
-# Based on ideas from x2p/s2p.t
-#
-# This doesn't currently test -exec etc, just the default -print on
-# the platforms below.
-
-BEGIN {
- chdir 't' if -d 't';
- @INC = ( '../lib' );
-}
-
-use strict;
-use warnings;
-use File::Path 'remove_tree';
-use File::Spec;
-require "./test.pl";
-
-# add more platforms if you feel like it, but make sure the
-# tests below are portable to the find(1) for any new platform,
-# or that they skip on that platform
-$^O =~ /^(?:linux|\w+bsd|darwin)$/
- or skip_all("Need something vaguely POSIX");
-
-my $VERBOSE = grep $_ eq '-v', @ARGV;
-
-my $tmpdir = tempfile();
-my $script = tempfile();
-mkdir $tmpdir
- or die "Cannot make temp dir $tmpdir: $!";
-
-# test file names shouldn't contain any shell special characters,
-# and for portability, probably shouldn't contain any high ascii or
-# Unicode characters
-#
-# handling Unicode here would be nice, but I think handling of Unicode
-# in perl's file system interfaces (open, unlink, readdir) etc needs to
-# be more regular before we can expect interoperability between find2perl
-# and a system find(1)
-#
-# keys for the test file list:
-# name - required
-# type - type of file to create:
-# "f" regular file, "d" directory, "l" link to target,
-# "s" symlink to target
-# atime, mtime - file times (default now)
-# mode - file mode (default per umask)
-# content - file content for type f files
-# target - target for link for type l and s
-#
-# I could have simply written code to create all the files, but I think
-# this makes the file tree a little more obvious
-use constant HOUR => 3600; # an hour in seconds
-my @test_files =
- (
- { name => "abc" },
- { name => "acc", mtime => time() - HOUR * 48 },
- { name => "ac", content => "x" x 10 },
- { name => "somedir", type => "d" },
- { name => "link", type => "l", target => "abc" },
- { name => "symlink", type => "s", target => "brokenlink" },
- );
-# make some files to search
-for my $spec (@test_files) {
- my $file = File::Spec->catfile($tmpdir, split '/', $spec->{name});
- my $type = $spec->{type} || "f";
- if ($type eq "f") {
- open my $fh, ">", $file
- or die "Cannot create test file $file: $!";
- if ($spec->{content}) {
- binmode $fh;
- print $fh $spec->{content};
- }
- close $fh
- or die "Cannot close $file: $!";
- }
- elsif ($type eq "d") {
- mkdir $file
- or die "Cannot create test directory $file: $!";
- }
- elsif ($type eq "l") {
- my $target = File::Spec->catfile($tmpdir, split '/', $spec->{target});
- link $target, $file
- or die "Cannot create test link $file: $!";
- }
- elsif ($type eq "s") {
- my $target = File::Spec->catfile($tmpdir, split '/', $spec->{target});
- symlink $target, $file
- or die "Cannot create test symlink $file: $!";
- }
- if ($spec->{mode}) {
- chmod $spec->{mode}, $file
- or die "Cannot set mode of test file $file: $!";
- }
- if ($spec->{mtime} || $spec->{atime}) {
- # default the times to now, since we just created the files
- my $mtime = $spec->{mtime} || time();
- my $atime = $spec->{atime} || time();
- utime $atime, $mtime, $file
- or die "Cannot set times of test file $file: $!";
- }
-}
-
-# do we have a vaguely sane find(1)?
-# BusyBox find is non-POSIX - it doesn't have -links
-my @files = sort `find '$tmpdir' '(' -name 'abc' -o -name 'acc' ')' -a -links +0`;
-@files == 2 && $files[0] =~ /\babc\n\z/ && $files[1] =~ /\bacc\n\z/
- or skip_all("doesn't appear to be a sane find(1)");
-
-# required keys:
-# args - find search spec as an array ref
-# optional:
-# name - short description of the test (defaults to args)
-# expect - an array ref of files expected to be found (skips the find(1) call)
-# TODO - why this test is TODO (if it is), if a code reference that is
-# called to check if the test is TODO (and why)
-# SKIP - return a message for why to skip
-my @testcases =
- (
- {
- name => "all files",
- args => [],
- },
- {
- name => "mapping of *",
- args => [ "-name", "a*c" ],
- },
- {
- args => [ "-type", "d" ],
- expect => [ "", "somedir" ],
- },
- {
- args => [ "-type", "f" ],
- },
- {
- args => [ "-mtime", "+1" ],
- expect => [ "acc" ],
- },
- {
- args => [ "-mtime", "-1" ],
- },
- {
- args => [ "-size", "10c" ],
- expect => [ "ac" ],
- },
- {
- args => [ "-links", "2" ],
- },
- {
- name => "[perl #113054] mapping of ?",
- args => [ "-name", "a?c" ],
- },
- );
-
-plan(tests => 1 + 4 * @testcases);
-
-my $find2perl = File::Spec->catfile(File::Spec->updir(), "x2p", "find2perl");
-ok (-x $find2perl, "find2perl exists");
-our $TODO;
-
-for my $test (@testcases) {
- SKIP:
- {
- local $TODO = $test->{TODO};
- $TODO = $TODO->() if ref $TODO;
- my $args = $test->{args}
- or die "Missing test args";
- my $name = $test->{name} || "@$args";
-
- my $skip = $test->{SKIP} && $test->{SKIP}->();
- $skip
- and skip($skip, 4);
-
- my $code = runperl(args => [ $find2perl, $tmpdir, @$args ]);
-
- ok($code, "$name: run findperl")
- or skip("", 3);
-
- open my $script_fh, ">", $script
- or die "Cannot create $script: $!";
- print $script_fh $code;
- close $script_fh
- or die "Cannot close $script: $!";
-
- my $files = runperl(progfile => $script);
-
- ok(length $files, "$name: run output script")
- or skip("", 2);
-
- my $find_files;
- my $source;
- if ($test->{expect}) {
- $find_files = join "\n",
- map { $_ eq "" ? $tmpdir : "$tmpdir/$_" }
- @{$test->{expect}};
- $source = "expected";
- # to balance the ok() in the other branch
- pass("$name: got files ok");
- }
- else {
- my $findcmd = "find $tmpdir ". join " ", map "'$_'", @$args;
-
- # make sure PERL_UNICODE doesn't reinterpret the output of find
- use open IN => ':raw';
- $find_files = `$findcmd`;
- ok(length $find_files, "$name: run find")
- or skip("", 1);
- $source = "find";
- }
-
- # is the order from find (or find2perl) guaranteed?
- # assume it isn't
- $files = join("\n", sort split /\n/, $files);
- $find_files = join("\n", sort split /\n/, $find_files);
-
- if ($VERBOSE) {
- note("script:\n$code");
- note("args:\n@$args");
- note("find2perl:\n$files");
- note("find:\n$find_files");
- }
-
- is($files, $find_files, "$name: find2perl matches $source");
- }
-}
-
-END {
- remove_tree($tmpdir);
-}
diff --git a/t/x2p/s2p.t b/t/x2p/s2p.t
deleted file mode 100644
index 0a0716da0c..0000000000
--- a/t/x2p/s2p.t
+++ /dev/null
@@ -1,892 +0,0 @@
-#!./perl
-
-=head1 NAME
-
-s2p.t - test suite for s2p/psed
-
-=head1 NOTES
-
-The general idea is to
-
- (a) run psed with a sed script and input data to obtain some output
- (b) run s2p with a sed script creating a Perl program and then run the
- Perl program with the input data, again producing output
-
-Both final outputs should be identical to the expected output.
-
-A $testcase{<name>} contains entries (after the comment ### <name> ###):
-
- - script: the sed script
- - input: the key of the input data, stored in $input{<input>}
- - expect: the expected output
- - datfil: an additional file [ <path>, <data> ] (if required)
-
-Temporary files are created in the working directory (embedding $$
-in the name), and removed after the test.
-
-Except for bin2dec (which indeed converts binary to decimal) none of the
-sed scripts is doing something useful.
-
-Author: Wolfgang Laun.
-
-=cut
-
-BEGIN {
- chdir 't' if -d 't';
- @INC = ( '../lib' );
-}
-
-use File::Copy;
-use File::Spec;
-require './test.pl';
-
-# BRE extensions
-$ENV{PSEDEXTBRE} = '<>wW';
-
-our %input = (
- bins => <<'[TheEnd]',
-0
-111
-1000
-10001
-[TheEnd]
-
- text => <<'[TheEnd]',
-line 1
-line 2
-line 3
-line 4
-line 5
-line 6
-line 7
-line 8
-[TheEnd]
-
- adr1 => <<'[TheEnd]',
-#no autoprint
-# This script should be run on itself
-/^#__DATA__$/,${
- /^#A$/p
- s/^# *[0-9]* *//
- /^#\*$/p
- /^#\.$/p
- /^#\(..\)\(..\)\2\1*$/p
- /^#[abc]\{1,\}[def]\{1,\}$/p
-}
-#__DATA__
-#A
-#*
-#.
-#abxyxy
-#abxyxyab
-#abxyxyabab
-#ad
-#abcdef
-[TheEnd]
-);
-
-
-our %testcase = (
-
-### bin2dec ###
-'bin2dec' => {
- script => <<'[TheEnd]',
-# binary -> decimal
-s/^[ ]*\([01]\{1,\}\)[ ]*/\1/
-t go
-i\
-is not a binary number
-d
-
-# expand binary to Xs
-: go
-s/^0*//
-s/^1/X/
-: expand
-s/^\(X\{1,\}\)0/\1\1/
-s/^\(X\{1,\}\)1/\1\1X/
-t expand
-
-# count Xs in decimal
-: count
-s/^X/1/
-s/0X/1/
-s/1X/2/
-s/2X/3/
-s/3X/4/
-s/4X/5/
-s/5X/6/
-s/6X/7/
-s/7X/8/
-s/8X/9/
-s/9X/X0/
-t count
-s/^$/0/
-[TheEnd]
- input => 'bins',
- expect => <<'[TheEnd]',
-0
-7
-8
-17
-[TheEnd]
-},
-
-
-### = ###
-'=' => {
- script => <<'[TheEnd]',
-1=
-$=
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-1
-line 1
-line 2
-line 3
-line 4
-line 5
-line 6
-line 7
-8
-line 8
-[TheEnd]
-},
-
-### D ###
-'D' => {
- script => <<'[TheEnd]',
-#no autoprint
-/1/{
-N
-N
-N
-D
-}
-p
-/2/D
-=
-p
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 2
-line 3
-line 4
-line 3
-line 4
-4
-line 3
-line 4
-line 5
-5
-line 5
-line 6
-6
-line 6
-line 7
-7
-line 7
-line 8
-8
-line 8
-[TheEnd]
-},
-
-### H ###
-'H' => {
- script => <<'[TheEnd]',
-#no autoprint
-1,$H
-$g
-$=
-$p
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-8
-
-line 1
-line 2
-line 3
-line 4
-line 5
-line 6
-line 7
-line 8
-[TheEnd]
-},
-
-### N ###
-'N' => {
- script => <<'[TheEnd]',
-3a\
-added line
-4a\
-added line
-5a\
-added line
-3,5N
-=
-d
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-1
-2
-added line
-4
-added line
-6
-7
-8
-[TheEnd]
-},
-
-### P ###
-'P' => {
- script => <<'[TheEnd]',
-1N
-2N
-3N
-4=
-4P
-4,$d
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-4
-line 1
-[TheEnd]
-},
-
-### a ###
-'a' => {
- script => <<'[TheEnd]',
-1a\
-added line 1.1\
-added line 1.2
-
-3a\
-added line 3.1
-3a\
-added line 3.2
-
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 1
-added line 1.1
-added line 1.2
-line 2
-line 3
-added line 3.1
-added line 3.2
-line 4
-line 5
-line 6
-line 7
-line 8
-[TheEnd]
-},
-
-### b ###
-'b' => {
- script => <<'[TheEnd]',
-#no autoprint
-2 b eos
-4 b eos
-p
-: eos
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 1
-line 3
-line 5
-line 6
-line 7
-line 8
-[TheEnd]
-},
-
-### block ###
-'block' => {
- script => "#no autoprint\n1,3{\n=\np\n}",
- input => 'text',
- expect => <<'[TheEnd]',
-1
-line 1
-2
-line 2
-3
-line 3
-[TheEnd]
-},
-
-### c ###
-'c' => {
- script => <<'[TheEnd]',
-2=
-
-2,4c\
-change 2,4 line 1\
-change 2,4 line 2
-
-2=
-
-3,5c\
-change 3,5 line 1\
-change 3,5 line 2
-
-3=
-
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 1
-2
-change 2,4 line 1
-change 2,4 line 2
-line 5
-line 6
-line 7
-line 8
-[TheEnd]
-},
-
-### c1 ###
-'c1' => {
- script => <<'[TheEnd]',
-1c\
-replaces line 1
-
-2,3c\
-replaces lines 2-3
-
-/5/,/6/c\
-replaces lines 3-4
-
-8,10c\
-replaces lines 6-10
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-replaces line 1
-replaces lines 2-3
-line 4
-replaces lines 3-4
-line 7
-[TheEnd]
-},
-
-### c2 ###
-'c2' => {
- script => <<'[TheEnd]',
-3!c\
-replace all except line 3
-
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-replace all except line 3
-replace all except line 3
-line 3
-replace all except line 3
-replace all except line 3
-replace all except line 3
-replace all except line 3
-replace all except line 3
-[TheEnd]
-},
-
-### c3 ###
-'c3' => {
- script => <<'[TheEnd]',
-1,4!c\
-replace all except 1-4
-
-/5/,/8/!c\
-replace all except 5-8
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-replace all except 5-8
-replace all except 5-8
-replace all except 5-8
-replace all except 5-8
-replace all except 1-4
-replace all except 1-4
-replace all except 1-4
-replace all except 1-4
-[TheEnd]
-},
-
-### d ###
-'d' => {
- script => <<'[TheEnd]',
-# d delete pattern space, start next cycle
-2,4 d
-5 d
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 1
-line 6
-line 7
-line 8
-[TheEnd]
-},
-
-### gh ###
-'gh' => {
- script => <<'[TheEnd]',
-1h
-2g
-3h
-4g
-5q
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 1
-line 1
-line 3
-line 3
-line 5
-[TheEnd]
-},
-
-### i ###
-'i' => {
- script => <<'[TheEnd]',
-1i\
-inserted line 1.1\
-inserted line 1.2
-
-3i\
-inserted line 3.1
-3i\
-inserted line 3.2
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-inserted line 1.1
-inserted line 1.2
-line 1
-line 2
-inserted line 3.1
-inserted line 3.2
-line 3
-line 4
-line 5
-line 6
-line 7
-line 8
-[TheEnd]
-},
-
-### n ###
-'n' => {
- script => <<'[TheEnd]',
-3a\
-added line
-4a\
-added line
-5a\
-added line
-3,5n
-=
-d
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-1
-2
-line 3
-added line
-4
-line 5
-added line
-6
-7
-8
-[TheEnd]
-},
-
-### o ###
-'o' => {
- script => <<'[TheEnd]',
-/abc/,/def/ s//XXX/
-// i\
-cheers
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 1
-line 2
-line 3
-line 4
-line 5
-line 6
-line 7
-line 8
-[TheEnd]
-},
-
-### q ###
-'q' => {
- script => <<'[TheEnd]',
-2a\
-append to line 2
-3a\
-append to line 3 - should not appear in output
-3q
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 1
-line 2
-append to line 2
-line 3
-[TheEnd]
-},
-
-### r ###
-'r' => {
- datfil => [ 'r.txt', "r.txt line 1\nr.txt line 2\nr.txt line 3\n" ],
- script => <<'[TheEnd]',
-2r%r.txt%
-4r %r.txt%
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 1
-line 2
-r.txt line 1
-r.txt line 2
-r.txt line 3
-line 3
-line 4
-r.txt line 1
-r.txt line 2
-r.txt line 3
-line 5
-line 6
-line 7
-line 8
-[TheEnd]
-},
-
-### s ###
-'s' => {
- script => <<'[TheEnd]',
-# enclose any '(a)'.. '(c)' in '-'
-s/([a-z])/-\1-/g
-
-s/\([abc]\)/-\1-/g
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 1
-line 2
-line 3
-line 4
-line 5
-line 6
-line 7
-line 8
-[TheEnd]
-},
-
-### s1 ###
-'s1' => {
- script => <<'[TheEnd]',
-s/\w/@1/
-s/\y/@2/
-
-s/\n/@3/
-
-# this is literal { }
-s/a{3}/@4/
-
-# proper repetition
-s/a\{3\}/a rep 3/
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-@1ine 1
-@1ine 2
-@1ine 3
-@1ine 4
-@1ine 5
-@1ine 6
-@1ine 7
-@1ine 8
-[TheEnd]
-},
-
-### s2 ### RT #115156
-'s2' => {
- todo => 'RT #115156',
- script => 's/1*$/x/g',
- input => 'bins',
- expect => <<'[TheEnd]',
-0x
-x
-1000x
-1000x
-[TheEnd]
-},
-
-### t ###
-'t' => {
- script => join( "\n",
- '#no autoprint', 's/./X/p', 's/foo/bar/p', 't bye', '=', 'p', ':bye' ),
- input => 'text',
- expect => <<'[TheEnd]',
-Xine 1
-Xine 2
-Xine 3
-Xine 4
-Xine 5
-Xine 6
-Xine 7
-Xine 8
-[TheEnd]
-},
-
-### w ###
-'w' => {
- datfil => [ 'w.txt', '' ],
- script => <<'[TheEnd]',
-w %w.txt%
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 1
-line 2
-line 3
-line 4
-line 5
-line 6
-line 7
-line 8
-[TheEnd]
-},
-
-### x ###
-'x' => {
- script => <<'[TheEnd]',
-1h
-1d
-2x
-2,$G
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-line 1
-line 2
-line 3
-line 2
-line 4
-line 2
-line 5
-line 2
-line 6
-line 2
-line 7
-line 2
-line 8
-line 2
-[TheEnd]
-},
-
-### y ###
-'y' => {
- script => <<'[TheEnd]',
-y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
-y/|/\
-/
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-LINE 1
-LINE 2
-LINE 3
-LINE 4
-LINE 5
-LINE 6
-LINE 7
-LINE 8
-[TheEnd]
-},
-
-### cnt ###
-'cnt' => {
- script => <<'[TheEnd]',
-#no autoprint
-
-# delete line, append NL to hold space
-s/.*//
-H
-$!b
-
-# last line only: get hold
-g
-s/./X/g
-t count
-: count
-s/^X/1/
-s/0X/1/
-s/1X/2/
-s/2X/3/
-s/3X/4/
-s/4X/5/
-s/5X/6/
-s/6X/7/
-s/7X/8/
-s/8X/9/
-s/9X/X0/
-t count
-p
-[TheEnd]
- input => 'text',
- expect => <<'[TheEnd]',
-8
-[TheEnd]
-},
-
-### adr1 ###
-'adr1' => {
- script => <<'[TheEnd]',
-#no autoprint
-# This script should be run on itself
-/^#__DATA__$/,${
- /^#A$/p
- s/^# *[0-9]* *//
- /^#\*$/p
- /^#\.$/p
- /^#\(..\)\(..\)\2\1*$/p
- /^#[abc]\{1,\}[def]\{1,\}$/p
-}
-#__DATA__
-#A
-#*
-#.
-#abxyxy
-#abxyxyab
-#abxyxyabab
-#ad
-#abcdef
-[TheEnd]
- input => 'adr1',
- expect => <<'[TheEnd]',
-#A
-[TheEnd]
-},
-
-);
-
-my @aux = ();
-my $ntc = 2 * keys %testcase;
-plan( $ntc );
-
-# temporary file names
-my $script = "s2pt$$.sed";
-my $stdin = "s2pt$$.in";
-my $plsed = "s2pt$$.pl";
-
-# various command lines for
-my $s2p = File::Spec->catfile( File::Spec->updir(), 'x2p', 's2p' );
-my $psed = File::Spec->catfile( File::Spec->curdir(), 'psed' );
-if ($^O eq 'VMS') {
- # default in the .com extension if it's not already there
- $s2p = VMS::Filespec::vmsify($s2p);
- $psed = VMS::Filespec::vmsify($psed);
- # Converting file specs from Unix format to VMS with the extended
- # character set active can result in a trailing '.' added for null
- # extensions. This must be removed if the intent is to default the
- # extension.
- $s2p =~ s/\.$//;
- $psed =~ s/\.$//;
- $s2p = VMS::Filespec::rmsexpand($s2p, '.com');
- $psed = VMS::Filespec::rmsexpand($psed, '.com');
-}
-my $sedcmd = [ $psed, '-f', $script, $stdin ];
-my $s2pcmd = [ $s2p, '-f', $script ];
-my $plcmd = [ $plsed, $stdin ];
-
-# psed: we create a local copy as linking may not work on some systems.
-copy( $s2p, $psed );
-push( @aux, $psed );
-
-# process all testcases
-#
-my $indat = '';
-for my $tc ( sort keys %testcase ){
- my( $psedres, $s2pres );
-
- local $TODO = $testcase{$tc}{todo};
-
- # 1st test: run psed
- # prepare the script
- open( SED, ">$script" ) || goto FAIL_BOTH;
- my $script = $testcase{$tc}{script};
-
- # additional files for r, w: patch script, inserting temporary names
- if( exists( $testcase{$tc}{datfil} ) ){
- my( $datnam, $datdat ) = @{$testcase{$tc}{datfil}};
- my $datfil = "s2pt$$" . $datnam;
- push( @aux, $datfil );
- open( DAT, ">$datfil" ) || goto FAIL_BOTH;
- print DAT $datdat;
- close( DAT );
- $script =~ s/\%$datnam\%/$datfil/eg;
- }
- print SED $script;
- close( SED ) || goto FAIL_BOTH;
-
- # prepare input
- #
- if( $indat ne $testcase{$tc}{input} ){
- $indat = $testcase{$tc}{input};
- open( IN, ">$stdin" ) || goto FAIL_BOTH;
- print IN $input{$indat};
- close( IN ) || goto FAIL_BOTH;
- }
-
- # on VMS, runperl eats blank lines to work around
- # spurious newlines in pipes
- $testcase{$tc}{expect} =~ s/\n\n/\n/ if $^O eq 'VMS';
-
- # run and compare
- #
- $psedres = runperl( args => $sedcmd );
- is( $psedres, $testcase{$tc}{expect}, "psed $tc" );
-
- # 2nd test: run s2p
- # translate the sed script to a Perl program
-
- my $perlprog = runperl( args => $s2pcmd );
- open( PP, ">$plsed" ) || goto FAIL_S2P;
- print PP $perlprog;
- close( PP ) || goto FAIL_S2P;
-
- # execute generated Perl program, compare
- $s2pres = runperl( args => $plcmd );
- is( $s2pres, $testcase{$tc}{expect}, "s2p $tc" );
- next;
-
-FAIL_BOTH:
- fail( "psed $tc" );
-FAIL_S2P:
- fail( "s2p $tc" );
-}
-
-END {
- for my $f ( $script, $stdin, $plsed, @aux ){
- 1 while unlink( $f ); # hats off to VMS...
- }
-}
diff --git a/utils.lst b/utils.lst
index 0922407787..c108c4afd8 100644
--- a/utils.lst
+++ b/utils.lst
@@ -26,6 +26,3 @@ utils/shasum
utils/splain
utils/xsubpp
utils/zipdetails
-x2p/a2p
-x2p/find2perl
-x2p/s2p # link = x2p/psed
diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template
index ff5f82b766..3398e91ea3 100644
--- a/vms/descrip_mms.template
+++ b/vms/descrip_mms.template
@@ -166,11 +166,9 @@ MTHREADLINKFLAGS =
# C preprocessor manifest "DEBUGGING" ==> perl -D, not the VMS debugger
.IFDEF LARGEFILE
CFLAGS = $(XTRACCFLAGS)$(DBGCCFLAGS)$(FLAGS)/Define=$(LARGEFILE)
-X2PCFLAGS = $(XTRACCFLAGS)$(DBGCCFLAGS)$(FLAGS)/Define=(PERL_FOR_X2P,$(LARGEFILE))
CORECFLAGS = $(XTRACCFLAGS)$(DBGCCFLAGS)$(FLAGS)/Define=(PERL_CORE,$(LARGEFILE))
.ELSE
CFLAGS = $(XTRACCFLAGS)$(DBGCCFLAGS)$(FLAGS)
-X2PCFLAGS = $(XTRACCFLAGS)$(DBGCCFLAGS)$(FLAGS)/Define=PERL_FOR_X2P
CORECFLAGS = $(XTRACCFLAGS)$(DBGCCFLAGS)$(FLAGS)/Define=PERL_CORE
.ENDIF
@@ -289,19 +287,11 @@ utils3 = [.utils]perlivp.com [.lib]splain.com [.utils]pl2pm.com [.utils]xsubpp.c
utils4 = [.utils]enc2xs.com [.utils]piconv.com [.utils]cpan.com [.utils]prove.com [.utils]ptar.com [.utils]ptardiff.com [.utils]shasum.com
utils5 = [.utils]corelist.com [.utils]ptargrep.com [.utils]zipdetails.com
-.ifdef NOX2P
all : base extras archcorefiles preplibrary [.pod]perltoc.pod
@ QUALIFIERS := $(MMSQUALIFIERS)
@ QUALIFIERS = QUALIFIERS - """" - """"
@ write sys$output " "
@ write sys$output " Everything is up to date. '$(MMS)''QUALIFIERS' test' to run test suite."
-.else
-all : base extras x2p archcorefiles preplibrary [.pod]perltoc.pod
- @ QUALIFIERS := $(MMSQUALIFIERS)
- @ QUALIFIERS = QUALIFIERS - """" - """"
- @ write sys$output " "
- @ write sys$output " Everything is up to date. '$(MMS)''QUALIFIERS' test' to run test suite."
-.endif
git_version.h : $(MINIPERL_EXE) make_patchnum.pl
$(MINIPERL) make_patchnum.pl
@@ -314,8 +304,6 @@ libmods : $(LIBPREREQ)
@ $(NOOP)
utils : $(utils1) $(utils2) $(utils3) $(utils4) $(utils5)
@ $(NOOP)
-x2p : [.x2p]$(DBG)a2p$(E) [.x2p]s2p.com [.x2p]find2perl.com
- @ $(NOOP)
extra.pods : miniperl
@ @extra_pods.com
@@ -511,12 +499,6 @@ nonxsext : $(LIBPREREQ) preplibrary $(MINIPERL_EXE) [.pod]perlfunc.pod
$(MINIPERL) -"I[-.lib]" $(MMS$SOURCE)
Copy/NoConfirm/Log [.utils]splain.com [.lib]
-[.x2p]find2perl.com : [.x2p]find2perl.PL $(ARCHDIR)Config.pm
- $(MINIPERL) -"I[-.lib]" $(MMS$SOURCE)
-
-[.x2p]s2p.com : [.x2p]s2p.PL $(ARCHDIR)Config.pm
- $(MINIPERL) -"I[-.lib]" $(MMS$SOURCE)
-
[.utils]xsubpp.com : [.utils]xsubpp.PL $(ARCHDIR)Config.pm nonxsext
$(MINIPERL) -"I[-.lib]" $(MMS$SOURCE)
@@ -526,35 +508,6 @@ nonxsext : $(LIBPREREQ) preplibrary $(MINIPERL_EXE) [.pod]perlfunc.pod
[.utils]pod2html.com : [.utils]pod2html.PL $(ARCHDIR)Config.pm nonxsext
$(MINIPERL) -"I[-.lib]" $(MMS$SOURCE)
-# Rename catches problem with some DECC versions in which object file is
-# placed in current default dir, not same one as source file.
-[.x2p]$(DBG)a2p$(E) : [.x2p]a2p$(O), [.x2p]hash$(O), [.x2p]str$(O), [.x2p]util$(O), [.x2p]walk$(O)
- @ If F$Search("hash$(O)").nes."" Then Rename/NoLog hash$(O),str$(O),util$(O),walk$(O) [.x2p]
- Link $(LINKFLAGS) /Exe=$(MMS$TARGET) $(MMS$SOURCE_LIST) $(CRTLOPTS)
-
-# Accommodate buggy cpp in some version of DECC, which chokes on illegal
-# filespec "y.tab.c", and broken gcc cpp, which doesn't start #include ""
-# search in same dir as source file
-[.x2p]a2p$(O) : [.x2p]a2p.c [.x2p]a2py.c [.x2p]INTERN.h [.x2p]a2p.h [.x2p]hash.h [.x2p]str.h config.h handy.h vmsish.h $(MINIPERL_EXE)
- $(MINIPERL) -pe "s/^#line\s+(\d+)\s+\Q""y.tab.c""/#line $1 ""y_tab.c""/;" $(MMS$SOURCE) >$(MMS$TARGET_NAME)_vms.c
- $(CC) $(X2PCFLAGS) /Object=$(MMS$TARGET)/Include=([.x2p],[],"./x2p") $(MMS$TARGET_NAME)_vms.c
- Delete/Log/NoConfirm $(MMS$TARGET_NAME)_vms.c;
-
-# gcc cpp broken -- doesn't look in directory of source file for #include ""
-.ifdef GNUC
-[.x2p]hash$(O) : [.x2p]hash.c
- $(CC) $(X2PCFLAGS) /Include=[.x2p] $(MMS$SOURCE)
-
-[.x2p]str$(O) : [.x2p]str.c
- $(CC) $(X2PCFLAGS) /Include=[.x2p] $(MMS$SOURCE)
-
-[.x2p]util$(O) : [.x2p]util.c
- $(CC) $(X2PCFLAGS) /Include=[.x2p] $(MMS$SOURCE)
-
-[.x2p]walk$(O) : [.x2p]walk.c
- $(CC) $(X2PCFLAGS) /Include=[.x2p] $(MMS$SOURCE)
-.endif
-
preplibrary : $(MINIPERL_EXE) $(LIBPREREQ)
@ $(NOOP)
@@ -625,8 +578,8 @@ archify : all
Delete/Log/NoConfirm [.lib.auto...]*.*;*/exclude=(*.al,*.ix,*.dir)
Delete/Log/NoConfirm [.lib]Config.pm;*
Delete/Log/NoConfirm [.lib]Config_heavy.pl;*
- Copy/Log/NoConfirm *$(E);,[.x2p]$(DBG)a2p$(E); $(ARCHDIR)
- Delete/Log/NoConfirm Perl*$(E);*,[.x2p]$(DBG)a2p$(E);*
+ Copy/Log/NoConfirm *$(E);, $(ARCHDIR)
+ Delete/Log/NoConfirm Perl*$(E);*
@ QUALIFIERS := $(MMSQUALIFIERS)
@ QUALIFIERS = QUALIFIERS - """" - """"
@ Write Sys$Output "Architecture-specific setup completed."
@@ -655,7 +608,7 @@ $(ARCHAUTO)time.stamp :
.ifdef LINK_ONLY
.else
-# We need an action line here for broken older versions of MMS which
+# We need(ed?) an action line here for broken older versions of MMS which
# otherwise conclude that they should be compiling [.x2p]utils.c :-(
#util$(O) : util.c
# $(CC) $(CORECFLAGS) $(MMS$SOURCE)
@@ -743,18 +696,6 @@ util$(O) : util.c $(h)
vms$(O) : vms.c $(h)
$(CC) $(CORECFLAGS) $(MMS$SOURCE)
-[.x2p]hash$(O) : [.x2p]hash.c [.x2p]EXTERN.h [.x2p]a2p.h [.x2p]hash.h [.x2p]str.h [.x2p]util.h config.h handy.h vmsish.h
- $(CC) $(X2PCFLAGS) $(MMS$SOURCE)
-
-[.x2p]str$(O) : [.x2p]str.c [.x2p]EXTERN.h [.x2p]a2p.h [.x2p]hash.h [.x2p]str.h [.x2p]util.h config.h handy.h vmsish.h
- $(CC) $(X2PCFLAGS) $(MMS$SOURCE)
-
-[.x2p]util$(O) : [.x2p]util.c [.x2p]EXTERN.h [.x2p]INTERN.h [.x2p]a2p.h [.x2p]hash.h [.x2p]str.h [.x2p]util.h config.h handy.h vmsish.h
- $(CC) $(X2PCFLAGS) $(MMS$SOURCE)
-
-[.x2p]walk$(O) : [.x2p]walk.c [.x2p]EXTERN.h [.x2p]a2p.h [.x2p]hash.h [.x2p]str.h [.x2p]util.h config.h handy.h vmsish.h
- $(CC) $(X2PCFLAGS) $(MMS$SOURCE)
-
# End of automatically generated make dependencies
.endif # !LINK_ONLY
@@ -819,7 +760,6 @@ tidy : cleanlis
- If F$Search("[.lib]*.com;-1").nes."" Then Purge/NoConfirm/Log [.lib]*.com
- If F$Search("[.pod]*.com;-1").nes."" Then Purge/NoConfirm/Log [.pod]*.com
- If F$Search("[.utils]*.com;-1").nes."" Then Purge/NoConfirm/Log [.utils]*.com
- - If F$Search("[.x2p]*.com;-1").nes."" Then Purge/NoConfirm/Log [.x2p]*.com
- If F$Search("[.lib]buildcustomize.pl;-1").nes."" Then Purge/NoConfirm/Log [.lib]buildcustomize.pl
clean : tidy cleantest
@@ -869,7 +809,6 @@ realclean : clean
- If F$Search("[.lib...].exists").nes."" Then Delete/NoConfirm/Log [.lib...].exists;*
- If F$Search("[.pod]*.com").nes."" Then Delete/NoConfirm/Log [.pod]*.com;*
- If F$Search("[.utils]*.com").nes."" Then Delete/NoConfirm/Log [.utils]*.com;*
- - If F$Search("[.x2p]*.com").nes."" Then Delete/NoConfirm/Log [.x2p]*.com;*
- If F$Search("$(ARCHDIR)Config.pm").nes."" Then Delete/NoConfirm/Log $(ARCHDIR)Config.pm;*
- If F$Search("$(ARCHDIR)Config_heavy.pl").nes."" Then Delete/NoConfirm/Log $(ARCHDIR)Config_heavy.pl;*
- If F$Search("[.utils]perldoc.com").nes."" Then Delete/NoConfirm/Log [.utils]perldoc.com;*
diff --git a/win32/Makefile b/win32/Makefile
index 9979998dbb..383bee7f01 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -581,7 +581,6 @@ WPERLEXE = ..\wperl.exe
PERLEXESTATIC = ..\perl-static.exe
GLOBEXE = ..\perlglob.exe
CONFIGPM = ..\lib\Config.pm ..\lib\Config_heavy.pl
-X2P = ..\x2p\a2p.exe
GENUUDMAP = ..\generate_uudmap.exe
!IF "$(BUILD_STATIC)" == "define" || "$(ALL_STATIC)" == "define"
PERLSTATIC = static
@@ -640,9 +639,6 @@ UTILS = \
..\utils\instmodsh \
..\utils\json_pp \
..\utils\pod2html \
- ..\x2p\find2perl \
- ..\x2p\psed \
- ..\x2p\s2p \
bin\exetype.pl \
bin\runperl.pl \
bin\pl2bat.pl \
@@ -722,13 +718,6 @@ WIN32_SRC = $(WIN32_SRC) .\win32io.c
#!ENDIF
-X2P_SRC = \
- ..\x2p\a2p.c \
- ..\x2p\hash.c \
- ..\x2p\str.c \
- ..\x2p\util.c \
- ..\x2p\walk.c
-
CORE_NOCFG_H = \
..\av.h \
..\cop.h \
@@ -786,7 +775,6 @@ MINICORE_OBJ = $(MICROCORE_OBJ:..\=.\mini\) \
MINIWIN32_OBJ = $(WIN32_OBJ:.\=.\mini\)
MINI_OBJ = $(MINICORE_OBJ) $(MINIWIN32_OBJ)
DLL_OBJ = $(DYNALOADER)
-X2P_OBJ = $(X2P_SRC:.c=.obj)
GENUUDMAP_OBJ = $(GENUUDMAP:.exe=.obj)
PERLDLL_OBJ = $(CORE_OBJ)
@@ -845,7 +833,7 @@ CFG_VARS = \
#
all : .\config.h ..\git_version.h $(GLOBEXE) $(CONFIGPM) \
- $(UNIDATAFILES) MakePPPort $(PERLEXE) $(X2P) Extensions_nonxs Extensions $(PERLSTATIC)
+ $(UNIDATAFILES) MakePPPort $(PERLEXE) Extensions_nonxs Extensions $(PERLSTATIC)
@echo Everything is up to date. '$(MAKE_BARE) test' to run test suite.
regnodes : ..\regnodes.h
@@ -855,7 +843,7 @@ regnodes : ..\regnodes.h
..\regexec$(o) : ..\regnodes.h ..\regcharclass.h
reonly : regnodes .\config.h ..\git_version.h $(GLOBEXE) $(CONFIGPM) \
- $(UNIDATAFILES) $(PERLEXE) $(X2P) Extensions_reonly
+ $(UNIDATAFILES) $(PERLEXE) Extensions_reonly
@echo Perl and 're' are up to date.
static: $(PERLEXESTATIC)
@@ -1024,7 +1012,6 @@ $(MINI_OBJ) : $(CORE_NOCFG_H)
$(WIN32_OBJ) : $(CORE_H)
$(CORE_OBJ) : $(CORE_H)
$(DLL_OBJ) : $(CORE_H)
-$(X2P_OBJ) : $(CORE_H)
perldll.def : $(MINIPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl create_perllibst_h.pl
$(MINIPERL) -I..\lib create_perllibst_h.pl
@@ -1046,29 +1033,6 @@ $(PERLSTATICLIB): Extensions_static
$(PERLEXE_RES): perlexe.rc $(PERLEXE_MANIFEST) $(PERLEXE_ICO)
-..\x2p\a2p$(o) : ..\x2p\a2p.c
- $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\a2p.c
-
-..\x2p\hash$(o) : ..\x2p\hash.c
- $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\hash.c
-
-..\x2p\str$(o) : ..\x2p\str.c
- $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\str.c
-
-..\x2p\util$(o) : ..\x2p\util.c
- $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\util.c
-
-..\x2p\walk$(o) : ..\x2p\walk.c
- $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\walk.c
-
-$(X2P) : $(MINIPERL) $(X2P_OBJ) Extensions
- $(MINIPERL) -I..\lib ..\x2p\find2perl.PL
- $(MINIPERL) -I..\lib ..\x2p\s2p.PL
- $(LINK32) -subsystem:console -out:$@ @<<
- $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ)
-<<
- $(EMBED_EXE_MANI)
-
$(MINIDIR)\globals$(o) : $(GENERATED_HEADERS)
$(UUDMAP_H) $(MG_DATA_H) : $(BITCOUNT_H)
@@ -1154,7 +1118,7 @@ doc: $(PERLEXE) ..\pod\perltoc.pod
# Note that this next section is parsed (and regenerated) by pod/buildtoc
# so please check that script before making structural changes here
-utils: $(PERLEXE) $(X2P) ..\utils\Makefile
+utils: $(PERLEXE) ..\utils\Makefile
cd ..\utils
$(MAKE) PERL=$(MINIPERL)
cd ..\pod
@@ -1299,7 +1263,6 @@ distclean: realclean
-cd ..\utils && del /f h2ph splain perlbug pl2pm c2ph pstruct h2xs \
perldoc perlivp libnetcfg enc2xs piconv cpan *.bat \
xsubpp pod2html instmodsh json_pp prove ptar ptardiff ptargrep shasum corelist zipdetails
- -cd ..\x2p && del /f find2perl s2p psed *.bat
-del /f ..\config.sh perlmain.c dlutils.c config.h.new \
perlmainst.c
-del /f $(CONFIGPM)
@@ -1326,7 +1289,6 @@ installbare : utils ..\pod\perltoc.pod
if exist $(PERLEXESTATIC) $(XCOPY) $(PERLEXESTATIC) $(INST_BIN)\*.*
$(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
if exist ..\perl*.pdb $(XCOPY) ..\perl*.pdb $(INST_BIN)\*.*
- if exist ..\x2p\a2p.pdb $(XCOPY) ..\x2p\a2p.pdb $(INST_BIN)\*.*
$(XCOPY) bin\*.bat $(INST_SCRIPT)\*.*
installhtml : doc
@@ -1414,10 +1376,8 @@ _clean :
-@$(DEL) $(UNIDATAFILES)
-@$(DEL) $(WIN32_OBJ)
-@$(DEL) $(DLL_OBJ)
- -@$(DEL) $(X2P_OBJ)
-@$(DEL) ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp *.res
-@$(DEL) ..\t\*.exe ..\t\*.dll ..\t\*.bat
- -@$(DEL) ..\x2p\*.exe ..\x2p\*.bat
-@$(DEL) *.ilk
-@$(DEL) *.pdb
-@$(DEL) Extensions_static
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 6aeef745be..b0f54d7061 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -692,7 +692,6 @@ PERLEXESTATIC = ..\perl-static.exe
STATICDIR = .\static.tmp
GLOBEXE = ..\perlglob.exe
CONFIGPM = ..\lib\Config.pm ..\lib\Config_heavy.pl
-X2P = ..\x2p\a2p.exe
GENUUDMAP = ..\generate_uudmap.exe
.IF "$(BUILD_STATIC)" == "define" || "$(ALL_STATIC)" == "define"
PERLSTATIC = static
@@ -749,9 +748,6 @@ UTILS = \
..\utils\shasum \
..\utils\instmodsh \
..\utils\json_pp \
- ..\x2p\find2perl \
- ..\x2p\psed \
- ..\x2p\s2p \
bin\exetype.pl \
bin\runperl.pl \
bin\pl2bat.pl \
@@ -845,13 +841,6 @@ WIN32_SRC = \
WIN32_SRC += .\win32io.c
#.ENDIF
-X2P_SRC = \
- ..\x2p\a2p.c \
- ..\x2p\hash.c \
- ..\x2p\str.c \
- ..\x2p\util.c \
- ..\x2p\walk.c
-
CORE_NOCFG_H = \
..\av.h \
..\cop.h \
@@ -907,7 +896,6 @@ MINICORE_OBJ = $(MINIDIR)\{$(MICROCORE_OBJ:f) miniperlmain$(o) perlio$(o)}
MINIWIN32_OBJ = $(MINIDIR)\{$(WIN32_OBJ:f)}
MINI_OBJ = $(MINICORE_OBJ) $(MINIWIN32_OBJ)
DLL_OBJ = $(DYNALOADER)
-X2P_OBJ = $(X2P_SRC:db:+$(o))
GENUUDMAP_OBJ = $(GENUUDMAP:db:+$(o))
PERLDLL_OBJ = $(CORE_OBJ)
@@ -976,7 +964,7 @@ CFG_VARS = \
all : CHECKDMAKE .\config.h ..\git_version.h $(GLOBEXE) $(MINIPERL) \
$(CONFIGPM) $(UNIDATAFILES) MakePPPort \
- $(PERLEXE) $(X2P) Extensions Extensions_nonxs $(PERLSTATIC)
+ $(PERLEXE) Extensions Extensions_nonxs $(PERLSTATIC)
regnodes : ..\regnodes.h
@@ -986,7 +974,7 @@ regnodes : ..\regnodes.h
reonly : regnodes .\config.h ..\git_version.h $(GLOBEXE) $(MINIPERL) \
$(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) \
- $(X2P) Extensions_reonly
+ Extensions_reonly
static: $(PERLEXESTATIC)
@@ -1181,8 +1169,6 @@ $(CORE_OBJ) : $(CORE_H)
$(DLL_OBJ) : $(CORE_H)
-$(X2P_OBJ) : $(CORE_H)
-
perldll.def : $(MINIPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl create_perllibst_h.pl
$(MINIPERL) -I..\lib create_perllibst_h.pl
$(MINIPERL) -I..\lib -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) \
@@ -1229,33 +1215,6 @@ $(PERLSTATICLIB): $(PERLDLL_OBJ) Extensions_static
$(PERLEXE_RES): perlexe.rc $(PERLEXE_MANIFEST) $(PERLEXE_ICO)
-..\x2p\a2p$(o) : ..\x2p\a2p.c
- $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\a2p.c
-
-..\x2p\hash$(o) : ..\x2p\hash.c
- $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\hash.c
-
-..\x2p\str$(o) : ..\x2p\str.c
- $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\str.c
-
-..\x2p\util$(o) : ..\x2p\util.c
- $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\util.c
-
-..\x2p\walk$(o) : ..\x2p\walk.c
- $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\walk.c
-
-$(X2P) : $(MINIPERL) $(X2P_OBJ) Extensions
- $(MINIPERL) -I..\lib ..\x2p\find2perl.PL
- $(MINIPERL) -I..\lib ..\x2p\s2p.PL
-.IF "$(CCTYPE)" == "GCC"
- $(LINK32) -v -o $@ $(BLINK_FLAGS) \
- $(mktmp $(LKPRE) $(X2P_OBJ) $(LIBFILES) $(LKPOST))
-.ELSE
- $(LINK32) -subsystem:console -out:$@ $(BLINK_FLAGS) \
- @$(mktmp $(LIBFILES) $(X2P_OBJ))
- $(EMBED_EXE_MANI)
-.ENDIF
-
$(MINIDIR)\globals$(o) : $(GENERATED_HEADERS)
$(UUDMAP_H) $(MG_DATA_H) : $(BITCOUNT_H)
@@ -1355,7 +1314,7 @@ doc: $(PERLEXE) ..\pod\perltoc.pod
# Note that this next section is parsed (and regenerated) by pod/buildtoc
# so please check that script before making structural changes here
-utils: $(PERLEXE) $(X2P) ..\utils\Makefile
+utils: $(PERLEXE) ..\utils\Makefile
cd ..\utils && $(MAKE) PERL=$(MINIPERL)
copy ..\README.aix ..\pod\perlaix.pod
copy ..\README.amiga ..\pod\perlamiga.pod
@@ -1497,7 +1456,6 @@ distclean: realclean
-cd ..\utils && del /f h2ph splain perlbug pl2pm c2ph pstruct h2xs \
perldoc perlivp libnetcfg enc2xs piconv cpan *.bat \
xsubpp pod2html instmodsh json_pp prove ptar ptardiff ptargrep shasum corelist zipdetails
- -cd ..\x2p && del /f find2perl s2p psed *.bat
-del /f ..\config.sh perlmain.c dlutils.c config.h.new \
perlmainst.c
-del /f $(CONFIGPM)
@@ -1524,7 +1482,6 @@ installbare : utils ..\pod\perltoc.pod
if exist $(PERLEXESTATIC) $(XCOPY) $(PERLEXESTATIC) $(INST_BIN)\*.*
$(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
if exist ..\perl*.pdb $(XCOPY) ..\perl*.pdb $(INST_BIN)\*.*
- if exist ..\x2p\a2p.pdb $(XCOPY) ..\x2p\a2p.pdb $(INST_BIN)\*.*
$(XCOPY) bin\*.bat $(INST_SCRIPT)\*.*
installhtml : doc
@@ -1618,10 +1575,8 @@ _clean :
-@erase $(UNIDATAFILES)
-@erase $(WIN32_OBJ)
-@erase $(DLL_OBJ)
- -@erase $(X2P_OBJ)
-@erase ..\*$(o) ..\*$(a) ..\*.exp *$(o) *$(a) *.exp *.res
-@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
- -@erase ..\x2p\*.exe ..\x2p\*.bat
-@erase *.ilk
-@erase *.pdb
-@erase Extensions_static
diff --git a/x2p/.gitignore b/x2p/.gitignore
deleted file mode 100644
index 1ee0a5b858..0000000000
--- a/x2p/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-/a2p
-/find2perl
-/find2perl.bat
-/psed
-/psed.bat
-/s2p
-/s2p.bat
diff --git a/x2p/EXTERN.h b/x2p/EXTERN.h
deleted file mode 100644
index dcc1b24395..0000000000
--- a/x2p/EXTERN.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* EXTERN.h
- *
- * Copyright (C) 1991, 1992, 1993, 1994, by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- */
-
-#undef EXT
-#define EXT extern
-
-#ifdef __cplusplus
-# define EXTERN_C extern "C"
-#else
-# define EXTERN_C extern
-#endif
-
-#undef INIT
-#define INIT(x)
-
-#undef DOINIT
diff --git a/x2p/INTERN.h b/x2p/INTERN.h
deleted file mode 100644
index 29332945d8..0000000000
--- a/x2p/INTERN.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* INTERN.h
- *
- * Copyright (C) 1993, 1994, by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- */
-
-#undef EXT
-#define EXT
-
-#ifdef __cplusplus
-# define EXTERN_C extern "C"
-#else
-# ifndef EXTERN_C
-# define EXTERN_C
-# endif
-#endif
-
-#undef INIT
-#define INIT(x) = x
-
-#define DOINIT
diff --git a/x2p/Makefile.SH b/x2p/Makefile.SH
deleted file mode 100755
index 2e554014c5..0000000000
--- a/x2p/Makefile.SH
+++ /dev/null
@@ -1,178 +0,0 @@
-#!/bin/sh
-
-case $PERL_CONFIG_SH in
-'')
- if test -f config.sh; then TOP=.;
- elif test -f ../config.sh; then TOP=..;
- elif test -f ../../config.sh; then TOP=../..;
- elif test -f ../../../config.sh; then TOP=../../..;
- elif test -f ../../../../config.sh; then TOP=../../../..;
- else
- echo "Can't find config.sh."; exit 1
- fi
- . $TOP/config.sh
- ;;
-esac
-: This forces SH files to create target in same directory as SH file.
-: This is so that make depend always knows where to find SH derivatives.
-case "$0" in
-*/Makefile.SH) cd `expr X$0 : 'X\(.*\)/'` ;;
-Makefile.SH) ;;
-*) case `pwd` in
- */x2p) ;;
- *) if test -d x2p; then cd x2p
- else echo "Can't figure out where to write output."; exit 1
- fi;;
- esac;;
-esac
-
-echo "Extracting x2p/Makefile (with variable substitutions)"
-rm -f Makefile
-
-# The .PL extractions use the Cwd extension. For statically-built
-# perls, we need perl, not just miniperl.
-case "$usedl" in
- define) perl="../miniperl" ;;
- *) perl="../perl" ;;
-esac
-
-cat >Makefile <<!GROK!THIS!
-# $RCSfile: Makefile.SH,v $$Revision: 4.1 $$Date: 92/08/07 18:29:07 $
-#
-# $Log: Makefile.SH,v $
-
-CC = $cc
-BYACC = $byacc
-LDFLAGS = $ldflags
-shellflags = $shellflags
-
-libs = $perllibs
-
-$make_set_make
-# grrr
-SHELL = $sh
-
-# These variables may need to be manually set for non-Unix systems.
-AR = $ar
-EXE_EXT = $_exe
-LIB_EXT = $_a
-OBJ_EXT = $_o
-PATH_SEP = $p_
-
-FIRSTMAKEFILE = $firstmakefile
-
-# how to tr(anslate) newlines
-
-TRNL = '$trnl'
-
-OPTIMIZE = $optimize
-
-.SUFFIXES: .c \$(OBJ_EXT)
-
-RUN =
-PERL = $perl
-
-!GROK!THIS!
-
-cat >>Makefile <<'!NO!SUBS!'
-
-REALPERL = ../perl
-CCCMD = `sh $(shellflags) ../cflags "optimize='$(OPTIMIZE)'" $@`
-
-pl = find2perl.PL s2p.PL
-plextract = find2perl s2p
-
-h = EXTERN.h INTERN.h ../config.h ../handy.h hash.h a2p.h str.h util.h
-
-c = hash.c str.c util.c walk.c
-
-obj = hash$(OBJ_EXT) str$(OBJ_EXT) util$(OBJ_EXT) walk$(OBJ_EXT)
-
-lintflags = -phbvxac
-
-
-.c$(OBJ_EXT):
- $(CCCMD) -DPERL_FOR_X2P $*.c
-
-all: a2p$(EXE_EXT) s2p find2perl
- @echo " "
-
-a2p$(EXE_EXT): $(obj) a2p$(OBJ_EXT)
- $(CC) -o a2p $(LDFLAGS) $(obj) a2p$(OBJ_EXT) $(libs)
-
-# I now supply a2p.c with the kits, so the following section is
-# used only if you force byacc to run by saying
-# make run_byacc
-# byacc 1.8.2 or 1.9 are recommended.
-
-run_byacc: FORCE
- @ echo Expect many shift/reduce and reduce/reduce conflicts
- $(BYACC) a2p.y
- rm -f a2p.c
- sed -e 's/(yyn = yydefred\[yystate\])/((yyn = yydefred[yystate]))/' \
- -e 's/(yys = getenv("YYDEBUG"))/((yys = getenv("YYDEBUG")))/' \
- -e 's/^yyerrlab://' \
- -e 's/^ goto yyerrlab;//' \
- -e 's/^yynewerror://' \
- -e 's/^ goto yynewerror;//' \
- -e 's|^static char yysccsid\(.*\)|/* static char yysccsid\1 */|' \
- -e 's/^\(char \*yyname\[\]\)/const \1/' \
- -e 's/^\(char \*yyrule\[\]\)/const \1/' \
- -e 's/^\( register\) \(char \*yys;\)/\1 const \2/' \
- < y.tab.c > a2p.c
-
-FORCE:
-
-# We don't want to regenerate a2p.c, but it might appear out-of-date
-# after a patch is applied or a new distribution is made.
-a2p.c: a2p.y
- -@sh -c true
-
-a2p$(OBJ_EXT): a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h \
- ../handy.h ../config.h str.h hash.h
- $(CCCMD) a2p.c
-
-clean:
- rm -f a2p$(EXE_EXT) psed *$(OBJ_EXT) $(plexe) $(plc)
-
-distclean: veryclean
-
-realclean: clean
- -rmdir .depending
- rm -f core $(plextract) all
- rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old
-
-veryclean: realclean
- rm -f *~ *.orig
-
-# The following lint has practically everything turned on. Unfortunately,
-# you have to wade through a lot of mumbo jumbo that can't be suppressed.
-# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
-# for that spot.
-
-lint:
- lint $(lintflags) $(defs) $(c) > a2p.fuzz
-
-depend: ../makedepend
- sh ../makedepend MAKE=$(MAKE) ../cflags
-
-clist:
- echo $(c) | tr ' ' $(TRNL) >.clist
-
-hlist:
- echo $(h) | tr ' ' $(TRNL) >.hlist
-
-$(plextract):
- $(RUN) $(PERL) -I../lib $@.PL
-
-find2perl: find2perl.PL ../config.sh
-
-s2p: s2p.PL ../config.sh
-
-# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
-$(obj):
- @ echo "You haven't done a "'"make depend" yet!'; exit 1
-makedepend: depend
-!NO!SUBS!
-$eunicefix Makefile
-rm -f $firstmakefile
diff --git a/x2p/a2p.c b/x2p/a2p.c
deleted file mode 100644
index 8d6e9cde57..0000000000
--- a/x2p/a2p.c
+++ /dev/null
@@ -1,2941 +0,0 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
-#endif
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define yyclearin (yychar=(-1))
-#define yyerrok (yyerrflag=0)
-#define YYRECOVERING (yyerrflag!=0)
-extern int yyparse(void);
-#define YYPREFIX "yy"
-#line 2 "a2p.y"
-/* $RCSfile: a2p.y,v $$Revision: 4.1 $$Date: 92/08/07 18:29:12 $
- *
- * Copyright (C) 1991, 1992, 1993, 1994, 1996, 1997, 1999, 2000,
- * by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- *
- * $Log: a2p.y,v $
- */
-
-#include "INTERN.h"
-#include "a2p.h"
-
-int root;
-int begins = Nullop;
-int ends = Nullop;
-
-#line 32 "y.tab.c"
-#define BEGIN 257
-#define END 258
-#define REGEX 259
-#define SEMINEW 260
-#define NEWLINE 261
-#define COMMENT 262
-#define FUN1 263
-#define FUNN 264
-#define GRGR 265
-#define PRINT 266
-#define PRINTF 267
-#define SPRINTF_OLD 268
-#define SPRINTF_NEW 269
-#define SPLIT 270
-#define IF 271
-#define ELSE 272
-#define WHILE 273
-#define FOR 274
-#define IN 275
-#define EXIT 276
-#define NEXT 277
-#define BREAK 278
-#define CONTINUE 279
-#define RET 280
-#define GETLINE 281
-#define DO 282
-#define SUB 283
-#define GSUB 284
-#define MATCH 285
-#define FUNCTION 286
-#define USERFUN 287
-#define DELETE 288
-#define ASGNOP 289
-#define OROR 290
-#define ANDAND 291
-#define NUMBER 292
-#define VAR 293
-#define SUBSTR 294
-#define INDEX 295
-#define MATCHOP 296
-#define RELOP 297
-#define OR 298
-#define STRING 299
-#define UMINUS 300
-#define NOT 301
-#define INCR 302
-#define DECR 303
-#define FIELD 304
-#define VFIELD 305
-#define SVFIELD 306
-#define YYERRCODE 256
-short yylhs[] = { -1,
- 0, 3, 6, 6, 2, 2, 7, 7, 7, 7,
- 7, 7, 9, 8, 8, 11, 11, 11, 11, 11,
- 15, 15, 15, 15, 14, 14, 14, 14, 13, 13,
- 13, 13, 12, 12, 12, 12, 18, 18, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 17, 17, 17, 17, 17, 10,
- 10, 10, 19, 19, 19, 1, 1, 20, 20, 20,
- 20, 4, 4, 21, 21, 22, 22, 22, 22, 5,
- 5, 23, 23, 23, 23, 26, 26, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 27, 27, 27, 25, 25, 25, 25, 25, 25, 25,
- 25,
-};
-short yylen[] = { 2,
- 2, 6, 5, 2, 3, 0, 1, 5, 10, 4,
- 1, 1, 1, 1, 3, 1, 1, 1, 1, 5,
- 3, 4, 4, 2, 3, 3, 3, 3, 3, 3,
- 1, 3, 1, 2, 5, 3, 1, 1, 1, 1,
- 1, 3, 3, 3, 3, 3, 3, 3, 2, 2,
- 2, 2, 2, 2, 3, 1, 2, 3, 4, 3,
- 4, 1, 3, 4, 4, 4, 4, 2, 8, 6,
- 8, 8, 6, 6, 6, 6, 6, 6, 6, 6,
- 8, 8, 8, 8, 1, 4, 1, 1, 2, 1,
- 1, 0, 4, 4, 3, 2, 0, 1, 1, 1,
- 1, 2, 0, 1, 1, 2, 2, 2, 2, 2,
- 0, 3, 2, 2, 1, 1, 0, 1, 4, 2,
- 4, 2, 1, 1, 1, 2, 1, 1, 2, 5,
- 1, 1, 1, 6, 9, 6, 7, 10, 9, 6,
- 5,
-};
-short yydefred[] = { 97,
- 0, 0, 99, 100, 101, 98, 0, 96, 0, 0,
- 31, 0, 0, 38, 0, 0, 0, 0, 0, 0,
- 0, 0, 40, 0, 0, 0, 41, 0, 0, 0,
- 0, 0, 87, 0, 88, 103, 0, 11, 0, 97,
- 0, 0, 0, 17, 18, 19, 0, 0, 0, 103,
- 103, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 24,
- 51, 52, 0, 0, 0, 0, 0, 0, 4, 0,
- 103, 0, 103, 103, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 49, 50, 0, 68, 0, 0, 0, 0, 63, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 104, 105, 0, 102, 55,
- 32, 28, 21, 0, 0, 0, 0, 0, 0, 30,
- 0, 0, 0, 0, 48, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 103, 103, 0, 0,
- 64, 65, 67, 0, 0, 0, 0, 0, 0, 0,
- 0, 13, 66, 86, 0, 0, 103, 0, 0, 0,
- 0, 0, 0, 124, 123, 127, 0, 103, 0, 103,
- 10, 103, 0, 110, 0, 115, 0, 0, 0, 22,
- 0, 61, 95, 0, 0, 97, 3, 0, 0, 0,
- 0, 0, 0, 0, 103, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 103,
- 103, 103, 103, 103, 8, 0, 0, 0, 0, 0,
- 73, 0, 78, 0, 77, 0, 80, 0, 79, 0,
- 75, 76, 0, 70, 0, 74, 132, 131, 133, 0,
- 0, 0, 0, 0, 116, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 103, 0, 0, 0, 103, 103, 103, 0, 0, 0,
- 103, 72, 71, 82, 81, 84, 83, 0, 69, 0,
- 0, 0, 0, 0, 0, 130, 0, 0, 0, 136,
- 140, 0, 0, 0, 9, 103, 103, 0, 137, 0,
- 0, 103, 135, 139, 0, 138,
-};
-short yydgoto[] = { 1,
- 2, 7, 38, 74, 128, 39, 40, 41, 171, 104,
- 75, 193, 44, 45, 46, 47, 48, 49, 106, 8,
- 129, 234, 194, 195, 196, 266, 260,
-};
-short yysindex[] = { 0,
- 0, -52, 0, 0, 0, 0, 6281, 0, -83, -65,
- 0, 27, 28, 0, 43, 46, 29, 48, 50, 51,
- -218, 64, 0, -14, 65, 66, 0, 8153, 8153, 6722,
- -176, -176, 0, 8153, 0, 0, 6722, 0, -165, 0,
- -38, -13, 6376, 0, 0, 0, -32, -232, 8198, 0,
- 0, 7770, 8198, 8198, 8153, 8153, 47, 7835, 7883, 8153,
- 69, 8198, 8198, 8153, 8153, 6722, -57, -267, -57, 0,
- 0, 0, -2, -210, -41, 79, 80, 85, 0, -52,
- 0, 8153, 0, 0, 6722, 8153, 7931, 8153, 8153, 8153,
- -32, -166, 8153, 8153, 8153, 8153, 8153, 8153, -150, 6722,
- 0, 0, 6770, 0, 3731, 88, -210, -210, 0, 1055,
- 93, 94, 6815, 184, 8153, 92, 6892, 96, 6939, 7003,
- 8198, 97, 44, 7048, 7094, 0, 0, 5585, 0, 0,
- 0, 0, 0, -210, 7172, 2108, 2108, -60, 7216, 0,
- 184, 184, 184, 184, 0, 45, 45, -57, -57, -57,
- -57, -176, -60, 6770, 6332, 32, 0, 0, 5632, 5700,
- 0, 0, 0, -148, 184, 8153, 8153, 8153, 8153, 8001,
- 102, 0, 0, 0, 8153, 8153, 0, 8198, 8198, 107,
- 121, 127, 8153, 0, 0, 0, 8153, 0, -130, 0,
- 0, 0, 8045, 0, -43, 0, 5899, 8153, -119, 0,
- 8153, 0, 0, 1434, 1434, 0, 0, 37, 5431, 6447,
- 6491, 6548, 134, 7281, 0, 6611, 7327, -210, -45, -45,
- 6722, 6722, 2656, 8045, 8045, 4777, 90, -210, -210, 0,
- 0, 0, 0, 0, 0, 8045, 8045, 8045, 8045, -52,
- 0, 8105, 0, 8153, 0, 8153, 0, 8153, 0, 8153,
- 0, 0, -96, 0, 8153, 0, 0, 0, 0, 8153,
- 8153, -39, -37, 7371, 0, 124, -89, 8198, 5967, -210,
- -210, -210, -210, -210, 144, 7449, 7493, 7560, 7604, 7648,
- 0, 7726, 8045, 8045, 0, 0, 0, 6659, 146, 95,
- 0, 0, 0, 0, 0, 0, 0, -210, 0, 4777,
- 4777, 4777, 2656, -51, 6722, 0, -210, 6014, -85, 0,
- 0, 151, 2656, -35, 0, 0, 0, 152, 0, 4777,
- 4777, 0, 0, 0, 4777, 0,
-};
-short yyrindex[] = { 0,
- 0, 2742, 0, 0, 0, 0, 194, 0, 0, 0,
- 0, 56, 0, 0, 111, 0, 3174, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 2475, 0,
- 2531, 2375, 4311, 0, 0, 0, 2057, 1630, 3897, 0,
- 0, 0, 154, 154, 0, 0, 382, 0, 0, 0,
- 0, 154, 105, 0, 0, 0, 818, 872, 1143, 0,
- 0, 0, 437, 6065, 0, -54, -49, -44, 0, 2798,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 2324, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 4263, 492, 6065, 6065, 0, 0,
- 0, 0, 0, 3222, 0, 0, 0, 0, 0, 0,
- 154, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 6065, 0, 0, 0, 2425, 0, 0,
- 3462, 3507, 3552, 3621, 0, 1956, 2007, 1197, 1251, 1522,
- 1576, 3119, 1901, 0, -23, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 3830, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 504, 504, 0,
- 0, 0, 13, 0, 0, 0, 103, 0, 0, 0,
- 0, 0, 123, 0, 0, 0, 0, 0, 763, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 4830, 173, 242,
- 0, 0, 140, 297, 350, 0, 0, 6065, 4878, 0,
- 0, 0, 0, 0, 0, 3945, 4017, 4106, 4208, 2848,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 141, 0, 0, 0, 105, 0, 4952,
- 5145, 5219, 5266, 5318, 0, 0, 0, 0, 0, 0,
- 0, 0, 398, 484, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 6065, 0, 0,
- 0, 0, 161, 0, 0, 0, 5534, 0, 6180, 0,
- 0, 0, 161, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
-};
-short yygindex[] = { 0,
- -17, 0, 0, 4597, -87, 0, 0, 0, 0, 12,
- 23, 4555, -12, -8, -3, 8435, 4752, 0, -70, 0,
- 0, 0, -124, -191, 0, -264, -7,
-};
-#define YYTABLESIZE 8719
-short yytable[] = { 130,
- 85, 285, 82, 286, 97, 319, 6, 313, 17, 95,
- 93, 82, 94, 18, 96, 233, 258, 16, 19, 159,
- 160, 82, 80, 82, 76, 82, 281, 82, 77, 42,
- 85, 265, 156, 78, 101, 102, 98, 85, 312, 50,
- 85, 85, 85, 85, 85, 85, 197, 85, 318, 82,
- 126, 127, 70, 125, 99, 62, 100, 51, 85, 85,
- 85, 98, 85, 85, 111, 112, 52, 53, 61, 101,
- 102, 125, 203, 122, 123, 158, 63, 241, 259, 99,
- 242, 97, 54, 156, 81, 55, 95, 58, 56, 59,
- 60, 96, 62, 85, 85, 79, 62, 62, 62, 62,
- 62, 267, 62, 62, 64, 65, 115, 138, 121, 99,
- 37, 265, 85, 62, 62, 62, 24, 62, 62, 131,
- 132, 265, 153, 85, 85, 133, 145, 33, 34, 35,
- 152, 158, 172, 162, 163, 166, 174, 173, 98, 168,
- 269, 76, 215, 128, 208, 77, 221, 37, 62, 62,
- 78, 37, 37, 37, 37, 37, 99, 37, 199, 200,
- 222, 128, 227, 118, 126, 127, 223, 62, 37, 37,
- 37, 84, 37, 37, 251, 309, 310, 311, 62, 62,
- 268, 118, 288, 289, 292, 305, 316, 306, 240, 219,
- 220, 317, 322, 1, 92, 323, 324, 92, 117, 118,
- 326, 117, 0, 37, 37, 0, 0, 3, 4, 5,
- 308, 0, 261, 120, 0, 0, 230, 231, 232, 257,
- 0, 0, 37, 66, 0, 0, 28, 0, 29, 83,
- 84, 120, 0, 37, 37, 17, 17, 0, 83, 84,
- 18, 18, 92, 262, 263, 19, 19, 0, 83, 84,
- 83, 84, 83, 84, 83, 84, 0, 85, 85, 85,
- 85, 85, 85, 85, 85, 85, 16, 16, 85, 85,
- 85, 0, 125, 125, 125, 85, 83, 84, 0, 290,
- 0, 85, 122, 85, 85, 85, 85, 85, 0, 85,
- 85, 85, 85, 85, 85, 85, 85, 85, 0, 85,
- 122, 85, 85, 85, 85, 85, 85, 0, 0, 0,
- 304, 0, 62, 62, 62, 62, 62, 62, 62, 62,
- 62, 24, 0, 62, 62, 62, 0, 314, 0, 0,
- 62, 0, 33, 34, 35, 0, 62, 126, 62, 62,
- 62, 62, 62, 0, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 0, 62, 126, 62, 62, 62, 62,
- 62, 62, 128, 128, 128, 0, 0, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 0, 0, 37, 37,
- 37, 57, 118, 118, 118, 37, 0, 0, 0, 0,
- 129, 37, 0, 37, 37, 37, 37, 37, 0, 37,
- 37, 37, 37, 37, 37, 37, 37, 37, 129, 37,
- 0, 37, 37, 37, 37, 37, 37, 0, 57, 0,
- 0, 57, 57, 57, 57, 57, 57, 0, 57, 0,
- 0, 0, 120, 120, 120, 0, 89, 0, 119, 57,
- 57, 0, 0, 57, 57, 0, 12, 13, 0, 0,
- 0, 14, 15, 16, 0, 0, 119, 0, 0, 0,
- 0, 0, 0, 0, 17, 0, 18, 19, 20, 0,
- 22, 0, 0, 89, 57, 57, 89, 89, 89, 89,
- 89, 89, 27, 89, 0, 31, 32, 33, 34, 35,
- 0, 91, 0, 57, 89, 89, 89, 0, 89, 89,
- 0, 122, 122, 122, 57, 57, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 121, 0, 0, 0, 91, 89,
- 89, 91, 91, 91, 91, 0, 91, 0, 91, 0,
- 0, 0, 121, 0, 92, 0, 0, 0, 0, 91,
- 91, 91, 0, 91, 91, 0, 126, 126, 126, 89,
- 89, 0, 92, 0, 0, 92, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 91, 91, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 91, 0, 0, 0, 0, 0, 129,
- 129, 129, 0, 0, 91, 91, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 92, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 57, 57,
- 57, 57, 57, 57, 57, 57, 57, 0, 0, 57,
- 57, 57, 0, 0, 0, 0, 57, 119, 119, 119,
- 0, 0, 57, 0, 57, 57, 57, 57, 57, 0,
- 57, 57, 57, 57, 57, 57, 57, 57, 57, 0,
- 57, 0, 57, 57, 57, 57, 57, 57, 0, 0,
- 0, 0, 0, 89, 89, 89, 89, 89, 89, 89,
- 89, 89, 0, 0, 89, 89, 89, 0, 0, 0,
- 0, 89, 0, 0, 0, 0, 0, 89, 0, 89,
- 89, 89, 89, 89, 0, 89, 89, 89, 89, 89,
- 89, 89, 89, 89, 0, 89, 0, 89, 89, 89,
- 89, 89, 89, 121, 121, 121, 0, 0, 91, 91,
- 91, 91, 91, 91, 91, 91, 91, 0, 0, 91,
- 91, 91, 23, 92, 92, 92, 91, 0, 92, 0,
- 0, 0, 91, 0, 91, 91, 91, 91, 91, 0,
- 91, 91, 91, 91, 91, 91, 91, 91, 91, 0,
- 91, 0, 91, 91, 91, 91, 91, 91, 0, 23,
- 0, 0, 23, 23, 23, 23, 23, 23, 0, 23,
- 0, 0, 0, 0, 0, 0, 0, 54, 0, 0,
- 23, 23, 23, 0, 23, 23, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 54, 23, 23, 54, 54, 54,
- 54, 54, 54, 0, 54, 0, 0, 0, 0, 0,
- 0, 39, 0, 0, 23, 54, 54, 54, 0, 54,
- 54, 0, 0, 0, 0, 23, 23, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 39, 0,
- 54, 39, 39, 39, 39, 39, 39, 0, 39, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 39,
- 39, 39, 0, 39, 39, 0, 0, 0, 0, 0,
- 54, 54, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 39, 39, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 39, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 39, 39, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 23,
- 23, 23, 23, 23, 23, 23, 23, 23, 0, 0,
- 23, 23, 23, 0, 0, 0, 0, 23, 0, 0,
- 0, 0, 0, 23, 0, 23, 23, 23, 23, 23,
- 0, 23, 23, 0, 23, 23, 23, 23, 23, 23,
- 0, 23, 0, 23, 23, 23, 23, 23, 23, 0,
- 0, 0, 0, 0, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 0, 0, 54, 54, 54, 0, 0,
- 0, 0, 54, 0, 66, 161, 0, 28, 54, 29,
- 54, 54, 54, 54, 54, 0, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 0, 54, 86, 54, 54,
- 54, 54, 54, 54, 0, 0, 0, 0, 39, 39,
- 39, 39, 39, 39, 39, 39, 39, 0, 0, 39,
- 39, 39, 53, 0, 0, 0, 39, 0, 0, 0,
- 0, 0, 39, 0, 39, 39, 39, 39, 39, 0,
- 39, 39, 39, 39, 39, 39, 39, 39, 39, 0,
- 39, 0, 39, 0, 0, 39, 39, 39, 0, 53,
- 0, 0, 53, 53, 53, 53, 53, 53, 0, 53,
- 0, 0, 0, 0, 0, 0, 44, 0, 0, 0,
- 53, 53, 53, 0, 53, 53, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 44, 0, 53, 44, 44, 44, 44,
- 44, 44, 0, 44, 0, 0, 0, 0, 0, 0,
- 45, 0, 0, 0, 44, 44, 44, 0, 44, 44,
- 0, 0, 0, 0, 0, 53, 53, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 45, 0, 44,
- 45, 45, 45, 45, 45, 45, 0, 45, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 45, 45,
- 45, 0, 45, 45, 0, 0, 0, 12, 13, 44,
- 44, 0, 14, 15, 16, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 17, 0, 18, 19, 20,
- 0, 22, 0, 45, 0, 0, 23, 24, 25, 26,
- 0, 0, 0, 27, 0, 0, 31, 32, 33, 34,
- 35, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 45, 45, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 53,
- 53, 53, 53, 53, 53, 53, 53, 53, 0, 0,
- 53, 53, 53, 0, 0, 0, 0, 53, 0, 0,
- 0, 0, 0, 53, 0, 53, 53, 53, 53, 53,
- 0, 53, 53, 53, 53, 53, 53, 53, 53, 53,
- 0, 53, 0, 53, 53, 53, 53, 53, 53, 0,
- 0, 0, 0, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 0, 0, 44, 44, 44, 0, 0, 0,
- 0, 44, 0, 66, 0, 0, 28, 44, 29, 44,
- 44, 44, 44, 44, 0, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 0, 44, 0, 44, 44, 44,
- 44, 44, 44, 0, 0, 0, 0, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 0, 0, 45, 45,
- 45, 46, 0, 0, 0, 45, 0, 0, 0, 0,
- 0, 45, 0, 45, 45, 45, 45, 45, 0, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 0, 45,
- 0, 45, 45, 45, 45, 45, 45, 0, 46, 0,
- 0, 46, 46, 46, 46, 46, 46, 0, 46, 0,
- 0, 0, 0, 0, 0, 47, 0, 0, 0, 46,
- 46, 46, 0, 46, 46, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 47, 0, 46, 47, 47, 47, 47, 47,
- 47, 0, 47, 0, 0, 0, 0, 0, 0, 39,
- 0, 0, 0, 47, 47, 47, 0, 47, 47, 0,
- 0, 0, 0, 0, 46, 46, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 39, 0, 47, 39,
- 39, 39, 39, 39, 39, 0, 39, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 39, 39, 39,
- 0, 39, 39, 0, 126, 127, 12, 13, 47, 47,
- 0, 14, 15, 16, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 17, 0, 18, 19, 20, 0,
- 22, 0, 39, 39, 0, 23, 24, 25, 26, 0,
- 0, 0, 27, 0, 0, 31, 32, 33, 34, 35,
- 0, 39, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 39, 39, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 46, 46,
- 46, 46, 46, 46, 46, 46, 46, 0, 0, 46,
- 46, 46, 0, 0, 0, 0, 46, 0, 0, 0,
- 0, 0, 46, 0, 46, 46, 46, 46, 46, 0,
- 46, 46, 46, 46, 46, 46, 46, 46, 46, 0,
- 46, 0, 46, 46, 46, 46, 46, 46, 0, 0,
- 0, 0, 47, 47, 47, 47, 47, 47, 47, 47,
- 47, 0, 0, 47, 47, 47, 0, 0, 0, 0,
- 47, 0, 0, 0, 0, 0, 47, 0, 47, 47,
- 47, 47, 47, 0, 47, 47, 47, 47, 47, 47,
- 47, 47, 47, 0, 47, 0, 47, 47, 47, 47,
- 47, 47, 0, 0, 0, 0, 39, 39, 39, 39,
- 39, 39, 39, 39, 39, 0, 0, 39, 39, 39,
- 36, 0, 0, 0, 39, 0, 0, 0, 0, 0,
- 39, 0, 39, 39, 39, 39, 39, 0, 0, 39,
- 39, 39, 39, 39, 39, 39, 39, 0, 39, 0,
- 39, 0, 0, 39, 39, 39, 0, 36, 0, 0,
- 36, 36, 36, 36, 36, 36, 0, 36, 0, 0,
- 0, 0, 0, 0, 0, 42, 0, 0, 36, 36,
- 36, 0, 36, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 36, 36, 42, 42, 0, 42, 42,
- 42, 0, 0, 0, 0, 0, 43, 0, 0, 0,
- 0, 0, 36, 42, 42, 42, 0, 42, 42, 0,
- 0, 0, 0, 36, 36, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 43, 43, 42, 43,
- 43, 43, 0, 0, 0, 0, 33, 0, 0, 0,
- 0, 0, 0, 0, 43, 43, 43, 0, 43, 43,
- 0, 0, 0, 0, 0, 0, 0, 0, 42, 42,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 33, 33, 0, 43,
- 33, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 33, 33, 33, 0, 33, 33,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 43,
- 43, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 37, 0, 33,
- 28, 0, 29, 0, 0, 0, 0, 36, 36, 36,
- 36, 36, 36, 36, 36, 36, 0, 0, 36, 36,
- 36, 0, 0, 0, 0, 36, 0, 0, 0, 33,
- 33, 36, 0, 36, 36, 36, 36, 36, 0, 36,
- 0, 0, 36, 36, 36, 36, 36, 36, 0, 36,
- 0, 36, 36, 36, 36, 36, 36, 0, 0, 0,
- 0, 0, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 0, 0, 42, 42, 42, 0, 0, 0, 0,
- 42, 0, 0, 0, 0, 0, 42, 0, 42, 42,
- 42, 42, 42, 0, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 0, 42, 0, 42, 42, 42, 42,
- 42, 42, 0, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 0, 0, 43, 43, 43, 0, 0, 0,
- 0, 43, 0, 0, 0, 0, 0, 43, 0, 43,
- 43, 43, 43, 43, 0, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 0, 43, 0, 43, 43, 43,
- 43, 43, 43, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 0, 34, 33, 33, 33, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 33, 0, 33,
- 33, 33, 33, 33, 0, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 0, 33, 0, 33, 33, 33,
- 33, 33, 33, 34, 34, 0, 11, 34, 126, 127,
- 12, 13, 0, 0, 14, 14, 15, 16, 0, 0,
- 0, 34, 34, 34, 0, 34, 34, 0, 17, 0,
- 18, 19, 20, 0, 22, 0, 0, 0, 0, 23,
- 24, 25, 26, 0, 0, 0, 27, 0, 30, 31,
- 32, 33, 34, 35, 14, 0, 34, 14, 0, 14,
- 0, 0, 0, 0, 15, 0, 0, 0, 0, 0,
- 0, 0, 0, 14, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 34, 34, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 15, 0, 0, 15, 0, 15,
- 0, 0, 0, 0, 12, 0, 0, 0, 0, 0,
- 0, 0, 0, 15, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 14, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 12, 0, 0, 12, 0, 12,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 7, 0, 0, 12, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 7, 0, 0, 7, 0, 7, 0, 0, 0, 0,
- 34, 34, 34, 34, 34, 34, 34, 34, 34, 7,
- 0, 34, 34, 34, 0, 0, 0, 12, 0, 0,
- 0, 0, 0, 0, 34, 0, 34, 34, 34, 34,
- 34, 0, 34, 34, 34, 34, 34, 34, 34, 34,
- 34, 0, 34, 0, 34, 34, 34, 34, 34, 34,
- 0, 14, 14, 14, 14, 14, 14, 14, 14, 0,
- 0, 0, 14, 14, 14, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 14, 0, 14, 14, 14,
- 14, 14, 0, 0, 0, 0, 14, 14, 14, 14,
- 0, 0, 0, 14, 0, 14, 14, 14, 14, 14,
- 14, 15, 15, 15, 15, 15, 15, 15, 15, 0,
- 0, 0, 15, 15, 15, 66, 0, 0, 28, 0,
- 29, 0, 0, 0, 0, 15, 0, 15, 15, 15,
- 15, 15, 0, 0, 0, 0, 15, 15, 15, 15,
- 0, 0, 0, 15, 0, 15, 15, 15, 15, 15,
- 15, 12, 12, 12, 12, 0, 12, 12, 12, 0,
- 0, 6, 12, 12, 12, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 12, 0, 12, 12, 12,
- 12, 12, 0, 0, 0, 0, 12, 12, 12, 12,
- 0, 0, 0, 12, 0, 12, 12, 12, 12, 12,
- 12, 6, 0, 0, 6, 0, 6, 7, 7, 7,
- 7, 7, 7, 7, 7, 0, 0, 5, 7, 7,
- 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 7, 0, 7, 7, 7, 7, 7, 0, 0,
- 0, 0, 7, 7, 7, 7, 0, 0, 0, 7,
- 0, 7, 7, 7, 7, 7, 7, 5, 0, 0,
- 5, 0, 5, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 6, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
- 2, 0, 2, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 12, 13,
- 5, 178, 179, 14, 15, 16, 0, 0, 0, 0,
- 0, 183, 184, 185, 186, 187, 17, 0, 18, 19,
- 20, 0, 22, 189, 0, 0, 0, 23, 24, 25,
- 26, 0, 0, 0, 27, 0, 0, 31, 32, 33,
- 34, 35, 0, 0, 0, 0, 0, 0, 0, 0,
- 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 6, 6,
- 6, 0, 0, 0, 6, 6, 0, 0, 0, 6,
- 6, 6, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 6, 0, 6, 6, 6, 6, 6, 0,
- 0, 0, 0, 6, 6, 6, 6, 0, 0, 0,
- 6, 0, 6, 6, 6, 6, 6, 6, 0, 0,
- 0, 0, 0, 0, 5, 5, 5, 0, 0, 0,
- 5, 5, 0, 0, 0, 5, 5, 5, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 5, 0,
- 5, 5, 5, 5, 5, 0, 0, 0, 0, 5,
- 5, 5, 5, 0, 0, 0, 5, 0, 5, 5,
- 5, 5, 5, 5, 2, 2, 2, 0, 0, 0,
- 2, 2, 0, 0, 0, 2, 2, 2, 60, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
- 2, 2, 2, 2, 2, 0, 0, 0, 0, 2,
- 2, 2, 2, 0, 0, 0, 2, 0, 2, 2,
- 2, 2, 2, 2, 0, 60, 0, 0, 60, 60,
- 60, 60, 60, 60, 0, 60, 0, 0, 0, 0,
- 0, 0, 0, 56, 0, 0, 60, 60, 60, 0,
- 60, 60, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 56, 60, 60, 56, 56, 56, 56, 56, 56, 0,
- 56, 58, 0, 0, 0, 0, 0, 0, 0, 0,
- 60, 56, 56, 0, 0, 56, 56, 0, 0, 0,
- 0, 60, 60, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 58, 0,
- 0, 0, 58, 58, 0, 58, 56, 56, 58, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 58,
- 58, 58, 0, 58, 58, 56, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 56, 56, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 58, 58, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 58, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 58, 58, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 0, 0, 60, 60, 60, 0,
- 0, 0, 0, 60, 0, 0, 0, 0, 0, 60,
- 0, 60, 60, 60, 60, 60, 0, 60, 60, 60,
- 60, 0, 60, 60, 60, 60, 0, 60, 0, 60,
- 60, 60, 0, 0, 0, 0, 0, 0, 0, 0,
- 56, 56, 56, 56, 56, 56, 56, 56, 56, 0,
- 0, 56, 56, 56, 0, 0, 0, 0, 56, 0,
- 0, 0, 0, 0, 56, 0, 56, 56, 56, 56,
- 56, 29, 56, 56, 56, 56, 0, 56, 56, 56,
- 56, 0, 56, 0, 56, 56, 56, 0, 58, 58,
- 58, 58, 58, 58, 0, 0, 58, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 58, 0, 29, 0,
- 0, 0, 29, 29, 0, 29, 25, 58, 29, 0,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 29,
- 29, 29, 58, 29, 29, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 25, 0, 0, 0, 25, 25, 0,
- 25, 27, 0, 25, 29, 29, 0, 0, 0, 0,
- 0, 0, 0, 0, 25, 25, 25, 0, 25, 25,
- 0, 0, 0, 29, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 29, 29, 0, 0, 27, 0,
- 0, 0, 27, 27, 0, 27, 0, 0, 27, 25,
- 25, 0, 0, 0, 0, 0, 0, 0, 0, 27,
- 27, 27, 0, 27, 27, 0, 0, 0, 25, 0,
- 26, 0, 0, 0, 0, 0, 0, 0, 0, 25,
- 25, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 27, 27, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 26, 0, 0,
- 0, 26, 26, 27, 26, 0, 0, 26, 0, 0,
- 0, 0, 0, 0, 27, 27, 0, 0, 26, 26,
- 26, 0, 26, 26, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 26, 26, 0, 0, 0, 29, 29,
- 29, 29, 29, 29, 0, 0, 29, 0, 0, 0,
- 0, 0, 26, 0, 0, 0, 29, 0, 0, 0,
- 0, 0, 0, 26, 26, 0, 0, 29, 0, 0,
- 29, 29, 29, 29, 29, 29, 29, 29, 29, 0,
- 0, 0, 29, 25, 25, 25, 25, 25, 25, 0,
- 66, 25, 0, 28, 157, 29, 0, 0, 0, 0,
- 0, 25, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 25, 86, 0, 25, 25, 25, 25, 25,
- 25, 25, 25, 25, 0, 0, 0, 25, 27, 27,
- 27, 27, 27, 27, 0, 0, 27, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 27, 0, 0, 59,
- 0, 0, 0, 0, 0, 0, 0, 27, 0, 0,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 0,
- 0, 0, 27, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 59, 0, 0, 0,
- 59, 59, 0, 59, 0, 0, 59, 26, 26, 26,
- 26, 26, 26, 0, 0, 26, 0, 59, 59, 59,
- 0, 59, 59, 0, 0, 26, 92, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 26, 0, 0, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 0, 0,
- 0, 26, 59, 59, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 92, 0, 0, 0, 92, 92, 0,
- 92, 59, 0, 92, 20, 0, 0, 0, 0, 0,
- 0, 0, 59, 59, 92, 92, 92, 0, 92, 92,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 20, 0, 0, 0, 20, 20, 0, 20, 92,
- 92, 20, 0, 12, 13, 0, 0, 0, 14, 15,
- 16, 0, 20, 20, 20, 0, 20, 0, 92, 0,
- 0, 17, 0, 18, 19, 20, 35, 22, 0, 92,
- 92, 0, 23, 24, 25, 26, 0, 0, 0, 27,
- 0, 0, 31, 32, 33, 34, 35, 20, 20, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 35, 0, 0, 20, 35, 35, 0,
- 35, 0, 0, 35, 0, 0, 0, 20, 20, 0,
- 0, 0, 0, 0, 35, 35, 35, 0, 35, 0,
- 0, 0, 0, 0, 0, 0, 59, 59, 59, 59,
- 59, 59, 0, 0, 59, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 59, 93, 0, 0, 0, 35,
- 35, 0, 0, 0, 0, 59, 0, 0, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 0, 35, 0,
- 59, 0, 0, 0, 0, 0, 0, 0, 0, 35,
- 35, 0, 93, 0, 0, 0, 93, 93, 0, 93,
- 0, 0, 93, 92, 92, 92, 92, 92, 92, 0,
- 0, 92, 0, 93, 93, 93, 0, 93, 0, 0,
- 0, 92, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 92, 0, 0, 92, 92, 92, 0, 0,
- 0, 0, 92, 92, 0, 0, 0, 92, 93, 93,
- 0, 20, 20, 20, 20, 20, 20, 94, 0, 20,
- 0, 0, 0, 0, 0, 0, 0, 93, 0, 20,
- 0, 0, 0, 0, 0, 0, 0, 0, 93, 93,
- 20, 0, 0, 20, 20, 20, 0, 0, 0, 0,
- 20, 20, 0, 0, 94, 20, 0, 0, 94, 94,
- 0, 94, 0, 0, 94, 0, 0, 0, 0, 0,
- 0, 0, 90, 0, 0, 94, 94, 94, 0, 94,
- 0, 0, 0, 35, 35, 35, 35, 35, 35, 0,
- 0, 35, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 35, 0, 0, 0, 0, 0, 0, 0, 90,
- 94, 94, 35, 90, 90, 35, 35, 35, 0, 90,
- 16, 0, 35, 35, 0, 0, 0, 35, 0, 94,
- 90, 90, 90, 0, 90, 0, 0, 0, 0, 0,
- 94, 94, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 16, 0, 0,
- 0, 16, 16, 0, 16, 90, 90, 16, 0, 0,
- 0, 0, 93, 93, 93, 93, 93, 93, 16, 16,
- 93, 0, 0, 0, 90, 0, 0, 0, 0, 0,
- 93, 0, 0, 0, 0, 90, 90, 0, 0, 0,
- 0, 93, 0, 0, 93, 93, 93, 0, 0, 0,
- 0, 93, 93, 16, 16, 0, 93, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 16, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 16, 16, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 94, 94, 94, 94, 94, 94,
- 0, 0, 94, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 94, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 94, 0, 0, 94, 94, 94, 0,
- 0, 0, 0, 94, 94, 0, 0, 0, 94, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 90,
- 90, 90, 90, 90, 90, 0, 0, 90, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 90, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 90, 0,
- 0, 90, 90, 90, 0, 0, 0, 0, 90, 90,
- 0, 43, 0, 90, 0, 0, 0, 16, 16, 16,
- 16, 16, 16, 0, 0, 16, 0, 0, 0, 0,
- 0, 0, 0, 0, 43, 16, 0, 0, 0, 0,
- 0, 43, 0, 0, 0, 0, 16, 0, 0, 16,
- 16, 16, 0, 105, 0, 0, 110, 105, 105, 113,
- 114, 16, 117, 119, 120, 0, 105, 105, 124, 125,
- 43, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 135, 0, 0, 43,
- 139, 141, 142, 143, 144, 0, 107, 108, 0, 0,
- 0, 0, 0, 0, 43, 0, 0, 155, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 165,
- 0, 0, 0, 0, 0, 105, 0, 134, 0, 136,
- 137, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 43, 43, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 155, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 209, 210, 211, 212, 214, 0, 0, 0, 0, 216,
- 217, 0, 105, 105, 0, 0, 0, 224, 0, 0,
- 0, 225, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 236, 204, 205, 237, 0, 0, 238, 239,
- 0, 0, 0, 0, 0, 0, 0, 0, 57, 0,
- 0, 0, 0, 218, 0, 43, 43, 264, 0, 68,
- 68, 0, 71, 72, 226, 68, 228, 0, 229, 0,
- 0, 0, 0, 0, 68, 0, 276, 0, 277, 0,
- 278, 0, 279, 0, 280, 0, 0, 0, 0, 282,
- 0, 253, 0, 0, 283, 284, 66, 0, 0, 28,
- 0, 29, 105, 0, 0, 0, 270, 271, 272, 273,
- 274, 0, 0, 0, 0, 192, 0, 0, 0, 0,
- 0, 0, 43, 0, 68, 68, 68, 68, 68, 68,
- 0, 0, 0, 0, 0, 0, 68, 0, 0, 43,
- 0, 68, 0, 0, 68, 68, 0, 0, 68, 114,
- 68, 68, 114, 0, 114, 68, 68, 298, 0, 0,
- 0, 300, 301, 302, 0, 0, 68, 307, 114, 0,
- 68, 0, 68, 68, 68, 68, 0, 0, 0, 190,
- 0, 0, 0, 202, 0, 0, 68, 0, 0, 0,
- 0, 0, 320, 321, 0, 0, 68, 113, 325, 0,
- 113, 0, 113, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 113, 0, 0, 0,
- 0, 0, 0, 0, 68, 0, 0, 0, 0, 0,
- 0, 0, 114, 0, 114, 0, 0, 0, 0, 0,
- 68, 68, 68, 68, 0, 68, 0, 68, 68, 0,
- 0, 0, 0, 0, 0, 68, 68, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 68, 68, 68,
- 68, 107, 0, 0, 107, 0, 107, 0, 0, 0,
- 113, 0, 113, 0, 0, 0, 0, 0, 0, 0,
- 107, 0, 0, 0, 0, 68, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 68, 68, 68,
- 68, 68, 0, 68, 68, 68, 177, 126, 127, 12,
- 13, 0, 178, 179, 14, 15, 16, 180, 0, 181,
- 182, 0, 183, 184, 185, 186, 187, 17, 188, 18,
- 19, 20, 0, 22, 189, 0, 0, 0, 23, 24,
- 25, 26, 0, 0, 107, 27, 107, 0, 31, 32,
- 33, 34, 35, 0, 0, 0, 0, 0, 0, 114,
- 0, 0, 114, 114, 0, 114, 114, 114, 114, 114,
- 114, 114, 114, 114, 0, 114, 114, 114, 114, 114,
- 114, 114, 114, 114, 114, 0, 114, 114, 0, 0,
- 0, 114, 114, 114, 114, 0, 0, 0, 114, 0,
- 0, 114, 114, 114, 114, 114, 0, 113, 0, 0,
- 113, 113, 0, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 0, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 0, 113, 113, 0, 0, 0, 113,
- 113, 113, 113, 0, 0, 0, 113, 0, 0, 113,
- 113, 113, 113, 113, 108, 0, 0, 108, 0, 108,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 108, 0, 0, 0, 0, 0, 0,
- 0, 107, 0, 0, 107, 107, 0, 107, 107, 107,
- 107, 107, 107, 107, 107, 107, 0, 107, 107, 107,
- 107, 107, 107, 107, 107, 107, 107, 0, 107, 107,
- 0, 0, 0, 107, 107, 107, 107, 0, 0, 0,
- 107, 0, 0, 107, 107, 107, 107, 107, 109, 0,
- 0, 109, 0, 109, 0, 0, 0, 108, 0, 108,
- 0, 0, 0, 0, 0, 0, 0, 109, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 106, 0, 0, 106, 0,
- 106, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 106, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 109, 0, 109, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 112, 0, 0,
- 112, 0, 112, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 106, 0,
- 106, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 108, 0, 0, 108, 108, 0,
- 108, 108, 108, 108, 108, 108, 108, 108, 108, 0,
- 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
- 0, 108, 108, 0, 0, 0, 108, 108, 108, 108,
- 112, 0, 112, 108, 0, 0, 108, 108, 108, 108,
- 108, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 66, 243, 0, 28, 244, 29, 0, 0, 109, 0,
- 0, 109, 109, 0, 109, 109, 109, 109, 109, 109,
- 109, 109, 109, 86, 109, 109, 109, 109, 109, 109,
- 109, 109, 109, 109, 0, 109, 109, 0, 0, 0,
- 109, 109, 109, 109, 0, 0, 0, 109, 0, 0,
- 109, 109, 109, 109, 109, 106, 0, 0, 106, 106,
- 0, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 0, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 0, 106, 106, 0, 0, 0, 106, 106, 106,
- 106, 0, 0, 0, 106, 0, 0, 106, 106, 106,
- 106, 106, 0, 141, 0, 0, 141, 112, 141, 0,
- 112, 112, 0, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 141, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 0, 112, 112, 0, 0, 0, 112,
- 112, 112, 112, 0, 0, 0, 112, 0, 0, 112,
- 112, 112, 112, 112, 66, 0, 0, 28, 0, 29,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 192, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 141, 0, 141, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 66, 0, 0, 28, 0, 29, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 192, 0, 0, 12, 13, 0, 0, 0, 14, 15,
- 16, 0, 0, 0, 0, 0, 0, 190, 0, 191,
- 0, 17, 0, 18, 19, 20, 0, 22, 0, 0,
- 0, 0, 23, 24, 25, 26, 0, 0, 0, 27,
- 0, 0, 31, 32, 33, 34, 35, 0, 0, 66,
- 0, 0, 28, 0, 29, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 190, 0, 206, 0, 192, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 141, 0, 0, 141, 141, 0, 141,
- 141, 141, 141, 141, 141, 141, 141, 141, 0, 141,
- 141, 141, 141, 141, 141, 141, 141, 141, 141, 0,
- 141, 141, 190, 0, 207, 141, 141, 141, 141, 0,
- 0, 0, 141, 0, 0, 141, 141, 141, 141, 141,
- 0, 0, 0, 0, 177, 0, 0, 12, 13, 0,
- 178, 179, 14, 15, 16, 180, 0, 181, 182, 0,
- 183, 184, 185, 186, 187, 17, 188, 18, 19, 20,
- 0, 22, 189, 0, 0, 0, 23, 24, 25, 26,
- 0, 0, 0, 27, 0, 0, 31, 32, 33, 34,
- 35, 177, 0, 0, 12, 13, 0, 178, 179, 14,
- 15, 16, 180, 0, 181, 182, 0, 183, 184, 185,
- 186, 187, 17, 188, 18, 19, 20, 0, 22, 189,
- 0, 0, 0, 23, 24, 25, 26, 0, 0, 0,
- 27, 0, 0, 31, 32, 33, 34, 35, 66, 0,
- 0, 28, 0, 29, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 192, 0, 177,
- 0, 0, 12, 13, 0, 178, 179, 14, 15, 16,
- 180, 0, 181, 182, 0, 183, 184, 185, 186, 187,
- 17, 188, 18, 19, 20, 0, 22, 189, 0, 0,
- 0, 23, 24, 25, 26, 0, 0, 0, 27, 0,
- 0, 31, 32, 33, 34, 35, 66, 0, 0, 28,
- 0, 29, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 190, 0, 235, 0, 192, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 66, 0, 0, 28, 0, 29, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 192, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 190,
- 0, 291, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 111, 0, 0, 111, 0, 111,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 111, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 190, 0, 315, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 177, 0,
- 0, 12, 13, 0, 178, 179, 14, 15, 16, 180,
- 0, 181, 182, 0, 183, 184, 185, 186, 187, 17,
- 188, 18, 19, 20, 0, 22, 189, 111, 0, 111,
- 23, 24, 25, 26, 0, 0, 0, 27, 0, 0,
- 31, 32, 33, 34, 35, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 134,
- 0, 0, 134, 0, 134, 0, 177, 0, 0, 12,
- 13, 0, 178, 179, 14, 15, 16, 180, 134, 181,
- 182, 0, 183, 184, 185, 186, 187, 17, 188, 18,
- 19, 20, 0, 22, 189, 0, 0, 0, 23, 24,
- 25, 26, 0, 0, 0, 27, 0, 0, 31, 32,
- 33, 34, 35, 177, 0, 0, 12, 13, 0, 178,
- 179, 14, 15, 16, 180, 0, 181, 182, 0, 183,
- 184, 185, 186, 187, 17, 188, 18, 19, 20, 0,
- 22, 189, 134, 0, 134, 23, 24, 25, 26, 0,
- 0, 0, 27, 0, 0, 31, 32, 33, 34, 35,
- 37, 0, 0, 28, 111, 29, 0, 111, 111, 0,
- 111, 111, 111, 111, 111, 111, 0, 111, 111, 0,
- 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
- 0, 111, 111, 0, 0, 0, 111, 111, 111, 111,
- 0, 0, 0, 111, 0, 0, 111, 111, 111, 111,
- 111, 66, 0, 0, 28, 157, 29, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 89, 0, 90, 86, 0, 0, 0, 0, 0,
- 0, 0, 0, 36, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 66, 0, 0, 28, 0,
- 29, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 89, 0, 90, 86, 134,
- 0, 0, 134, 134, 0, 134, 134, 134, 134, 134,
- 134, 0, 134, 134, 0, 134, 134, 134, 134, 134,
- 134, 134, 134, 134, 134, 0, 134, 134, 0, 0,
- 0, 134, 134, 134, 134, 0, 0, 0, 134, 0,
- 0, 134, 134, 134, 134, 134, 66, 245, 0, 28,
- 246, 29, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 86,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 66, 247, 0, 28, 248, 29, 0, 9, 10, 11,
- 0, 0, 0, 12, 13, 0, 0, 0, 14, 15,
- 16, 0, 0, 86, 0, 0, 0, 0, 0, 0,
- 0, 17, 0, 18, 19, 20, 21, 22, 0, 0,
- 0, 0, 23, 24, 25, 26, 0, 0, 0, 27,
- 0, 30, 31, 32, 33, 34, 35, 66, 249, 0,
- 28, 250, 29, 0, 12, 13, 0, 0, 0, 14,
- 15, 16, 0, 0, 0, 0, 0, 0, 0, 0,
- 86, 0, 17, 0, 18, 19, 20, 0, 22, 0,
- 0, 0, 0, 23, 24, 25, 26, 87, 88, 0,
- 27, 0, 0, 31, 32, 33, 34, 35, 12, 13,
- 0, 0, 0, 14, 15, 16, 0, 0, 0, 0,
- 66, 254, 0, 28, 255, 29, 17, 0, 18, 19,
- 20, 0, 22, 0, 0, 0, 0, 23, 24, 25,
- 26, 87, 88, 86, 27, 0, 0, 31, 32, 33,
- 34, 35, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 37, 0,
- 0, 28, 0, 29, 0, 0, 0, 0, 0, 12,
- 13, 0, 0, 0, 14, 15, 16, 303, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 17, 0, 18,
- 19, 20, 0, 22, 0, 0, 0, 0, 23, 24,
- 25, 26, 0, 0, 0, 27, 0, 0, 31, 32,
- 33, 34, 35, 12, 13, 0, 0, 0, 14, 15,
- 16, 37, 0, 0, 28, 0, 29, 0, 0, 0,
- 0, 17, 0, 18, 19, 20, 0, 22, 0, 0,
- 0, 0, 23, 24, 25, 26, 0, 0, 0, 27,
- 0, 0, 31, 32, 33, 34, 35, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 154,
- 12, 13, 28, 0, 29, 14, 15, 16, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 17, 0,
- 18, 19, 20, 0, 22, 0, 0, 0, 0, 23,
- 24, 25, 26, 0, 0, 0, 27, 0, 0, 31,
- 32, 33, 34, 35, 66, 0, 0, 28, 164, 29,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 12, 13, 0, 0, 86, 14, 15,
- 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 17, 0, 18, 19, 20, 0, 22, 0, 0,
- 0, 0, 23, 24, 25, 26, 0, 0, 0, 27,
- 0, 0, 31, 32, 33, 34, 35, 11, 0, 0,
- 0, 12, 13, 0, 0, 0, 14, 15, 16, 0,
- 0, 66, 0, 0, 28, 167, 29, 0, 0, 17,
- 0, 18, 19, 20, 0, 22, 0, 0, 0, 0,
- 23, 24, 25, 26, 86, 0, 0, 27, 0, 30,
- 31, 32, 33, 34, 35, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 66, 0,
- 11, 28, 169, 29, 12, 13, 0, 0, 0, 14,
- 15, 16, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 86, 17, 0, 18, 19, 20, 0, 22, 0,
- 0, 0, 0, 23, 24, 25, 26, 0, 0, 0,
- 27, 0, 30, 31, 32, 33, 34, 35, 11, 0,
- 0, 0, 12, 13, 0, 0, 0, 14, 15, 16,
- 0, 0, 66, 0, 0, 28, 170, 29, 0, 0,
- 17, 0, 18, 19, 20, 0, 22, 0, 0, 0,
- 0, 23, 24, 25, 26, 86, 0, 0, 27, 0,
- 30, 31, 32, 33, 34, 35, 0, 12, 13, 0,
- 0, 0, 14, 15, 16, 0, 0, 66, 0, 0,
- 28, 175, 29, 0, 0, 17, 0, 18, 19, 20,
- 0, 22, 0, 0, 0, 0, 23, 24, 25, 26,
- 86, 0, 0, 27, 0, 0, 31, 32, 33, 34,
- 35, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 66, 0, 0, 28, 176, 29, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 12, 13, 86, 0, 0, 14,
- 15, 16, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 17, 0, 18, 19, 20, 0, 22, 0,
- 0, 0, 0, 23, 24, 25, 26, 0, 0, 0,
- 27, 0, 0, 31, 32, 33, 34, 35, 0, 0,
- 0, 12, 13, 0, 0, 0, 14, 15, 16, 0,
- 0, 66, 0, 0, 28, 0, 29, 0, 0, 17,
- 0, 18, 19, 20, 0, 22, 0, 0, 0, 198,
- 23, 24, 25, 26, 86, 0, 0, 27, 0, 0,
- 31, 32, 33, 34, 35, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 66, 0, 0, 28, 0,
- 29, 0, 0, 0, 0, 12, 13, 0, 0, 0,
- 14, 15, 16, 201, 0, 0, 0, 0, 86, 0,
- 0, 0, 0, 17, 0, 18, 19, 20, 0, 22,
- 0, 0, 0, 0, 23, 24, 25, 26, 0, 0,
- 0, 27, 0, 0, 31, 32, 33, 34, 35, 0,
- 12, 13, 0, 0, 0, 14, 15, 16, 0, 0,
- 66, 252, 0, 28, 0, 29, 0, 0, 17, 0,
- 18, 19, 20, 0, 22, 0, 0, 0, 0, 23,
- 24, 25, 26, 86, 0, 0, 27, 0, 0, 31,
- 32, 33, 34, 35, 0, 0, 12, 13, 0, 0,
- 0, 14, 15, 16, 0, 0, 66, 256, 0, 28,
- 0, 29, 0, 0, 17, 0, 18, 19, 20, 0,
- 22, 0, 0, 0, 0, 23, 24, 25, 26, 86,
- 0, 0, 27, 0, 0, 31, 32, 33, 34, 35,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 66, 287, 0, 28, 0, 29, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 86, 12, 13, 0, 0, 0, 14,
- 15, 16, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 17, 0, 18, 19, 20, 0, 22, 0,
- 0, 0, 0, 23, 24, 25, 26, 0, 0, 0,
- 27, 0, 0, 31, 32, 33, 34, 35, 12, 13,
- 0, 0, 0, 14, 15, 16, 0, 0, 66, 293,
- 0, 28, 0, 29, 0, 0, 17, 0, 18, 19,
- 20, 0, 22, 0, 0, 0, 0, 23, 24, 25,
- 26, 86, 0, 0, 27, 0, 0, 31, 32, 33,
- 34, 35, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 66, 294, 0, 28, 0, 29, 0, 0,
- 0, 0, 0, 12, 13, 0, 0, 0, 14, 15,
- 16, 0, 0, 0, 0, 86, 0, 0, 0, 0,
- 0, 17, 0, 18, 19, 20, 0, 22, 0, 0,
- 0, 0, 23, 24, 25, 26, 0, 0, 0, 27,
- 0, 0, 31, 32, 33, 34, 35, 0, 0, 12,
- 13, 0, 0, 0, 14, 15, 16, 0, 0, 66,
- 295, 0, 28, 0, 29, 0, 0, 17, 0, 18,
- 19, 20, 0, 22, 0, 0, 0, 0, 23, 24,
- 25, 26, 86, 0, 0, 27, 0, 0, 31, 32,
- 33, 34, 35, 12, 13, 0, 0, 0, 14, 15,
- 16, 0, 0, 66, 296, 0, 28, 0, 29, 0,
- 0, 17, 0, 18, 19, 20, 0, 22, 0, 0,
- 0, 0, 23, 24, 25, 26, 86, 0, 0, 27,
- 0, 0, 31, 32, 33, 34, 35, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 66, 297, 0,
- 28, 0, 29, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 86, 12, 13, 0, 0, 0, 14, 15, 16, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 17,
- 0, 18, 19, 20, 0, 22, 0, 0, 0, 0,
- 23, 24, 25, 26, 0, 0, 0, 27, 0, 0,
- 31, 32, 33, 34, 35, 12, 13, 0, 0, 0,
- 14, 15, 16, 0, 0, 66, 299, 0, 28, 0,
- 29, 0, 0, 17, 0, 18, 19, 20, 0, 22,
- 0, 0, 0, 0, 23, 24, 25, 26, 86, 0,
- 0, 27, 0, 0, 31, 32, 33, 34, 35, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 66,
- 109, 0, 28, 0, 29, 0, 0, 0, 0, 0,
- 0, 0, 12, 13, 0, 0, 0, 14, 15, 16,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 17, 0, 18, 19, 20, 0, 22, 0, 0, 0,
- 0, 23, 24, 25, 26, 0, 0, 0, 27, 0,
- 0, 31, 32, 33, 34, 35, 12, 13, 0, 0,
- 0, 14, 15, 16, 66, 0, 0, 28, 0, 29,
- 0, 0, 0, 0, 17, 0, 18, 19, 20, 0,
- 22, 0, 0, 0, 0, 23, 24, 25, 26, 0,
- 0, 0, 27, 0, 0, 31, 32, 33, 34, 35,
- 12, 13, 0, 0, 0, 14, 15, 16, 0, 0,
- 0, 0, 66, 0, 0, 28, 0, 29, 17, 0,
- 18, 19, 20, 0, 22, 0, 0, 0, 0, 23,
- 24, 25, 26, 0, 0, 0, 27, 0, 0, 31,
- 32, 33, 34, 35, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 66, 0, 0, 28, 0, 29, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 12, 13,
- 0, 0, 0, 14, 15, 16, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 17, 0, 18, 19,
- 20, 0, 22, 0, 0, 0, 0, 23, 24, 25,
- 26, 0, 0, 0, 27, 0, 0, 31, 32, 33,
- 34, 35, 12, 13, 0, 0, 0, 14, 15, 16,
- 66, 0, 0, 28, 0, 29, 0, 0, 0, 0,
- 17, 0, 18, 19, 20, 0, 22, 0, 0, 0,
- 0, 23, 24, 25, 26, 0, 0, 0, 27, 0,
- 0, 31, 32, 33, 34, 35, 0, 0, 0, 0,
- 0, 0, 0, 0, 66, 0, 0, 28, 0, 29,
- 0, 0, 0, 116, 0, 0, 0, 12, 13, 0,
- 0, 0, 14, 15, 16, 0, 0, 86, 0, 0,
- 0, 0, 0, 0, 0, 17, 0, 18, 19, 20,
- 0, 22, 0, 0, 0, 0, 23, 24, 25, 26,
- 0, 0, 0, 27, 0, 0, 31, 32, 33, 34,
- 35, 118, 0, 0, 66, 12, 13, 28, 0, 29,
- 14, 15, 16, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 17, 0, 18, 19, 20, 0, 22,
- 0, 0, 0, 0, 23, 24, 25, 26, 0, 0,
- 0, 27, 0, 0, 31, 32, 33, 34, 35, 140,
- 0, 0, 66, 12, 13, 28, 0, 29, 14, 15,
- 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 17, 0, 18, 19, 20, 0, 22, 0, 0,
- 0, 0, 23, 24, 25, 26, 0, 0, 0, 27,
- 0, 0, 31, 32, 33, 34, 35, 103, 0, 0,
- 28, 0, 29, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 213,
- 0, 0, 0, 12, 13, 0, 0, 0, 14, 15,
- 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 17, 0, 18, 19, 20, 0, 22, 0, 0,
- 0, 0, 23, 24, 25, 26, 0, 0, 0, 27,
- 0, 0, 31, 32, 33, 34, 35, 12, 13, 0,
- 0, 0, 14, 15, 16, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 17, 0, 18, 19, 20,
- 0, 22, 0, 0, 0, 0, 23, 24, 25, 26,
- 0, 0, 0, 27, 0, 0, 31, 32, 33, 34,
- 35, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 275, 0, 0, 0, 12, 13, 0,
- 0, 0, 14, 15, 16, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 17, 0, 18, 19, 20,
- 0, 22, 0, 0, 0, 0, 23, 24, 25, 26,
- 0, 0, 0, 27, 0, 0, 31, 32, 33, 34,
- 35, 0, 0, 0, 0, 12, 13, 0, 0, 0,
- 14, 15, 16, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 17, 0, 18, 19, 20, 0, 22,
- 0, 0, 0, 0, 23, 24, 25, 26, 0, 0,
- 0, 27, 0, 0, 31, 32, 33, 34, 35, 0,
- 12, 13, 67, 69, 0, 14, 15, 16, 73, 0,
- 0, 0, 0, 0, 0, 0, 0, 91, 17, 0,
- 18, 19, 20, 0, 22, 0, 0, 0, 0, 23,
- 24, 25, 26, 0, 0, 0, 27, 0, 0, 31,
- 32, 33, 34, 35, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 146, 147, 148,
- 149, 150, 151, 0, 0, 0, 0, 0, 0, 91,
- 0, 0, 0, 0, 91, 0, 0, 91, 91, 0,
- 0, 91, 0, 91, 91, 0, 0, 0, 91, 91,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 91,
- 0, 0, 0, 91, 0, 91, 91, 91, 91, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 91,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 91,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 91, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 91, 91, 91, 91, 0, 91, 0,
- 91, 91, 0, 0, 0, 0, 0, 0, 91, 91,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 91, 91, 91, 91, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 91, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 91, 91, 91, 91, 91, 0, 91, 91, 91,
-};
-short yycheck[] = { 41,
- 0, 41, 63, 41, 37, 41, 59, 59, 63, 42,
- 43, 63, 45, 63, 47, 59, 62, 41, 63, 107,
- 108, 63, 40, 63, 37, 63, 123, 63, 37, 7,
- 44, 223, 103, 37, 302, 303, 94, 37, 303, 123,
- 40, 41, 42, 43, 44, 45, 134, 47, 313, 63,
- 261, 262, 30, 41, 112, 0, 289, 123, 58, 59,
- 60, 94, 62, 63, 53, 54, 40, 40, 287, 302,
- 303, 59, 41, 62, 63, 44, 91, 41, 124, 112,
- 44, 37, 40, 154, 123, 40, 42, 40, 60, 40,
- 40, 47, 37, 93, 94, 261, 41, 42, 43, 44,
- 45, 226, 47, 40, 40, 40, 60, 85, 40, 112,
- 0, 303, 112, 58, 59, 60, 293, 62, 63, 41,
- 41, 313, 100, 123, 124, 41, 293, 304, 305, 306,
- 281, 44, 121, 41, 41, 44, 93, 41, 94, 44,
- 228, 154, 41, 41, 293, 154, 40, 37, 93, 94,
- 154, 41, 42, 43, 44, 45, 112, 47, 136, 137,
- 40, 59, 293, 41, 261, 262, 40, 112, 58, 59,
- 60, 291, 62, 63, 41, 300, 301, 302, 123, 124,
- 91, 59, 59, 273, 41, 40, 272, 93, 206, 178,
- 179, 41, 41, 0, 41, 320, 321, 93, 59, 59,
- 325, 41, -1, 93, 94, -1, -1, 260, 261, 262,
- 298, -1, 220, 41, -1, -1, 260, 261, 262, 265,
- -1, -1, 112, 40, -1, -1, 43, -1, 45, 290,
- 291, 59, -1, 123, 124, 290, 291, -1, 290, 291,
- 290, 291, 275, 221, 222, 290, 291, -1, 290, 291,
- 290, 291, 290, 291, 290, 291, -1, 257, 258, 259,
- 260, 261, 262, 263, 264, 265, 290, 291, 268, 269,
- 270, -1, 260, 261, 262, 275, 290, 291, -1, 268,
- -1, 281, 41, 283, 284, 285, 286, 287, -1, 289,
- 290, 291, 292, 293, 294, 295, 296, 297, -1, 299,
- 59, 301, 302, 303, 304, 305, 306, -1, -1, -1,
- 288, -1, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 293, -1, 268, 269, 270, -1, 305, -1, -1,
- 275, -1, 304, 305, 306, -1, 281, 41, 283, 284,
- 285, 286, 287, -1, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, -1, 299, 59, 301, 302, 303, 304,
- 305, 306, 260, 261, 262, -1, -1, 257, 258, 259,
- 260, 261, 262, 263, 264, 265, -1, -1, 268, 269,
- 270, 0, 260, 261, 262, 275, -1, -1, -1, -1,
- 41, 281, -1, 283, 284, 285, 286, 287, -1, 289,
- 290, 291, 292, 293, 294, 295, 296, 297, 59, 299,
- -1, 301, 302, 303, 304, 305, 306, -1, 37, -1,
- -1, 40, 41, 42, 43, 44, 45, -1, 47, -1,
- -1, -1, 260, 261, 262, -1, 0, -1, 41, 58,
- 59, -1, -1, 62, 63, -1, 263, 264, -1, -1,
- -1, 268, 269, 270, -1, -1, 59, -1, -1, -1,
- -1, -1, -1, -1, 281, -1, 283, 284, 285, -1,
- 287, -1, -1, 37, 93, 94, 40, 41, 42, 43,
- 44, 45, 299, 47, -1, 302, 303, 304, 305, 306,
- -1, 0, -1, 112, 58, 59, 60, -1, 62, 63,
- -1, 260, 261, 262, 123, 124, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 41, -1, -1, -1, 37, 93,
- 94, 40, 41, 42, 43, -1, 45, -1, 47, -1,
- -1, -1, 59, -1, 41, -1, -1, -1, -1, 58,
- 59, 60, -1, 62, 63, -1, 260, 261, 262, 123,
- 124, -1, 59, -1, -1, 62, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 93, 94, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 112, -1, -1, -1, -1, -1, 260,
- 261, 262, -1, -1, 123, 124, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 124, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 257, 258,
- 259, 260, 261, 262, 263, 264, 265, -1, -1, 268,
- 269, 270, -1, -1, -1, -1, 275, 260, 261, 262,
- -1, -1, 281, -1, 283, 284, 285, 286, 287, -1,
- 289, 290, 291, 292, 293, 294, 295, 296, 297, -1,
- 299, -1, 301, 302, 303, 304, 305, 306, -1, -1,
- -1, -1, -1, 257, 258, 259, 260, 261, 262, 263,
- 264, 265, -1, -1, 268, 269, 270, -1, -1, -1,
- -1, 275, -1, -1, -1, -1, -1, 281, -1, 283,
- 284, 285, 286, 287, -1, 289, 290, 291, 292, 293,
- 294, 295, 296, 297, -1, 299, -1, 301, 302, 303,
- 304, 305, 306, 260, 261, 262, -1, -1, 257, 258,
- 259, 260, 261, 262, 263, 264, 265, -1, -1, 268,
- 269, 270, 0, 260, 261, 262, 275, -1, 265, -1,
- -1, -1, 281, -1, 283, 284, 285, 286, 287, -1,
- 289, 290, 291, 292, 293, 294, 295, 296, 297, -1,
- 299, -1, 301, 302, 303, 304, 305, 306, -1, 37,
- -1, -1, 40, 41, 42, 43, 44, 45, -1, 47,
- -1, -1, -1, -1, -1, -1, -1, 0, -1, -1,
- 58, 59, 60, -1, 62, 63, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 37, 93, 94, 40, 41, 42,
- 43, 44, 45, -1, 47, -1, -1, -1, -1, -1,
- -1, 0, -1, -1, 112, 58, 59, 60, -1, 62,
- 63, -1, -1, -1, -1, 123, 124, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 37, -1,
- 93, 40, 41, 42, 43, 44, 45, -1, 47, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 58,
- 59, 60, -1, 62, 63, -1, -1, -1, -1, -1,
- 123, 124, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 93, 94, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 112, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 123, 124, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 257,
- 258, 259, 260, 261, 262, 263, 264, 265, -1, -1,
- 268, 269, 270, -1, -1, -1, -1, 275, -1, -1,
- -1, -1, -1, 281, -1, 283, 284, 285, 286, 287,
- -1, 289, 290, -1, 292, 293, 294, 295, 296, 297,
- -1, 299, -1, 301, 302, 303, 304, 305, 306, -1,
- -1, -1, -1, -1, 257, 258, 259, 260, 261, 262,
- 263, 264, 265, -1, -1, 268, 269, 270, -1, -1,
- -1, -1, 275, -1, 40, 41, -1, 43, 281, 45,
- 283, 284, 285, 286, 287, -1, 289, 290, 291, 292,
- 293, 294, 295, 296, 297, -1, 299, 63, 301, 302,
- 303, 304, 305, 306, -1, -1, -1, -1, 257, 258,
- 259, 260, 261, 262, 263, 264, 265, -1, -1, 268,
- 269, 270, 0, -1, -1, -1, 275, -1, -1, -1,
- -1, -1, 281, -1, 283, 284, 285, 286, 287, -1,
- 289, 290, 291, 292, 293, 294, 295, 296, 297, -1,
- 299, -1, 301, -1, -1, 304, 305, 306, -1, 37,
- -1, -1, 40, 41, 42, 43, 44, 45, -1, 47,
- -1, -1, -1, -1, -1, -1, 0, -1, -1, -1,
- 58, 59, 60, -1, 62, 63, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 37, -1, 93, 40, 41, 42, 43,
- 44, 45, -1, 47, -1, -1, -1, -1, -1, -1,
- 0, -1, -1, -1, 58, 59, 60, -1, 62, 63,
- -1, -1, -1, -1, -1, 123, 124, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 37, -1, 93,
- 40, 41, 42, 43, 44, 45, -1, 47, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 58, 59,
- 60, -1, 62, 63, -1, -1, -1, 263, 264, 123,
- 124, -1, 268, 269, 270, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 281, -1, 283, 284, 285,
- -1, 287, -1, 93, -1, -1, 292, 293, 294, 295,
- -1, -1, -1, 299, -1, -1, 302, 303, 304, 305,
- 306, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 123, 124, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 257,
- 258, 259, 260, 261, 262, 263, 264, 265, -1, -1,
- 268, 269, 270, -1, -1, -1, -1, 275, -1, -1,
- -1, -1, -1, 281, -1, 283, 284, 285, 286, 287,
- -1, 289, 290, 291, 292, 293, 294, 295, 296, 297,
- -1, 299, -1, 301, 302, 303, 304, 305, 306, -1,
- -1, -1, -1, 257, 258, 259, 260, 261, 262, 263,
- 264, 265, -1, -1, 268, 269, 270, -1, -1, -1,
- -1, 275, -1, 40, -1, -1, 43, 281, 45, 283,
- 284, 285, 286, 287, -1, 289, 290, 291, 292, 293,
- 294, 295, 296, 297, -1, 299, -1, 301, 302, 303,
- 304, 305, 306, -1, -1, -1, -1, 257, 258, 259,
- 260, 261, 262, 263, 264, 265, -1, -1, 268, 269,
- 270, 0, -1, -1, -1, 275, -1, -1, -1, -1,
- -1, 281, -1, 283, 284, 285, 286, 287, -1, 289,
- 290, 291, 292, 293, 294, 295, 296, 297, -1, 299,
- -1, 301, 302, 303, 304, 305, 306, -1, 37, -1,
- -1, 40, 41, 42, 43, 44, 45, -1, 47, -1,
- -1, -1, -1, -1, -1, 0, -1, -1, -1, 58,
- 59, 60, -1, 62, 63, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 37, -1, 93, 40, 41, 42, 43, 44,
- 45, -1, 47, -1, -1, -1, -1, -1, -1, 0,
- -1, -1, -1, 58, 59, 60, -1, 62, 63, -1,
- -1, -1, -1, -1, 123, 124, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 37, -1, 93, 40,
- 41, 42, 43, 44, 45, -1, 47, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 58, 59, 60,
- -1, 62, 63, -1, 261, 262, 263, 264, 123, 124,
- -1, 268, 269, 270, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 281, -1, 283, 284, 285, -1,
- 287, -1, 93, 94, -1, 292, 293, 294, 295, -1,
- -1, -1, 299, -1, -1, 302, 303, 304, 305, 306,
- -1, 112, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 123, 124, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 257, 258,
- 259, 260, 261, 262, 263, 264, 265, -1, -1, 268,
- 269, 270, -1, -1, -1, -1, 275, -1, -1, -1,
- -1, -1, 281, -1, 283, 284, 285, 286, 287, -1,
- 289, 290, 291, 292, 293, 294, 295, 296, 297, -1,
- 299, -1, 301, 302, 303, 304, 305, 306, -1, -1,
- -1, -1, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, -1, -1, 268, 269, 270, -1, -1, -1, -1,
- 275, -1, -1, -1, -1, -1, 281, -1, 283, 284,
- 285, 286, 287, -1, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, -1, 299, -1, 301, 302, 303, 304,
- 305, 306, -1, -1, -1, -1, 257, 258, 259, 260,
- 261, 262, 263, 264, 265, -1, -1, 268, 269, 270,
- 0, -1, -1, -1, 275, -1, -1, -1, -1, -1,
- 281, -1, 283, 284, 285, 286, 287, -1, -1, 290,
- 291, 292, 293, 294, 295, 296, 297, -1, 299, -1,
- 301, -1, -1, 304, 305, 306, -1, 37, -1, -1,
- 40, 41, 42, 43, 44, 45, -1, 47, -1, -1,
- -1, -1, -1, -1, -1, 0, -1, -1, 58, 59,
- 60, -1, 62, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 93, 94, 40, 41, -1, 43, 44,
- 45, -1, -1, -1, -1, -1, 0, -1, -1, -1,
- -1, -1, 112, 58, 59, 60, -1, 62, 63, -1,
- -1, -1, -1, 123, 124, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 40, 41, 93, 43,
- 44, 45, -1, -1, -1, -1, 0, -1, -1, -1,
- -1, -1, -1, -1, 58, 59, 60, -1, 62, 63,
- -1, -1, -1, -1, -1, -1, -1, -1, 123, 124,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 40, 41, -1, 93,
- 44, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 58, 59, 60, -1, 62, 63,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 123,
- 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 40, -1, 93,
- 43, -1, 45, -1, -1, -1, -1, 257, 258, 259,
- 260, 261, 262, 263, 264, 265, -1, -1, 268, 269,
- 270, -1, -1, -1, -1, 275, -1, -1, -1, 123,
- 124, 281, -1, 283, 284, 285, 286, 287, -1, 289,
- -1, -1, 292, 293, 294, 295, 296, 297, -1, 299,
- -1, 301, 302, 303, 304, 305, 306, -1, -1, -1,
- -1, -1, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, -1, -1, 268, 269, 270, -1, -1, -1, -1,
- 275, -1, -1, -1, -1, -1, 281, -1, 283, 284,
- 285, 286, 287, -1, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, -1, 299, -1, 301, 302, 303, 304,
- 305, 306, -1, 257, 258, 259, 260, 261, 262, 263,
- 264, 265, -1, -1, 268, 269, 270, -1, -1, -1,
- -1, 275, -1, -1, -1, -1, -1, 281, -1, 283,
- 284, 285, 286, 287, -1, 289, 290, 291, 292, 293,
- 294, 295, 296, 297, -1, 299, -1, 301, 302, 303,
- 304, 305, 306, 257, 258, 259, 260, 261, 262, 263,
- 264, 265, -1, 0, 268, 269, 270, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 281, -1, 283,
- 284, 285, 286, 287, -1, 289, 290, 291, 292, 293,
- 294, 295, 296, 297, -1, 299, -1, 301, 302, 303,
- 304, 305, 306, 40, 41, -1, 259, 44, 261, 262,
- 263, 264, -1, -1, 0, 268, 269, 270, -1, -1,
- -1, 58, 59, 60, -1, 62, 63, -1, 281, -1,
- 283, 284, 285, -1, 287, -1, -1, -1, -1, 292,
- 293, 294, 295, -1, -1, -1, 299, -1, 301, 302,
- 303, 304, 305, 306, 40, -1, 93, 43, -1, 45,
- -1, -1, -1, -1, 0, -1, -1, -1, -1, -1,
- -1, -1, -1, 59, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 123, 124, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 40, -1, -1, 43, -1, 45,
- -1, -1, -1, -1, 0, -1, -1, -1, -1, -1,
- -1, -1, -1, 59, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 123, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 40, -1, -1, 43, -1, 45,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 0, -1, -1, 59, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 123, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 40, -1, -1, 43, -1, 45, -1, -1, -1, -1,
- 257, 258, 259, 260, 261, 262, 263, 264, 265, 59,
- -1, 268, 269, 270, -1, -1, -1, 123, -1, -1,
- -1, -1, -1, -1, 281, -1, 283, 284, 285, 286,
- 287, -1, 289, 290, 291, 292, 293, 294, 295, 296,
- 297, -1, 299, -1, 301, 302, 303, 304, 305, 306,
- -1, 257, 258, 259, 260, 261, 262, 263, 264, -1,
- -1, -1, 268, 269, 270, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 281, -1, 283, 284, 285,
- 286, 287, -1, -1, -1, -1, 292, 293, 294, 295,
- -1, -1, -1, 299, -1, 301, 302, 303, 304, 305,
- 306, 257, 258, 259, 260, 261, 262, 263, 264, -1,
- -1, -1, 268, 269, 270, 40, -1, -1, 43, -1,
- 45, -1, -1, -1, -1, 281, -1, 283, 284, 285,
- 286, 287, -1, -1, -1, -1, 292, 293, 294, 295,
- -1, -1, -1, 299, -1, 301, 302, 303, 304, 305,
- 306, 257, 258, 259, 260, -1, 262, 263, 264, -1,
- -1, 0, 268, 269, 270, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 281, -1, 283, 284, 285,
- 286, 287, -1, -1, -1, -1, 292, 293, 294, 295,
- -1, -1, -1, 299, -1, 301, 302, 303, 304, 305,
- 306, 40, -1, -1, 43, -1, 45, 257, 258, 259,
- 260, 261, 262, 263, 264, -1, -1, 0, 268, 269,
- 270, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 281, -1, 283, 284, 285, 286, 287, -1, -1,
- -1, -1, 292, 293, 294, 295, -1, -1, -1, 299,
- -1, 301, 302, 303, 304, 305, 306, 40, -1, -1,
- 43, -1, 45, -1, -1, -1, -1, 0, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 123, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 40, -1, -1,
- 43, -1, 45, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 263, 264,
- 123, 266, 267, 268, 269, 270, -1, -1, -1, -1,
- -1, 276, 277, 278, 279, 280, 281, -1, 283, 284,
- 285, -1, 287, 288, -1, -1, -1, 292, 293, 294,
- 295, -1, -1, -1, 299, -1, -1, 302, 303, 304,
- 305, 306, -1, -1, -1, -1, -1, -1, -1, -1,
- 123, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 257, 258,
- 259, -1, -1, -1, 263, 264, -1, -1, -1, 268,
- 269, 270, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 281, -1, 283, 284, 285, 286, 287, -1,
- -1, -1, -1, 292, 293, 294, 295, -1, -1, -1,
- 299, -1, 301, 302, 303, 304, 305, 306, -1, -1,
- -1, -1, -1, -1, 257, 258, 259, -1, -1, -1,
- 263, 264, -1, -1, -1, 268, 269, 270, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 281, -1,
- 283, 284, 285, 286, 287, -1, -1, -1, -1, 292,
- 293, 294, 295, -1, -1, -1, 299, -1, 301, 302,
- 303, 304, 305, 306, 257, 258, 259, -1, -1, -1,
- 263, 264, -1, -1, -1, 268, 269, 270, 0, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 281, -1,
- 283, 284, 285, 286, 287, -1, -1, -1, -1, 292,
- 293, 294, 295, -1, -1, -1, 299, -1, 301, 302,
- 303, 304, 305, 306, -1, 37, -1, -1, 40, 41,
- 42, 43, 44, 45, -1, 47, -1, -1, -1, -1,
- -1, -1, -1, 0, -1, -1, 58, 59, 60, -1,
- 62, 63, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 37, 93, 94, 40, 41, 42, 43, 44, 45, -1,
- 47, 0, -1, -1, -1, -1, -1, -1, -1, -1,
- 112, 58, 59, -1, -1, 62, 63, -1, -1, -1,
- -1, 123, 124, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 37, -1,
- -1, -1, 41, 42, -1, 44, 93, 94, 47, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 58,
- 59, 60, -1, 62, 63, 112, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 123, 124, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 93, 94, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 112, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 123, 124, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
- 262, 263, 264, 265, -1, -1, 268, 269, 270, -1,
- -1, -1, -1, 275, -1, -1, -1, -1, -1, 281,
- -1, 283, 284, 285, 286, 287, -1, 289, 290, 291,
- 292, -1, 294, 295, 296, 297, -1, 299, -1, 301,
- 302, 303, -1, -1, -1, -1, -1, -1, -1, -1,
- 257, 258, 259, 260, 261, 262, 263, 264, 265, -1,
- -1, 268, 269, 270, -1, -1, -1, -1, 275, -1,
- -1, -1, -1, -1, 281, -1, 283, 284, 285, 286,
- 287, 0, 289, 290, 291, 292, -1, 294, 295, 296,
- 297, -1, 299, -1, 301, 302, 303, -1, 257, 258,
- 259, 260, 261, 262, -1, -1, 265, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 275, -1, 37, -1,
- -1, -1, 41, 42, -1, 44, 0, 286, 47, -1,
- 289, 290, 291, 292, 293, 294, 295, 296, 297, 58,
- 59, 60, 301, 62, 63, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 37, -1, -1, -1, 41, 42, -1,
- 44, 0, -1, 47, 93, 94, -1, -1, -1, -1,
- -1, -1, -1, -1, 58, 59, 60, -1, 62, 63,
- -1, -1, -1, 112, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 123, 124, -1, -1, 37, -1,
- -1, -1, 41, 42, -1, 44, -1, -1, 47, 93,
- 94, -1, -1, -1, -1, -1, -1, -1, -1, 58,
- 59, 60, -1, 62, 63, -1, -1, -1, 112, -1,
- 0, -1, -1, -1, -1, -1, -1, -1, -1, 123,
- 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 93, 94, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 37, -1, -1,
- -1, 41, 42, 112, 44, -1, -1, 47, -1, -1,
- -1, -1, -1, -1, 123, 124, -1, -1, 58, 59,
- 60, -1, 62, 63, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 93, 94, -1, -1, -1, 257, 258,
- 259, 260, 261, 262, -1, -1, 265, -1, -1, -1,
- -1, -1, 112, -1, -1, -1, 275, -1, -1, -1,
- -1, -1, -1, 123, 124, -1, -1, 286, -1, -1,
- 289, 290, 291, 292, 293, 294, 295, 296, 297, -1,
- -1, -1, 301, 257, 258, 259, 260, 261, 262, -1,
- 40, 265, -1, 43, 44, 45, -1, -1, -1, -1,
- -1, 275, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 286, 63, -1, 289, 290, 291, 292, 293,
- 294, 295, 296, 297, -1, -1, -1, 301, 257, 258,
- 259, 260, 261, 262, -1, -1, 265, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 275, -1, -1, 0,
- -1, -1, -1, -1, -1, -1, -1, 286, -1, -1,
- 289, 290, 291, 292, 293, 294, 295, 296, 297, -1,
- -1, -1, 301, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 37, -1, -1, -1,
- 41, 42, -1, 44, -1, -1, 47, 257, 258, 259,
- 260, 261, 262, -1, -1, 265, -1, 58, 59, 60,
- -1, 62, 63, -1, -1, 275, 0, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 286, -1, -1, 289,
- 290, 291, 292, 293, 294, 295, 296, 297, -1, -1,
- -1, 301, 93, 94, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 37, -1, -1, -1, 41, 42, -1,
- 44, 112, -1, 47, 0, -1, -1, -1, -1, -1,
- -1, -1, 123, 124, 58, 59, 60, -1, 62, 63,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 37, -1, -1, -1, 41, 42, -1, 44, 93,
- 94, 47, -1, 263, 264, -1, -1, -1, 268, 269,
- 270, -1, 58, 59, 60, -1, 62, -1, 112, -1,
- -1, 281, -1, 283, 284, 285, 0, 287, -1, 123,
- 124, -1, 292, 293, 294, 295, -1, -1, -1, 299,
- -1, -1, 302, 303, 304, 305, 306, 93, 94, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 37, -1, -1, 112, 41, 42, -1,
- 44, -1, -1, 47, -1, -1, -1, 123, 124, -1,
- -1, -1, -1, -1, 58, 59, 60, -1, 62, -1,
- -1, -1, -1, -1, -1, -1, 257, 258, 259, 260,
- 261, 262, -1, -1, 265, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 275, 0, -1, -1, -1, 93,
- 94, -1, -1, -1, -1, 286, -1, -1, 289, 290,
- 291, 292, 293, 294, 295, 296, 297, -1, 112, -1,
- 301, -1, -1, -1, -1, -1, -1, -1, -1, 123,
- 124, -1, 37, -1, -1, -1, 41, 42, -1, 44,
- -1, -1, 47, 257, 258, 259, 260, 261, 262, -1,
- -1, 265, -1, 58, 59, 60, -1, 62, -1, -1,
- -1, 275, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 286, -1, -1, 289, 290, 291, -1, -1,
- -1, -1, 296, 297, -1, -1, -1, 301, 93, 94,
- -1, 257, 258, 259, 260, 261, 262, 0, -1, 265,
- -1, -1, -1, -1, -1, -1, -1, 112, -1, 275,
- -1, -1, -1, -1, -1, -1, -1, -1, 123, 124,
- 286, -1, -1, 289, 290, 291, -1, -1, -1, -1,
- 296, 297, -1, -1, 37, 301, -1, -1, 41, 42,
- -1, 44, -1, -1, 47, -1, -1, -1, -1, -1,
- -1, -1, 0, -1, -1, 58, 59, 60, -1, 62,
- -1, -1, -1, 257, 258, 259, 260, 261, 262, -1,
- -1, 265, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 275, -1, -1, -1, -1, -1, -1, -1, 37,
- 93, 94, 286, 41, 42, 289, 290, 291, -1, 47,
- 0, -1, 296, 297, -1, -1, -1, 301, -1, 112,
- 58, 59, 60, -1, 62, -1, -1, -1, -1, -1,
- 123, 124, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 37, -1, -1,
- -1, 41, 42, -1, 44, 93, 94, 47, -1, -1,
- -1, -1, 257, 258, 259, 260, 261, 262, 58, 59,
- 265, -1, -1, -1, 112, -1, -1, -1, -1, -1,
- 275, -1, -1, -1, -1, 123, 124, -1, -1, -1,
- -1, 286, -1, -1, 289, 290, 291, -1, -1, -1,
- -1, 296, 297, 93, 94, -1, 301, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 112, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 123, 124, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 257, 258, 259, 260, 261, 262,
- -1, -1, 265, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 275, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 286, -1, -1, 289, 290, 291, -1,
- -1, -1, -1, 296, 297, -1, -1, -1, 301, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 257,
- 258, 259, 260, 261, 262, -1, -1, 265, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 275, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 286, -1,
- -1, 289, 290, 291, -1, -1, -1, -1, 296, 297,
- -1, 7, -1, 301, -1, -1, -1, 257, 258, 259,
- 260, 261, 262, -1, -1, 265, -1, -1, -1, -1,
- -1, -1, -1, -1, 30, 275, -1, -1, -1, -1,
- -1, 37, -1, -1, -1, -1, 286, -1, -1, 289,
- 290, 291, -1, 49, -1, -1, 52, 53, 54, 55,
- 56, 301, 58, 59, 60, -1, 62, 63, 64, 65,
- 66, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 82, -1, -1, 85,
- 86, 87, 88, 89, 90, -1, 50, 51, -1, -1,
- -1, -1, -1, -1, 100, -1, -1, 103, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 115,
- -1, -1, -1, -1, -1, 121, -1, 81, -1, 83,
- 84, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 136, 137, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 154, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 166, 167, 168, 169, 170, -1, -1, -1, -1, 175,
- 176, -1, 178, 179, -1, -1, -1, 183, -1, -1,
- -1, 187, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 198, 157, 158, 201, -1, -1, 204, 205,
- -1, -1, -1, -1, -1, -1, -1, -1, 17, -1,
- -1, -1, -1, 177, -1, 221, 222, 223, -1, 28,
- 29, -1, 31, 32, 188, 34, 190, -1, 192, -1,
- -1, -1, -1, -1, 43, -1, 242, -1, 244, -1,
- 246, -1, 248, -1, 250, -1, -1, -1, -1, 255,
- -1, 215, -1, -1, 260, 261, 40, -1, -1, 43,
- -1, 45, 268, -1, -1, -1, 230, 231, 232, 233,
- 234, -1, -1, -1, -1, 59, -1, -1, -1, -1,
- -1, -1, 288, -1, 93, 94, 95, 96, 97, 98,
- -1, -1, -1, -1, -1, -1, 105, -1, -1, 305,
- -1, 110, -1, -1, 113, 114, -1, -1, 117, 40,
- 119, 120, 43, -1, 45, 124, 125, 281, -1, -1,
- -1, 285, 286, 287, -1, -1, 135, 291, 59, -1,
- 139, -1, 141, 142, 143, 144, -1, -1, -1, 123,
- -1, -1, -1, 152, -1, -1, 155, -1, -1, -1,
- -1, -1, 316, 317, -1, -1, 165, 40, 322, -1,
- 43, -1, 45, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
- -1, -1, -1, -1, 193, -1, -1, -1, -1, -1,
- -1, -1, 123, -1, 125, -1, -1, -1, -1, -1,
- 209, 210, 211, 212, -1, 214, -1, 216, 217, -1,
- -1, -1, -1, -1, -1, 224, 225, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 236, 237, 238,
- 239, 40, -1, -1, 43, -1, 45, -1, -1, -1,
- 123, -1, 125, -1, -1, -1, -1, -1, -1, -1,
- 59, -1, -1, -1, -1, 264, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 276, 277, 278,
- 279, 280, -1, 282, 283, 284, 260, 261, 262, 263,
- 264, -1, 266, 267, 268, 269, 270, 271, -1, 273,
- 274, -1, 276, 277, 278, 279, 280, 281, 282, 283,
- 284, 285, -1, 287, 288, -1, -1, -1, 292, 293,
- 294, 295, -1, -1, 123, 299, 125, -1, 302, 303,
- 304, 305, 306, -1, -1, -1, -1, -1, -1, 260,
- -1, -1, 263, 264, -1, 266, 267, 268, 269, 270,
- 271, 272, 273, 274, -1, 276, 277, 278, 279, 280,
- 281, 282, 283, 284, 285, -1, 287, 288, -1, -1,
- -1, 292, 293, 294, 295, -1, -1, -1, 299, -1,
- -1, 302, 303, 304, 305, 306, -1, 260, -1, -1,
- 263, 264, -1, 266, 267, 268, 269, 270, 271, 272,
- 273, 274, -1, 276, 277, 278, 279, 280, 281, 282,
- 283, 284, 285, -1, 287, 288, -1, -1, -1, 292,
- 293, 294, 295, -1, -1, -1, 299, -1, -1, 302,
- 303, 304, 305, 306, 40, -1, -1, 43, -1, 45,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 59, -1, -1, -1, -1, -1, -1,
- -1, 260, -1, -1, 263, 264, -1, 266, 267, 268,
- 269, 270, 271, 272, 273, 274, -1, 276, 277, 278,
- 279, 280, 281, 282, 283, 284, 285, -1, 287, 288,
- -1, -1, -1, 292, 293, 294, 295, -1, -1, -1,
- 299, -1, -1, 302, 303, 304, 305, 306, 40, -1,
- -1, 43, -1, 45, -1, -1, -1, 123, -1, 125,
- -1, -1, -1, -1, -1, -1, -1, 59, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 40, -1, -1, 43, -1,
- 45, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 59, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 123, -1, 125, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 40, -1, -1,
- 43, -1, 45, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 123, -1,
- 125, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 260, -1, -1, 263, 264, -1,
- 266, 267, 268, 269, 270, 271, 272, 273, 274, -1,
- 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
- -1, 287, 288, -1, -1, -1, 292, 293, 294, 295,
- 123, -1, 125, 299, -1, -1, 302, 303, 304, 305,
- 306, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 40, 41, -1, 43, 44, 45, -1, -1, 260, -1,
- -1, 263, 264, -1, 266, 267, 268, 269, 270, 271,
- 272, 273, 274, 63, 276, 277, 278, 279, 280, 281,
- 282, 283, 284, 285, -1, 287, 288, -1, -1, -1,
- 292, 293, 294, 295, -1, -1, -1, 299, -1, -1,
- 302, 303, 304, 305, 306, 260, -1, -1, 263, 264,
- -1, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- -1, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, -1, 287, 288, -1, -1, -1, 292, 293, 294,
- 295, -1, -1, -1, 299, -1, -1, 302, 303, 304,
- 305, 306, -1, 40, -1, -1, 43, 260, 45, -1,
- 263, 264, -1, 266, 267, 268, 269, 270, 271, 272,
- 273, 274, 59, 276, 277, 278, 279, 280, 281, 282,
- 283, 284, 285, -1, 287, 288, -1, -1, -1, 292,
- 293, 294, 295, -1, -1, -1, 299, -1, -1, 302,
- 303, 304, 305, 306, 40, -1, -1, 43, -1, 45,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 59, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 123, -1, 125, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 40, -1, -1, 43, -1, 45, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 59, -1, -1, 263, 264, -1, -1, -1, 268, 269,
- 270, -1, -1, -1, -1, -1, -1, 123, -1, 125,
- -1, 281, -1, 283, 284, 285, -1, 287, -1, -1,
- -1, -1, 292, 293, 294, 295, -1, -1, -1, 299,
- -1, -1, 302, 303, 304, 305, 306, -1, -1, 40,
- -1, -1, 43, -1, 45, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 123, -1, 125, -1, 59, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 260, -1, -1, 263, 264, -1, 266,
- 267, 268, 269, 270, 271, 272, 273, 274, -1, 276,
- 277, 278, 279, 280, 281, 282, 283, 284, 285, -1,
- 287, 288, 123, -1, 125, 292, 293, 294, 295, -1,
- -1, -1, 299, -1, -1, 302, 303, 304, 305, 306,
- -1, -1, -1, -1, 260, -1, -1, 263, 264, -1,
- 266, 267, 268, 269, 270, 271, -1, 273, 274, -1,
- 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
- -1, 287, 288, -1, -1, -1, 292, 293, 294, 295,
- -1, -1, -1, 299, -1, -1, 302, 303, 304, 305,
- 306, 260, -1, -1, 263, 264, -1, 266, 267, 268,
- 269, 270, 271, -1, 273, 274, -1, 276, 277, 278,
- 279, 280, 281, 282, 283, 284, 285, -1, 287, 288,
- -1, -1, -1, 292, 293, 294, 295, -1, -1, -1,
- 299, -1, -1, 302, 303, 304, 305, 306, 40, -1,
- -1, 43, -1, 45, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 59, -1, 260,
- -1, -1, 263, 264, -1, 266, 267, 268, 269, 270,
- 271, -1, 273, 274, -1, 276, 277, 278, 279, 280,
- 281, 282, 283, 284, 285, -1, 287, 288, -1, -1,
- -1, 292, 293, 294, 295, -1, -1, -1, 299, -1,
- -1, 302, 303, 304, 305, 306, 40, -1, -1, 43,
- -1, 45, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 123, -1, 125, -1, 59, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 40, -1, -1, 43, -1, 45, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 59, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 123,
- -1, 125, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 40, -1, -1, 43, -1, 45,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 59, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 123, -1, 125, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 260, -1,
- -1, 263, 264, -1, 266, 267, 268, 269, 270, 271,
- -1, 273, 274, -1, 276, 277, 278, 279, 280, 281,
- 282, 283, 284, 285, -1, 287, 288, 123, -1, 125,
- 292, 293, 294, 295, -1, -1, -1, 299, -1, -1,
- 302, 303, 304, 305, 306, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
- -1, -1, 43, -1, 45, -1, 260, -1, -1, 263,
- 264, -1, 266, 267, 268, 269, 270, 271, 59, 273,
- 274, -1, 276, 277, 278, 279, 280, 281, 282, 283,
- 284, 285, -1, 287, 288, -1, -1, -1, 292, 293,
- 294, 295, -1, -1, -1, 299, -1, -1, 302, 303,
- 304, 305, 306, 260, -1, -1, 263, 264, -1, 266,
- 267, 268, 269, 270, 271, -1, 273, 274, -1, 276,
- 277, 278, 279, 280, 281, 282, 283, 284, 285, -1,
- 287, 288, 123, -1, 125, 292, 293, 294, 295, -1,
- -1, -1, 299, -1, -1, 302, 303, 304, 305, 306,
- 40, -1, -1, 43, 260, 45, -1, 263, 264, -1,
- 266, 267, 268, 269, 270, 271, -1, 273, 274, -1,
- 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
- -1, 287, 288, -1, -1, -1, 292, 293, 294, 295,
- -1, -1, -1, 299, -1, -1, 302, 303, 304, 305,
- 306, 40, -1, -1, 43, 44, 45, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 60, -1, 62, 63, -1, -1, -1, -1, -1,
- -1, -1, -1, 123, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 40, -1, -1, 43, -1,
- 45, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 60, -1, 62, 63, 260,
- -1, -1, 263, 264, -1, 266, 267, 268, 269, 270,
- 271, -1, 273, 274, -1, 276, 277, 278, 279, 280,
- 281, 282, 283, 284, 285, -1, 287, 288, -1, -1,
- -1, 292, 293, 294, 295, -1, -1, -1, 299, -1,
- -1, 302, 303, 304, 305, 306, 40, 41, -1, 43,
- 44, 45, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 63,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 40, 41, -1, 43, 44, 45, -1, 257, 258, 259,
- -1, -1, -1, 263, 264, -1, -1, -1, 268, 269,
- 270, -1, -1, 63, -1, -1, -1, -1, -1, -1,
- -1, 281, -1, 283, 284, 285, 286, 287, -1, -1,
- -1, -1, 292, 293, 294, 295, -1, -1, -1, 299,
- -1, 301, 302, 303, 304, 305, 306, 40, 41, -1,
- 43, 44, 45, -1, 263, 264, -1, -1, -1, 268,
- 269, 270, -1, -1, -1, -1, -1, -1, -1, -1,
- 63, -1, 281, -1, 283, 284, 285, -1, 287, -1,
- -1, -1, -1, 292, 293, 294, 295, 296, 297, -1,
- 299, -1, -1, 302, 303, 304, 305, 306, 263, 264,
- -1, -1, -1, 268, 269, 270, -1, -1, -1, -1,
- 40, 41, -1, 43, 44, 45, 281, -1, 283, 284,
- 285, -1, 287, -1, -1, -1, -1, 292, 293, 294,
- 295, 296, 297, 63, 299, -1, -1, 302, 303, 304,
- 305, 306, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 40, -1,
- -1, 43, -1, 45, -1, -1, -1, -1, -1, 263,
- 264, -1, -1, -1, 268, 269, 270, 59, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 281, -1, 283,
- 284, 285, -1, 287, -1, -1, -1, -1, 292, 293,
- 294, 295, -1, -1, -1, 299, -1, -1, 302, 303,
- 304, 305, 306, 263, 264, -1, -1, -1, 268, 269,
- 270, 40, -1, -1, 43, -1, 45, -1, -1, -1,
- -1, 281, -1, 283, 284, 285, -1, 287, -1, -1,
- -1, -1, 292, 293, 294, 295, -1, -1, -1, 299,
- -1, -1, 302, 303, 304, 305, 306, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
- 263, 264, 43, -1, 45, 268, 269, 270, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 281, -1,
- 283, 284, 285, -1, 287, -1, -1, -1, -1, 292,
- 293, 294, 295, -1, -1, -1, 299, -1, -1, 302,
- 303, 304, 305, 306, 40, -1, -1, 43, 44, 45,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 263, 264, -1, -1, 63, 268, 269,
- 270, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 281, -1, 283, 284, 285, -1, 287, -1, -1,
- -1, -1, 292, 293, 294, 295, -1, -1, -1, 299,
- -1, -1, 302, 303, 304, 305, 306, 259, -1, -1,
- -1, 263, 264, -1, -1, -1, 268, 269, 270, -1,
- -1, 40, -1, -1, 43, 44, 45, -1, -1, 281,
- -1, 283, 284, 285, -1, 287, -1, -1, -1, -1,
- 292, 293, 294, 295, 63, -1, -1, 299, -1, 301,
- 302, 303, 304, 305, 306, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 40, -1,
- 259, 43, 44, 45, 263, 264, -1, -1, -1, 268,
- 269, 270, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 63, 281, -1, 283, 284, 285, -1, 287, -1,
- -1, -1, -1, 292, 293, 294, 295, -1, -1, -1,
- 299, -1, 301, 302, 303, 304, 305, 306, 259, -1,
- -1, -1, 263, 264, -1, -1, -1, 268, 269, 270,
- -1, -1, 40, -1, -1, 43, 44, 45, -1, -1,
- 281, -1, 283, 284, 285, -1, 287, -1, -1, -1,
- -1, 292, 293, 294, 295, 63, -1, -1, 299, -1,
- 301, 302, 303, 304, 305, 306, -1, 263, 264, -1,
- -1, -1, 268, 269, 270, -1, -1, 40, -1, -1,
- 43, 44, 45, -1, -1, 281, -1, 283, 284, 285,
- -1, 287, -1, -1, -1, -1, 292, 293, 294, 295,
- 63, -1, -1, 299, -1, -1, 302, 303, 304, 305,
- 306, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 40, -1, -1, 43, 44, 45, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 263, 264, 63, -1, -1, 268,
- 269, 270, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 281, -1, 283, 284, 285, -1, 287, -1,
- -1, -1, -1, 292, 293, 294, 295, -1, -1, -1,
- 299, -1, -1, 302, 303, 304, 305, 306, -1, -1,
- -1, 263, 264, -1, -1, -1, 268, 269, 270, -1,
- -1, 40, -1, -1, 43, -1, 45, -1, -1, 281,
- -1, 283, 284, 285, -1, 287, -1, -1, -1, 58,
- 292, 293, 294, 295, 63, -1, -1, 299, -1, -1,
- 302, 303, 304, 305, 306, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 40, -1, -1, 43, -1,
- 45, -1, -1, -1, -1, 263, 264, -1, -1, -1,
- 268, 269, 270, 58, -1, -1, -1, -1, 63, -1,
- -1, -1, -1, 281, -1, 283, 284, 285, -1, 287,
- -1, -1, -1, -1, 292, 293, 294, 295, -1, -1,
- -1, 299, -1, -1, 302, 303, 304, 305, 306, -1,
- 263, 264, -1, -1, -1, 268, 269, 270, -1, -1,
- 40, 41, -1, 43, -1, 45, -1, -1, 281, -1,
- 283, 284, 285, -1, 287, -1, -1, -1, -1, 292,
- 293, 294, 295, 63, -1, -1, 299, -1, -1, 302,
- 303, 304, 305, 306, -1, -1, 263, 264, -1, -1,
- -1, 268, 269, 270, -1, -1, 40, 41, -1, 43,
- -1, 45, -1, -1, 281, -1, 283, 284, 285, -1,
- 287, -1, -1, -1, -1, 292, 293, 294, 295, 63,
- -1, -1, 299, -1, -1, 302, 303, 304, 305, 306,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 40, 41, -1, 43, -1, 45, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 63, 263, 264, -1, -1, -1, 268,
- 269, 270, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 281, -1, 283, 284, 285, -1, 287, -1,
- -1, -1, -1, 292, 293, 294, 295, -1, -1, -1,
- 299, -1, -1, 302, 303, 304, 305, 306, 263, 264,
- -1, -1, -1, 268, 269, 270, -1, -1, 40, 41,
- -1, 43, -1, 45, -1, -1, 281, -1, 283, 284,
- 285, -1, 287, -1, -1, -1, -1, 292, 293, 294,
- 295, 63, -1, -1, 299, -1, -1, 302, 303, 304,
- 305, 306, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 40, 41, -1, 43, -1, 45, -1, -1,
- -1, -1, -1, 263, 264, -1, -1, -1, 268, 269,
- 270, -1, -1, -1, -1, 63, -1, -1, -1, -1,
- -1, 281, -1, 283, 284, 285, -1, 287, -1, -1,
- -1, -1, 292, 293, 294, 295, -1, -1, -1, 299,
- -1, -1, 302, 303, 304, 305, 306, -1, -1, 263,
- 264, -1, -1, -1, 268, 269, 270, -1, -1, 40,
- 41, -1, 43, -1, 45, -1, -1, 281, -1, 283,
- 284, 285, -1, 287, -1, -1, -1, -1, 292, 293,
- 294, 295, 63, -1, -1, 299, -1, -1, 302, 303,
- 304, 305, 306, 263, 264, -1, -1, -1, 268, 269,
- 270, -1, -1, 40, 41, -1, 43, -1, 45, -1,
- -1, 281, -1, 283, 284, 285, -1, 287, -1, -1,
- -1, -1, 292, 293, 294, 295, 63, -1, -1, 299,
- -1, -1, 302, 303, 304, 305, 306, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
- 43, -1, 45, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 63, 263, 264, -1, -1, -1, 268, 269, 270, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 281,
- -1, 283, 284, 285, -1, 287, -1, -1, -1, -1,
- 292, 293, 294, 295, -1, -1, -1, 299, -1, -1,
- 302, 303, 304, 305, 306, 263, 264, -1, -1, -1,
- 268, 269, 270, -1, -1, 40, 41, -1, 43, -1,
- 45, -1, -1, 281, -1, 283, 284, 285, -1, 287,
- -1, -1, -1, -1, 292, 293, 294, 295, 63, -1,
- -1, 299, -1, -1, 302, 303, 304, 305, 306, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
- 41, -1, 43, -1, 45, -1, -1, -1, -1, -1,
- -1, -1, 263, 264, -1, -1, -1, 268, 269, 270,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 281, -1, 283, 284, 285, -1, 287, -1, -1, -1,
- -1, 292, 293, 294, 295, -1, -1, -1, 299, -1,
- -1, 302, 303, 304, 305, 306, 263, 264, -1, -1,
- -1, 268, 269, 270, 40, -1, -1, 43, -1, 45,
- -1, -1, -1, -1, 281, -1, 283, 284, 285, -1,
- 287, -1, -1, -1, -1, 292, 293, 294, 295, -1,
- -1, -1, 299, -1, -1, 302, 303, 304, 305, 306,
- 263, 264, -1, -1, -1, 268, 269, 270, -1, -1,
- -1, -1, 40, -1, -1, 43, -1, 45, 281, -1,
- 283, 284, 285, -1, 287, -1, -1, -1, -1, 292,
- 293, 294, 295, -1, -1, -1, 299, -1, -1, 302,
- 303, 304, 305, 306, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 40, -1, -1, 43, -1, 45, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 263, 264,
- -1, -1, -1, 268, 269, 270, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 281, -1, 283, 284,
- 285, -1, 287, -1, -1, -1, -1, 292, 293, 294,
- 295, -1, -1, -1, 299, -1, -1, 302, 303, 304,
- 305, 306, 263, 264, -1, -1, -1, 268, 269, 270,
- 40, -1, -1, 43, -1, 45, -1, -1, -1, -1,
- 281, -1, 283, 284, 285, -1, 287, -1, -1, -1,
- -1, 292, 293, 294, 295, -1, -1, -1, 299, -1,
- -1, 302, 303, 304, 305, 306, -1, -1, -1, -1,
- -1, -1, -1, -1, 40, -1, -1, 43, -1, 45,
- -1, -1, -1, 259, -1, -1, -1, 263, 264, -1,
- -1, -1, 268, 269, 270, -1, -1, 63, -1, -1,
- -1, -1, -1, -1, -1, 281, -1, 283, 284, 285,
- -1, 287, -1, -1, -1, -1, 292, 293, 294, 295,
- -1, -1, -1, 299, -1, -1, 302, 303, 304, 305,
- 306, 259, -1, -1, 40, 263, 264, 43, -1, 45,
- 268, 269, 270, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 281, -1, 283, 284, 285, -1, 287,
- -1, -1, -1, -1, 292, 293, 294, 295, -1, -1,
- -1, 299, -1, -1, 302, 303, 304, 305, 306, 259,
- -1, -1, 40, 263, 264, 43, -1, 45, 268, 269,
- 270, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 281, -1, 283, 284, 285, -1, 287, -1, -1,
- -1, -1, 292, 293, 294, 295, -1, -1, -1, 299,
- -1, -1, 302, 303, 304, 305, 306, 40, -1, -1,
- 43, -1, 45, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 259,
- -1, -1, -1, 263, 264, -1, -1, -1, 268, 269,
- 270, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 281, -1, 283, 284, 285, -1, 287, -1, -1,
- -1, -1, 292, 293, 294, 295, -1, -1, -1, 299,
- -1, -1, 302, 303, 304, 305, 306, 263, 264, -1,
- -1, -1, 268, 269, 270, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 281, -1, 283, 284, 285,
- -1, 287, -1, -1, -1, -1, 292, 293, 294, 295,
- -1, -1, -1, 299, -1, -1, 302, 303, 304, 305,
- 306, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 259, -1, -1, -1, 263, 264, -1,
- -1, -1, 268, 269, 270, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 281, -1, 283, 284, 285,
- -1, 287, -1, -1, -1, -1, 292, 293, 294, 295,
- -1, -1, -1, 299, -1, -1, 302, 303, 304, 305,
- 306, -1, -1, -1, -1, 263, 264, -1, -1, -1,
- 268, 269, 270, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 281, -1, 283, 284, 285, -1, 287,
- -1, -1, -1, -1, 292, 293, 294, 295, -1, -1,
- -1, 299, -1, -1, 302, 303, 304, 305, 306, -1,
- 263, 264, 28, 29, -1, 268, 269, 270, 34, -1,
- -1, -1, -1, -1, -1, -1, -1, 43, 281, -1,
- 283, 284, 285, -1, 287, -1, -1, -1, -1, 292,
- 293, 294, 295, -1, -1, -1, 299, -1, -1, 302,
- 303, 304, 305, 306, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 93, 94, 95,
- 96, 97, 98, -1, -1, -1, -1, -1, -1, 105,
- -1, -1, -1, -1, 110, -1, -1, 113, 114, -1,
- -1, 117, -1, 119, 120, -1, -1, -1, 124, 125,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 135,
- -1, -1, -1, 139, -1, 141, 142, 143, 144, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 155,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 165,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 193, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 209, 210, 211, 212, -1, 214, -1,
- 216, 217, -1, -1, -1, -1, -1, -1, 224, 225,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 236, 237, 238, 239, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 264, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 276, 277, 278, 279, 280, -1, 282, 283, 284,
-};
-#define YYFINAL 1
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 306
-#if YYDEBUG
-const char *yyname[] = {
-"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,"'%'",0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
-"':'","';'","'<'",0,"'>'","'?'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,"'['",0,"']'","'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'p'",0,0,0,0,0,0,0,
-0,0,0,"'{'","'|'","'}'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"BEGIN","END","REGEX","SEMINEW",
-"NEWLINE","COMMENT","FUN1","FUNN","GRGR","PRINT","PRINTF","SPRINTF_OLD",
-"SPRINTF_NEW","SPLIT","IF","ELSE","WHILE","FOR","IN","EXIT","NEXT","BREAK",
-"CONTINUE","RET","GETLINE","DO","SUB","GSUB","MATCH","FUNCTION","USERFUN",
-"DELETE","ASGNOP","OROR","ANDAND","NUMBER","VAR","SUBSTR","INDEX","MATCHOP",
-"RELOP","OR","STRING","UMINUS","NOT","INCR","DECR","FIELD","VFIELD","SVFIELD",
-};
-const char *yyrule[] = {
-"$accept : program",
-"program : junk hunks",
-"begin : BEGIN '{' maybe states '}' junk",
-"end : END '{' maybe states '}'",
-"end : end NEWLINE",
-"hunks : hunks hunk junk",
-"hunks :",
-"hunk : patpat",
-"hunk : patpat '{' maybe states '}'",
-"hunk : FUNCTION USERFUN '(' arg_list ')' maybe '{' maybe states '}'",
-"hunk : '{' maybe states '}'",
-"hunk : begin",
-"hunk : end",
-"arg_list : expr_list",
-"patpat : cond",
-"patpat : cond ',' cond",
-"cond : expr",
-"cond : match",
-"cond : rel",
-"cond : compound_cond",
-"cond : cond '?' expr ':' expr",
-"compound_cond : '(' compound_cond ')'",
-"compound_cond : cond ANDAND maybe cond",
-"compound_cond : cond OROR maybe cond",
-"compound_cond : NOT cond",
-"rel : expr RELOP expr",
-"rel : expr '>' expr",
-"rel : expr '<' expr",
-"rel : '(' rel ')'",
-"match : expr MATCHOP expr",
-"match : expr MATCHOP REGEX",
-"match : REGEX",
-"match : '(' match ')'",
-"expr : term",
-"expr : expr term",
-"expr : expr '?' expr ':' expr",
-"expr : variable ASGNOP cond",
-"sprintf : SPRINTF_NEW",
-"sprintf : SPRINTF_OLD",
-"term : variable",
-"term : NUMBER",
-"term : STRING",
-"term : term '+' term",
-"term : term '-' term",
-"term : term '*' term",
-"term : term '/' term",
-"term : term '%' term",
-"term : term '^' term",
-"term : term IN VAR",
-"term : variable INCR",
-"term : variable DECR",
-"term : INCR variable",
-"term : DECR variable",
-"term : '-' term",
-"term : '+' term",
-"term : '(' cond ')'",
-"term : GETLINE",
-"term : GETLINE variable",
-"term : GETLINE '<' expr",
-"term : GETLINE variable '<' expr",
-"term : term 'p' GETLINE",
-"term : term 'p' GETLINE variable",
-"term : FUN1",
-"term : FUN1 '(' ')'",
-"term : FUN1 '(' expr ')'",
-"term : FUNN '(' expr_list ')'",
-"term : USERFUN '(' expr_list ')'",
-"term : SPRINTF_NEW '(' expr_list ')'",
-"term : sprintf expr_list",
-"term : SUBSTR '(' expr ',' expr ',' expr ')'",
-"term : SUBSTR '(' expr ',' expr ')'",
-"term : SPLIT '(' expr ',' VAR ',' expr ')'",
-"term : SPLIT '(' expr ',' VAR ',' REGEX ')'",
-"term : SPLIT '(' expr ',' VAR ')'",
-"term : INDEX '(' expr ',' expr ')'",
-"term : MATCH '(' expr ',' REGEX ')'",
-"term : MATCH '(' expr ',' expr ')'",
-"term : SUB '(' expr ',' expr ')'",
-"term : SUB '(' REGEX ',' expr ')'",
-"term : GSUB '(' expr ',' expr ')'",
-"term : GSUB '(' REGEX ',' expr ')'",
-"term : SUB '(' expr ',' expr ',' expr ')'",
-"term : SUB '(' REGEX ',' expr ',' expr ')'",
-"term : GSUB '(' expr ',' expr ',' expr ')'",
-"term : GSUB '(' REGEX ',' expr ',' expr ')'",
-"variable : VAR",
-"variable : VAR '[' expr_list ']'",
-"variable : FIELD",
-"variable : SVFIELD",
-"variable : VFIELD term",
-"expr_list : expr",
-"expr_list : clist",
-"expr_list :",
-"clist : expr ',' maybe expr",
-"clist : clist ',' maybe expr",
-"clist : '(' clist ')'",
-"junk : junk hunksep",
-"junk :",
-"hunksep : ';'",
-"hunksep : SEMINEW",
-"hunksep : NEWLINE",
-"hunksep : COMMENT",
-"maybe : maybe nlstuff",
-"maybe :",
-"nlstuff : NEWLINE",
-"nlstuff : COMMENT",
-"separator : ';' maybe",
-"separator : SEMINEW maybe",
-"separator : NEWLINE maybe",
-"separator : COMMENT maybe",
-"states : states statement",
-"states :",
-"statement : simple separator maybe",
-"statement : ';' maybe",
-"statement : SEMINEW maybe",
-"statement : compound",
-"simpnull : simple",
-"simpnull :",
-"simple : expr",
-"simple : PRINT expr_list redir expr",
-"simple : PRINT expr_list",
-"simple : PRINTF expr_list redir expr",
-"simple : PRINTF expr_list",
-"simple : BREAK",
-"simple : NEXT",
-"simple : EXIT",
-"simple : EXIT expr",
-"simple : CONTINUE",
-"simple : RET",
-"simple : RET expr",
-"simple : DELETE VAR '[' expr_list ']'",
-"redir : '>'",
-"redir : GRGR",
-"redir : '|'",
-"compound : IF '(' cond ')' maybe statement",
-"compound : IF '(' cond ')' maybe statement ELSE maybe statement",
-"compound : WHILE '(' cond ')' maybe statement",
-"compound : DO maybe statement WHILE '(' cond ')'",
-"compound : FOR '(' simpnull ';' cond ';' simpnull ')' maybe statement",
-"compound : FOR '(' simpnull ';' ';' simpnull ')' maybe statement",
-"compound : FOR '(' expr ')' maybe statement",
-"compound : '{' maybe states '}' maybe",
-};
-#endif
-#ifndef YYSTYPE
-typedef int YYSTYPE;
-#endif
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 500
-#define YYMAXDEPTH 500
-#endif
-#endif
-int yydebug;
-int yynerrs;
-int yyerrflag;
-int yychar;
-short *yyssp;
-YYSTYPE *yyvsp;
-YYSTYPE yyval;
-YYSTYPE yylval;
-short yyss[YYSTACKSIZE];
-YYSTYPE yyvs[YYSTACKSIZE];
-#define yystacksize YYSTACKSIZE
-#line 429 "a2p.y"
-
-int yyparse (void);
-
-#include "a2py.c"
-#line 2178 "y.tab.c"
-#define YYABORT goto yyabort
-#define YYREJECT goto yyabort
-#define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-
-#if YYDEBUG
-# if defined(WIN32)
-EXTERN_C _CRTIMP char *getenv(const char *);
-# else
-EXTERN_C char *getenv(const char *);
-# endif
-#endif
-
-int
-yyparse(void)
-{
- int yym, yyn, yystate;
-#if YYDEBUG
- const char *yys;
-
- if ((yys = getenv("YYDEBUG")))
- {
- yyn = *yys;
- if (yyn >= '0' && yyn <= '9')
- yydebug = yyn - '0';
- }
-#endif
-
- yynerrs = 0;
- yyerrflag = 0;
- yychar = (-1);
-
- yyssp = yyss;
- yyvsp = yyvs;
- *yyssp = yystate = 0;
-
-yyloop:
- if (((yyn = yydefred[yystate])) != 0) goto yyreduce;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- }
- if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, shifting to state %d\n",
- YYPREFIX, yystate, yytable[yyn]);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- yychar = (-1);
- if (yyerrflag > 0) --yyerrflag;
- goto yyloop;
- }
- if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
- {
- yyn = yytable[yyn];
- goto yyreduce;
- }
- if (yyerrflag) goto yyinrecovery;
-#ifdef lint
-
-#endif
-
- yyerror("syntax error");
-#ifdef lint
-
-#endif
-
- ++yynerrs;
-yyinrecovery:
- if (yyerrflag < 3)
- {
- yyerrflag = 3;
- for (;;)
- {
- if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate = yytable[yyn];
- *++yyvsp = yylval;
- goto yyloop;
- }
- else
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: error recovery discarding state %d\n",
- YYPREFIX, *yyssp);
-#endif
- if (yyssp <= yyss) goto yyabort;
- --yyssp;
- --yyvsp;
- }
- }
- }
- else
- {
- if (yychar == 0) goto yyabort;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
- YYPREFIX, yystate, yychar, yys);
- }
-#endif
- yychar = (-1);
- goto yyloop;
- }
-yyreduce:
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: state %d, reducing by rule %d (%s)\n",
- YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
- yym = yylen[yyn];
- yyval = yyvsp[1-yym];
- switch (yyn)
- {
-case 1:
-#line 52 "a2p.y"
-{ root = oper4(OPROG,yyvsp[-1],begins,yyvsp[0],ends); }
-break;
-case 2:
-#line 56 "a2p.y"
-{ begins = oper4(OJUNK,begins,yyvsp[-3],yyvsp[-2],yyvsp[0]); in_begin = FALSE;
- yyval = Nullop; }
-break;
-case 3:
-#line 61 "a2p.y"
-{ ends = oper3(OJUNK,ends,yyvsp[-2],yyvsp[-1]); yyval = Nullop; }
-break;
-case 4:
-#line 63 "a2p.y"
-{ yyval = yyvsp[-1]; }
-break;
-case 5:
-#line 67 "a2p.y"
-{ yyval = oper3(OHUNKS,yyvsp[-2],yyvsp[-1],yyvsp[0]); }
-break;
-case 6:
-#line 69 "a2p.y"
-{ yyval = Nullop; }
-break;
-case 7:
-#line 73 "a2p.y"
-{ yyval = oper1(OHUNK,yyvsp[0]); need_entire = TRUE; }
-break;
-case 8:
-#line 75 "a2p.y"
-{ yyval = oper2(OHUNK,yyvsp[-4],oper2(OJUNK,yyvsp[-2],yyvsp[-1])); }
-break;
-case 9:
-#line 77 "a2p.y"
-{ fixfargs(yyvsp[-8],yyvsp[-6],0); yyval = oper5(OUSERDEF,yyvsp[-8],yyvsp[-6],yyvsp[-4],yyvsp[-2],yyvsp[-1]); }
-break;
-case 10:
-#line 79 "a2p.y"
-{ yyval = oper2(OHUNK,Nullop,oper2(OJUNK,yyvsp[-2],yyvsp[-1])); }
-break;
-case 13:
-#line 85 "a2p.y"
-{ yyval = rememberargs(yyval); }
-break;
-case 14:
-#line 89 "a2p.y"
-{ yyval = oper1(OPAT,yyvsp[0]); }
-break;
-case 15:
-#line 91 "a2p.y"
-{ yyval = oper2(ORANGE,yyvsp[-2],yyvsp[0]); }
-break;
-case 20:
-#line 99 "a2p.y"
-{ yyval = oper3(OCOND,yyvsp[-4],yyvsp[-2],yyvsp[0]); }
-break;
-case 21:
-#line 104 "a2p.y"
-{ yyval = oper1(OCPAREN,yyvsp[-1]); }
-break;
-case 22:
-#line 106 "a2p.y"
-{ yyval = oper3(OCANDAND,yyvsp[-3],yyvsp[-1],yyvsp[0]); }
-break;
-case 23:
-#line 108 "a2p.y"
-{ yyval = oper3(OCOROR,yyvsp[-3],yyvsp[-1],yyvsp[0]); }
-break;
-case 24:
-#line 110 "a2p.y"
-{ yyval = oper1(OCNOT,yyvsp[0]); }
-break;
-case 25:
-#line 114 "a2p.y"
-{ yyval = oper3(ORELOP,yyvsp[-1],yyvsp[-2],yyvsp[0]); }
-break;
-case 26:
-#line 116 "a2p.y"
-{ yyval = oper3(ORELOP,string(">",1),yyvsp[-2],yyvsp[0]); }
-break;
-case 27:
-#line 118 "a2p.y"
-{ yyval = oper3(ORELOP,string("<",1),yyvsp[-2],yyvsp[0]); }
-break;
-case 28:
-#line 120 "a2p.y"
-{ yyval = oper1(ORPAREN,yyvsp[-1]); }
-break;
-case 29:
-#line 124 "a2p.y"
-{ yyval = oper3(OMATCHOP,yyvsp[-1],yyvsp[-2],yyvsp[0]); }
-break;
-case 30:
-#line 126 "a2p.y"
-{ yyval = oper3(OMATCHOP,yyvsp[-1],yyvsp[-2],oper1(OREGEX,yyvsp[0])); }
-break;
-case 31:
-#line 128 "a2p.y"
-{ yyval = oper1(OREGEX,yyvsp[0]); }
-break;
-case 32:
-#line 130 "a2p.y"
-{ yyval = oper1(OMPAREN,yyvsp[-1]); }
-break;
-case 33:
-#line 134 "a2p.y"
-{ yyval = yyvsp[0]; }
-break;
-case 34:
-#line 136 "a2p.y"
-{ yyval = oper2(OCONCAT,yyvsp[-1],yyvsp[0]); }
-break;
-case 35:
-#line 138 "a2p.y"
-{ yyval = oper3(OCOND,yyvsp[-4],yyvsp[-2],yyvsp[0]); }
-break;
-case 36:
-#line 140 "a2p.y"
-{
- yyval = oper3(OASSIGN,yyvsp[-1],yyvsp[-2],yyvsp[0]);
- if ((ops[yyvsp[-2]].ival & 255) == OFLD)
- lval_field = TRUE;
- else if ((ops[yyvsp[-2]].ival & 255) == OVFLD)
- lval_field = TRUE;
- }
-break;
-case 39:
-#line 153 "a2p.y"
-{ yyval = yyvsp[0]; }
-break;
-case 40:
-#line 155 "a2p.y"
-{ yyval = oper1(ONUM,yyvsp[0]); }
-break;
-case 41:
-#line 157 "a2p.y"
-{ yyval = oper1(OSTR,yyvsp[0]); }
-break;
-case 42:
-#line 159 "a2p.y"
-{ yyval = oper2(OADD,yyvsp[-2],yyvsp[0]); }
-break;
-case 43:
-#line 161 "a2p.y"
-{ yyval = oper2(OSUBTRACT,yyvsp[-2],yyvsp[0]); }
-break;
-case 44:
-#line 163 "a2p.y"
-{ yyval = oper2(OMULT,yyvsp[-2],yyvsp[0]); }
-break;
-case 45:
-#line 165 "a2p.y"
-{ yyval = oper2(ODIV,yyvsp[-2],yyvsp[0]); }
-break;
-case 46:
-#line 167 "a2p.y"
-{ yyval = oper2(OMOD,yyvsp[-2],yyvsp[0]); }
-break;
-case 47:
-#line 169 "a2p.y"
-{ yyval = oper2(OPOW,yyvsp[-2],yyvsp[0]); }
-break;
-case 48:
-#line 171 "a2p.y"
-{ yyval = oper2(ODEFINED,aryrefarg(yyvsp[0]),yyvsp[-2]); }
-break;
-case 49:
-#line 173 "a2p.y"
-{
- yyval = oper1(OPOSTINCR,yyvsp[-1]);
- if ((ops[yyvsp[-1]].ival & 255) == OFLD)
- lval_field = TRUE;
- else if ((ops[yyvsp[-1]].ival & 255) == OVFLD)
- lval_field = TRUE;
- }
-break;
-case 50:
-#line 181 "a2p.y"
-{
- yyval = oper1(OPOSTDECR,yyvsp[-1]);
- if ((ops[yyvsp[-1]].ival & 255) == OFLD)
- lval_field = TRUE;
- else if ((ops[yyvsp[-1]].ival & 255) == OVFLD)
- lval_field = TRUE;
- }
-break;
-case 51:
-#line 189 "a2p.y"
-{
- yyval = oper1(OPREINCR,yyvsp[0]);
- if ((ops[yyvsp[0]].ival & 255) == OFLD)
- lval_field = TRUE;
- else if ((ops[yyvsp[0]].ival & 255) == OVFLD)
- lval_field = TRUE;
- }
-break;
-case 52:
-#line 197 "a2p.y"
-{
- yyval = oper1(OPREDECR,yyvsp[0]);
- if ((ops[yyvsp[0]].ival & 255) == OFLD)
- lval_field = TRUE;
- else if ((ops[yyvsp[0]].ival & 255) == OVFLD)
- lval_field = TRUE;
- }
-break;
-case 53:
-#line 205 "a2p.y"
-{ yyval = oper1(OUMINUS,yyvsp[0]); }
-break;
-case 54:
-#line 207 "a2p.y"
-{ yyval = oper1(OUPLUS,yyvsp[0]); }
-break;
-case 55:
-#line 209 "a2p.y"
-{ yyval = oper1(OPAREN,yyvsp[-1]); }
-break;
-case 56:
-#line 211 "a2p.y"
-{ yyval = oper0(OGETLINE); }
-break;
-case 57:
-#line 213 "a2p.y"
-{ yyval = oper1(OGETLINE,yyvsp[0]); }
-break;
-case 58:
-#line 215 "a2p.y"
-{ yyval = oper3(OGETLINE,Nullop,string("<",1),yyvsp[0]);
- if (ops[yyvsp[0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
-break;
-case 59:
-#line 218 "a2p.y"
-{ yyval = oper3(OGETLINE,yyvsp[-2],string("<",1),yyvsp[0]);
- if (ops[yyvsp[0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
-break;
-case 60:
-#line 221 "a2p.y"
-{ yyval = oper3(OGETLINE,Nullop,string("|",1),yyvsp[-2]);
- if (ops[yyvsp[-2]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
-break;
-case 61:
-#line 224 "a2p.y"
-{ yyval = oper3(OGETLINE,yyvsp[0],string("|",1),yyvsp[-3]);
- if (ops[yyvsp[-3]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
-break;
-case 62:
-#line 227 "a2p.y"
-{ yyval = oper0(yyvsp[0]); need_entire = do_chop = TRUE; }
-break;
-case 63:
-#line 229 "a2p.y"
-{ yyval = oper1(yyvsp[-2],Nullop); need_entire = do_chop = TRUE; }
-break;
-case 64:
-#line 231 "a2p.y"
-{ yyval = oper1(yyvsp[-3],yyvsp[-1]); }
-break;
-case 65:
-#line 233 "a2p.y"
-{ yyval = oper1(yyvsp[-3],yyvsp[-1]); }
-break;
-case 66:
-#line 235 "a2p.y"
-{ yyval = oper2(OUSERFUN,yyvsp[-3],yyvsp[-1]); }
-break;
-case 67:
-#line 237 "a2p.y"
-{ yyval = oper1(OSPRINTF,yyvsp[-1]); }
-break;
-case 68:
-#line 239 "a2p.y"
-{ yyval = oper1(OSPRINTF,yyvsp[0]); }
-break;
-case 69:
-#line 241 "a2p.y"
-{ yyval = oper3(OSUBSTR,yyvsp[-5],yyvsp[-3],yyvsp[-1]); }
-break;
-case 70:
-#line 243 "a2p.y"
-{ yyval = oper2(OSUBSTR,yyvsp[-3],yyvsp[-1]); }
-break;
-case 71:
-#line 245 "a2p.y"
-{ yyval = oper3(OSPLIT,yyvsp[-5],aryrefarg(numary(yyvsp[-3])),yyvsp[-1]); }
-break;
-case 72:
-#line 247 "a2p.y"
-{ yyval = oper3(OSPLIT,yyvsp[-5],aryrefarg(numary(yyvsp[-3])),oper1(OREGEX,yyvsp[-1]));}
-break;
-case 73:
-#line 249 "a2p.y"
-{ yyval = oper2(OSPLIT,yyvsp[-3],aryrefarg(numary(yyvsp[-1]))); }
-break;
-case 74:
-#line 251 "a2p.y"
-{ yyval = oper2(OINDEX,yyvsp[-3],yyvsp[-1]); }
-break;
-case 75:
-#line 253 "a2p.y"
-{ yyval = oper2(OMATCH,yyvsp[-3],oper1(OREGEX,yyvsp[-1])); }
-break;
-case 76:
-#line 255 "a2p.y"
-{ yyval = oper2(OMATCH,yyvsp[-3],yyvsp[-1]); }
-break;
-case 77:
-#line 257 "a2p.y"
-{ yyval = oper2(OSUB,yyvsp[-3],yyvsp[-1]); }
-break;
-case 78:
-#line 259 "a2p.y"
-{ yyval = oper2(OSUB,oper1(OREGEX,yyvsp[-3]),yyvsp[-1]); }
-break;
-case 79:
-#line 261 "a2p.y"
-{ yyval = oper2(OGSUB,yyvsp[-3],yyvsp[-1]); }
-break;
-case 80:
-#line 263 "a2p.y"
-{ yyval = oper2(OGSUB,oper1(OREGEX,yyvsp[-3]),yyvsp[-1]); }
-break;
-case 81:
-#line 265 "a2p.y"
-{ yyval = oper3(OSUB,yyvsp[-5],yyvsp[-3],yyvsp[-1]); }
-break;
-case 82:
-#line 267 "a2p.y"
-{ yyval = oper3(OSUB,oper1(OREGEX,yyvsp[-5]),yyvsp[-3],yyvsp[-1]); }
-break;
-case 83:
-#line 269 "a2p.y"
-{ yyval = oper3(OGSUB,yyvsp[-5],yyvsp[-3],yyvsp[-1]); }
-break;
-case 84:
-#line 271 "a2p.y"
-{ yyval = oper3(OGSUB,oper1(OREGEX,yyvsp[-5]),yyvsp[-3],yyvsp[-1]); }
-break;
-case 85:
-#line 275 "a2p.y"
-{ yyval = oper1(OVAR,yyvsp[0]); }
-break;
-case 86:
-#line 277 "a2p.y"
-{ yyval = oper2(OVAR,aryrefarg(yyvsp[-3]),yyvsp[-1]); }
-break;
-case 87:
-#line 279 "a2p.y"
-{ yyval = oper1(OFLD,yyvsp[0]); }
-break;
-case 88:
-#line 281 "a2p.y"
-{ yyval = oper1(OVFLD,oper1(OVAR,yyvsp[0])); }
-break;
-case 89:
-#line 283 "a2p.y"
-{ yyval = oper1(OVFLD,yyvsp[0]); }
-break;
-case 92:
-#line 290 "a2p.y"
-{ yyval = Nullop; }
-break;
-case 93:
-#line 294 "a2p.y"
-{ yyval = oper3(OCOMMA,yyvsp[-3],yyvsp[-1],yyvsp[0]); }
-break;
-case 94:
-#line 296 "a2p.y"
-{ yyval = oper3(OCOMMA,yyvsp[-3],yyvsp[-1],yyvsp[0]); }
-break;
-case 95:
-#line 298 "a2p.y"
-{ yyval = yyvsp[-1]; }
-break;
-case 96:
-#line 302 "a2p.y"
-{ yyval = oper2(OJUNK,yyvsp[-1],yyvsp[0]); }
-break;
-case 97:
-#line 304 "a2p.y"
-{ yyval = Nullop; }
-break;
-case 98:
-#line 308 "a2p.y"
-{ yyval = oper2(OJUNK,oper0(OSEMICOLON),oper0(ONEWLINE)); }
-break;
-case 99:
-#line 310 "a2p.y"
-{ yyval = oper2(OJUNK,oper0(OSEMICOLON),oper0(ONEWLINE)); }
-break;
-case 100:
-#line 312 "a2p.y"
-{ yyval = oper0(ONEWLINE); }
-break;
-case 101:
-#line 314 "a2p.y"
-{ yyval = oper1(OCOMMENT,yyvsp[0]); }
-break;
-case 102:
-#line 318 "a2p.y"
-{ yyval = oper2(OJUNK,yyvsp[-1],yyvsp[0]); }
-break;
-case 103:
-#line 320 "a2p.y"
-{ yyval = Nullop; }
-break;
-case 104:
-#line 324 "a2p.y"
-{ yyval = oper0(ONEWLINE); }
-break;
-case 105:
-#line 326 "a2p.y"
-{ yyval = oper1(OCOMMENT,yyvsp[0]); }
-break;
-case 106:
-#line 331 "a2p.y"
-{ yyval = oper2(OJUNK,oper0(OSEMICOLON),yyvsp[0]); }
-break;
-case 107:
-#line 333 "a2p.y"
-{ yyval = oper2(OJUNK,oper0(OSNEWLINE),yyvsp[0]); }
-break;
-case 108:
-#line 335 "a2p.y"
-{ yyval = oper2(OJUNK,oper0(OSNEWLINE),yyvsp[0]); }
-break;
-case 109:
-#line 337 "a2p.y"
-{ yyval = oper2(OJUNK,oper1(OSCOMMENT,yyvsp[-1]),yyvsp[0]); }
-break;
-case 110:
-#line 341 "a2p.y"
-{ yyval = oper2(OSTATES,yyvsp[-1],yyvsp[0]); }
-break;
-case 111:
-#line 343 "a2p.y"
-{ yyval = Nullop; }
-break;
-case 112:
-#line 348 "a2p.y"
-{ yyval = oper2(OJUNK,oper2(OSTATE,yyvsp[-2],yyvsp[-1]),yyvsp[0]); }
-break;
-case 113:
-#line 350 "a2p.y"
-{ yyval = oper2(OSTATE,Nullop,oper2(OJUNK,oper0(OSEMICOLON),yyvsp[0])); }
-break;
-case 114:
-#line 352 "a2p.y"
-{ yyval = oper2(OSTATE,Nullop,oper2(OJUNK,oper0(OSNEWLINE),yyvsp[0])); }
-break;
-case 117:
-#line 358 "a2p.y"
-{ yyval = Nullop; }
-break;
-case 119:
-#line 364 "a2p.y"
-{ yyval = oper3(OPRINT,yyvsp[-2],yyvsp[-1],yyvsp[0]);
- do_opens = TRUE;
- saw_ORS = saw_OFS = TRUE;
- if (!yyvsp[-2]) need_entire = TRUE;
- if (ops[yyvsp[0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
-break;
-case 120:
-#line 370 "a2p.y"
-{ yyval = oper1(OPRINT,yyvsp[0]);
- if (!yyvsp[0]) need_entire = TRUE;
- saw_ORS = saw_OFS = TRUE;
- }
-break;
-case 121:
-#line 375 "a2p.y"
-{ yyval = oper3(OPRINTF,yyvsp[-2],yyvsp[-1],yyvsp[0]);
- do_opens = TRUE;
- if (!yyvsp[-2]) need_entire = TRUE;
- if (ops[yyvsp[0]].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
-break;
-case 122:
-#line 380 "a2p.y"
-{ yyval = oper1(OPRINTF,yyvsp[0]);
- if (!yyvsp[0]) need_entire = TRUE;
- }
-break;
-case 123:
-#line 384 "a2p.y"
-{ yyval = oper0(OBREAK); }
-break;
-case 124:
-#line 386 "a2p.y"
-{ yyval = oper0(ONEXT); }
-break;
-case 125:
-#line 388 "a2p.y"
-{ yyval = oper0(OEXIT); }
-break;
-case 126:
-#line 390 "a2p.y"
-{ yyval = oper1(OEXIT,yyvsp[0]); }
-break;
-case 127:
-#line 392 "a2p.y"
-{ yyval = oper0(OCONTINUE); }
-break;
-case 128:
-#line 394 "a2p.y"
-{ yyval = oper0(ORETURN); }
-break;
-case 129:
-#line 396 "a2p.y"
-{ yyval = oper1(ORETURN,yyvsp[0]); }
-break;
-case 130:
-#line 398 "a2p.y"
-{ yyval = oper2(ODELETE,aryrefarg(yyvsp[-3]),yyvsp[-1]); }
-break;
-case 131:
-#line 402 "a2p.y"
-{ yyval = oper1(OREDIR,string(">",1)); }
-break;
-case 132:
-#line 404 "a2p.y"
-{ yyval = oper1(OREDIR,string(">>",2)); }
-break;
-case 133:
-#line 406 "a2p.y"
-{ yyval = oper1(OREDIR,string("|",1)); }
-break;
-case 134:
-#line 411 "a2p.y"
-{ yyval = oper2(OIF,yyvsp[-3],bl(yyvsp[0],yyvsp[-1])); }
-break;
-case 135:
-#line 413 "a2p.y"
-{ yyval = oper3(OIF,yyvsp[-6],bl(yyvsp[-3],yyvsp[-4]),bl(yyvsp[0],yyvsp[-1])); }
-break;
-case 136:
-#line 415 "a2p.y"
-{ yyval = oper2(OWHILE,yyvsp[-3],bl(yyvsp[0],yyvsp[-1])); }
-break;
-case 137:
-#line 417 "a2p.y"
-{ yyval = oper2(ODO,bl(yyvsp[-4],yyvsp[-5]),yyvsp[-1]); }
-break;
-case 138:
-#line 419 "a2p.y"
-{ yyval = oper4(OFOR,yyvsp[-7],yyvsp[-5],yyvsp[-3],bl(yyvsp[0],yyvsp[-1])); }
-break;
-case 139:
-#line 421 "a2p.y"
-{ yyval = oper4(OFOR,yyvsp[-6],string("",0),yyvsp[-3],bl(yyvsp[0],yyvsp[-1])); }
-break;
-case 140:
-#line 423 "a2p.y"
-{ yyval = oper2(OFORIN,yyvsp[-3],bl(yyvsp[0],yyvsp[-1])); }
-break;
-case 141:
-#line 425 "a2p.y"
-{ yyval = oper3(OBLOCK,oper2(OJUNK,yyvsp[-3],yyvsp[-2]),Nullop,yyvsp[0]); }
-break;
-#line 2878 "y.tab.c"
- }
- yyssp -= yym;
- yystate = *yyssp;
- yyvsp -= yym;
- yym = yylhs[yyn];
- if (yystate == 0 && yym == 0)
- {
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
- yystate = YYFINAL;
- *++yyssp = YYFINAL;
- *++yyvsp = yyval;
- if (yychar < 0)
- {
- if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
- if (yydebug)
- {
- yys = 0;
- if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
- if (!yys) yys = "illegal-symbol";
- printf("%sdebug: state %d, reading %d (%s)\n",
- YYPREFIX, YYFINAL, yychar, yys);
- }
-#endif
- }
- if (yychar == 0) goto yyaccept;
- goto yyloop;
- }
- if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
- yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
- yystate = yytable[yyn];
- else
- yystate = yydgoto[yym];
-#if YYDEBUG
- if (yydebug)
- printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
-#endif
- if (yyssp >= yyss + yystacksize - 1)
- {
- goto yyoverflow;
- }
- *++yyssp = yystate;
- *++yyvsp = yyval;
- goto yyloop;
-yyoverflow:
- yyerror("yacc stack overflow");
-yyabort:
- return (1);
-yyaccept:
- return (0);
-}
diff --git a/x2p/a2p.h b/x2p/a2p.h
deleted file mode 100644
index 1d2a562744..0000000000
--- a/x2p/a2p.h
+++ /dev/null
@@ -1,462 +0,0 @@
-/* a2p.h
- *
- * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- * 2000, 2001, 2002, by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- */
-
-#ifdef WIN32
-#define _INC_WIN32_PERL5 /* kludge around win32 stdio layer */
-#endif
-
-#ifdef __VMS
-# include "config.h"
-#elif defined(NETWARE)
-# include "../NetWare/config.h"
-#else
-# include "../config.h"
-#endif
-
-#if defined(__STDC__) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
-# define STANDARD_C 1
-#endif
-
-#ifdef WIN32
-#undef USE_STDIO_PTR /* XXX fast gets won't work, must investigate */
-# ifndef STANDARD_C
-# define STANDARD_C
-# endif
-#endif
-
-/* Use all the "standard" definitions? */
-#if defined(STANDARD_C) && defined(I_STDLIB)
-# include <stdlib.h>
-#endif /* STANDARD_C */
-
-#include <stdio.h>
-
-#ifdef I_MATH
-#include <math.h>
-#endif
-
-#ifdef I_SYS_TYPES
-# include <sys/types.h>
-#endif
-
-#ifdef USE_NEXT_CTYPE
-
-#if NX_CURRENT_COMPILER_RELEASE >= 400
-#include <objc/NXCType.h>
-#else /* NX_CURRENT_COMPILER_RELEASE < 400 */
-#include <appkit/NXCType.h>
-#endif /* NX_CURRENT_COMPILER_RELEASE >= 400 */
-
-#else /* !USE_NEXT_CTYPE */
-#include <ctype.h>
-#endif /* USE_NEXT_CTYPE */
-
-#define MEM_SIZE Size_t
-#ifdef PERL_MEM_LOG
- typedef IVTYPE IV;
- typedef UVTYPE UV;
-#endif
-
-#ifndef STANDARD_C
- Malloc_t malloc (MEM_SIZE nbytes);
- Malloc_t calloc (MEM_SIZE elements, MEM_SIZE size);
- Malloc_t realloc (Malloc_t where, MEM_SIZE nbytes);
- Free_t free (Malloc_t where);
-#endif
-
-#if defined(I_STRING) || defined(__cplusplus)
-# include <string.h>
-#else
-# include <strings.h>
-#endif
-
-#if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)
-#define strchr index
-#define strrchr rindex
-#endif
-
-#ifdef I_TIME
-# include <time.h>
-#endif
-
-#ifdef I_SYS_TIME
-# ifdef I_SYS_TIME_KERNEL
-# define KERNEL
-# endif
-# include <sys/time.h>
-# ifdef I_SYS_TIME_KERNEL
-# undef KERNEL
-# endif
-#endif
-
-#ifndef MSDOS
-# if defined(HAS_TIMES) && defined(I_SYS_TIMES)
-# include <sys/times.h>
-# endif
-#endif
-
-#ifdef DOSISH
-# if defined(OS2)
-# define PTHX_UNUSED
-# include "../os2ish.h"
-# else
-# include "../dosish.h"
-# endif
-#else
-# if defined(VMS)
-# define NO_PERL_TYPEDEFS
-# include "vmsish.h"
-# endif
-#endif
-
-#ifndef STANDARD_C
-/* All of these are in stdlib.h or time.h for ANSI C */
-Time_t time();
-struct tm *gmtime(), *localtime();
-#if defined(OEMVS)
-char *(strchr)(), *(strrchr)();
-char *(strcpy)(), *(strcat)();
-#else
-char *strchr(), *strrchr();
-char *strcpy(), *strcat();
-#endif
-#endif /* ! STANDARD_C */
-
-#ifdef __cplusplus
-# define PERL_EXPORT_C extern "C"
-#else
-# define PERL_EXPORT_C extern
-#endif
-
-#ifdef VMS
-# include "handy.h"
-#else
-# include "../handy.h"
-#endif
-
-#define Nullop 0
-
-#define OPROG 1
-#define OJUNK 2
-#define OHUNKS 3
-#define ORANGE 4
-#define OPAT 5
-#define OHUNK 6
-#define OPPAREN 7
-#define OPANDAND 8
-#define OPOROR 9
-#define OPNOT 10
-#define OCPAREN 11
-#define OCANDAND 12
-#define OCOROR 13
-#define OCNOT 14
-#define ORELOP 15
-#define ORPAREN 16
-#define OMATCHOP 17
-#define OMPAREN 18
-#define OCONCAT 19
-#define OASSIGN 20
-#define OADD 21
-#define OSUBTRACT 22
-#define OMULT 23
-#define ODIV 24
-#define OMOD 25
-#define OPOSTINCR 26
-#define OPOSTDECR 27
-#define OPREINCR 28
-#define OPREDECR 29
-#define OUMINUS 30
-#define OUPLUS 31
-#define OPAREN 32
-#define OGETLINE 33
-#define OSPRINTF 34
-#define OSUBSTR 35
-#define OSTRING 36
-#define OSPLIT 37
-#define OSNEWLINE 38
-#define OINDEX 39
-#define ONUM 40
-#define OSTR 41
-#define OVAR 42
-#define OFLD 43
-#define ONEWLINE 44
-#define OCOMMENT 45
-#define OCOMMA 46
-#define OSEMICOLON 47
-#define OSCOMMENT 48
-#define OSTATES 49
-#define OSTATE 50
-#define OPRINT 51
-#define OPRINTF 52
-#define OBREAK 53
-#define ONEXT 54
-#define OEXIT 55
-#define OCONTINUE 56
-#define OREDIR 57
-#define OIF 58
-#define OWHILE 59
-#define OFOR 60
-#define OFORIN 61
-#define OVFLD 62
-#define OBLOCK 63
-#define OREGEX 64
-#define OLENGTH 65
-#define OLOG 66
-#define OEXP 67
-#define OSQRT 68
-#define OINT 69
-#define ODO 70
-#define OPOW 71
-#define OSUB 72
-#define OGSUB 73
-#define OMATCH 74
-#define OUSERFUN 75
-#define OUSERDEF 76
-#define OCLOSE 77
-#define OATAN2 78
-#define OSIN 79
-#define OCOS 80
-#define ORAND 81
-#define OSRAND 82
-#define ODELETE 83
-#define OSYSTEM 84
-#define OCOND 85
-#define ORETURN 86
-#define ODEFINED 87
-#define OSTAR 88
-
-#ifdef DOINIT
-const char *opname[] = {
- "0",
- "PROG",
- "JUNK",
- "HUNKS",
- "RANGE",
- "PAT",
- "HUNK",
- "PPAREN",
- "PANDAND",
- "POROR",
- "PNOT",
- "CPAREN",
- "CANDAND",
- "COROR",
- "CNOT",
- "RELOP",
- "RPAREN",
- "MATCHOP",
- "MPAREN",
- "CONCAT",
- "ASSIGN",
- "ADD",
- "SUBTRACT",
- "MULT",
- "DIV",
- "MOD",
- "POSTINCR",
- "POSTDECR",
- "PREINCR",
- "PREDECR",
- "UMINUS",
- "UPLUS",
- "PAREN",
- "GETLINE",
- "SPRINTF",
- "SUBSTR",
- "STRING",
- "SPLIT",
- "SNEWLINE",
- "INDEX",
- "NUM",
- "STR",
- "VAR",
- "FLD",
- "NEWLINE",
- "COMMENT",
- "COMMA",
- "SEMICOLON",
- "SCOMMENT",
- "STATES",
- "STATE",
- "PRINT",
- "PRINTF",
- "BREAK",
- "NEXT",
- "EXIT",
- "CONTINUE",
- "REDIR",
- "IF",
- "WHILE",
- "FOR",
- "FORIN",
- "VFLD",
- "BLOCK",
- "REGEX",
- "LENGTH",
- "LOG",
- "EXP",
- "SQRT",
- "INT",
- "DO",
- "POW",
- "SUB",
- "GSUB",
- "MATCH",
- "USERFUN",
- "USERDEF",
- "CLOSE",
- "ATAN2",
- "SIN",
- "COS",
- "RAND",
- "SRAND",
- "DELETE",
- "SYSTEM",
- "COND",
- "RETURN",
- "DEFINED",
- "STAR",
- "89"
-};
-#else
-extern const char *opname[];
-#endif
-
-EXT int mop INIT(1);
-
-union u_ops {
- int ival;
- char *cval;
-};
-#define OPSMAX 50000
-EXT union u_ops ops[OPSMAX];
-
-typedef struct string STR;
-typedef struct htbl HASH;
-
-#include "str.h"
-#include "hash.h"
-
-
-/* A string is TRUE if not "" or "0". */
-#define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
-EXT const char *Yes INIT("1");
-EXT const char *No INIT("");
-
-#define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
-EXT STR *Str;
-
-#define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
-
-/* Prototypes for things in a2p.c */
-int aryrefarg ( int arg );
-int bl ( int arg, int maybe );
-void dump ( int branch );
-int fixfargs ( int name, int arg, int prevargs );
-int fixrargs ( char *name, int arg, int prevargs );
-void fixup ( STR *str );
-int numary ( int arg );
-int oper0 ( int type );
-int oper1 ( int type, int arg1 );
-int oper2 ( int type, int arg1, int arg2 );
-int oper3 ( int type, int arg1, int arg2, int arg3 );
-int oper4 ( int type, int arg1, int arg2, int arg3, int arg4 );
-int oper5 ( int type, int arg1, int arg2, int arg3, int arg4, int arg5 );
-void putlines ( STR *str );
-void putone ( void );
-int rememberargs ( int arg );
-char * scannum ( char *s );
-char * scanpat ( char *s );
-int string ( const char *ptr, int len );
-void yyerror ( const char *s );
-int yylex ( void );
-
-EXT int line INIT(0);
-
-EXT FILE *rsfp;
-EXT char buf[2048];
-EXT char *bufptr INIT(buf);
-
-EXT STR *linestr INIT(NULL);
-
-EXT char tokenbuf[2048];
-EXT int expectterm INIT(TRUE);
-
-#ifdef DEBUGGING
-EXT int debug INIT(0);
-EXT int dlevel INIT(0);
-#define YYDEBUG 1
-extern int yydebug;
-#else
-# ifndef YYDEBUG
-# define YYDEBUG 0
-# endif
-#endif
-
-EXT STR *freestrroot INIT(NULL);
-
-EXT STR str_no;
-EXT STR str_yes;
-
-EXT bool do_split INIT(FALSE);
-EXT bool split_to_array INIT(FALSE);
-EXT bool saw_RS INIT(FALSE);
-EXT bool saw_OFS INIT(FALSE);
-EXT bool saw_ORS INIT(FALSE);
-EXT bool saw_line_op INIT(FALSE);
-EXT bool in_begin INIT(TRUE);
-EXT bool do_opens INIT(FALSE);
-EXT bool do_fancy_opens INIT(FALSE);
-EXT bool lval_field INIT(FALSE);
-EXT bool do_chop INIT(FALSE);
-EXT bool need_entire INIT(FALSE);
-EXT bool absmaxfld INIT(FALSE);
-EXT bool saw_altinput INIT(FALSE);
-
-EXT bool nomemok INIT(FALSE);
-
-EXT char const_FS INIT(0);
-EXT char *namelist INIT(NULL);
-EXT char fswitch INIT(0);
-EXT bool old_awk INIT(0);
-
-EXT int saw_FS INIT(0);
-EXT int maxfld INIT(0);
-EXT int arymax INIT(0);
-EXT char *nameary[100];
-
-EXT STR *opens;
-
-EXT HASH *symtab;
-EXT HASH *curarghash;
-
-#define P_MIN 0
-#define P_LISTOP 5
-#define P_COMMA 10
-#define P_ASSIGN 15
-#define P_COND 20
-#define P_DOTDOT 25
-#define P_OROR 30
-#define P_ANDAND 35
-#define P_OR 40
-#define P_AND 45
-#define P_EQ 50
-#define P_REL 55
-#define P_UNI 60
-#define P_FILETEST 65
-#define P_SHIFT 70
-#define P_ADD 75
-#define P_MUL 80
-#define P_MATCH 85
-#define P_UNARY 90
-#define P_POW 95
-#define P_AUTO 100
-#define P_MAX 999
-
-EXT int an;
diff --git a/x2p/a2p.pod b/x2p/a2p.pod
deleted file mode 100644
index aeddf9a0d5..0000000000
--- a/x2p/a2p.pod
+++ /dev/null
@@ -1,175 +0,0 @@
-=head1 NAME
-
-a2p - Awk to Perl translator
-
-=head1 SYNOPSIS
-
-B<a2p> [I<options>] [I<filename>]
-
-=head1 DESCRIPTION
-
-I<A2p> takes an awk script specified on the command line (or from
-standard input) and produces a comparable I<perl> script on the
-standard output.
-
-=head2 OPTIONS
-
-Options include:
-
-=over 5
-
-=item B<-DE<lt>numberE<gt>>
-
-sets debugging flags.
-
-=item B<-FE<lt>characterE<gt>>
-
-tells a2p that this awk script is always invoked with this B<-F>
-switch.
-
-=item B<-nE<lt>fieldlistE<gt>>
-
-specifies the names of the input fields if input does not have to be
-split into an array. If you were translating an awk script that
-processes the password file, you might say:
-
- a2p -7 -nlogin.password.uid.gid.gcos.shell.home
-
-Any delimiter can be used to separate the field names.
-
-=item B<-E<lt>numberE<gt>>
-
-causes a2p to assume that input will always have that many fields.
-
-=item B<-o>
-
-tells a2p to use old awk behavior. The only current differences are:
-
-=over 5
-
-=item *
-
-Old awk always has a line loop, even if there are no line
-actions, whereas new awk does not.
-
-=item *
-
-In old awk, sprintf is extremely greedy about its arguments.
-For example, given the statement
-
- print sprintf(some_args), extra_args;
-
-old awk considers I<extra_args> to be arguments to C<sprintf>; new awk
-considers them arguments to C<print>.
-
-=back
-
-=back
-
-=head2 "Considerations"
-
-A2p cannot do as good a job translating as a human would, but it
-usually does pretty well. There are some areas where you may want to
-examine the perl script produced and tweak it some. Here are some of
-them, in no particular order.
-
-There is an awk idiom of putting int() around a string expression to
-force numeric interpretation, even though the argument is always
-integer anyway. This is generally unneeded in perl, but a2p can't
-tell if the argument is always going to be integer, so it leaves it
-in. You may wish to remove it.
-
-Perl differentiates numeric comparison from string comparison. Awk
-has one operator for both that decides at run time which comparison to
-do. A2p does not try to do a complete job of awk emulation at this
-point. Instead it guesses which one you want. It's almost always
-right, but it can be spoofed. All such guesses are marked with the
-comment "C<#???>". You should go through and check them. You might
-want to run at least once with the B<-w> switch to perl, which will
-warn you if you use == where you should have used eq.
-
-Perl does not attempt to emulate the behavior of awk in which
-nonexistent array elements spring into existence simply by being
-referenced. If somehow you are relying on this mechanism to create
-null entries for a subsequent for...in, they won't be there in perl.
-
-If a2p makes a split line that assigns to a list of variables that
-looks like (Fld1, Fld2, Fld3...) you may want to rerun a2p using the
-B<-n> option mentioned above. This will let you name the fields
-throughout the script. If it splits to an array instead, the script
-is probably referring to the number of fields somewhere.
-
-The exit statement in awk doesn't necessarily exit; it goes to the END
-block if there is one. Awk scripts that do contortions within the END
-block to bypass the block under such circumstances can be simplified
-by removing the conditional in the END block and just exiting directly
-from the perl script.
-
-Perl has two kinds of array, numerically-indexed and associative.
-Perl associative arrays are called "hashes". Awk arrays are usually
-translated to hashes, but if you happen to know that the index is
-always going to be numeric you could change the {...} to [...].
-Iteration over a hash is done using the keys() function, but iteration
-over an array is NOT. You might need to modify any loop that iterates
-over such an array.
-
-Awk starts by assuming OFMT has the value %.6g. Perl starts by
-assuming its equivalent, $#, to have the value %.20g. You'll want to
-set $# explicitly if you use the default value of OFMT.
-
-Near the top of the line loop will be the split operation that is
-implicit in the awk script. There are times when you can move this
-down past some conditionals that test the entire record so that the
-split is not done as often.
-
-For aesthetic reasons you may wish to change index variables from being
-1-based (awk style) to 0-based (Perl style). Be sure to change all
-operations the variable is involved in to match.
-
-Cute comments that say "# Here is a workaround because awk is dumb"
-are passed through unmodified.
-
-Awk scripts are often embedded in a shell script that pipes stuff into
-and out of awk. Often the shell script wrapper can be incorporated
-into the perl script, since perl can start up pipes into and out of
-itself, and can do other things that awk can't do by itself.
-
-Scripts that refer to the special variables RSTART and RLENGTH can
-often be simplified by referring to the variables $`, $& and $', as
-long as they are within the scope of the pattern match that sets them.
-
-The produced perl script may have subroutines defined to deal with
-awk's semantics regarding getline and print. Since a2p usually picks
-correctness over efficiency. it is almost always possible to rewrite
-such code to be more efficient by discarding the semantic sugar.
-
-For efficiency, you may wish to remove the keyword from any return
-statement that is the last statement executed in a subroutine. A2p
-catches the most common case, but doesn't analyze embedded blocks for
-subtler cases.
-
-ARGV[0] translates to $ARGV0, but ARGV[n] translates to $ARGV[$n-1]. A
-loop that tries to iterate over ARGV[0] won't find it.
-
-=head1 ENVIRONMENT
-
-A2p uses no environment variables.
-
-=head1 AUTHOR
-
-Larry Wall E<lt>F<larry@wall.org>E<gt>
-
-=head1 SEE ALSO
-
- perl The perl compiler/interpreter
-
- s2p sed to perl translator
-
-=head1 BUGS
-
-It would be possible to emulate awk's behavior in selecting string
-versus numeric operations at run time by inspection of the operands,
-but it would be gross and inefficient. Besides, a2p almost always
-guesses right.
-
-Storage for the awk syntax tree is currently static, and can run out.
diff --git a/x2p/a2p.y b/x2p/a2p.y
deleted file mode 100644
index 74c42d8c19..0000000000
--- a/x2p/a2p.y
+++ /dev/null
@@ -1,432 +0,0 @@
-%{
-/* $RCSfile: a2p.y,v $$Revision: 4.1 $$Date: 92/08/07 18:29:12 $
- *
- * Copyright (C) 1991, 1992, 1993, 1994, 1996, 1997, 1999, 2000,
- * by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- *
- * $Log: a2p.y,v $
- */
-
-#include "INTERN.h"
-#include "a2p.h"
-
-int root;
-int begins = Nullop;
-int ends = Nullop;
-
-%}
-%token BEGIN END
-%token REGEX
-%token SEMINEW NEWLINE COMMENT
-%token FUN1 FUNN GRGR
-%token PRINT PRINTF SPRINTF_OLD SPRINTF_NEW SPLIT
-%token IF ELSE WHILE FOR IN
-%token EXIT NEXT BREAK CONTINUE RET
-%token GETLINE DO SUB GSUB MATCH
-%token FUNCTION USERFUN DELETE
-
-%right ASGNOP
-%right '?' ':'
-%left OROR
-%left ANDAND
-%left IN
-%left NUMBER VAR SUBSTR INDEX
-%left MATCHOP
-%left RELOP '<' '>'
-%left OR
-%left STRING
-%left '+' '-'
-%left '*' '/' '%'
-%right UMINUS
-%left NOT
-%right '^'
-%left INCR DECR
-%left FIELD VFIELD SVFIELD
-
-%%
-
-program : junk hunks
- { root = oper4(OPROG,$1,begins,$2,ends); }
- ;
-
-begin : BEGIN '{' maybe states '}' junk
- { begins = oper4(OJUNK,begins,$3,$4,$6); in_begin = FALSE;
- $$ = Nullop; }
- ;
-
-end : END '{' maybe states '}'
- { ends = oper3(OJUNK,ends,$3,$4); $$ = Nullop; }
- | end NEWLINE
- { $$ = $1; }
- ;
-
-hunks : hunks hunk junk
- { $$ = oper3(OHUNKS,$1,$2,$3); }
- | /* NULL */
- { $$ = Nullop; }
- ;
-
-hunk : patpat
- { $$ = oper1(OHUNK,$1); need_entire = TRUE; }
- | patpat '{' maybe states '}'
- { $$ = oper2(OHUNK,$1,oper2(OJUNK,$3,$4)); }
- | FUNCTION USERFUN '(' arg_list ')' maybe '{' maybe states '}'
- { fixfargs($2,$4,0); $$ = oper5(OUSERDEF,$2,$4,$6,$8,$9); }
- | '{' maybe states '}'
- { $$ = oper2(OHUNK,Nullop,oper2(OJUNK,$2,$3)); }
- | begin
- | end
- ;
-
-arg_list: expr_list
- { $$ = rememberargs($$); }
- ;
-
-patpat : cond
- { $$ = oper1(OPAT,$1); }
- | cond ',' cond
- { $$ = oper2(ORANGE,$1,$3); }
- ;
-
-cond : expr
- | match
- | rel
- | compound_cond
- | cond '?' expr ':' expr
- { $$ = oper3(OCOND,$1,$3,$5); }
- ;
-
-compound_cond
- : '(' compound_cond ')'
- { $$ = oper1(OCPAREN,$2); }
- | cond ANDAND maybe cond
- { $$ = oper3(OCANDAND,$1,$3,$4); }
- | cond OROR maybe cond
- { $$ = oper3(OCOROR,$1,$3,$4); }
- | NOT cond
- { $$ = oper1(OCNOT,$2); }
- ;
-
-rel : expr RELOP expr
- { $$ = oper3(ORELOP,$2,$1,$3); }
- | expr '>' expr
- { $$ = oper3(ORELOP,string(">",1),$1,$3); }
- | expr '<' expr
- { $$ = oper3(ORELOP,string("<",1),$1,$3); }
- | '(' rel ')'
- { $$ = oper1(ORPAREN,$2); }
- ;
-
-match : expr MATCHOP expr
- { $$ = oper3(OMATCHOP,$2,$1,$3); }
- | expr MATCHOP REGEX
- { $$ = oper3(OMATCHOP,$2,$1,oper1(OREGEX,$3)); }
- | REGEX %prec MATCHOP
- { $$ = oper1(OREGEX,$1); }
- | '(' match ')'
- { $$ = oper1(OMPAREN,$2); }
- ;
-
-expr : term
- { $$ = $1; }
- | expr term
- { $$ = oper2(OCONCAT,$1,$2); }
- | expr '?' expr ':' expr
- { $$ = oper3(OCOND,$1,$3,$5); }
- | variable ASGNOP cond
- {
- $$ = oper3(OASSIGN,$2,$1,$3);
- if ((ops[$1].ival & 255) == OFLD)
- lval_field = TRUE;
- else if ((ops[$1].ival & 255) == OVFLD)
- lval_field = TRUE;
- }
- ;
-
-sprintf : SPRINTF_NEW
- | SPRINTF_OLD ;
-
-term : variable
- { $$ = $1; }
- | NUMBER
- { $$ = oper1(ONUM,$1); }
- | STRING
- { $$ = oper1(OSTR,$1); }
- | term '+' term
- { $$ = oper2(OADD,$1,$3); }
- | term '-' term
- { $$ = oper2(OSUBTRACT,$1,$3); }
- | term '*' term
- { $$ = oper2(OMULT,$1,$3); }
- | term '/' term
- { $$ = oper2(ODIV,$1,$3); }
- | term '%' term
- { $$ = oper2(OMOD,$1,$3); }
- | term '^' term
- { $$ = oper2(OPOW,$1,$3); }
- | term IN VAR
- { $$ = oper2(ODEFINED,aryrefarg($3),$1); }
- | variable INCR
- {
- $$ = oper1(OPOSTINCR,$1);
- if ((ops[$1].ival & 255) == OFLD)
- lval_field = TRUE;
- else if ((ops[$1].ival & 255) == OVFLD)
- lval_field = TRUE;
- }
- | variable DECR
- {
- $$ = oper1(OPOSTDECR,$1);
- if ((ops[$1].ival & 255) == OFLD)
- lval_field = TRUE;
- else if ((ops[$1].ival & 255) == OVFLD)
- lval_field = TRUE;
- }
- | INCR variable
- {
- $$ = oper1(OPREINCR,$2);
- if ((ops[$2].ival & 255) == OFLD)
- lval_field = TRUE;
- else if ((ops[$2].ival & 255) == OVFLD)
- lval_field = TRUE;
- }
- | DECR variable
- {
- $$ = oper1(OPREDECR,$2);
- if ((ops[$2].ival & 255) == OFLD)
- lval_field = TRUE;
- else if ((ops[$2].ival & 255) == OVFLD)
- lval_field = TRUE;
- }
- | '-' term %prec UMINUS
- { $$ = oper1(OUMINUS,$2); }
- | '+' term %prec UMINUS
- { $$ = oper1(OUPLUS,$2); }
- | '(' cond ')'
- { $$ = oper1(OPAREN,$2); }
- | GETLINE
- { $$ = oper0(OGETLINE); }
- | GETLINE variable
- { $$ = oper1(OGETLINE,$2); }
- | GETLINE '<' expr
- { $$ = oper3(OGETLINE,Nullop,string("<",1),$3);
- if (ops[$3].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
- | GETLINE variable '<' expr
- { $$ = oper3(OGETLINE,$2,string("<",1),$4);
- if (ops[$4].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
- | term 'p' GETLINE
- { $$ = oper3(OGETLINE,Nullop,string("|",1),$1);
- if (ops[$1].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
- | term 'p' GETLINE variable
- { $$ = oper3(OGETLINE,$4,string("|",1),$1);
- if (ops[$1].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
- | FUN1
- { $$ = oper0($1); need_entire = do_chop = TRUE; }
- | FUN1 '(' ')'
- { $$ = oper1($1,Nullop); need_entire = do_chop = TRUE; }
- | FUN1 '(' expr ')'
- { $$ = oper1($1,$3); }
- | FUNN '(' expr_list ')'
- { $$ = oper1($1,$3); }
- | USERFUN '(' expr_list ')'
- { $$ = oper2(OUSERFUN,$1,$3); }
- | SPRINTF_NEW '(' expr_list ')'
- { $$ = oper1(OSPRINTF,$3); }
- | sprintf expr_list
- { $$ = oper1(OSPRINTF,$2); }
- | SUBSTR '(' expr ',' expr ',' expr ')'
- { $$ = oper3(OSUBSTR,$3,$5,$7); }
- | SUBSTR '(' expr ',' expr ')'
- { $$ = oper2(OSUBSTR,$3,$5); }
- | SPLIT '(' expr ',' VAR ',' expr ')'
- { $$ = oper3(OSPLIT,$3,aryrefarg(numary($5)),$7); }
- | SPLIT '(' expr ',' VAR ',' REGEX ')'
- { $$ = oper3(OSPLIT,$3,aryrefarg(numary($5)),oper1(OREGEX,$7));}
- | SPLIT '(' expr ',' VAR ')'
- { $$ = oper2(OSPLIT,$3,aryrefarg(numary($5))); }
- | INDEX '(' expr ',' expr ')'
- { $$ = oper2(OINDEX,$3,$5); }
- | MATCH '(' expr ',' REGEX ')'
- { $$ = oper2(OMATCH,$3,oper1(OREGEX,$5)); }
- | MATCH '(' expr ',' expr ')'
- { $$ = oper2(OMATCH,$3,$5); }
- | SUB '(' expr ',' expr ')'
- { $$ = oper2(OSUB,$3,$5); }
- | SUB '(' REGEX ',' expr ')'
- { $$ = oper2(OSUB,oper1(OREGEX,$3),$5); }
- | GSUB '(' expr ',' expr ')'
- { $$ = oper2(OGSUB,$3,$5); }
- | GSUB '(' REGEX ',' expr ')'
- { $$ = oper2(OGSUB,oper1(OREGEX,$3),$5); }
- | SUB '(' expr ',' expr ',' expr ')'
- { $$ = oper3(OSUB,$3,$5,$7); }
- | SUB '(' REGEX ',' expr ',' expr ')'
- { $$ = oper3(OSUB,oper1(OREGEX,$3),$5,$7); }
- | GSUB '(' expr ',' expr ',' expr ')'
- { $$ = oper3(OGSUB,$3,$5,$7); }
- | GSUB '(' REGEX ',' expr ',' expr ')'
- { $$ = oper3(OGSUB,oper1(OREGEX,$3),$5,$7); }
- ;
-
-variable: VAR
- { $$ = oper1(OVAR,$1); }
- | VAR '[' expr_list ']'
- { $$ = oper2(OVAR,aryrefarg($1),$3); }
- | FIELD
- { $$ = oper1(OFLD,$1); }
- | SVFIELD
- { $$ = oper1(OVFLD,oper1(OVAR,$1)); }
- | VFIELD term
- { $$ = oper1(OVFLD,$2); }
- ;
-
-expr_list
- : expr
- | clist
- | /* NULL */
- { $$ = Nullop; }
- ;
-
-clist : expr ',' maybe expr
- { $$ = oper3(OCOMMA,$1,$3,$4); }
- | clist ',' maybe expr
- { $$ = oper3(OCOMMA,$1,$3,$4); }
- | '(' clist ')' /* these parens are invisible */
- { $$ = $2; }
- ;
-
-junk : junk hunksep
- { $$ = oper2(OJUNK,$1,$2); }
- | /* NULL */
- { $$ = Nullop; }
- ;
-
-hunksep : ';'
- { $$ = oper2(OJUNK,oper0(OSEMICOLON),oper0(ONEWLINE)); }
- | SEMINEW
- { $$ = oper2(OJUNK,oper0(OSEMICOLON),oper0(ONEWLINE)); }
- | NEWLINE
- { $$ = oper0(ONEWLINE); }
- | COMMENT
- { $$ = oper1(OCOMMENT,$1); }
- ;
-
-maybe : maybe nlstuff
- { $$ = oper2(OJUNK,$1,$2); }
- | /* NULL */
- { $$ = Nullop; }
- ;
-
-nlstuff : NEWLINE
- { $$ = oper0(ONEWLINE); }
- | COMMENT
- { $$ = oper1(OCOMMENT,$1); }
- ;
-
-separator
- : ';' maybe
- { $$ = oper2(OJUNK,oper0(OSEMICOLON),$2); }
- | SEMINEW maybe
- { $$ = oper2(OJUNK,oper0(OSNEWLINE),$2); }
- | NEWLINE maybe
- { $$ = oper2(OJUNK,oper0(OSNEWLINE),$2); }
- | COMMENT maybe
- { $$ = oper2(OJUNK,oper1(OSCOMMENT,$1),$2); }
- ;
-
-states : states statement
- { $$ = oper2(OSTATES,$1,$2); }
- | /* NULL */
- { $$ = Nullop; }
- ;
-
-statement
- : simple separator maybe
- { $$ = oper2(OJUNK,oper2(OSTATE,$1,$2),$3); }
- | ';' maybe
- { $$ = oper2(OSTATE,Nullop,oper2(OJUNK,oper0(OSEMICOLON),$2)); }
- | SEMINEW maybe
- { $$ = oper2(OSTATE,Nullop,oper2(OJUNK,oper0(OSNEWLINE),$2)); }
- | compound
- ;
-
-simpnull: simple
- | /* NULL */
- { $$ = Nullop; }
- ;
-
-simple
- : expr
- | PRINT expr_list redir expr
- { $$ = oper3(OPRINT,$2,$3,$4);
- do_opens = TRUE;
- saw_ORS = saw_OFS = TRUE;
- if (!$2) need_entire = TRUE;
- if (ops[$4].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
- | PRINT expr_list
- { $$ = oper1(OPRINT,$2);
- if (!$2) need_entire = TRUE;
- saw_ORS = saw_OFS = TRUE;
- }
- | PRINTF expr_list redir expr
- { $$ = oper3(OPRINTF,$2,$3,$4);
- do_opens = TRUE;
- if (!$2) need_entire = TRUE;
- if (ops[$4].ival != OSTR + (1<<8)) do_fancy_opens = TRUE; }
- | PRINTF expr_list
- { $$ = oper1(OPRINTF,$2);
- if (!$2) need_entire = TRUE;
- }
- | BREAK
- { $$ = oper0(OBREAK); }
- | NEXT
- { $$ = oper0(ONEXT); }
- | EXIT
- { $$ = oper0(OEXIT); }
- | EXIT expr
- { $$ = oper1(OEXIT,$2); }
- | CONTINUE
- { $$ = oper0(OCONTINUE); }
- | RET
- { $$ = oper0(ORETURN); }
- | RET expr
- { $$ = oper1(ORETURN,$2); }
- | DELETE VAR '[' expr_list ']'
- { $$ = oper2(ODELETE,aryrefarg($2),$4); }
- ;
-
-redir : '>' %prec FIELD
- { $$ = oper1(OREDIR,string(">",1)); }
- | GRGR
- { $$ = oper1(OREDIR,string(">>",2)); }
- | '|'
- { $$ = oper1(OREDIR,string("|",1)); }
- ;
-
-compound
- : IF '(' cond ')' maybe statement
- { $$ = oper2(OIF,$3,bl($6,$5)); }
- | IF '(' cond ')' maybe statement ELSE maybe statement
- { $$ = oper3(OIF,$3,bl($6,$5),bl($9,$8)); }
- | WHILE '(' cond ')' maybe statement
- { $$ = oper2(OWHILE,$3,bl($6,$5)); }
- | DO maybe statement WHILE '(' cond ')'
- { $$ = oper2(ODO,bl($3,$2),$6); }
- | FOR '(' simpnull ';' cond ';' simpnull ')' maybe statement
- { $$ = oper4(OFOR,$3,$5,$7,bl($10,$9)); }
- | FOR '(' simpnull ';' ';' simpnull ')' maybe statement
- { $$ = oper4(OFOR,$3,string("",0),$6,bl($9,$8)); }
- | FOR '(' expr ')' maybe statement
- { $$ = oper2(OFORIN,$3,bl($6,$5)); }
- | '{' maybe states '}' maybe
- { $$ = oper3(OBLOCK,oper2(OJUNK,$2,$3),Nullop,$5); }
- ;
-
-%%
-
-int yyparse (void);
-
-#include "a2py.c"
diff --git a/x2p/a2py.c b/x2p/a2py.c
deleted file mode 100644
index 695c4fd56e..0000000000
--- a/x2p/a2py.c
+++ /dev/null
@@ -1,1300 +0,0 @@
-/* a2py.c
- *
- * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- * 2000, 2001, 2002, by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- */
-
-#if defined(OS2) || defined(WIN32) || defined(NETWARE)
-#if defined(WIN32)
-#include <io.h>
-#endif
-#if defined(NETWARE)
-#include "../netware/clibstuf.h"
-#endif
-#include "../patchlevel.h"
-#endif
-#include "util.h"
-#include "../unicode_constants.h"
-#define DELETE_CHAR DEL_NATIVE
-
-const char *filename;
-const char *myname;
-
-int checkers = 0;
-
-int oper0(int type);
-int oper1(int type, int arg1);
-int oper2(int type, int arg1, int arg2);
-int oper3(int type, int arg1, int arg2, int arg3);
-int oper4(int type, int arg1, int arg2, int arg3, int arg4);
-int oper5(int type, int arg1, int arg2, int arg3, int arg4, int arg5);
-STR *walk(int useval, int level, int node, int *numericptr, int minprec);
-#ifdef NETWARE
-char *savestr(char *str);
-char *cpy2(char *to, char *from, int delim);
-#endif
-
-#if defined(OS2) || defined(WIN32) || defined(NETWARE)
-static void usage(void);
-
-static void
-usage()
-{
- printf("\nThis is the AWK to PERL translator, revision %d.0, version %d\n", PERL_REVISION, PERL_VERSION);
- printf("\nUsage: %s [-D<number>] [-F<char>] [-n<fieldlist>] [-<number>] filename\n", myname);
- printf("\n -D<number> sets debugging flags."
- "\n -F<character> the awk script to translate is always invoked with"
- "\n this -F switch."
- "\n -n<fieldlist> specifies the names of the input fields if input does"
- "\n not have to be split into an array."
- "\n -<number> causes a2p to assume that input will always have that"
- "\n many fields.\n");
- exit(1);
-}
-#endif
-
-int
-main(int argc, const char **argv)
-{
- STR *str;
- int i;
- STR *tmpstr;
- /* char *namelist; */
-
- #ifdef NETWARE
- fnInitGpfGlobals(); /* For importing the CLIB calls in place of Watcom calls */
- #endif /* NETWARE */
-
- myname = argv[0];
- linestr = str_new(80);
- for (argc--,argv++; argc; argc--,argv++) {
- if (argv[0][0] != '-' || !argv[0][1])
- break;
- switch (argv[0][1]) {
-#ifdef DEBUGGING
- case 'D':
- debug = atoi(argv[0]+2);
-#if YYDEBUG
- yydebug = (debug & 1);
-#endif
- break;
-#endif
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- maxfld = atoi(argv[0]+1);
- absmaxfld = TRUE;
- break;
- case 'F':
- fswitch = argv[0][2];
- break;
- case 'n':
- namelist = savestr(argv[0]+2);
- break;
- case 'o':
- old_awk = TRUE;
- break;
- case '-':
- argc--,argv++;
- goto switch_end;
- case 0:
- break;
- default:
-#if defined(OS2) || defined(WIN32) || defined(NETWARE)
- fprintf(stderr, "Unrecognized switch: %s\n",argv[0]);
- usage();
-#else
- fatal("Unrecognized switch: %s\n",argv[0]);
-#endif
- }
- }
- switch_end:
-
- /* open script */
-
- if (argv[0] == NULL) {
-#if defined(OS2) || defined(WIN32) || defined(NETWARE)
- if ( isatty(fileno(stdin)) )
- usage();
-#endif
- argv[0] = "-";
- }
- filename = savestr(argv[0]);
-
- if (strEQ(filename,"-"))
- argv[0] = "";
- if (!*argv[0])
- rsfp = stdin;
- else
- rsfp = fopen(argv[0],"r");
- if (rsfp == NULL)
- fatal("Awk script \"%s\" doesn't seem to exist.\n",filename);
-
- /* init tokener */
-
- bufptr = str_get(linestr);
- symtab = hnew();
- curarghash = hnew();
-
- /* now parse the report spec */
-
- if (yyparse())
- fatal("Translation aborted due to syntax errors.\n");
-
-#ifdef DEBUGGING
- if (debug & 2) {
- int type, len;
-
- for (i=1; i<mop;) {
- type = ops[i].ival;
- len = type >> 8;
- type &= 255;
- printf("%d\t%d\t%d\t%-10s",i++,type,len,opname[type]);
- if (type == OSTRING)
- printf("\t\"%s\"\n",ops[i].cval),i++;
- else {
- while (len--) {
- printf("\t%d",ops[i].ival),i++;
- }
- putchar('\n');
- }
- }
- }
- if (debug & 8)
- dump(root);
-#endif
-
- /* first pass to look for numeric variables */
-
- prewalk(0,0,root,&i);
-
- /* second pass to produce new program */
-
- tmpstr = walk(0,0,root,&i,P_MIN);
- str = str_make(STARTPERL);
- str_cat(str, "\neval 'exec ");
- str_cat(str, BIN);
- str_cat(str, "/perl -S $0 ${1+\"$@\"}'\n\
- if $running_under_some_shell;\n\
- # this emulates #! processing on NIH machines.\n\
- # (remove #! line above if indigestible)\n\n");
- str_cat(str,
- "eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;\n");
- str_cat(str,
- " # process any FOO=bar switches\n\n");
- if (do_opens && opens) {
- str_scat(str,opens);
- str_free(opens);
- str_cat(str,"\n");
- }
- str_scat(str,tmpstr);
- str_free(tmpstr);
-#ifdef DEBUGGING
- if (!(debug & 16))
-#endif
- fixup(str);
- putlines(str);
- if (checkers) {
- fprintf(stderr,
- "Please check my work on the %d line%s I've marked with \"#???\".\n",
- checkers, checkers == 1 ? "" : "s" );
- fprintf(stderr,
- "The operation I've selected may be wrong for the operand types.\n");
- }
- exit(0);
- /* by ANSI specs return is needed. This also shuts up VC++ and his warnings */
- return(0);
-}
-
-#define RETURN(retval) return (bufptr = s,retval)
-#define XTERM(retval) return (expectterm = TRUE,bufptr = s,retval)
-#define XOP(retval) return (expectterm = FALSE,bufptr = s,retval)
-#define ID(x) return (yylval=string(x,0),expectterm = FALSE,bufptr = s,idtype)
-
-int idtype;
-
-int
-yylex(void)
-{
- char *s = bufptr;
- char *d;
- int tmp;
-
- retry:
-#if YYDEBUG
- if (yydebug) {
- if (strchr(s,'\n'))
- fprintf(stderr,"Tokener at %s",s);
- else
- fprintf(stderr,"Tokener at %s\n",s);
- }
-#endif
- switch (*s) {
- default:
- fprintf(stderr,
- "Unrecognized character %c in file %s line %d--ignoring.\n",
- *s++,filename,line);
- goto retry;
- case '\\':
- s++;
- if (*s && *s != '\n') {
- yyerror("Ignoring spurious backslash");
- goto retry;
- }
- /*FALLSTHROUGH*/
- case 0:
- s = str_get(linestr);
- *s = '\0';
- if (!rsfp)
- RETURN(0);
- line++;
- if ((s = str_gets(linestr, rsfp)) == NULL) {
- if (rsfp != stdin)
- fclose(rsfp);
- rsfp = NULL;
- s = str_get(linestr);
- RETURN(0);
- }
- goto retry;
- case ' ': case '\t':
- s++;
- goto retry;
- case '\n':
- *s = '\0';
- XTERM(NEWLINE);
- case '#':
- yylval = string(s,0);
- *s = '\0';
- XTERM(COMMENT);
- case ';':
- tmp = *s++;
- if (*s == '\n') {
- s++;
- XTERM(SEMINEW);
- }
- XTERM(tmp);
- case '(':
- tmp = *s++;
- XTERM(tmp);
- case '{':
- case '[':
- case ')':
- case ']':
- case '?':
- case ':':
- tmp = *s++;
- XOP(tmp);
- case DELETE_CHAR:
- s++;
- XTERM('}');
- case '}':
- for (d = s + 1; isSPACE(*d); d++) ;
- if (!*d)
- s = d - 1;
- *s = 127;
- XTERM(';');
- case ',':
- tmp = *s++;
- XTERM(tmp);
- case '~':
- s++;
- yylval = string("~",1);
- XTERM(MATCHOP);
- case '+':
- case '-':
- if (s[1] == *s) {
- s++;
- if (*s++ == '+')
- XTERM(INCR);
- else
- XTERM(DECR);
- }
- /* FALL THROUGH */
- case '*':
- case '%':
- case '^':
- tmp = *s++;
- if (*s == '=') {
- if (tmp == '^')
- yylval = string("**=",3);
- else
- yylval = string(s-1,2);
- s++;
- XTERM(ASGNOP);
- }
- XTERM(tmp);
- case '&':
- s++;
- tmp = *s++;
- if (tmp == '&')
- XTERM(ANDAND);
- s--;
- XTERM('&');
- case '|':
- s++;
- tmp = *s++;
- if (tmp == '|')
- XTERM(OROR);
- s--;
- while (*s == ' ' || *s == '\t')
- s++;
- if (strnEQ(s,"getline",7))
- XTERM('p');
- else
- XTERM('|');
- case '=':
- s++;
- tmp = *s++;
- if (tmp == '=') {
- yylval = string("==",2);
- XTERM(RELOP);
- }
- s--;
- yylval = string("=",1);
- XTERM(ASGNOP);
- case '!':
- s++;
- tmp = *s++;
- if (tmp == '=') {
- yylval = string("!=",2);
- XTERM(RELOP);
- }
- if (tmp == '~') {
- yylval = string("!~",2);
- XTERM(MATCHOP);
- }
- s--;
- XTERM(NOT);
- case '<':
- s++;
- tmp = *s++;
- if (tmp == '=') {
- yylval = string("<=",2);
- XTERM(RELOP);
- }
- s--;
- XTERM('<');
- case '>':
- s++;
- tmp = *s++;
- if (tmp == '>') {
- yylval = string(">>",2);
- XTERM(GRGR);
- }
- if (tmp == '=') {
- yylval = string(">=",2);
- XTERM(RELOP);
- }
- s--;
- XTERM('>');
-
-#define SNARFWORD \
- d = tokenbuf; \
- while (isWORDCHAR(*s)) \
- *d++ = *s++; \
- *d = '\0'; \
- d = tokenbuf; \
- if (*s == '(') \
- idtype = USERFUN; \
- else \
- idtype = VAR;
-
- case '$':
- s++;
- if (*s == '0') {
- s++;
- do_chop = TRUE;
- need_entire = TRUE;
- idtype = VAR;
- ID("0");
- }
- do_split = TRUE;
- if (isDIGIT(*s)) {
- for (d = s; isDIGIT(*s); s++) ;
- yylval = string(d,s-d);
- tmp = atoi(d);
- if (tmp > maxfld)
- maxfld = tmp;
- XOP(FIELD);
- }
- for (d = s; isWORDCHAR(*s); )
- s++;
- split_to_array = TRUE;
- if (d != s)
- {
- yylval = string(d,s-d);
- XTERM(SVFIELD);
- }
- XOP(VFIELD);
-
- case '/': /* may either be division or pattern */
- if (expectterm) {
- s = scanpat(s);
- XTERM(REGEX);
- }
- tmp = *s++;
- if (*s == '=') {
- yylval = string("/=",2);
- s++;
- XTERM(ASGNOP);
- }
- XTERM(tmp);
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9': case '.':
- s = scannum(s);
- XOP(NUMBER);
- case '"':
- s++;
- s = cpy2(tokenbuf,s,s[-1]);
- if (!*s)
- fatal("String not terminated:\n%s",str_get(linestr));
- s++;
- yylval = string(tokenbuf,0);
- XOP(STRING);
-
- case 'a': case 'A':
- SNARFWORD;
- if (strEQ(d,"ARGV")) {
- yylval=numary(string("ARGV",0));
- XOP(VAR);
- }
- if (strEQ(d,"atan2")) {
- yylval = OATAN2;
- XTERM(FUNN);
- }
- ID(d);
- case 'b': case 'B':
- SNARFWORD;
- if (strEQ(d,"break"))
- XTERM(BREAK);
- if (strEQ(d,"BEGIN"))
- XTERM(BEGIN);
- ID(d);
- case 'c': case 'C':
- SNARFWORD;
- if (strEQ(d,"continue"))
- XTERM(CONTINUE);
- if (strEQ(d,"cos")) {
- yylval = OCOS;
- XTERM(FUN1);
- }
- if (strEQ(d,"close")) {
- do_fancy_opens = 1;
- yylval = OCLOSE;
- XTERM(FUN1);
- }
- if (strEQ(d,"chdir"))
- *d = toUPPER(*d);
- else if (strEQ(d,"crypt"))
- *d = toUPPER(*d);
- else if (strEQ(d,"chop"))
- *d = toUPPER(*d);
- else if (strEQ(d,"chmod"))
- *d = toUPPER(*d);
- else if (strEQ(d,"chown"))
- *d = toUPPER(*d);
- ID(d);
- case 'd': case 'D':
- SNARFWORD;
- if (strEQ(d,"do"))
- XTERM(DO);
- if (strEQ(d,"delete"))
- XTERM(DELETE);
- if (strEQ(d,"die"))
- *d = toUPPER(*d);
- ID(d);
- case 'e': case 'E':
- SNARFWORD;
- if (strEQ(d,"END"))
- XTERM(END);
- if (strEQ(d,"else"))
- XTERM(ELSE);
- if (strEQ(d,"exit")) {
- saw_line_op = TRUE;
- XTERM(EXIT);
- }
- if (strEQ(d,"exp")) {
- yylval = OEXP;
- XTERM(FUN1);
- }
- if (strEQ(d,"elsif"))
- *d = toUPPER(*d);
- else if (strEQ(d,"eq"))
- *d = toUPPER(*d);
- else if (strEQ(d,"eval"))
- *d = toUPPER(*d);
- else if (strEQ(d,"eof"))
- *d = toUPPER(*d);
- else if (strEQ(d,"each"))
- *d = toUPPER(*d);
- else if (strEQ(d,"exec"))
- *d = toUPPER(*d);
- ID(d);
- case 'f': case 'F':
- SNARFWORD;
- if (strEQ(d,"FS")) {
- saw_FS++;
- if (saw_FS == 1 && in_begin) {
- for (d = s; *d && isSPACE(*d); d++) ;
- if (*d == '=') {
- for (d++; *d && isSPACE(*d); d++) ;
- if (*d == '"' && d[2] == '"')
- const_FS = d[1];
- }
- }
- ID(tokenbuf);
- }
- if (strEQ(d,"for"))
- XTERM(FOR);
- else if (strEQ(d,"function"))
- XTERM(FUNCTION);
- if (strEQ(d,"FILENAME"))
- ID("ARGV");
- if (strEQ(d,"foreach"))
- *d = toUPPER(*d);
- else if (strEQ(d,"format"))
- *d = toUPPER(*d);
- else if (strEQ(d,"fork"))
- *d = toUPPER(*d);
- else if (strEQ(d,"fh"))
- *d = toUPPER(*d);
- ID(d);
- case 'g': case 'G':
- SNARFWORD;
- if (strEQ(d,"getline"))
- XTERM(GETLINE);
- if (strEQ(d,"gsub"))
- XTERM(GSUB);
- if (strEQ(d,"ge"))
- *d = toUPPER(*d);
- else if (strEQ(d,"gt"))
- *d = toUPPER(*d);
- else if (strEQ(d,"goto"))
- *d = toUPPER(*d);
- else if (strEQ(d,"gmtime"))
- *d = toUPPER(*d);
- ID(d);
- case 'h': case 'H':
- SNARFWORD;
- if (strEQ(d,"hex"))
- *d = toUPPER(*d);
- ID(d);
- case 'i': case 'I':
- SNARFWORD;
- if (strEQ(d,"if"))
- XTERM(IF);
- if (strEQ(d,"in"))
- XTERM(IN);
- if (strEQ(d,"index")) {
- XTERM(INDEX);
- }
- if (strEQ(d,"int")) {
- yylval = OINT;
- XTERM(FUN1);
- }
- ID(d);
- case 'j': case 'J':
- SNARFWORD;
- if (strEQ(d,"join"))
- *d = toUPPER(*d);
- ID(d);
- case 'k': case 'K':
- SNARFWORD;
- if (strEQ(d,"keys"))
- *d = toUPPER(*d);
- else if (strEQ(d,"kill"))
- *d = toUPPER(*d);
- ID(d);
- case 'l': case 'L':
- SNARFWORD;
- if (strEQ(d,"length")) {
- yylval = OLENGTH;
- XTERM(FUN1);
- }
- if (strEQ(d,"log")) {
- yylval = OLOG;
- XTERM(FUN1);
- }
- if (strEQ(d,"last"))
- *d = toUPPER(*d);
- else if (strEQ(d,"local"))
- *d = toUPPER(*d);
- else if (strEQ(d,"lt"))
- *d = toUPPER(*d);
- else if (strEQ(d,"le"))
- *d = toUPPER(*d);
- else if (strEQ(d,"locatime"))
- *d = toUPPER(*d);
- else if (strEQ(d,"link"))
- *d = toUPPER(*d);
- ID(d);
- case 'm': case 'M':
- SNARFWORD;
- if (strEQ(d,"match")) {
- XTERM(MATCH);
- }
- if (strEQ(d,"m"))
- *d = toUPPER(*d);
- ID(d);
- case 'n': case 'N':
- SNARFWORD;
- if (strEQ(d,"NF"))
- do_chop = do_split = split_to_array = TRUE;
- if (strEQ(d,"next")) {
- saw_line_op = TRUE;
- XTERM(NEXT);
- }
- if (strEQ(d,"ne"))
- *d = toUPPER(*d);
- ID(d);
- case 'o': case 'O':
- SNARFWORD;
- if (strEQ(d,"ORS")) {
- saw_ORS = TRUE;
- ID("\\");
- }
- if (strEQ(d,"OFS")) {
- saw_OFS = TRUE;
- ID(",");
- }
- if (strEQ(d,"OFMT")) {
- ID("#");
- }
- if (strEQ(d,"open"))
- *d = toUPPER(*d);
- else if (strEQ(d,"ord"))
- *d = toUPPER(*d);
- else if (strEQ(d,"oct"))
- *d = toUPPER(*d);
- ID(d);
- case 'p': case 'P':
- SNARFWORD;
- if (strEQ(d,"print")) {
- XTERM(PRINT);
- }
- if (strEQ(d,"printf")) {
- XTERM(PRINTF);
- }
- if (strEQ(d,"push"))
- *d = toUPPER(*d);
- else if (strEQ(d,"pop"))
- *d = toUPPER(*d);
- ID(d);
- case 'q': case 'Q':
- SNARFWORD;
- ID(d);
- case 'r': case 'R':
- SNARFWORD;
- if (strEQ(d,"RS")) {
- saw_RS = TRUE;
- ID("/");
- }
- if (strEQ(d,"rand")) {
- yylval = ORAND;
- XTERM(FUN1);
- }
- if (strEQ(d,"return"))
- XTERM(RET);
- if (strEQ(d,"reset"))
- *d = toUPPER(*d);
- else if (strEQ(d,"redo"))
- *d = toUPPER(*d);
- else if (strEQ(d,"rename"))
- *d = toUPPER(*d);
- ID(d);
- case 's': case 'S':
- SNARFWORD;
- if (strEQ(d,"split")) {
- XOP(SPLIT);
- }
- if (strEQ(d,"substr")) {
- XTERM(SUBSTR);
- }
- if (strEQ(d,"sub"))
- XTERM(SUB);
- if (strEQ(d,"sprintf")) {
- /* In old awk, { print sprintf("str%sg"),"in" } prints
- * "string"; in new awk, "in" is not considered an argument to
- * sprintf, so the statement breaks. To support both, the
- * grammar treats arguments to SPRINTF_OLD like old awk,
- * SPRINTF_NEW like new. Here we return the appropriate one.
- */
- XTERM(old_awk ? SPRINTF_OLD : SPRINTF_NEW);
- }
- if (strEQ(d,"sqrt")) {
- yylval = OSQRT;
- XTERM(FUN1);
- }
- if (strEQ(d,"SUBSEP")) {
- ID(";");
- }
- if (strEQ(d,"sin")) {
- yylval = OSIN;
- XTERM(FUN1);
- }
- if (strEQ(d,"srand")) {
- yylval = OSRAND;
- XTERM(FUN1);
- }
- if (strEQ(d,"system")) {
- yylval = OSYSTEM;
- XTERM(FUN1);
- }
- if (strEQ(d,"s"))
- *d = toUPPER(*d);
- else if (strEQ(d,"shift"))
- *d = toUPPER(*d);
- else if (strEQ(d,"select"))
- *d = toUPPER(*d);
- else if (strEQ(d,"seek"))
- *d = toUPPER(*d);
- else if (strEQ(d,"stat"))
- *d = toUPPER(*d);
- else if (strEQ(d,"study"))
- *d = toUPPER(*d);
- else if (strEQ(d,"sleep"))
- *d = toUPPER(*d);
- else if (strEQ(d,"symlink"))
- *d = toUPPER(*d);
- else if (strEQ(d,"sort"))
- *d = toUPPER(*d);
- ID(d);
- case 't': case 'T':
- SNARFWORD;
- if (strEQ(d,"tr"))
- *d = toUPPER(*d);
- else if (strEQ(d,"tell"))
- *d = toUPPER(*d);
- else if (strEQ(d,"time"))
- *d = toUPPER(*d);
- else if (strEQ(d,"times"))
- *d = toUPPER(*d);
- ID(d);
- case 'u': case 'U':
- SNARFWORD;
- if (strEQ(d,"until"))
- *d = toUPPER(*d);
- else if (strEQ(d,"unless"))
- *d = toUPPER(*d);
- else if (strEQ(d,"umask"))
- *d = toUPPER(*d);
- else if (strEQ(d,"unshift"))
- *d = toUPPER(*d);
- else if (strEQ(d,"unlink"))
- *d = toUPPER(*d);
- else if (strEQ(d,"utime"))
- *d = toUPPER(*d);
- ID(d);
- case 'v': case 'V':
- SNARFWORD;
- if (strEQ(d,"values"))
- *d = toUPPER(*d);
- ID(d);
- case 'w': case 'W':
- SNARFWORD;
- if (strEQ(d,"while"))
- XTERM(WHILE);
- if (strEQ(d,"write"))
- *d = toUPPER(*d);
- else if (strEQ(d,"wait"))
- *d = toUPPER(*d);
- ID(d);
- case 'x': case 'X':
- SNARFWORD;
- if (strEQ(d,"x"))
- *d = toUPPER(*d);
- ID(d);
- case 'y': case 'Y':
- SNARFWORD;
- if (strEQ(d,"y"))
- *d = toUPPER(*d);
- ID(d);
- case 'z': case 'Z':
- SNARFWORD;
- ID(d);
- }
-}
-
-char *
-scanpat(char *s)
-{
- char *d;
-
- switch (*s++) {
- case '/':
- break;
- default:
- fatal("Search pattern not found:\n%s",str_get(linestr));
- }
-
- d = tokenbuf;
- for (; *s; s++,d++) {
- if (*s == '\\') {
- if (s[1] == '/')
- *d++ = *s++;
- else if (s[1] == '\\')
- *d++ = *s++;
- else if (s[1] == '[')
- *d++ = *s++;
- }
- else if (*s == '[') {
- *d++ = *s++;
- do {
- if (*s == '\\' && s[1])
- *d++ = *s++;
- if (*s == '/' || (*s == '-' && s[1] == ']'))
- *d++ = '\\';
- *d++ = *s++;
- } while (*s && *s != ']');
- }
- else if (*s == '/')
- break;
- *d = *s;
- }
- *d = '\0';
-
- if (!*s)
- fatal("Search pattern not terminated:\n%s",str_get(linestr));
- s++;
- yylval = string(tokenbuf,0);
- return s;
-}
-
-void
-yyerror(const char *s)
-{
- fprintf(stderr,"%s in file %s at line %d\n",
- s,filename,line);
-}
-
-char *
-scannum(char *s)
-{
- char *d;
-
- switch (*s) {
- case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9': case '0' : case '.':
- d = tokenbuf;
- while (isDIGIT(*s)) {
- *d++ = *s++;
- }
- if (*s == '.') {
- if (isDIGIT(s[1])) {
- *d++ = *s++;
- while (isDIGIT(*s)) {
- *d++ = *s++;
- }
- }
- else
- s++;
- }
- if (strchr("eE",*s) && strchr("+-0123456789",s[1])) {
- *d++ = *s++;
- if (*s == '+' || *s == '-')
- *d++ = *s++;
- while (isDIGIT(*s))
- *d++ = *s++;
- }
- *d = '\0';
- yylval = string(tokenbuf,0);
- break;
- }
- return s;
-}
-
-int
-string(const char *ptr, int len)
-{
- int retval = mop;
-
- ops[mop++].ival = OSTRING + (1<<8);
- if (!len)
- len = strlen(ptr);
- ops[mop].cval = (char *) safemalloc(len+1);
- strncpy(ops[mop].cval,ptr,len);
- ops[mop++].cval[len] = '\0';
- if (mop >= OPSMAX)
- fatal("Recompile a2p with larger OPSMAX\n");
- return retval;
-}
-
-int
-oper0(int type)
-{
- int retval = mop;
-
- if (type > 255)
- fatal("type > 255 (%d)\n",type);
- ops[mop++].ival = type;
- if (mop >= OPSMAX)
- fatal("Recompile a2p with larger OPSMAX\n");
- return retval;
-}
-
-int
-oper1(int type, int arg1)
-{
- int retval = mop;
-
- if (type > 255)
- fatal("type > 255 (%d)\n",type);
- ops[mop++].ival = type + (1<<8);
- ops[mop++].ival = arg1;
- if (mop >= OPSMAX)
- fatal("Recompile a2p with larger OPSMAX\n");
- return retval;
-}
-
-int
-oper2(int type, int arg1, int arg2)
-{
- int retval = mop;
-
- if (type > 255)
- fatal("type > 255 (%d)\n",type);
- ops[mop++].ival = type + (2<<8);
- ops[mop++].ival = arg1;
- ops[mop++].ival = arg2;
- if (mop >= OPSMAX)
- fatal("Recompile a2p with larger OPSMAX\n");
- return retval;
-}
-
-int
-oper3(int type, int arg1, int arg2, int arg3)
-{
- int retval = mop;
-
- if (type > 255)
- fatal("type > 255 (%d)\n",type);
- ops[mop++].ival = type + (3<<8);
- ops[mop++].ival = arg1;
- ops[mop++].ival = arg2;
- ops[mop++].ival = arg3;
- if (mop >= OPSMAX)
- fatal("Recompile a2p with larger OPSMAX\n");
- return retval;
-}
-
-int
-oper4(int type, int arg1, int arg2, int arg3, int arg4)
-{
- int retval = mop;
-
- if (type > 255)
- fatal("type > 255 (%d)\n",type);
- ops[mop++].ival = type + (4<<8);
- ops[mop++].ival = arg1;
- ops[mop++].ival = arg2;
- ops[mop++].ival = arg3;
- ops[mop++].ival = arg4;
- if (mop >= OPSMAX)
- fatal("Recompile a2p with larger OPSMAX\n");
- return retval;
-}
-
-int
-oper5(int type, int arg1, int arg2, int arg3, int arg4, int arg5)
-{
- int retval = mop;
-
- if (type > 255)
- fatal("type > 255 (%d)\n",type);
- ops[mop++].ival = type + (5<<8);
- ops[mop++].ival = arg1;
- ops[mop++].ival = arg2;
- ops[mop++].ival = arg3;
- ops[mop++].ival = arg4;
- ops[mop++].ival = arg5;
- if (mop >= OPSMAX)
- fatal("Recompile a2p with larger OPSMAX\n");
- return retval;
-}
-
-int depth = 0;
-
-void
-dump(int branch)
-{
- int type;
- int len;
- int i;
-
- type = ops[branch].ival;
- len = type >> 8;
- type &= 255;
- for (i=depth; i; i--)
- printf(" ");
- if (type == OSTRING) {
- printf("%-5d\"%s\"\n",branch,ops[branch+1].cval);
- }
- else {
- printf("(%-5d%s %d\n",branch,opname[type],len);
- depth++;
- for (i=1; i<=len; i++)
- dump(ops[branch+i].ival);
- depth--;
- for (i=depth; i; i--)
- printf(" ");
- printf(")\n");
- }
-}
-
-int
-bl(int arg, int maybe)
-{
- if (!arg)
- return 0;
- else if ((ops[arg].ival & 255) != OBLOCK)
- return oper2(OBLOCK,arg,maybe);
- else if ((ops[arg].ival >> 8) < 2)
- return oper2(OBLOCK,ops[arg+1].ival,maybe);
- else
- return arg;
-}
-
-void
-fixup(STR *str)
-{
- char *s;
- char *t;
-
- for (s = str->str_ptr; *s; s++) {
- if (*s == ';' && s[1] == ' ' && s[2] == '\n') {
- strcpy(s+1,s+2);
- s++;
- }
- else if (*s == '\n') {
- for (t = s+1; isSPACE(*t & 127); t++) ;
- t--;
- while (isSPACE(*t & 127) && *t != '\n') t--;
- if (*t == '\n' && t-s > 1) {
- if (s[-1] == '{')
- s--;
- strcpy(s+1,t);
- }
- s++;
- }
- }
-}
-
-void
-putlines(STR *str)
-{
- char *d, *s, *t, *e;
- int pos, newpos;
-
- d = tokenbuf;
- pos = 0;
- for (s = str->str_ptr; *s; s++) {
- *d++ = *s;
- pos++;
- if (*s == '\n') {
- *d = '\0';
- d = tokenbuf;
- pos = 0;
- putone();
- }
- else if (*s == '\t')
- pos += 7;
- if (pos > 78) { /* split a long line? */
- *d-- = '\0';
- newpos = 0;
- for (t = tokenbuf; isSPACE(*t & 127); t++) {
- if (*t == '\t')
- newpos += 8;
- else
- newpos += 1;
- }
- e = d;
- while (d > tokenbuf && (*d != ' ' || d[-1] != ';'))
- d--;
- if (d < t+10) {
- d = e;
- while (d > tokenbuf &&
- (*d != ' ' || d[-1] != '|' || d[-2] != '|') )
- d--;
- }
- if (d < t+10) {
- d = e;
- while (d > tokenbuf &&
- (*d != ' ' || d[-1] != '&' || d[-2] != '&') )
- d--;
- }
- if (d < t+10) {
- d = e;
- while (d > tokenbuf && (*d != ' ' || d[-1] != ','))
- d--;
- }
- if (d < t+10) {
- d = e;
- while (d > tokenbuf && *d != ' ')
- d--;
- }
- if (d > t+3) {
- char save[2048];
- strcpy(save, d);
- *d = '\n';
- d[1] = '\0';
- putone();
- putchar('\n');
- if (d[-1] != ';' && !(newpos % 4)) {
- *t++ = ' ';
- *t++ = ' ';
- newpos += 2;
- }
- strcpy(t,save+1);
- newpos += strlen(t);
- d = t + strlen(t);
- pos = newpos;
- }
- else
- d = e + 1;
- }
- }
-}
-
-void
-putone(void)
-{
- char *t;
-
- for (t = tokenbuf; *t; t++) {
- *t &= 127;
- if (*t == 127) {
- *t = ' ';
- strcpy(t+strlen(t)-1, "\t#???\n");
- checkers++;
- }
- }
- t = tokenbuf;
- if (*t == '#') {
- if (strnEQ(t,"#!/bin/awk",10) || strnEQ(t,"#! /bin/awk",11))
- return;
- if (strnEQ(t,"#!/usr/bin/awk",14) || strnEQ(t,"#! /usr/bin/awk",15))
- return;
- }
- fputs(tokenbuf,stdout);
-}
-
-int
-numary(int arg)
-{
- STR *key;
- int dummy;
-
- key = walk(0,0,arg,&dummy,P_MIN);
- str_cat(key,"[]");
- hstore(symtab,key->str_ptr,str_make("1"));
- str_free(key);
- return arg;
-}
-
-int
-rememberargs(int arg)
-{
- int type;
- STR *str;
-
- if (!arg)
- return arg;
- type = ops[arg].ival & 255;
- if (type == OCOMMA) {
- rememberargs(ops[arg+1].ival);
- rememberargs(ops[arg+3].ival);
- }
- else if (type == OVAR) {
- str = str_new(0);
- hstore(curarghash,ops[ops[arg+1].ival+1].cval,str);
- }
- else
- fatal("panic: unknown argument type %d, line %d\n",type,line);
- return arg;
-}
-
-int
-aryrefarg(int arg)
-{
- int type = ops[arg].ival & 255;
- STR *str;
-
- if (type != OSTRING)
- fatal("panic: aryrefarg %d, line %d\n",type,line);
- str = hfetch(curarghash,ops[arg+1].cval);
- if (str)
- str_set(str,"*");
- return arg;
-}
-
-int
-fixfargs(int name, int arg, int prevargs)
-{
- int type;
- STR *str;
- int numargs = 0;
-
- if (!arg)
- return prevargs;
- type = ops[arg].ival & 255;
- if (type == OCOMMA) {
- numargs = fixfargs(name,ops[arg+1].ival,prevargs);
- numargs = fixfargs(name,ops[arg+3].ival,numargs);
- }
- else if (type == OVAR) {
- str = hfetch(curarghash,ops[ops[arg+1].ival+1].cval);
- if (strEQ(str_get(str),"*")) {
- char tmpbuf[128];
-
- str_set(str,""); /* in case another routine has this */
- ops[arg].ival &= ~255;
- ops[arg].ival |= OSTAR;
- sprintf(tmpbuf,"%s:%d",ops[name+1].cval,prevargs);
- fprintf(stderr,"Adding %s\n",tmpbuf);
- str = str_new(0);
- str_set(str,"*");
- hstore(curarghash,tmpbuf,str);
- }
- numargs = prevargs + 1;
- }
- else
- fatal("panic: unknown argument type %d, arg %d, line %d\n",
- type,prevargs+1,line);
- return numargs;
-}
-
-int
-fixrargs(char *name, int arg, int prevargs)
-{
- int type;
- STR *str;
- int numargs;
-
- if (!arg)
- return prevargs;
- type = ops[arg].ival & 255;
- if (type == OCOMMA) {
- numargs = fixrargs(name,ops[arg+1].ival,prevargs);
- numargs = fixrargs(name,ops[arg+3].ival,numargs);
- }
- else {
- char *tmpbuf = (char *) safemalloc(strlen(name) + (sizeof(prevargs) * 3) + 5);
- sprintf(tmpbuf,"%s:%d",name,prevargs);
- str = hfetch(curarghash,tmpbuf);
- safefree(tmpbuf);
- if (str && strEQ(str->str_ptr,"*")) {
- if (type == OVAR || type == OSTAR) {
- ops[arg].ival &= ~255;
- ops[arg].ival |= OSTAR;
- }
- else
- fatal("Can't pass expression by reference as arg %d of %s\n",
- prevargs+1, name);
- }
- numargs = prevargs + 1;
- }
- return numargs;
-}
diff --git a/x2p/find2perl.PL b/x2p/find2perl.PL
deleted file mode 100644
index d68c0362e8..0000000000
--- a/x2p/find2perl.PL
+++ /dev/null
@@ -1,919 +0,0 @@
-#!/usr/local/bin/perl
-
-use Config;
-use File::Basename qw(&basename &dirname);
-use Cwd;
-
-# List explicitly here the variables you want Configure to
-# generate. Metaconfig only looks for shell variables, so you
-# have to mention them as if they were shell variables, not
-# %Config entries. Thus you write
-# $startperl
-# to ensure Configure will look for $Config{startperl}.
-
-# This forces PL files to create target in same directory as PL file.
-# This is so that make depend always knows where to find PL derivatives.
-$origdir = cwd;
-chdir dirname($0);
-$file = basename($0, '.PL');
-$file .= '.com' if $^O eq 'VMS';
-
-open OUT,">$file" or die "Can't create $file: $!";
-
-print "Extracting $file (with variable substitutions)\n";
-
-# In this section, perl variables will be expanded during extraction.
-# You can use $Config{...} to use Configure variables.
-
-print OUT <<"!GROK!THIS!";
-$Config{startperl}
- eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
- if \$running_under_some_shell;
-(my \$perlpath = <<'/../') =~ s/\\s*\\z//;
-$Config{perlpath}
-/../
-!GROK!THIS!
-
-# In the following, perl variables are not expanded during extraction.
-
-print OUT <<'!NO!SUBS!';
-use strict;
-use vars qw/$statdone/;
-use File::Spec::Functions 'curdir';
-my $startperl = "#! $perlpath -w";
-
-sub tab ();
-sub n ($$);
-sub fileglob_to_re ($);
-sub quote ($);
-
-my @roots = ();
-while ($ARGV[0] =~ /^[^-!(]/) {
- push(@roots, shift);
-}
-@roots = (curdir()) unless @roots;
-for (@roots) { $_ = quote($_) }
-my $roots = join(', ', @roots);
-
-my $find = "find";
-my $indent_depth = 1;
-my $stat = 'lstat';
-my $decl = '';
-my $flushall = '';
-my $initfile = '';
-my $initnewer = '';
-my $out = '';
-my $declaresubs = "sub wanted;\n";
-my %init = ();
-my ($follow_in_effect,$Skip_And) = (0,0);
-my $print_needed = 1;
-
-while (@ARGV) {
- $_ = shift;
- s/^-// || /^[()!]/ || die "Unrecognized switch: $_\n";
- if ($_ eq '(') {
- $out .= tab . "(\n";
- $indent_depth++;
- next;
- } elsif ($_ eq ')') {
- --$indent_depth;
- $out .= tab . ")";
- } elsif ($_ eq 'follow') {
- $follow_in_effect= 1;
- $stat = 'stat';
- $Skip_And= 1;
- } elsif ($_ eq '!') {
- $out .= tab . "!";
- next;
- } elsif (/^(i)?name$/) {
- $out .= tab . '/' . fileglob_to_re(shift) . "/s$1";
- } elsif (/^(i)?path$/) {
- $out .= tab . '$File::Find::name =~ /' . fileglob_to_re(shift) . "/s$1";
- } elsif ($_ eq 'perm') {
- my $onum = shift;
- $onum =~ /^-?[0-7]+$/
- || die "Malformed -perm argument: $onum\n";
- $out .= tab;
- if ($onum =~ s/^-//) {
- $onum = sprintf("0%o", oct($onum) & 07777);
- $out .= "((\$mode & $onum) == $onum)";
- } else {
- $onum =~ s/^0*/0/;
- $out .= "((\$mode & 0777) == $onum)";
- }
- } elsif ($_ eq 'type') {
- (my $filetest = shift) =~ tr/s/S/;
- $out .= tab . "-$filetest _";
- } elsif ($_ eq 'print') {
- $out .= tab . 'print("$name\n")';
- $print_needed = 0;
- } elsif ($_ eq 'print0') {
- $out .= tab . 'print("$name\0")';
- $print_needed = 0;
- } elsif ($_ eq 'fstype') {
- my $type = shift;
- $out .= tab;
- if ($type eq 'nfs') {
- $out .= '($dev < 0)';
- } else {
- $out .= '($dev >= 0)'; #XXX
- }
- } elsif ($_ eq 'user') {
- my $uname = shift;
- $out .= tab . "(\$uid == \$uid{'$uname'})";
- $init{user} = 1;
- } elsif ($_ eq 'group') {
- my $gname = shift;
- $out .= tab . "(\$gid == \$gid{'$gname'})";
- $init{group} = 1;
- } elsif ($_ eq 'nouser') {
- $out .= tab . '!exists $uid{$uid}';
- $init{user} = 1;
- } elsif ($_ eq 'nogroup') {
- $out .= tab . '!exists $gid{$gid}';
- $init{group} = 1;
- } elsif ($_ eq 'links') {
- $out .= tab . n('$nlink', shift);
- } elsif ($_ eq 'inum') {
- $out .= tab . n('$ino', shift);
- } elsif ($_ eq 'size') {
- $_ = shift;
- my $n = 'int(((-s _) + 511) / 512)';
- if (s/c\z//) {
- $n = 'int(-s _)';
- } elsif (s/k\z//) {
- $n = 'int(((-s _) + 1023) / 1024)';
- }
- $out .= tab . n($n, $_);
- } elsif ($_ eq 'atime') {
- $out .= tab . n('int(-A _)', shift);
- } elsif ($_ eq 'mtime') {
- $out .= tab . n('int(-M _)', shift);
- } elsif ($_ eq 'ctime') {
- $out .= tab . n('int(-C _)', shift);
- } elsif ($_ eq 'exec') {
- my @cmd = ();
- while (@ARGV && $ARGV[0] ne ';')
- { push(@cmd, shift) }
- shift;
- $out .= tab;
- if ($cmd[0] =~m#^(?:(?:/usr)?/bin/)?rm$#
- && $cmd[$#cmd] eq '{}'
- && (@cmd == 2 || (@cmd == 3 && $cmd[1] eq '-f'))) {
- if (@cmd == 2) {
- $out .= '(unlink($_) || warn "$name: $!\n")';
- } elsif (!@ARGV) {
- $out .= 'unlink($_)';
- } else {
- $out .= '(unlink($_) || 1)';
- }
- } else {
- for (@cmd)
- { s/'/\\'/g }
- { local $" = "','"; $out .= "doexec(0, '@cmd')"; }
- $declaresubs .= "sub doexec (\$\@);\n";
- $init{doexec} = 1;
- }
- $print_needed = 0;
- } elsif ($_ eq 'ok') {
- my @cmd = ();
- while (@ARGV && $ARGV[0] ne ';')
- { push(@cmd, shift) }
- shift;
- $out .= tab;
- for (@cmd)
- { s/'/\\'/g }
- { local $" = "','"; $out .= "doexec(1, '@cmd')"; }
- $declaresubs .= "sub doexec (\$\@);\n";
- $init{doexec} = 1;
- $print_needed = 0;
- } elsif ($_ eq 'prune') {
- $out .= tab . '($File::Find::prune = 1)';
- } elsif ($_ eq 'xdev') {
- $out .= tab . '!($File::Find::prune |= ($dev != $File::Find::topdev))'
-;
- } elsif ($_ eq 'newer') {
- my $file = shift;
- my $newername = 'AGE_OF' . $file;
- $newername =~ s/\W/_/g;
- $newername = '$' . $newername;
- $out .= tab . "(-M _ < $newername)";
- $initnewer .= "my $newername = -M " . quote($file) . ";\n";
- } elsif ($_ eq 'eval') {
- my $prog = shift;
- $prog =~ s/'/\\'/g;
- $out .= tab . "eval {$prog}";
- $print_needed = 0;
- } elsif ($_ eq 'depth') {
- $find = 'finddepth';
- next;
- } elsif ($_ eq 'ls') {
- $out .= tab . "ls";
- $declaresubs .= "sub ls ();\n";
- $init{ls} = 1;
- $print_needed = 0;
- } elsif ($_ eq 'tar') {
- die "-tar must have a filename argument\n" unless @ARGV;
- my $file = shift;
- my $fh = 'FH' . $file;
- $fh =~ s/\W/_/g;
- $out .= tab . "tar(*$fh, \$name)";
- $flushall .= "tflushall;\n";
- $declaresubs .= "sub tar;\nsub tflushall ();\n";
- $initfile .= "open($fh, " . quote('> ' . $file) .
- qq{) || die "Can't open $fh: \$!\\n";\n};
- $init{tar} = 1;
- } elsif (/^(n?)cpio\z/) {
- die "-$_ must have a filename argument\n" unless @ARGV;
- my $file = shift;
- my $fh = 'FH' . $file;
- $fh =~ s/\W/_/g;
- $out .= tab . "cpio(*$fh, \$name, '$1')";
- $find = 'finddepth';
- $flushall .= "cflushall;\n";
- $declaresubs .= "sub cpio;\nsub cflushall ();\n";
- $initfile .= "open($fh, " . quote('> ' . $file) .
- qq{) || die "Can't open $fh: \$!\\n";\n};
- $init{cpio} = 1;
- } else {
- die "Unrecognized switch: -$_\n";
- }
-
- if (@ARGV) {
- if ($ARGV[0] eq '-o') {
- { local($statdone) = 1; $out .= "\n" . tab . "||\n"; }
- $statdone = 0 if $indent_depth == 1 && exists $init{delayedstat};
- $init{saw_or} = 1;
- shift;
- } else {
- $out .= " &&" unless $Skip_And || $ARGV[0] eq ')';
- $out .= "\n";
- shift if $ARGV[0] eq '-a';
- }
- }
-}
-
-if ($print_needed) {
- my $t = tab;
- if ($t !~ /&&\s*$/) { $t .= '&& ' }
- $out .= "\n" . $t . 'print("$name\n")';
-}
-
-
-print <<"END";
-$startperl
- eval 'exec $perlpath -S \$0 \${1+"\$@"}'
- if 0; #\$running_under_some_shell
-
-use strict;
-use File::Find ();
-
-# Set the variable \$File::Find::dont_use_nlink if you're using AFS,
-# since AFS cheats.
-
-# for the convenience of &wanted calls, including -eval statements:
-use vars qw/*name *dir *prune/;
-*name = *File::Find::name;
-*dir = *File::Find::dir;
-*prune = *File::Find::prune;
-
-$declaresubs
-
-END
-
-if (exists $init{doexec}) {
- print <<'END';
-use Cwd ();
-my $cwd = Cwd::cwd();
-
-END
-}
-
-if (exists $init{ls}) {
- print <<'END';
-my @rwx = qw(--- --x -w- -wx r-- r-x rw- rwx);
-my @moname = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
-
-END
-}
-
-if (exists $init{user} || exists $init{ls} || exists $init{tar}) {
- print "my (%uid, %user);\n";
- print "while (my (\$name, \$pw, \$uid) = getpwent) {\n";
- print ' $uid{$name} = $uid{$uid} = $uid;', "\n"
- if exists $init{user};
- print ' $user{$uid} = $name unless exists $user{$uid};', "\n"
- if exists $init{ls} || exists $init{tar};
- print "}\n\n";
-}
-
-if (exists $init{group} || exists $init{ls} || exists $init{tar}) {
- print "my (%gid, %group);\n";
- print "while (my (\$name, \$pw, \$gid) = getgrent) {\n";
- print ' $gid{$name} = $gid{$gid} = $gid;', "\n"
- if exists $init{group};
- print ' $group{$gid} = $name unless exists $group{$gid};', "\n"
- if exists $init{ls} || exists $init{tar};
- print "}\n\n";
-}
-
-print $initnewer, "\n" if $initnewer ne '';
-print $initfile, "\n" if $initfile ne '';
-$flushall .= "exit;\n";
-if (exists $init{declarestat}) {
- $out = <<'END' . $out;
- my ($dev,$ino,$mode,$nlink,$uid,$gid);
-
-END
-}
-
-if ( $follow_in_effect ) {
-$out =~ s/lstat\(\$_\)/lstat(_)/;
-print <<"END";
-$decl
-# Traverse desired filesystems
-File::Find::$find( {wanted => \\&wanted, follow => 1}, $roots);
-$flushall
-
-sub wanted {
-$out;
-}
-
-END
-} else {
-print <<"END";
-$decl
-# Traverse desired filesystems
-File::Find::$find({wanted => \\&wanted}, $roots);
-$flushall
-
-sub wanted {
-$out;
-}
-
-END
-}
-
-if (exists $init{doexec}) {
- print <<'END';
-
-sub doexec ($@) {
- my $ok = shift;
- my @command = @_; # copy so we don't try to s/// aliases to constants
- for my $word (@command)
- { $word =~ s#{}#$name#g }
- if ($ok) {
- my $old = select(STDOUT);
- $| = 1;
- print "@command";
- select($old);
- return 0 unless <STDIN> =~ /^y/;
- }
- chdir $cwd; #sigh
- system @command;
- chdir $File::Find::dir;
- return !$?;
-}
-
-END
-}
-
-if (exists $init{ls}) {
- print <<'INTRO', <<"SUB", <<'END';
-
-sub sizemm {
- my $rdev = shift;
- sprintf("%3d, %3d", ($rdev >> 8) & 0xff, $rdev & 0xff);
-}
-
-sub ls () {
- my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
-INTRO
- \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat(_);
-SUB
- my $pname = $name;
-
- $blocks
- or $blocks = int(($size + 1023) / 1024);
-
- my $perms = $rwx[$mode & 7];
- $mode >>= 3;
- $perms = $rwx[$mode & 7] . $perms;
- $mode >>= 3;
- $perms = $rwx[$mode & 7] . $perms;
- substr($perms, 2, 1) =~ tr/-x/Ss/ if -u _;
- substr($perms, 5, 1) =~ tr/-x/Ss/ if -g _;
- substr($perms, 8, 1) =~ tr/-x/Tt/ if -k _;
- if (-f _) { $perms = '-' . $perms; }
- elsif (-d _) { $perms = 'd' . $perms; }
- elsif (-l _) { $perms = 'l' . $perms; $pname .= ' -> ' . readlink($_); }
- elsif (-c _) { $perms = 'c' . $perms; $size = sizemm($rdev); }
- elsif (-b _) { $perms = 'b' . $perms; $size = sizemm($rdev); }
- elsif (-p _) { $perms = 'p' . $perms; }
- elsif (-S _) { $perms = 's' . $perms; }
- else { $perms = '?' . $perms; }
-
- my $user = $user{$uid} || $uid;
- my $group = $group{$gid} || $gid;
-
- my ($sec,$min,$hour,$mday,$mon,$timeyear) = localtime($mtime);
- if (-M _ > 365.25 / 2) {
- $timeyear += 1900;
- } else {
- $timeyear = sprintf("%02d:%02d", $hour, $min);
- }
-
- printf "%5lu %4ld %-10s %3d %-8s %-8s %8s %s %2d %5s %s\n",
- $ino,
- $blocks,
- $perms,
- $nlink,
- $user,
- $group,
- $size,
- $moname[$mon],
- $mday,
- $timeyear,
- $pname;
- 1;
-}
-
-END
-}
-
-
-if (exists $init{cpio} || exists $init{tar}) {
-print <<'END';
-
-my %blocks = ();
-
-sub flush {
- my ($fh, $varref, $blksz) = @_;
-
- while (length($$varref) >= $blksz) {
- no strict qw/refs/;
- syswrite($fh, $$varref, $blksz);
- substr($$varref, 0, $blksz) = '';
- ++$blocks{$fh};
- }
-}
-
-END
-}
-
-
-if (exists $init{cpio}) {
- print <<'INTRO', <<"SUB", <<'END';
-
-my %cpout = ();
-my %nc = ();
-
-sub cpio {
- my ($fh, $fname, $nc) = @_;
- my $text = '';
- my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
- $atime,$mtime,$ctime,$blksize,$blocks);
- local (*IN);
-
- if ( ! defined $fname ) {
- $fname = 'TRAILER!!!';
- ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
- $atime,$mtime,$ctime,$blksize,$blocks) = (0) x 13;
- } else {
- ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
-INTRO
- \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat(_);
-SUB
- if (-f _) {
- open(IN, "./$_\0") || do {
- warn "Couldn't open $fname: $!\n";
- return;
- }
- } else {
- $text = readlink($_);
- $size = 0 unless defined $text;
- }
- }
-
- $fname =~ s#^\./##;
- $nc{$fh} = $nc;
- if ($nc eq 'n') {
- $cpout{$fh} .=
- sprintf("%06o%06o%06o%06o%06o%06o%06o%06o%011lo%06o%011lo%s\0",
- 070707,
- $dev & 0777777,
- $ino & 0777777,
- $mode & 0777777,
- $uid & 0777777,
- $gid & 0777777,
- $nlink & 0777777,
- $rdev & 0177777,
- $mtime,
- length($fname)+1,
- $size,
- $fname);
- } else {
- $cpout{$fh} .= "\0" if length($cpout{$fh}) & 1;
- $cpout{$fh} .= pack("SSSSSSSSLSLa*",
- 070707, $dev, $ino, $mode, $uid, $gid, $nlink, $rdev, $mtime,
- length($fname)+1, $size,
- $fname . (length($fname) & 1 ? "\0" : "\0\0"));
- }
-
- if ($text ne '') {
- $cpout{$fh} .= $text;
- } elsif ($size) {
- my $l;
- flush($fh, \$cpout{$fh}, 5120)
- while ($l = length($cpout{$fh})) >= 5120;
- while (sysread(IN, $cpout{$fh}, 5120 - $l, $l)) {
- flush($fh, \$cpout{$fh}, 5120);
- $l = length($cpout{$fh});
- }
- close IN;
- }
-}
-
-sub cflushall () {
- for my $fh (keys %cpout) {
- cpio($fh, undef, $nc{$fh});
- $cpout{$fh} .= "0" x (5120 - length($cpout{$fh}));
- flush($fh, \$cpout{$fh}, 5120);
- print $blocks{$fh} * 10, " blocks\n";
- }
-}
-
-END
-}
-
-if (exists $init{tar}) {
- print <<'INTRO', <<"SUB", <<'END';
-
-my %tarout = ();
-my %linkseen = ();
-
-sub tar {
- my ($fh, $fname) = @_;
- my $prefix = '';
- my $typeflag = '0';
- my $linkname;
- my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
-INTRO
- \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat(_);
-SUB
- local (*IN);
-
- if ($nlink > 1) {
- if ($linkname = $linkseen{$fh, $dev, $ino}) {
- if (length($linkname) > 100) {
- warn "$0: omitting file with linkname ",
- "too long for tar output: $linkname\n";
- return;
- }
- $typeflag = '1';
- $size = 0;
- } else {
- $linkseen{$fh, $dev, $ino} = $fname;
- }
- }
- if ($typeflag eq '0') {
- if (-f _) {
- open(IN, "./$_\0") || do {
- warn "Couldn't open $fname: $!\n";
- return;
- }
- } else {
- $linkname = readlink($_);
- if (defined $linkname) { $typeflag = '2' }
- elsif (-c _) { $typeflag = '3' }
- elsif (-b _) { $typeflag = '4' }
- elsif (-d _) { $typeflag = '5' }
- elsif (-p _) { $typeflag = '6' }
- }
- }
-
- if (length($fname) > 100) {
- ($prefix, $fname) = ($fname =~ m#\A(.*?)/(.{,100})\Z(?!\n)#);
- if (!defined($fname) || length($prefix) > 155) {
- warn "$0: omitting file with name too long for tar output: ",
- $fname, "\n";
- return;
- }
- }
-
- $size = 0 if $typeflag ne '0';
- my $header = pack("a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155",
- $fname,
- sprintf("%7o ", $mode & 0777),
- sprintf("%7o ", $uid & 0777777),
- sprintf("%7o ", $gid & 0777777),
- sprintf("%11o ", $size),
- sprintf("%11o ", $mtime),
- ' 'x8,
- $typeflag,
- defined $linkname ? $linkname : '',
- "ustar\0",
- "00",
- $user{$uid},
- $group{$gid},
- ($rdev >> 8) & 0xff,
- $rdev & 0xff,
- $prefix,
- );
- substr($header, 148, 8) = sprintf("%7o ", unpack("%16C*", $header));
- my $l = length($header) % 512;
- $tarout{$fh} .= $header;
- $tarout{$fh} .= "\0" x (512 - $l) if $l;
-
- if ($size) {
- flush($fh, \$tarout{$fh}, 10240)
- while ($l = length($tarout{$fh})) >= 10240;
- while (sysread(IN, $tarout{$fh}, 10240 - $l, $l)) {
- my $slop = length($tarout{$fh}) % 512;
- $tarout{$fh} .= "\0" x (512 - $slop) if $slop;
- flush($fh, \$tarout{$fh}, 10240);
- $l = length($tarout{$fh});
- }
- close IN;
- }
-}
-
-sub tflushall () {
- my $len;
- for my $fh (keys %tarout) {
- $len = 10240 - length($tarout{$fh});
- $len += 10240 if $len < 1024;
- $tarout{$fh} .= "\0" x $len;
- flush($fh, \$tarout{$fh}, 10240);
- }
-}
-
-END
-}
-
-exit;
-
-############################################################################
-
-sub tab () {
- my $tabstring;
-
- $tabstring = "\t" x ($indent_depth/2) . ' ' x ($indent_depth%2 * 4);
- if (!$statdone) {
- if ($_ =~ /^(?:name|print|prune|exec|ok|\(|\))/) {
- $init{delayedstat} = 1;
- } else {
- my $statcall = '(($dev,$ino,$mode,$nlink,$uid,$gid) = '
- . $stat . '($_))';
- if (exists $init{saw_or}) {
- $tabstring .= "(\$nlink || $statcall) &&\n" . $tabstring;
- } else {
- $tabstring .= "$statcall &&\n" . $tabstring;
- }
- $statdone = 1;
- $init{declarestat} = 1;
- }
- }
- $tabstring =~ s/^\s+/ / if $out =~ /!$/;
- $tabstring;
-}
-
-sub fileglob_to_re ($) {
- my $x = shift;
- $x =~ s#([./^\$()+])#\\$1#g;
- $x =~ s#\*#.*#g;
- $x =~ s#\?#.#g;
- "^$x\\z";
-}
-
-sub n ($$) {
- my ($pre, $n) = @_;
- $n =~ s/^-/< / || $n =~ s/^\+/> / || $n =~ s/^/== /;
- $n =~ s/ 0*(\d)/ $1/;
- "($pre $n)";
-}
-
-sub quote ($) {
- my $string = shift;
- $string =~ s/\\/\\\\/g;
- $string =~ s/'/\\'/g;
- "'$string'";
-}
-
-__END__
-
-=head1 NAME
-
-find2perl - translate find command lines to Perl code
-
-=head1 SYNOPSIS
-
- find2perl [paths] [predicates] | perl
-
-=head1 DESCRIPTION
-
-find2perl is a little translator to convert find command lines to
-equivalent Perl code. The resulting code is typically faster than
-running find itself.
-
-"paths" are a set of paths where find2perl will start its searches and
-"predicates" are taken from the following list.
-
-=over 4
-
-=item C<! PREDICATE>
-
-Negate the sense of the following predicate. The C<!> must be passed as
-a distinct argument, so it may need to be surrounded by whitespace and/or
-quoted from interpretation by the shell using a backslash (just as with
-using C<find(1)>).
-
-=item C<( PREDICATES )>
-
-Group the given PREDICATES. The parentheses must be passed as distinct
-arguments, so they may need to be surrounded by whitespace and/or
-quoted from interpretation by the shell using a backslash (just as with
-using C<find(1)>).
-
-=item C<PREDICATE1 PREDICATE2>
-
-True if _both_ PREDICATE1 and PREDICATE2 are true; PREDICATE2 is not
-evaluated if PREDICATE1 is false.
-
-=item C<PREDICATE1 -o PREDICATE2>
-
-True if either one of PREDICATE1 or PREDICATE2 is true; PREDICATE2 is
-not evaluated if PREDICATE1 is true.
-
-=item C<-follow>
-
-Follow (dereference) symlinks. The checking of file attributes depends
-on the position of the C<-follow> option. If it precedes the file
-check option, an C<stat> is done which means the file check applies to the
-file the symbolic link is pointing to. If C<-follow> option follows the
-file check option, this now applies to the symbolic link itself, i.e.
-an C<lstat> is done.
-
-=item C<-depth>
-
-Change directory traversal algorithm from breadth-first to depth-first.
-
-=item C<-prune>
-
-Do not descend into the directory currently matched.
-
-=item C<-xdev>
-
-Do not traverse mount points (prunes search at mount-point directories).
-
-=item C<-name GLOB>
-
-File name matches specified GLOB wildcard pattern. GLOB may need to be
-quoted to avoid interpretation by the shell (just as with using
-C<find(1)>).
-
-=item C<-iname GLOB>
-
-Like C<-name>, but the match is case insensitive.
-
-=item C<-path GLOB>
-
-Path name matches specified GLOB wildcard pattern.
-
-=item C<-ipath GLOB>
-
-Like C<-path>, but the match is case insensitive.
-
-=item C<-perm PERM>
-
-Low-order 9 bits of permission match octal value PERM.
-
-=item C<-perm -PERM>
-
-The bits specified in PERM are all set in file's permissions.
-
-=item C<-type X>
-
-The file's type matches perl's C<-X> operator.
-
-=item C<-fstype TYPE>
-
-Filesystem of current path is of type TYPE (only NFS/non-NFS distinction
-is implemented).
-
-=item C<-user USER>
-
-True if USER is owner of file.
-
-=item C<-group GROUP>
-
-True if file's group is GROUP.
-
-=item C<-nouser>
-
-True if file's owner is not in password database.
-
-=item C<-nogroup>
-
-True if file's group is not in group database.
-
-=item C<-inum INUM>
-
-True file's inode number is INUM.
-
-=item C<-links N>
-
-True if (hard) link count of file matches N (see below).
-
-=item C<-size N>
-
-True if file's size matches N (see below) N is normally counted in
-512-byte blocks, but a suffix of "c" specifies that size should be
-counted in characters (bytes) and a suffix of "k" specifies that
-size should be counted in 1024-byte blocks.
-
-=item C<-atime N>
-
-True if last-access time of file matches N (measured in days) (see
-below).
-
-=item C<-ctime N>
-
-True if last-changed time of file's inode matches N (measured in days,
-see below).
-
-=item C<-mtime N>
-
-True if last-modified time of file matches N (measured in days, see below).
-
-=item C<-newer FILE>
-
-True if last-modified time of file matches N.
-
-=item C<-print>
-
-Print out path of file (always true). If none of C<-exec>, C<-ls>,
-C<-print0>, or C<-ok> is specified, then C<-print> will be added
-implicitly.
-
-=item C<-print0>
-
-Like -print, but terminates with \0 instead of \n.
-
-=item C<-exec OPTIONS ;>
-
-exec() the arguments in OPTIONS in a subprocess; any occurrence of {} in
-OPTIONS will first be substituted with the path of the current
-file. Note that the command "rm" has been special-cased to use perl's
-unlink() function instead (as an optimization). The C<;> must be passed as
-a distinct argument, so it may need to be surrounded by whitespace and/or
-quoted from interpretation by the shell using a backslash (just as with
-using C<find(1)>).
-
-=item C<-ok OPTIONS ;>
-
-Like -exec, but first prompts user; if user's response does not begin
-with a y, skip the exec. The C<;> must be passed as
-a distinct argument, so it may need to be surrounded by whitespace and/or
-quoted from interpretation by the shell using a backslash (just as with
-using C<find(1)>).
-
-=item C<-eval EXPR>
-
-Has the perl script eval() the EXPR.
-
-=item C<-ls>
-
-Simulates C<-exec ls -dils {} ;>
-
-=item C<-tar FILE>
-
-Adds current output to tar-format FILE.
-
-=item C<-cpio FILE>
-
-Adds current output to old-style cpio-format FILE.
-
-=item C<-ncpio FILE>
-
-Adds current output to "new"-style cpio-format FILE.
-
-=back
-
-Predicates which take a numeric argument N can come in three forms:
-
- * N is prefixed with a +: match values greater than N
- * N is prefixed with a -: match values less than N
- * N is not prefixed with either + or -: match only values equal to N
-
-=head1 SEE ALSO
-
-find, File::Find.
-
-=cut
-!NO!SUBS!
-
-close OUT or die "Can't close $file: $!";
-chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
-exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
-chdir $origdir;
diff --git a/x2p/hash.c b/x2p/hash.c
deleted file mode 100644
index 7d9c5ece85..0000000000
--- a/x2p/hash.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* hash.c
- *
- * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
- * 2005 by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- */
-
-#include <stdio.h>
-#include "EXTERN.h"
-#include "a2p.h"
-#include "util.h"
-
-#ifdef NETWARE
-char *savestr(char *str);
-#endif
-
-STR *
-hfetch(HASH *tb, char *key)
-{
- char *s;
- int i;
- int hash;
- HENT *entry;
-
- if (!tb)
- return NULL;
- for (s=key, i=0, hash = 0;
- /* while */ *s;
- s++, i++, hash *= 5) {
- hash += *s * coeff[i];
- }
- entry = tb->tbl_array[hash & tb->tbl_max];
- for (; entry; entry = entry->hent_next) {
- if (entry->hent_hash != hash) /* strings can't be equal */
- continue;
- if (strNE(entry->hent_key,key)) /* is this it? */
- continue;
- return entry->hent_val;
- }
- return NULL;
-}
-
-bool
-hstore(HASH *tb, char *key, STR *val)
-{
- char *s;
- int i;
- int hash;
- HENT *entry;
- HENT **oentry;
-
- if (!tb)
- return FALSE;
- for (s=key, i=0, hash = 0;
- /* while */ *s;
- s++, i++, hash *= 5) {
- hash += *s * coeff[i];
- }
-
- oentry = &(tb->tbl_array[hash & tb->tbl_max]);
- i = 1;
-
- for (entry = *oentry; entry; i=0, entry = entry->hent_next) {
- if (entry->hent_hash != hash) /* strings can't be equal */
- continue;
- if (strNE(entry->hent_key,key)) /* is this it? */
- continue;
- /*NOSTRICT*/
- safefree(entry->hent_val);
- entry->hent_val = val;
- return TRUE;
- }
- /*NOSTRICT*/
- entry = (HENT*) safemalloc(sizeof(HENT));
-
- entry->hent_key = savestr(key);
- entry->hent_val = val;
- entry->hent_hash = hash;
- entry->hent_next = *oentry;
- *oentry = entry;
-
- if (i) { /* initial entry? */
- tb->tbl_fill++;
- if ((tb->tbl_fill * 100 / (tb->tbl_max + 1)) > FILLPCT)
- hsplit(tb);
- }
-
- return FALSE;
-}
-
-void
-hsplit(HASH *tb)
-{
- const int oldsize = tb->tbl_max + 1;
- int newsize = oldsize * 2;
- int i;
- HENT **a;
- HENT **b;
- HENT *entry;
- HENT **oentry;
-
- a = (HENT**) saferealloc((char*)tb->tbl_array, newsize * sizeof(HENT*));
- memset(&a[oldsize], 0, oldsize * sizeof(HENT*)); /* zero second half */
- tb->tbl_max = --newsize;
- tb->tbl_array = a;
-
- for (i=0; i<oldsize; i++,a++) {
- if (!*a) /* non-existent */
- continue;
- b = a+oldsize;
- for (oentry = a, entry = *a; entry; entry = *oentry) {
- if ((entry->hent_hash & newsize) != i) {
- *oentry = entry->hent_next;
- entry->hent_next = *b;
- if (!*b)
- tb->tbl_fill++;
- *b = entry;
- continue;
- }
- else
- oentry = &entry->hent_next;
- }
- if (!*a) /* everything moved */
- tb->tbl_fill--;
- }
-}
-
-HASH *
-hnew(void)
-{
- HASH *tb = (HASH*)safemalloc(sizeof(HASH));
-
- tb->tbl_array = (HENT**) safemalloc(8 * sizeof(HENT*));
- tb->tbl_fill = 0;
- tb->tbl_max = 7;
- hiterinit(tb); /* so each() will start off right */
- memset(tb->tbl_array, 0, 8 * sizeof(HENT*));
- return tb;
-}
-
-int
-hiterinit(HASH *tb)
-{
- tb->tbl_riter = -1;
- tb->tbl_eiter = (HENT*)NULL;
- return tb->tbl_fill;
-}
diff --git a/x2p/hash.h b/x2p/hash.h
deleted file mode 100644
index ee5be5bab1..0000000000
--- a/x2p/hash.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* hash.h
- *
- * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2005
- * by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- */
-
-#define FILLPCT 60 /* don't make greater than 99 */
-
-#ifdef DOINIT
-EXTERN_C char const coeff[] = {
- 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
- 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
- 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
- 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
- 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
- 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
- 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
- 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1};
-#else
-EXTERN_C const char coeff[];
-#endif
-
-typedef struct hentry HENT;
-
-struct hentry {
- HENT *hent_next;
- char *hent_key;
- STR *hent_val;
- int hent_hash;
-};
-
-struct htbl {
- HENT **tbl_array;
- int tbl_max;
- int tbl_fill;
- int tbl_riter; /* current root of iterator */
- HENT *tbl_eiter; /* current entry of iterator */
-};
-
-STR * hfetch ( HASH *tb, char *key );
-int hiterinit ( HASH *tb );
-HASH * hnew ( void );
-void hsplit ( HASH *tb );
-bool hstore ( HASH *tb, char *key, STR *val );
diff --git a/x2p/s2p.PL b/x2p/s2p.PL
deleted file mode 100644
index 8a5abaeca8..0000000000
--- a/x2p/s2p.PL
+++ /dev/null
@@ -1,2072 +0,0 @@
-#!/usr/bin/perl
-
-use Config;
-use File::Basename qw(&basename &dirname);
-use Cwd;
-use subs qw(link);
-
-sub link { # This is a cut-down version of installperl:link().
- my($from,$to) = @_;
- my($success) = 0;
-
- eval {
- CORE::link($from, $to)
- ? $success++
- : ($from =~ m#^/afs/# || $to =~ m#^/afs/#)
- ? die "AFS" # okay inside eval {}
- : die "Couldn't link $from to $to: $!\n";
- };
- if ($@) {
- require File::Copy;
- File::Copy::copy($from, $to)
- ? $success++
- : warn "Couldn't copy $from to $to: $!\n";
- }
- $success;
-}
-
-# List explicitly here the variables you want Configure to
-# generate. Metaconfig only looks for shell variables, so you
-# have to mention them as if they were shell variables, not
-# %Config entries. Thus you write
-# $startperl
-# to ensure Configure will look for $Config{startperl}.
-
-# This forces PL files to create target in same directory as PL file.
-# This is so that make depend always knows where to find PL derivatives.
-$origdir = cwd;
-chdir dirname($0);
-$file = basename($0, '.PL');
-$file .= '.com' if $^O eq 'VMS';
-
-open OUT,">$file" or die "Can't create $file: $!";
-
-print "Extracting $file (with variable substitutions)\n";
-
-# In this section, perl variables will be expanded during extraction.
-# You can use $Config{...} to use Configure variables.
-
-print OUT <<"!GROK!THIS!";
-$Config{startperl}
- eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
- if \$running_under_some_shell;
-my \$startperl;
-my \$perlpath;
-(\$startperl = <<'/../') =~ s/\\s*\\z//;
-$Config{startperl}
-/../
-(\$perlpath = <<'/../') =~ s/\\s*\\z//;
-$Config{perlpath}
-/../
-!GROK!THIS!
-
-# In the following, perl variables are not expanded during extraction.
-
-print OUT <<'!NO!SUBS!';
-
-$0 =~ s/^.*?(\w+)[\.\w]*$/$1/;
-
-# (p)sed - a stream editor
-# History: Aug 12 2000: Original version.
-# Mar 25 2002: Rearrange generated Perl program.
-# Jul 23 2007: Fix bug in regex stripping (M.Thorland)
-
-use strict;
-use integer;
-use Symbol;
-
-=head1 NAME
-
-psed - a stream editor
-
-=head1 SYNOPSIS
-
- psed [-an] script [file ...]
- psed [-an] [-e script] [-f script-file] [file ...]
-
- s2p [-an] [-e script] [-f script-file]
-
-=head1 DESCRIPTION
-
-A stream editor reads the input stream consisting of the specified files
-(or standard input, if none are given), processes is line by line by
-applying a script consisting of edit commands, and writes resulting lines
-to standard output. The filename 'C<->' may be used to read standard input.
-
-The edit script is composed from arguments of B<-e> options and
-script-files, in the given order. A single script argument may be specified
-as the first parameter.
-
-If this program is invoked with the name F<s2p>, it will act as a
-sed-to-Perl translator. See L<"SED SCRIPT TRANSLATION">.
-
-B<sed> returns an exit code of 0 on success or >0 if an error occurred.
-
-=head1 OPTIONS
-
-=over 4
-
-=item B<-a>
-
-A file specified as argument to the B<w> edit command is by default
-opened before input processing starts. Using B<-a>, opening of such
-files is delayed until the first line is actually written to the file.
-
-=item B<-e> I<script>
-
-The editing commands defined by I<script> are appended to the script.
-Multiple commands must be separated by newlines.
-
-=item B<-f> I<script-file>
-
-Editing commands from the specified I<script-file> are read and appended
-to the script.
-
-=item B<-n>
-
-By default, a line is written to standard output after the editing script
-has been applied to it. The B<-n> option suppresses automatic printing.
-
-=back
-
-=head1 COMMANDS
-
-B<sed> command syntax is defined as
-
-Z<> Z<> Z<> Z<>[I<address>[B<,>I<address>]][B<!>]I<function>[I<argument>]
-
-with whitespace being permitted before or after addresses, and between
-the function character and the argument. The I<address>es and the
-address inverter (C<!>) are used to restrict the application of a
-command to the selected line(s) of input.
-
-Each command must be on a line of its own, except where noted in
-the synopses below.
-
-The edit cycle performed on each input line consist of reading the line
-(without its trailing newline character) into the I<pattern space>,
-applying the applicable commands of the edit script, writing the final
-contents of the pattern space and a newline to the standard output.
-A I<hold space> is provided for saving the contents of the
-pattern space for later use.
-
-=head2 Addresses
-
-A sed address is either a line number or a pattern, which may be combined
-arbitrarily to construct ranges. Lines are numbered across all input files.
-
-Any address may be followed by an exclamation mark ('C<!>'), selecting
-all lines not matching that address.
-
-=over 4
-
-=item I<number>
-
-The line with the given number is selected.
-
-=item B<$>
-
-A dollar sign (C<$>) is the line number of the last line of the input stream.
-
-=item B</>I<regular expression>B</>
-
-A pattern address is a basic regular expression (see
-L<"BASIC REGULAR EXPRESSIONS">), between the delimiting character C</>.
-Any other character except C<\> or newline may be used to delimit a
-pattern address when the initial delimiter is prefixed with a
-backslash ('C<\>').
-
-=back
-
-If no address is given, the command selects every line.
-
-If one address is given, it selects the line (or lines) matching the
-address.
-
-Two addresses select a range that begins whenever the first address
-matches, and ends (including that line) when the second address matches.
-If the first (second) address is a matching pattern, the second
-address is not applied to the very same line to determine the end of
-the range. Likewise, if the second address is a matching pattern, the
-first address is not applied to the very same line to determine the
-begin of another range. If both addresses are line numbers,
-and the second line number is less than the first line number, then
-only the first line is selected.
-
-
-=head2 Functions
-
-The maximum permitted number of addresses is indicated with each
-function synopsis below.
-
-The argument I<text> consists of one or more lines following the command.
-Embedded newlines in I<text> must be preceded with a backslash. Other
-backslashes in I<text> are deleted and the following character is taken
-literally.
-
-=over 4
-
-=cut
-
-my %ComTab;
-my %GenKey;
-#--------------------------------------------------------------------------
-$ComTab{'a'}=[ 1, 'txt', \&Emit, '{ push( @Q, <<'."'TheEnd' ) }\n" ]; #ok
-
-=item [1addr]B<a\> I<text>
-
-Write I<text> (which must start on the line following the command)
-to standard output immediately before reading the next line
-of input, either by executing the B<N> function or by beginning a new cycle.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'b'}=[ 2, 'str', \&Branch, '{ goto XXX; }' ]; #ok
-
-=item [2addr]B<b> [I<label>]
-
-Branch to the B<:> function with the specified I<label>. If no label
-is given, branch to the end of the script.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'c'}=[ 2, 'txt', \&Change, <<'-X-' ]; #ok
-{ print <<'TheEnd'; } $doPrint = 0; goto EOS;
--X-
-### continue OK => next CYCLE;
-
-=item [2addr]B<c\> I<text>
-
-The line, or range of lines, selected by the address is deleted.
-The I<text> (which must start on the line following the command)
-is written to standard output. With an address range, this occurs at
-the end of the range.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'d'}=[ 2, '', \&Emit, <<'-X-' ]; #ok
-{ $doPrint = 0;
- goto EOS;
-}
--X-
-### continue OK => next CYCLE;
-
-=item [2addr]B<d>
-
-Deletes the pattern space and starts the next cycle.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'D'}=[ 2, '', \&Emit, <<'-X-' ]; #ok
-{ s/^.*\n?//;
- if(length($_)){ goto BOS } else { goto EOS }
-}
--X-
-### continue OK => next CYCLE;
-
-=item [2addr]B<D>
-
-Deletes the pattern space through the first embedded newline or to the end.
-If the pattern space becomes empty, a new cycle is started, otherwise
-execution of the script is restarted.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'g'}=[ 2, '', \&Emit, '{ $_ = $Hold };' ]; #ok
-
-=item [2addr]B<g>
-
-Replace the contents of the pattern space with the hold space.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'G'}=[ 2, '', \&Emit, '{ $_ .= "\n"; $_ .= $Hold };' ]; #ok
-
-=item [2addr]B<G>
-
-Append a newline and the contents of the hold space to the pattern space.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'h'}=[ 2, '', \&Emit, '{ $Hold = $_ }' ]; #ok
-
-=item [2addr]B<h>
-
-Replace the contents of the hold space with the pattern space.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'H'}=[ 2, '', \&Emit, '{ $Hold .= "\n"; $Hold .= $_; }' ]; #ok
-
-=item [2addr]B<H>
-
-Append a newline and the contents of the pattern space to the hold space.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'i'}=[ 1, 'txt', \&Emit, '{ print <<'."'TheEnd' }\n" ]; #ok
-
-=item [1addr]B<i\> I<text>
-
-Write the I<text> (which must start on the line following the command)
-to standard output.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'l'}=[ 2, '', \&Emit, '{ _l() }' ]; #okUTF8
-
-=item [2addr]B<l>
-
-Print the contents of the pattern space: non-printable characters are
-shown in C-style escaped form; long lines are split and have a trailing
-^'C<\>' at the point of the split; the true end of a line is marked with
-a 'C<$>'. Escapes are: '\a', '\t', '\n', '\f', '\r', '\e' for
-BEL, HT, LF, FF, CR, ESC, respectively, and '\' followed by a three-digit
-octal number for all other non-printable characters.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'n'}=[ 2, '', \&Emit, <<'-X-' ]; #ok
-{ print $_, "\n" if $doPrint;
- printQ() if @Q;
- $CondReg = 0;
- last CYCLE unless getsARGV();
- chomp();
-}
--X-
-
-=item [2addr]B<n>
-
-If automatic printing is enabled, write the pattern space to the standard
-output. Replace the pattern space with the next line of input. If
-there is no more input, processing is terminated.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'N'}=[ 2, '', \&Emit, <<'-X-' ]; #ok
-{ printQ() if @Q;
- $CondReg = 0;
- last CYCLE unless getsARGV( $h );
- chomp( $h );
- $_ .= "\n$h";
-}
--X-
-
-=item [2addr]B<N>
-
-Append a newline and the next line of input to the pattern space. If
-there is no more input, processing is terminated.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'p'}=[ 2, '', \&Emit, '{ print $_, "\n"; }' ]; #ok
-
-=item [2addr]B<p>
-
-Print the pattern space to the standard output. (Use the B<-n> option
-to suppress automatic printing at the end of a cycle if you want to
-avoid double printing of lines.)
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'P'}=[ 2, '', \&Emit, <<'-X-' ]; #ok
-{ if( /^(.*)/ ){ print $1, "\n"; } }
--X-
-
-=item [2addr]B<P>
-
-Prints the pattern space through the first embedded newline or to the end.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'q'}=[ 1, '', \&Emit, <<'-X-' ]; #ok
-{ print $_, "\n" if $doPrint;
- last CYCLE;
-}
--X-
-
-=item [1addr]B<q>
-
-Branch to the end of the script and quit without starting a new cycle.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'r'}=[ 1, 'str', \&Emit, "{ _r( '-X-' ) }" ]; #ok
-
-=item [1addr]B<r> I<file>
-
-Copy the contents of the I<file> to standard output immediately before
-the next attempt to read a line of input. Any error encountered while
-reading I<file> is silently ignored.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'s'}=[ 2, 'sub', \&Emit, '' ]; #ok
-
-=item [2addr]B<s/>I<regular expression>B</>I<replacement>B</>I<flags>
-
-Substitute the I<replacement> string for the first substring in
-the pattern space that matches the I<regular expression>.
-Any character other than backslash or newline can be used instead of a
-slash to delimit the regular expression and the replacement.
-To use the delimiter as a literal character within the regular expression
-and the replacement, precede the character by a backslash ('C<\>').
-
-Literal newlines may be embedded in the replacement string by
-preceding a newline with a backslash.
-
-Within the replacement, an ampersand ('C<&>') is replaced by the string
-matching the regular expression. The strings 'C<\1>' through 'C<\9>' are
-replaced by the corresponding subpattern (see L<"BASIC REGULAR EXPRESSIONS">).
-To get a literal 'C<&>' or 'C<\>' in the replacement text, precede it
-by a backslash.
-
-The following I<flags> modify the behaviour of the B<s> command:
-
-=over 8
-
-=item B<g>
-
-The replacement is performed for all matching, non-overlapping substrings
-of the pattern space.
-
-=item B<1>..B<9>
-
-Replace only the n-th matching substring of the pattern space.
-
-=item B<p>
-
-If the substitution was made, print the new value of the pattern space.
-
-=item B<w> I<file>
-
-If the substitution was made, write the new value of the pattern space
-to the specified file.
-
-=back
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'t'}=[ 2, 'str', \&Branch, '{ goto XXX if _t() }' ]; #ok
-
-=item [2addr]B<t> [I<label>]
-
-Branch to the B<:> function with the specified I<label> if any B<s>
-substitutions have been made since the most recent reading of an input line
-or execution of a B<t> function. If no label is given, branch to the end of
-the script.
-
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'w'}=[ 2, 'str', \&Write, "{ _w( '-X-' ) }" ]; #ok
-
-=item [2addr]B<w> I<file>
-
-The contents of the pattern space are written to the I<file>.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'x'}=[ 2, '', \&Emit, '{ ($Hold, $_) = ($_, $Hold) }' ]; #ok
-
-=item [2addr]B<x>
-
-Swap the contents of the pattern space and the hold space.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'y'}=[ 2, 'tra', \&Emit, '' ]; #ok
-
-=item [2addr]B<y>B</>I<string1>B</>I<string2>B</>
-
-In the pattern space, replace all characters occurring in I<string1> by the
-character at the corresponding position in I<string2>. It is possible
-to use any character (other than a backslash or newline) instead of a
-slash to delimit the strings. Within I<string1> and I<string2>, a
-backslash followed by any character other than a newline is that literal
-character, and a backslash followed by an 'n' is replaced by a newline
-character.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'='}=[ 1, '', \&Emit, '{ print "$.\n" }' ]; #ok
-
-=item [1addr]B<=>
-
-Prints the current line number on the standard output.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{':'}=[ 0, 'str', \&Label, '' ]; #ok
-
-=item [0addr]B<:> [I<label>]
-
-The command specifies the position of the I<label>. It has no other effect.
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'{'}=[ 2, '', \&BeginBlock, '{' ]; #ok
-$ComTab{'}'}=[ 0, '', \&EndBlock, ';}' ]; #ok
-# ';' to avoid warning on empty {}-block
-
-=item [2addr]B<{> [I<command>]
-
-=item [0addr]B<}>
-
-These two commands begin and end a command list. The first command may
-be given on the same line as the opening B<{> command. The commands
-within the list are jointly selected by the address(es) given on the
-B<{> command (but may still have individual addresses).
-
-=cut
-
-#--------------------------------------------------------------------------
-$ComTab{'#'}=[ 0, 'str', \&Comment, '' ]; #ok
-
-=item [0addr]B<#> [I<comment>]
-
-The entire line is ignored (treated as a comment). If, however, the first
-two characters in the script are 'C<#n>', automatic printing of output is
-suppressed, as if the B<-n> option were given on the command line.
-
-=back
-
-=cut
-
-use vars qw{ $isEOF $Hold %wFiles @Q $CondReg $doPrint };
-
-my $useDEBUG = exists( $ENV{PSEDDEBUG} );
-my $useEXTBRE = $ENV{PSEDEXTBRE} || '';
-$useEXTBRE =~ s/[^<>wWyB]//g; # gawk RE's handle these
-
-my $doAutoPrint = 1; # automatic printing of pattern space (-n => 0)
-my $doOpenWrite = 1; # open w command output files at start (-a => 0)
-my $svOpenWrite = 0; # save $doOpenWrite
-
-# lower case $0 below as a VMSism. The VMS build procedure creates the
-# s2p file traditionally in upper case on the disk. When VMS is in a
-# case preserved or case sensitive mode, $0 will be returned in the exact
-# case which will be on the disk, and that is not predictable at this time.
-
-my $doGenerate = lc($0) eq 's2p';
-
-# Collected and compiled script
-#
-my( @Commands, %Defined, @BlockStack, %Label, $labNum, $Code, $Func );
-$Code = '';
-
-##################
-# Compile Time
-#
-# Labels
-#
-# Error handling
-#
-sub Warn($;$){
- my( $msg, $loc ) = @_;
- $loc ||= '';
- $loc .= ': ' if length( $loc );
- warn( "$0: $loc$msg\n" );
-}
-
-$labNum = 0;
-sub newLabel(){
- return 'L_'.++$labNum;
-}
-
-# safeHere: create safe here delimiter and modify opcode and argument
-#
-sub safeHere($$){
- my( $codref, $argref ) = @_;
- my $eod = 'EOD000';
- while( $$argref =~ /^$eod$/m ){
- $eod++;
- }
- $$codref =~ s/TheEnd/$eod/e;
- $$argref .= "$eod\n";
-}
-
-# Emit: create address logic and emit command
-#
-sub Emit($$$$$$){
- my( $addr1, $addr2, $negated, $opcode, $arg, $fl ) = @_;
- my $cond = '';
- if( defined( $addr1 ) ){
- if( defined( $addr2 ) ){
- $addr1 .= $addr2 =~ /^\d+$/ ? "..$addr2" : "...$addr2";
- } else {
- $addr1 .= ' == $.' if $addr1 =~ /^\d+$/;
- }
- $cond = $negated ? "unless( $addr1 )\n" : "if( $addr1 )\n";
- }
-
- if( $opcode eq '' ){
- $Code .= "$cond$arg\n";
-
- } elsif( $opcode =~ s/-X-/$arg/e ){
- $Code .= "$cond$opcode\n";
-
- } elsif( $opcode =~ /TheEnd/ ){
- safeHere( \$opcode, \$arg );
- $Code .= "$cond$opcode$arg";
-
- } else {
- $Code .= "$cond$opcode\n";
- }
- 0;
-}
-
-# Write (w command, w flag): store pathname
-#
-sub Write($$$$$$){
- my( $addr1, $addr2, $negated, $opcode, $path, $fl ) = @_;
- $wFiles{$path} = '';
- Emit( $addr1, $addr2, $negated, $opcode, $path, $fl );
-}
-
-
-# Label (: command): label definition
-#
-sub Label($$$$$$){
- my( $addr1, $addr2, $negated, $opcode, $lab, $fl ) = @_;
- my $rc = 0;
- $lab =~ s/\s+//;
- if( length( $lab ) ){
- my $h;
- if( ! exists( $Label{$lab} ) ){
- $h = $Label{$lab}{name} = newLabel();
- } else {
- $h = $Label{$lab}{name};
- if( exists( $Label{$lab}{defined} ) ){
- my $dl = $Label{$lab}{defined};
- Warn( "duplicate label $lab (first defined at $dl)", $fl );
- $rc = 1;
- }
- }
- $Label{$lab}{defined} = $fl;
- $Code .= "$h:;\n";
- }
- $rc;
-}
-
-# BeginBlock ({ command): push block start
-#
-sub BeginBlock($$$$$$){
- my( $addr1, $addr2, $negated, $opcode, $arg, $fl ) = @_;
- push( @BlockStack, [ $fl, $addr1, $addr2, $negated ] );
- Emit( $addr1, $addr2, $negated, $opcode, $arg, $fl );
-}
-
-# EndBlock (} command): check proper nesting
-#
-sub EndBlock($$$$$$){
- my( $addr1, $addr2, $negated, $opcode, $arg, $fl ) = @_;
- my $rc;
- my $jcom = pop( @BlockStack );
- if( defined( $jcom ) ){
- $rc = Emit( $addr1, $addr2, $negated, $opcode, $arg, $fl );
- } else {
- Warn( "unexpected '}'", $fl );
- $rc = 1;
- }
- $rc;
-}
-
-# Branch (t, b commands): check or create label, substitute default
-#
-sub Branch($$$$$$){
- my( $addr1, $addr2, $negated, $opcode, $lab, $fl ) = @_;
- $lab =~ s/\s+//; # no spaces at end
- my $h;
- if( length( $lab ) ){
- if( ! exists( $Label{$lab} ) ){
- $h = $Label{$lab}{name} = newLabel();
- } else {
- $h = $Label{$lab}{name};
- }
- push( @{$Label{$lab}{used}}, $fl );
- } else {
- $h = 'EOS';
- }
- $opcode =~ s/XXX/$h/e;
- Emit( $addr1, $addr2, $negated, $opcode, '', $fl );
-}
-
-# Change (c command): is special due to range end watching
-#
-sub Change($$$$$$){
- my( $addr1, $addr2, $negated, $opcode, $arg, $fl ) = @_;
- my $kwd = $negated ? 'unless' : 'if';
- if( defined( $addr2 ) ){
- $addr1 .= $addr2 =~ /^\d+$/ ? "..$addr2" : "...$addr2";
- if( ! $negated ){
- $addr1 = '$icnt = ('.$addr1.')';
- $opcode = 'if( $icnt =~ /E0$/ )' . $opcode;
- }
- } else {
- $addr1 .= ' == $.' if $addr1 =~ /^\d+$/;
- }
- safeHere( \$opcode, \$arg );
- $Code .= "$kwd( $addr1 ){\n $opcode$arg}\n";
- 0;
-}
-
-
-# Comment (# command): A no-op. Who would've thought that!
-#
-sub Comment($$$$$$){
- my( $addr1, $addr2, $negated, $opcode, $arg, $fl ) = @_;
-### $Code .= "# $arg\n";
- 0;
-}
-
-# stripRegex from the current command. If we're in the first
-# part of s///, trailing spaces have to be kept as the initial
-# part of the replacement string.
-#
-sub stripRegex($$;$){
- my( $del, $sref, $sub ) = @_;
- my $regex = $del;
- print "stripRegex:$del:$$sref:\n" if $useDEBUG;
- while( $$sref =~ s{^(.*?)(\\*)\Q$del\E(\s*)}{}s ){
- my $sl = $2;
- $regex .= $1.$sl.$del;
- if( length( $sl ) % 2 == 0 ){
- if( $sub && (length( $3 ) > 0) ){
- $$sref = $3 . $$sref;
- }
- return $regex;
- }
- $regex .= $3;
- }
- undef();
-}
-
-# stripTrans: take a <del> terminated string from y command
-# honoring and cleaning up of \-escaped <del>'s
-#
-sub stripTrans($$){
- my( $del, $sref ) = @_;
- my $t = '';
- print "stripTrans:$del:$$sref:\n" if $useDEBUG;
- while( $$sref =~ s{^(.*?)(\\*)\Q$del\E}{}s ){
- my $sl = $2;
- $t .= $1;
- if( length( $sl ) % 2 == 0 ){
- $t .= $sl;
- $t =~ s/\\\\/\\/g;
- return $t;
- }
- chop( $sl );
- $t .= $sl.$del.$3;
- }
- undef();
-}
-
-# makey - construct Perl y/// from sed y///
-#
-sub makey($$$){
- my( $fr, $to, $fl ) = @_;
- my $error = 0;
-
- # Ensure that any '-' is up front.
- # Diagnose duplicate contradicting mappings
- my %tr;
- for( my $i = 0; $i < length($fr); $i++ ){
- my $fc = substr($fr,$i,1);
- my $tc = substr($to,$i,1);
- if( exists( $tr{$fc} ) && $tr{$fc} ne $tc ){
- Warn( "ambiguous translation for character '$fc' in 'y' command",
- $fl );
- $error++;
- }
- $tr{$fc} = $tc;
- }
- $fr = $to = '';
- if( exists( $tr{'-'} ) ){
- ( $fr, $to ) = ( '-', $tr{'-'} );
- delete( $tr{'-'} );
- } else {
- $fr = $to = '';
- }
- # might just as well sort it...
- for my $fc ( sort keys( %tr ) ){
- $fr .= $fc;
- $to .= $tr{$fc};
- }
- # make embedded delimiters and newlines safe
- $fr =~ s/([{}])/\$1/g;
- $to =~ s/([{}])/\$1/g;
- $fr =~ s/\n/\\n/g;
- $to =~ s/\n/\\n/g;
- return $error ? undef() : "{ y{$fr}{$to}; }";
-}
-
-######
-# makes - construct Perl s/// from sed s///
-#
-sub makes($$$$$$$){
- my( $regex, $subst, $path, $global, $print, $nmatch, $fl ) = @_;
-
- # make embedded newlines safe
- $regex =~ s/\n/\\n/g;
- $subst =~ s/\n/\\n/g;
-
- my $code;
- # n-th occurrence
- #
- if( length( $nmatch ) ){
- $code = <<TheEnd;
-{ \$n = $nmatch;
- while( --\$n && ( \$s = m ${regex}g ) ){}
- \$s = ( substr( \$_, pos() ) =~ s ${regex}${subst}s ) if \$s;
- \$CondReg ||= \$s;
-TheEnd
- } else {
- $code = <<TheEnd;
-{ \$s = s ${regex}${subst}s${global};
- \$CondReg ||= \$s;
-TheEnd
- }
- if( $print ){
- $code .= ' print $_, "\n" if $s;'."\n";
- }
- if( defined( $path ) ){
- $wFiles{$path} = '';
- $code .= " _w( '$path' ) if \$s;\n";
- $GenKey{'w'} = 1;
- }
- $code .= "}";
-}
-
-=head1 BASIC REGULAR EXPRESSIONS
-
-A I<Basic Regular Expression> (BRE), as defined in POSIX 1003.2, consists
-of I<atoms>, for matching parts of a string, and I<bounds>, specifying
-repetitions of a preceding atom.
-
-=head2 Atoms
-
-The possible atoms of a BRE are: B<.>, matching any single character;
-B<^> and B<$>, matching the null string at the beginning or end
-of a string, respectively; a I<bracket expressions>, enclosed
-in B<[> and B<]> (see below); and any single character with no
-other significance (matching that character). A B<\> before one
-of: B<.>, B<^>, B<$>, B<[>, B<*>, B<\>, matching the character
-after the backslash. A sequence of atoms enclosed in B<\(> and B<\)>
-becomes an atom and establishes the target for a I<backreference>,
-consisting of the substring that actually matches the enclosed atoms.
-Finally, B<\> followed by one of the digits B<0> through B<9> is a
-backreference.
-
-A B<^> that is not first, or a B<$> that is not last does not have
-a special significance and need not be preceded by a backslash to
-become literal. The same is true for a B<]>, that does not terminate
-a bracket expression.
-
-An unescaped backslash cannot be last in a BRE.
-
-=head2 Bounds
-
-The BRE bounds are: B<*>, specifying 0 or more matches of the preceding
-atom; B<\{>I<count>B<\}>, specifying that many repetitions;
-B<\{>I<minimum>B<,\}>, giving a lower limit; and
-B<\{>I<minimum>B<,>I<maximum>B<\}> finally defines a lower and upper
-bound.
-
-A bound appearing as the first item in a BRE is taken literally.
-
-=head2 Bracket Expressions
-
-A I<bracket expression> is a list of characters, character ranges
-and character classes enclosed in B<[> and B<]> and matches any
-single character from the represented set of characters.
-
-A character range is written as two characters separated by B<-> and
-represents all characters (according to the character collating sequence)
-that are not less than the first and not greater than the second.
-(Ranges are very collating-sequence-dependent, and portable programs
-should avoid relying on them.)
-
-A character class is one of the class names
-
- alnum digit punct
- alpha graph space
- blank lower upper
- cntrl print xdigit
-
-enclosed in B<[:> and B<:]> and represents the set of characters
-as defined in ctype(3).
-
-If the first character after B<[> is B<^>, the sense of matching is
-inverted.
-
-To include a literal 'C<^>', place it anywhere else but first. To
-include a literal 'C<]>' place it first or immediately after an
-initial B<^>. To include a literal 'C<->' make it the first (or
-second after B<^>) or last character, or the second endpoint of
-a range.
-
-The special bracket expression constructs C<[[:E<lt>:]]> and C<[[:E<gt>:]]>
-match the null string at the beginning and end of a word respectively.
-(Note that neither is identical to Perl's '\b' atom.)
-
-=head2 Additional Atoms
-
-Since some sed implementations provide additional regular expression
-atoms (not defined in POSIX 1003.2), B<psed> is capable of translating
-the following backslash escapes:
-
-=over 4
-
-=item B<\E<lt>> This is the same as C<[[:E<gt>:]]>.
-
-=item B<\E<gt>> This is the same as C<[[:E<lt>:]]>.
-
-=item B<\w> This is an abbreviation for C<[[:alnum:]_]>.
-
-=item B<\W> This is an abbreviation for C<[^[:alnum:]_]>.
-
-=item B<\y> Match the empty string at a word boundary.
-
-=item B<\B> Match the empty string between any two either word or non-word characters.
-
-=back
-
-To enable this feature, the environment variable PSEDEXTBRE must be set
-to a string containing the requested characters, e.g.:
-C<PSEDEXTBRE='E<lt>E<gt>wW'>.
-
-=cut
-
-#####
-# bre2p - convert BRE to Perl RE
-#
-sub peek(\$$){
- my( $pref, $ic ) = @_;
- $ic < length($$pref)-1 ? substr( $$pref, $ic+1, 1 ) : '';
-}
-
-sub bre2p($$$){
- my( $del, $pat, $fl ) = @_;
- my $led = $del;
- $led =~ tr/{([</})]>/;
- $led = '' if $led eq $del;
-
- $pat = substr( $pat, 1, length($pat) - 2 );
- my $res = '';
- my $bracklev = 0;
- my $backref = 0;
- my $parlev = 0;
- for( my $ic = 0; $ic < length( $pat ); $ic++ ){
- my $c = substr( $pat, $ic, 1 );
- if( $c eq '\\' ){
- ### backslash escapes
- my $nc = peek($pat,$ic);
- if( $nc eq '' ){
- Warn( "'\\' cannot be last in pattern", $fl );
- return undef();
- }
- $ic++;
- if( $nc eq $del ){ ## \<pattern del> => \<pattern del>
- $res .= "\\$del";
-
- } elsif( $nc =~ /([[.*\\n])/ ){
- ## check for \-escaped magics and \n:
- ## \[ \. \* \\ \n stay as they are
- $res .= '\\'.$nc;
-
- } elsif( $nc eq '(' ){ ## \( => (
- $parlev++;
- $res .= '(';
-
- } elsif( $nc eq ')' ){ ## \) => )
- $parlev--;
- $backref++;
- if( $parlev < 0 ){
- Warn( "unmatched '\\)'", $fl );
- return undef();
- }
- $res .= ')';
-
- } elsif( $nc eq '{' ){ ## repetition factor \{<i>[,[<j>]]\}
- my $endpos = index( $pat, '\\}', $ic );
- if( $endpos < 0 ){
- Warn( "unmatched '\\{'", $fl );
- return undef();
- }
- my $rep = substr( $pat, $ic+1, $endpos-($ic+1) );
- $ic = $endpos + 1;
-
- if( $res =~ /^\^?$/ ){
- $res .= "\\{$rep\}";
- } elsif( $rep =~ /^(\d+)(,?)(\d*)?$/ ){
- my $min = $1;
- my $com = $2 || '';
- my $max = $3;
- if( length( $max ) ){
- if( $max < $min ){
- Warn( "maximum less than minimum in '\\{$rep\\}'",
- $fl );
- return undef();
- }
- } else {
- $max = '';
- }
- # simplify some
- if( $min == 0 && $max eq '1' ){
- $res .= '?';
- } elsif( $min == 1 && "$com$max" eq ',' ){
- $res .= '+';
- } elsif( $min == 0 && "$com$max" eq ',' ){
- $res .= '*';
- } else {
- $res .= "{$min$com$max}";
- }
- } else {
- Warn( "invalid repeat clause '\\{$rep\\}'", $fl );
- return undef();
- }
-
- } elsif( $nc =~ /^[1-9]$/ ){
- ## \1 .. \9 => \1 .. \9, but check for a following digit
- if( $nc > $backref ){
- Warn( "invalid backreference ($nc)", $fl );
- return undef();
- }
- $res .= "\\$nc";
- if( peek($pat,$ic) =~ /[0-9]/ ){
- $res .= '(?:)';
- }
-
- } elsif( $useEXTBRE && ( $nc =~ /[$useEXTBRE]/ ) ){
- ## extensions - at most <>wWyB - not in POSIX
- if( $nc eq '<' ){ ## \< => \b(?=\w), be precise
- $res .= '\\b(?<=\\W)';
- } elsif( $nc eq '>' ){ ## \> => \b(?=\W), be precise
- $res .= '\\b(?=\\W)';
- } elsif( $nc eq 'y' ){ ## \y => \b
- $res .= '\\b';
- } else { ## \B, \w, \W remain the same
- $res .= "\\$nc";
- }
- } elsif( $nc eq $led ){
- ## \<closing bracketing-delimiter> - keep '\'
- $res .= "\\$nc";
-
- } else { ## \ <char> => <char> ("as if '\' were not present")
- $res .= $nc;
- }
-
- } elsif( $c eq '.' ){ ## . => .
- $res .= $c;
-
- } elsif( $c eq '*' ){ ## * => * but \* if there's nothing preceding it
- if( $res =~ /^\^?$/ ){
- $res .= '\\*';
- } elsif( substr( $res, -1, 1 ) ne '*' ){
- $res .= $c;
- }
-
- } elsif( $c eq '[' ){
- ## parse []: [^...] [^]...] [-...]
- my $add = '[';
- if( peek($pat,$ic) eq '^' ){
- $ic++;
- $add .= '^';
- }
- my $nc = peek($pat,$ic);
- if( $nc eq ']' || $nc eq '-' ){
- $add .= $nc;
- $ic++;
- }
- # check that [ is not trailing
- if( $ic >= length( $pat ) - 1 ){
- Warn( "unmatched '['", $fl );
- return undef();
- }
- # look for [:...:] and x-y
- my $rstr = substr( $pat, $ic+1 );
- if( $rstr =~ /^((?:\[:\(\w+|[><]\):\]|[^]-](?:-[^]])?)*)/ ){
- my $cnt = $1;
- $ic += length( $cnt );
- $cnt =~ s/([\\\$])/\\$1/g; # '\', '$' are magic in Perl []
- # try some simplifications
- my $red = $cnt;
- if( $red =~ s/0-9// ){
- $cnt = $red.'\d';
- if( $red =~ s/A-Z// && $red =~ s/a-z// && $red =~ s/_// ){
- $cnt = $red.'\w';
- }
- }
- $add .= $cnt;
-
- # POSIX 1003.2 has this (optional) for begin/end word
- $add = '\\b(?=\\W)' if $add eq '[[:<:]]';
- $add = '\\b(?<=\\W)' if $add eq '[[:>:]]';
-
- }
-
- ## may have a trailing '-' before ']'
- if( $ic < length($pat) - 1 &&
- substr( $pat, $ic+1 ) =~ /^(-?])/ ){
- $ic += length( $1 );
- $add .= $1;
- # another simplification
- $add =~ s/^\[(\^?)(\\[dw])]$/ $1 eq '^' ? uc($2) : $2 /e;
- $res .= $add;
- } else {
- Warn( "unmatched '['", $fl );
- return undef();
- }
-
- } elsif( $c eq $led ){ ## unescaped <closing bracketing-delimiter>
- $res .= "\\$c";
-
- } elsif( $c eq ']' ){ ## unmatched ] is not magic
- $res .= ']';
-
- } elsif( $c =~ /[|+?{}()]/ ){ ## not magic in BRE, but in Perl: \-quote
- $res .= "\\$c";
-
- } elsif( $c eq '^' ){ ## not magic unless 1st, but in Perl: \-quote
- $res .= length( $res ) ? '\\^' : '^';
-
- } elsif( $c eq '$' ){ ## not magic unless last, but in Perl: \-quote
- $res .= $ic == length( $pat ) - 1 ? '$' : '\\$';
-
- } else {
- $res .= $c;
- }
- }
-
- if( $parlev ){
- Warn( "unmatched '\\('", $fl );
- return undef();
- }
-
- # final cleanup: eliminate raw HTs
- $res =~ s/\t/\\t/g;
- return $del . $res . ( $led ? $led : $del );
-}
-
-
-#####
-# sub2p - convert sed substitution to Perl substitution
-#
-sub sub2p($$$){
- my( $del, $subst, $fl ) = @_;
- my $led = $del;
- $led =~ tr/{([</})]>/;
- $led = '' if $led eq $del;
-
- $subst = substr( $subst, 1, length($subst) - 2 );
- my $res = '';
-
- for( my $ic = 0; $ic < length( $subst ); $ic++ ){
- my $c = substr( $subst, $ic, 1 );
- if( $c eq '\\' ){
- ### backslash escapes
- my $nc = peek($subst,$ic);
- if( $nc eq '' ){
- Warn( "'\\' cannot be last in substitution", $fl );
- return undef();
- }
- $ic++;
- if( $nc =~ /[\\$del$led]/ ){ ## \ and delimiter
- $res .= '\\' . $nc;
- } elsif( $nc =~ /[1-9]/ ){ ## \1 - \9 => ${1} - ${9}
- $res .= '${' . $nc . '}';
- } else { ## everything else (includes &): omit \
- $res .= $nc;
- }
- } elsif( $c eq '&' ){ ## & => $&
- $res .= '$&';
- } elsif( $c =~ /[\$\@$led]/ ){ ## magic in Perl's substitution string
- $res .= '\\' . $c;
- } else {
- $res .= $c;
- }
- }
-
- # final cleanup: eliminate raw HTs
- $res =~ s/\t/\\t/g;
- return ( $led ? $del : $led ) . $res . ( $led ? $led : $del );
-}
-
-
-sub Parse(){
- my $error = 0;
- my( $pdef, $pfil, $plin );
- for( my $icom = 0; $icom < @Commands; $icom++ ){
- my $cmd = $Commands[$icom];
- print "Parse:$cmd:\n" if $useDEBUG;
- $cmd =~ s/^\s+//;
- next unless length( $cmd );
- my $scom = $icom;
- if( exists( $Defined{$icom} ) ){
- $pdef = $Defined{$icom};
- if( $pdef =~ /^ #(\d+)/ ){
- $pfil = 'expression #';
- $plin = $1;
- } else {
- $pfil = "$pdef l.";
- $plin = 1;
- }
- } else {
- $plin++;
- }
- my $fl = "$pfil$plin";
-
- # insert command as comment in gnerated code
- #
- $Code .= "# $cmd\n" if $doGenerate;
-
- # The Address(es)
- #
- my( $negated, $naddr, $addr1, $addr2 );
- $naddr = 0;
- if( $cmd =~ s/^(\d+)\s*// ){
- $addr1 = "$1"; $naddr++;
- } elsif( $cmd =~ s/^\$\s*// ){
- $addr1 = 'eofARGV()'; $naddr++;
- } elsif( $cmd =~ s{^(/)}{} || $cmd =~ s{^\\(.)}{} ){
- my $del = $1;
- my $regex = stripRegex( $del, \$cmd );
- if( defined( $regex ) ){
- $addr1 = 'm '.bre2p( $del, $regex, $fl ).'s';
- $naddr++;
- } else {
- Warn( "malformed regex, 1st address", $fl );
- $error++;
- next;
- }
- }
- if( defined( $addr1 ) && $cmd =~ s/,\s*// ){
- if( $cmd =~ s/^(\d+)\s*// ){
- $addr2 = "$1"; $naddr++;
- } elsif( $cmd =~ s/^\$\s*// ){
- $addr2 = 'eofARGV()'; $naddr++;
- } elsif( $cmd =~ s{^(/)}{} || $cmd =~ s{^\\(.)}{} ){
- my $del = $1;
- my $regex = stripRegex( $del, \$cmd );
- if( defined( $regex ) ){
- $addr2 = 'm '. bre2p( $del, $regex, $fl ).'s';
- $naddr++;
- } else {
- Warn( "malformed regex, 2nd address", $fl );
- $error++;
- next;
- }
- } else {
- Warn( "invalid address after ','", $fl );
- $error++;
- next;
- }
- }
-
- # address modifier '!'
- #
- $negated = $cmd =~ s/^!\s*//;
- if( defined( $addr1 ) ){
- print "Parse: addr1=$addr1" if $useDEBUG;
- if( defined( $addr2 ) ){
- print ", addr2=$addr2 " if $useDEBUG;
- # both numeric and addr1 > addr2 => eliminate addr2
- undef( $addr2 ) if $addr1 =~ /^\d+$/ &&
- $addr2 =~ /^\d+$/ && $addr1 > $addr2;
- }
- }
- print 'negated' if $useDEBUG && $negated;
- print " command:$cmd\n" if $useDEBUG;
-
- # The Command
- #
- if( $cmd !~ s/^([:#={}abcdDgGhHilnNpPqrstwxy])\s*// ){
- my $h = substr( $cmd, 0, 1 );
- Warn( "unknown command '$h'", $fl );
- $error++;
- next;
- }
- my $key = $1;
-
- my $tabref = $ComTab{$key};
- $GenKey{$key} = 1;
- if( $naddr > $tabref->[0] ){
- Warn( "excess address(es)", $fl );
- $error++;
- next;
- }
-
- my $arg = '';
- if( $tabref->[1] eq 'str' ){
- # take remainder - don't care if it is empty
- $arg = $cmd;
- $cmd = '';
-
- } elsif( $tabref->[1] eq 'txt' ){
- # multi-line text
- my $goon = $cmd =~ /(.*)\\$/;
- if( length( $1 ) ){
- Warn( "extra characters after command ($cmd)", $fl );
- $error++;
- }
- while( $goon ){
- $icom++;
- if( $icom > $#Commands ){
- Warn( "unexpected end of script", $fl );
- $error++;
- last;
- }
- $cmd = $Commands[$icom];
- $Code .= "# $cmd\n" if $doGenerate;
- $goon = $cmd =~ s/\\$//;
- $cmd =~ s/\\(.)/$1/g;
- $arg .= "\n" if length( $arg );
- $arg .= $cmd;
- }
- $arg .= "\n" if length( $arg );
- $cmd = '';
-
- } elsif( $tabref->[1] eq 'sub' ){
- # s///
- if( ! length( $cmd ) ){
- Warn( "'s' command requires argument", $fl );
- $error++;
- next;
- }
- if( $cmd =~ s{^([^\\\n])}{} ){
- my $del = $1;
- my $regex = stripRegex( $del, \$cmd, "s" );
- if( ! defined( $regex ) ){
- Warn( "malformed regular expression", $fl );
- $error++;
- next;
- }
- $regex = bre2p( $del, $regex, $fl );
-
- # a trailing \ indicates embedded NL (in replacement string)
- while( $cmd =~ s/(?<!\\)\\$/\n/ ){
- $icom++;
- if( $icom > $#Commands ){
- Warn( "unexpected end of script", $fl );
- $error++;
- last;
- }
- $cmd .= $Commands[$icom];
- $Code .= "# $Commands[$icom]\n" if $doGenerate;
- }
-
- my $subst = stripRegex( $del, \$cmd );
- if( ! defined( $regex ) ){
- Warn( "malformed substitution expression", $fl );
- $error++;
- next;
- }
- $subst = sub2p( $del, $subst, $fl );
-
- # parse s/// modifier: g|p|0-9|w <file>
- my( $global, $nmatch, $print, $write ) =
- ( '', '', 0, undef );
- while( $cmd =~ s/^([gp0-9])// ){
- $1 eq 'g' ? ( $global = 'g' ) :
- $1 eq 'p' ? ( $print = $1 ) : ( $nmatch .= $1 );
- }
- $write = $1 if $cmd =~ s/w\s*(.*)$//;
- ### $nmatch =~ s/^(\d)\1*$/$1/; ### may be dangerous?
- if( $global && length( $nmatch ) || length( $nmatch ) > 1 ){
- Warn( "conflicting flags '$global$nmatch'", $fl );
- $error++;
- next;
- }
-
- $arg = makes( $regex, $subst,
- $write, $global, $print, $nmatch, $fl );
- if( ! defined( $arg ) ){
- $error++;
- next;
- }
-
- } else {
- Warn( "improper delimiter in s command", $fl );
- $error++;
- next;
- }
-
- } elsif( $tabref->[1] eq 'tra' ){
- # y///
- # a trailing \ indicates embedded newline
- while( $cmd =~ s/(?<!\\)\\$/\n/ ){
- $icom++;
- if( $icom > $#Commands ){
- Warn( "unexpected end of script", $fl );
- $error++;
- last;
- }
- $cmd .= $Commands[$icom];
- $Code .= "# $Commands[$icom]\n" if $doGenerate;
- }
- if( ! length( $cmd ) ){
- Warn( "'y' command requires argument", $fl );
- $error++;
- next;
- }
- my $d = substr( $cmd, 0, 1 ); $cmd = substr( $cmd, 1 );
- if( $d eq '\\' ){
- Warn( "'\\' not valid as delimiter in 'y' command", $fl );
- $error++;
- next;
- }
- my $fr = stripTrans( $d, \$cmd );
- if( ! defined( $fr ) || ! length( $cmd ) ){
- Warn( "malformed 'y' command argument", $fl );
- $error++;
- next;
- }
- my $to = stripTrans( $d, \$cmd );
- if( ! defined( $to ) ){
- Warn( "malformed 'y' command argument", $fl );
- $error++;
- next;
- }
- if( length($fr) != length($to) ){
- Warn( "string lengths in 'y' command differ", $fl );
- $error++;
- next;
- }
- if( ! defined( $arg = makey( $fr, $to, $fl ) ) ){
- $error++;
- next;
- }
-
- }
-
- # $cmd must be now empty - exception is {
- if( $cmd !~ /^\s*$/ ){
- if( $key eq '{' ){
- # dirty hack to process command on '{' line
- $Commands[$icom--] = $cmd;
- } else {
- Warn( "extra characters after command ($cmd)", $fl );
- $error++;
- next;
- }
- }
-
- # Make Code
- #
- if( &{$tabref->[2]}( $addr1, $addr2, $negated,
- $tabref->[3], $arg, $fl ) ){
- $error++;
- }
- }
-
- while( @BlockStack ){
- my $bl = pop( @BlockStack );
- Warn( "start of unterminated '{'", $bl );
- $error++;
- }
-
- for my $lab ( keys( %Label ) ){
- if( ! exists( $Label{$lab}{defined} ) ){
- for my $used ( @{$Label{$lab}{used}} ){
- Warn( "undefined label '$lab'", $used );
- $error++;
- }
- }
- }
-
- exit( 1 ) if $error;
-}
-
-
-##############
-#### MAIN ####
-##############
-
-sub usage(){
- print STDERR "Usage: sed [-an] command [file...]\n";
- print STDERR " [-an] [-e command] [-f script-file] [file...]\n";
-}
-
-###################
-# Here we go again...
-#
-my $expr = 0;
-while( @ARGV && $ARGV[0] =~ /^-(.)(.*)$/ ){
- my $opt = $1;
- my $arg = $2;
- shift( @ARGV );
- if( $opt eq 'e' ){
- if( length( $arg ) ){
- push( @Commands, split( "\n", $arg ) );
- } elsif( @ARGV ){
- push( @Commands, shift( @ARGV ) );
- } else {
- Warn( "option -e requires an argument" );
- usage();
- exit( 1 );
- }
- $expr++;
- $Defined{$#Commands} = " #$expr";
- next;
- }
- if( $opt eq 'f' ){
- my $path;
- if( length( $arg ) ){
- $path = $arg;
- } elsif( @ARGV ){
- $path = shift( @ARGV );
- } else {
- Warn( "option -f requires an argument" );
- usage();
- exit( 1 );
- }
- my $fst = $#Commands + 1;
- open( SCRIPT, "<$path" ) || die( "$0: $path: could not open ($!)\n" );
- my $cmd;
- while( defined( $cmd = <SCRIPT> ) ){
- chomp( $cmd );
- push( @Commands, $cmd );
- }
- close( SCRIPT );
- if( $#Commands >= $fst ){
- $Defined{$fst} = "$path";
- }
- next;
- }
- if( $opt eq '-' && $arg eq '' ){
- last;
- }
- if( $opt eq 'h' || $opt eq '?' ){
- usage();
- exit( 0 );
- }
- if( $opt eq 'n' ){
- $doAutoPrint = 0;
- } elsif( $opt eq 'a' ){
- $doOpenWrite = 0;
- } else {
- Warn( "illegal option '$opt'" );
- usage();
- exit( 1 );
- }
- if( length( $arg ) ){
- unshift( @ARGV, "-$arg" );
- }
-}
-
-# A singleton command may be the 1st argument when there are no options.
-#
-if( @Commands == 0 ){
- if( @ARGV == 0 ){
- Warn( "no script command given" );
- usage();
- exit( 1 );
- }
- push( @Commands, split( "\n", shift( @ARGV ) ) );
- $Defined{0} = ' #1';
-}
-
-print STDERR "Files: @ARGV\n" if $useDEBUG;
-
-# generate leading code
-#
-$Func = <<'[TheEnd]';
-
-# openARGV: open 1st input file
-#
-sub openARGV(){
- unshift( @ARGV, '-' ) unless @ARGV;
- my $file = shift( @ARGV );
- open( ARG, "<$file" )
- || die( "$0: can't open $file for reading ($!)\n" );
- $isEOF = 0;
-}
-
-# getsARGV: Read another input line into argument (default: $_).
-# Move on to next input file, and reset EOF flag $isEOF.
-sub getsARGV(;\$){
- my $argref = @_ ? shift() : \$_;
- while( $isEOF || ! defined( $$argref = <ARG> ) ){
- close( ARG );
- return 0 unless @ARGV;
- my $file = shift( @ARGV );
- open( ARG, "<$file" )
- || die( "$0: can't open $file for reading ($!)\n" );
- $isEOF = 0;
- }
- 1;
-}
-
-# eofARGV: end-of-file test
-#
-sub eofARGV(){
- return @ARGV == 0 && ( $isEOF = eof( ARG ) );
-}
-
-# makeHandle: Generates another file handle for some file (given by its path)
-# to be written due to a w command or an s command's w flag.
-sub makeHandle($){
- my( $path ) = @_;
- my $handle;
- if( ! exists( $wFiles{$path} ) || $wFiles{$path} eq '' ){
- $handle = $wFiles{$path} = gensym();
- if( $doOpenWrite ){
- if( ! open( $handle, ">$path" ) ){
- die( "$0: can't open $path for writing: ($!)\n" );
- }
- }
- } else {
- $handle = $wFiles{$path};
- }
- return $handle;
-}
-
-# printQ: Print queued output which is either a string or a reference
-# to a pathname.
-sub printQ(){
- for my $q ( @Q ){
- if( ref( $q ) ){
- # flush open w files so that reading this file gets it all
- if( exists( $wFiles{$$q} ) && $wFiles{$$q} ne '' ){
- open( $wFiles{$$q}, ">>$$q" );
- }
- # copy file to stdout: slow, but safe
- if( open( RF, "<$$q" ) ){
- while( defined( my $line = <RF> ) ){
- print $line;
- }
- close( RF );
- }
- } else {
- print $q;
- }
- }
- undef( @Q );
-}
-
-[TheEnd]
-
-# generate the sed loop
-#
-$Code .= <<'[TheEnd]';
-sub openARGV();
-sub getsARGV(;\$);
-sub eofARGV();
-sub printQ();
-
-# Run: the sed loop reading input and applying the script
-#
-sub Run(){
- my( $h, $icnt, $s, $n );
- # hack (not unbreakable :-/) to avoid // matching an empty string
- my $z = "\000"; $z =~ /$z/;
- # Initialize.
- openARGV();
- $Hold = '';
- $CondReg = 0;
- $doPrint = $doAutoPrint;
-CYCLE:
- while( getsARGV() ){
- chomp();
- $CondReg = 0; # cleared on t
-BOS:;
-[TheEnd]
-
- # parse - avoid opening files when doing s2p
- #
- ( $svOpenWrite, $doOpenWrite ) = ( $doOpenWrite, $svOpenWrite )
- if $doGenerate;
- Parse();
- ( $svOpenWrite, $doOpenWrite ) = ( $doOpenWrite, $svOpenWrite )
- if $doGenerate;
-
- # append trailing code
- #
- $Code .= <<'[TheEnd]';
-EOS: if( $doPrint ){
- print $_, "\n";
- } else {
- $doPrint = $doAutoPrint;
- }
- printQ() if @Q;
- }
-
- exit( 0 );
-}
-[TheEnd]
-
-
-# append optional functions, prepend prototypes
-#
-my $Proto = "# prototypes\n";
-if( $GenKey{'l'} ){
- $Proto .= "sub _l();\n";
- $Func .= <<'[TheEnd]';
-# _l: l command processing
-#
-sub _l(){
- my $h = $_;
- my $mcpl = 70;
- # transform non printing chars into escape notation
- $h =~ s/\\/\\\\/g;
- if( $h =~ /[^[:print:]]/ ){
- $h =~ s/\a/\\a/g;
- $h =~ s/\f/\\f/g;
- $h =~ s/\n/\\n/g;
- $h =~ s/\t/\\t/g;
- $h =~ s/\r/\\r/g;
- $h =~ s/\e/\\e/g;
- $h =~ s/([^[:print:]])/sprintf("\\%03o", ord($1))/ge;
- }
- # split into lines of length $mcpl
- while( length( $h ) > $mcpl ){
- my $l = substr( $h, 0, $mcpl-1 );
- $h = substr( $h, $mcpl );
- # remove incomplete \-escape from end of line
- if( $l =~ s/(?<!\\)(\\[0-7]{0,2})$// ){
- $h = $1 . $h;
- }
- print $l, "\\\n";
- }
- print "$h\$\n";
-}
-
-[TheEnd]
-}
-
-if( $GenKey{'r'} ){
- $Proto .= "sub _r(\$);\n";
- $Func .= <<'[TheEnd]';
-# _r: r command processing: Save a reference to the pathname.
-#
-sub _r($){
- my $path = shift();
- push( @Q, \$path );
-}
-
-[TheEnd]
-}
-
-if( $GenKey{'t'} ){
- $Proto .= "sub _t();\n";
- $Func .= <<'[TheEnd]';
-# _t: t command - condition register test/reset
-#
-sub _t(){
- my $res = $CondReg;
- $CondReg = 0;
- $res;
-}
-
-[TheEnd]
-}
-
-if( $GenKey{'w'} ){
- $Proto .= "sub _w(\$);\n";
- $Func .= <<'[TheEnd]';
-# _w: w command and s command's w flag - write to file
-#
-sub _w($){
- my $path = shift();
- my $handle = $wFiles{$path};
- if( ! $doOpenWrite && ! defined( fileno( $handle ) ) ){
- open( $handle, ">$path" )
- || die( "$0: $path: cannot open ($!)\n" );
- }
- print $handle $_, "\n";
-}
-
-[TheEnd]
-}
-
-$Code = $Proto . $Code;
-
-# magic "#n" - same as -n option
-#
-$doAutoPrint = 0 if substr( $Commands[0], 0, 2 ) eq '#n';
-
-# eval code - check for errors
-#
-print "Code:\n$Code$Func" if $useDEBUG;
-eval $Code . $Func;
-if( $@ ){
- print "Code:\n$Code$Func";
- die( "$0: internal error - generated incorrect Perl code: $@\n" );
-}
-
-if( $doGenerate ){
-
- # write full Perl program
- #
-
- # bang line, declarations, prototypes
- print <<TheEnd;
-#!$perlpath -w
-eval 'exec $perlpath -S \$0 \${1+"\$@"}'
- if 0;
-\$0 =~ s/^.*?(\\w+)\[\\.\\w+\]*\$/\$1/;
-
-use strict;
-use Symbol;
-use vars qw{ \$isEOF \$Hold \%wFiles \@Q \$CondReg
- \$doAutoPrint \$doOpenWrite \$doPrint };
-\$doAutoPrint = $doAutoPrint;
-\$doOpenWrite = $doOpenWrite;
-TheEnd
-
- my $wf = "'" . join( "', '", keys( %wFiles ) ) . "'";
- if( $wf ne "''" ){
- print <<TheEnd;
-sub makeHandle(\$);
-for my \$p ( $wf ){
- exit( 1 ) unless makeHandle( \$p );
-}
-TheEnd
- }
-
- print $Code;
- print "Run();\n";
- print $Func;
- exit( 0 );
-
-} else {
-
- # execute: make handles (and optionally open) all w files; run!
- for my $p ( keys( %wFiles ) ){
- exit( 1 ) unless makeHandle( $p );
- }
- Run();
-}
-
-
-=head1 ENVIRONMENT
-
-The environment variable C<PSEDEXTBRE> may be set to extend BREs.
-See L<"Additional Atoms">.
-
-=head1 DIAGNOSTICS
-
-=over 4
-
-=item ambiguous translation for character '%s' in 'y' command
-
-The indicated character appears twice, with different translations.
-
-=item '[' cannot be last in pattern
-
-A '[' in a BRE indicates the beginning of a I<bracket expression>.
-
-=item '\' cannot be last in pattern
-
-A '\' in a BRE is used to make the subsequent character literal.
-
-=item '\' cannot be last in substitution
-
-A '\' in a substitution string is used to make the subsequent character literal.
-
-=item conflicting flags '%s'
-
-In an B<s> command, either the 'g' flag and an n-th occurrence flag, or
-multiple n-th occurrence flags are specified. Note that only the digits
-^'1' through '9' are permitted.
-
-=item duplicate label %s (first defined at %s)
-
-=item excess address(es)
-
-The command has more than the permitted number of addresses.
-
-=item extra characters after command (%s)
-
-=item illegal option '%s'
-
-=item improper delimiter in s command
-
-The BRE and substitution may not be delimited with '\' or newline.
-
-=item invalid address after ','
-
-=item invalid backreference (%s)
-
-The specified backreference number exceeds the number of backreferences
-in the BRE.
-
-=item invalid repeat clause '\{%s\}'
-
-The repeat clause does not contain a valid integer value, or pair of
-values.
-
-=item malformed regex, 1st address
-
-=item malformed regex, 2nd address
-
-=item malformed regular expression
-
-=item malformed substitution expression
-
-=item malformed 'y' command argument
-
-The first or second string of a B<y> command is syntactically incorrect.
-
-=item maximum less than minimum in '\{%s\}'
-
-=item no script command given
-
-There must be at least one B<-e> or one B<-f> option specifying a
-script or script file.
-
-=item '\' not valid as delimiter in 'y' command
-
-=item option -e requires an argument
-
-=item option -f requires an argument
-
-=item 's' command requires argument
-
-=item start of unterminated '{'
-
-=item string lengths in 'y' command differ
-
-The translation table strings in a B<y> command must have equal lengths.
-
-=item undefined label '%s'
-
-=item unexpected '}'
-
-A B<}> command without a preceding B<{> command was encountered.
-
-=item unexpected end of script
-
-The end of the script was reached although a text line after a
-B<a>, B<c> or B<i> command indicated another line.
-
-=item unknown command '%s'
-
-=item unterminated '['
-
-A BRE contains an unterminated bracket expression.
-
-=item unterminated '\('
-
-A BRE contains an unterminated backreference.
-
-=item '\{' without closing '\}'
-
-A BRE contains an unterminated bounds specification.
-
-=item '\)' without preceding '\('
-
-=item 'y' command requires argument
-
-=back
-
-=head1 EXAMPLE
-
-The basic material for the preceding section was generated by running
-the sed script
-
- #no autoprint
- s/^.*Warn( *"\([^"]*\)".*$/\1/
- t process
- b
- :process
- s/$!/%s/g
- s/$[_[:alnum:]]\{1,\}/%s/g
- s/\\\\/\\/g
- s/^/=item /
- p
-
-on the program's own text, and piping the output into C<sort -u>.
-
-
-=head1 SED SCRIPT TRANSLATION
-
-If this program is invoked with the name F<s2p> it will act as a
-sed-to-Perl translator. After option processing (all other
-arguments are ignored), a Perl program is printed on standard
-output, which will process the input stream (as read from all
-arguments) in the way defined by the sed script and the option setting
-used for the translation.
-
-=head1 SEE ALSO
-
-perl(1), re_format(7)
-
-=head1 BUGS
-
-The B<l> command will show escape characters (ESC) as 'C<\e>', but
-a vertical tab (VT) in octal.
-
-Trailing spaces are truncated from labels in B<:>, B<t> and B<b> commands.
-
-The meaning of an empty regular expression ('C<//>'), as defined by B<sed>,
-is "the last pattern used, at run time". This deviates from the Perl
-interpretation, which will re-use the "last last successfully executed
-regular expression". Since keeping track of pattern usage would create
-terribly cluttered code, and differences would only appear in obscure
-context (where other B<sed> implementations appear to deviate, too),
-the Perl semantics was adopted. Note that common usage of this feature,
-such as in C</abc/s//xyz/>, will work as expected.
-
-Collating elements (of bracket expressions in BREs) are not implemented.
-
-=head1 STANDARDS
-
-This B<sed> implementation conforms to the IEEE Std1003.2-1992 ("POSIX.2")
-definition of B<sed>, and is compatible with the I<OpenBSD>
-implementation, except where otherwise noted (see L<"BUGS">).
-
-=head1 AUTHOR
-
-This Perl implementation of I<sed> was written by Wolfgang Laun,
-I<Wolfgang.Laun@alcatel.at>.
-
-=head1 COPYRIGHT and LICENSE
-
-This program is free and open software. You may use, modify,
-distribute, and sell this program (and any modified variants) in any
-way you wish, provided you do not restrict others from doing the same.
-
-=cut
-
-!NO!SUBS!
-
-close OUT or die "Can't close $file: $!";
-chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
-unlink 'psed';
-print "Linking $file to psed.\n";
-if (defined $Config{d_link}) {
- link $file, 'psed';
-} else {
- unshift @INC, '../lib';
- require File::Copy;
- File::Copy::syscopy('s2p', 'psed');
-}
-exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
-chdir $origdir;
diff --git a/x2p/str.c b/x2p/str.c
deleted file mode 100644
index e12e5e9c12..0000000000
--- a/x2p/str.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* str.c
- *
- * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
- * 2001, 2002, 2005 by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- */
-
-#include "EXTERN.h"
-#include "a2p.h"
-#include "util.h"
-
-void
-str_numset(STR *str, double num)
-{
- str->str_nval = num;
- str->str_pok = 0; /* invalidate pointer */
- str->str_nok = 1; /* validate number */
-}
-
-char *
-str_2ptr(STR *str)
-{
- char *s;
-
- if (!str)
- return (char *)""; /* probably safe - won't be written to */
- GROWSTR(&(str->str_ptr), &(str->str_len), 24);
- s = str->str_ptr;
- if (str->str_nok) {
- sprintf(s,"%.20g",str->str_nval);
- while (*s) s++;
- }
- *s = '\0';
- str->str_cur = s - str->str_ptr;
- str->str_pok = 1;
-#ifdef DEBUGGING
- if (debug & 32)
- fprintf(stderr,"0x%lx ptr(%s)\n",(unsigned long)str,str->str_ptr);
-#endif
- return str->str_ptr;
-}
-
-void
-str_sset(STR *dstr, STR *sstr)
-{
- if (!sstr)
- str_nset(dstr,No,0);
- else if (sstr->str_nok)
- str_numset(dstr,sstr->str_nval);
- else if (sstr->str_pok)
- str_nset(dstr,sstr->str_ptr,sstr->str_cur);
- else
- str_nset(dstr,"",0);
-}
-
-void
-str_nset(STR *str, const char *ptr, int len)
-{
- GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
- memcpy(str->str_ptr,ptr,len);
- str->str_cur = len;
- *(str->str_ptr+str->str_cur) = '\0';
- str->str_nok = 0; /* invalidate number */
- str->str_pok = 1; /* validate pointer */
-}
-
-void
-str_set(STR *str, const char *ptr)
-{
- int len;
-
- if (!ptr)
- ptr = "";
- len = strlen(ptr);
- GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
- memcpy(str->str_ptr,ptr,len+1);
- str->str_cur = len;
- str->str_nok = 0; /* invalidate number */
- str->str_pok = 1; /* validate pointer */
-}
-
-void
-str_ncat(STR *str, const char *ptr, int len)
-{
- if (!(str->str_pok))
- str_2ptr(str);
- GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + len + 1);
- memcpy(str->str_ptr+str->str_cur, ptr, len);
- str->str_cur += len;
- *(str->str_ptr+str->str_cur) = '\0';
- str->str_nok = 0; /* invalidate number */
- str->str_pok = 1; /* validate pointer */
-}
-
-void
-str_scat(STR *dstr, STR *sstr)
-{
- if (!(sstr->str_pok))
- str_2ptr(sstr);
- if (sstr)
- str_ncat(dstr,sstr->str_ptr,sstr->str_cur);
-}
-
-void
-str_cat(STR *str, const char *ptr)
-{
- int len;
-
- if (!ptr)
- return;
- if (!(str->str_pok))
- str_2ptr(str);
- len = strlen(ptr);
- GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + len + 1);
- memcpy(str->str_ptr+str->str_cur, ptr, len+1);
- str->str_cur += len;
- str->str_nok = 0; /* invalidate number */
- str->str_pok = 1; /* validate pointer */
-}
-
-STR *
-str_new(int len)
-{
- STR *str;
-
- if (freestrroot) {
- str = freestrroot;
- freestrroot = str->str_link.str_next;
- }
- else {
- str = (STR *) safemalloc(sizeof(STR));
- memset((char*)str,0,sizeof(STR));
- }
- if (len)
- GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
- return str;
-}
-
-/* make str point to what nstr did */
-
-void
-str_free(STR *str)
-{
- if (!str)
- return;
- if (str->str_len)
- str->str_ptr[0] = '\0';
- str->str_cur = 0;
- str->str_nok = 0;
- str->str_pok = 0;
- str->str_link.str_next = freestrroot;
- freestrroot = str;
-}
-
-int
-str_len(STR *str)
-{
- if (!str)
- return 0;
- if (!(str->str_pok))
- str_2ptr(str);
- if (str->str_len)
- return str->str_cur;
- else
- return 0;
-}
-
-char *
-str_gets(STR *str, FILE *fp)
-{
-#if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
- /* Here is some breathtakingly efficient cheating */
-
- char *bp; /* we're going to steal some values */
- int cnt; /* from the stdio struct and put EVERYTHING */
- STDCHAR *ptr; /* in the innermost loop into registers */
- char newline = '\n'; /* (assuming at least 6 registers) */
- int i;
- int bpx;
-
-#if defined(VMS)
- /* An ungetc()d char is handled separately from the regular
- * buffer, so we getc() it back out and stuff it in the buffer.
- */
- i = getc(fp);
- if (i == EOF) return NULL;
- *(--((*fp)->_ptr)) = (unsigned char) i;
- (*fp)->_cnt++;
-#endif
-
- cnt = FILE_cnt(fp); /* get count into register */
- str->str_nok = 0; /* invalidate number */
- str->str_pok = 1; /* validate pointer */
- if (str->str_len <= cnt) /* make sure we have the room */
- GROWSTR(&(str->str_ptr), &(str->str_len), cnt+1);
- bp = str->str_ptr; /* move these two too to registers */
- ptr = (STDCHAR*)FILE_ptr(fp);
- for (;;) {
- while (--cnt >= 0) {
- if ((*bp++ = *ptr++) == newline) {
- if (bp <= str->str_ptr + 1 || bp[-2] != '\\')
- goto thats_all_folks;
- else {
- line++;
- bp -= 2;
- }
- }
- }
-
- FILE_cnt(fp) = cnt; /* deregisterize cnt and ptr */
- FILE_ptr(fp) = ptr;
- i = getc(fp); /* get more characters */
- cnt = FILE_cnt(fp);
- ptr = (STDCHAR*)FILE_ptr(fp); /* reregisterize cnt and ptr */
-
- bpx = bp - str->str_ptr; /* prepare for possible relocation */
- GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + cnt + 1);
- bp = str->str_ptr + bpx; /* reconstitute our pointer */
-
- if (i == newline) { /* all done for now? */
- *bp++ = i;
- goto thats_all_folks;
- }
- else if (i == EOF) /* all done for ever? */
- goto thats_all_folks;
- *bp++ = i; /* now go back to screaming loop */
- }
-
-thats_all_folks:
- FILE_cnt(fp) = cnt; /* put these back or we're in trouble */
- FILE_ptr(fp) = ptr;
- *bp = '\0';
- str->str_cur = bp - str->str_ptr; /* set length */
-
-#else /* USE_STDIO_PTR && STDIO_PTR_LVALUE && STDIO_CNT_LVALUE */
- /* The big, slow, and stupid way */
-
- static char buf[4192];
-
- if (fgets(buf, sizeof buf, fp) != NULL)
- str_set(str, buf);
- else
- str_set(str, No);
-
-#endif /* USE_STDIO_PTR && STDIO_PTR_LVALUE && STDIO_CNT_LVALUE */
-
- return str->str_cur ? str->str_ptr : NULL;
-}
-
-STR *
-str_make(const char *s)
-{
- STR *str = str_new(0);
-
- str_set(str,s);
- return str;
-}
-
diff --git a/x2p/str.h b/x2p/str.h
deleted file mode 100644
index 7fc8e1e3b4..0000000000
--- a/x2p/str.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* str.h
- *
- * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2005
- * by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- */
-
-struct string {
- char * str_ptr; /* pointer to malloced string */
- double str_nval; /* numeric value, if any */
- int str_len; /* allocated size */
- int str_cur; /* length of str_ptr as a C string */
- union {
- STR *str_next; /* while free, link to next free str */
- } str_link;
- char str_pok; /* state of str_ptr */
- char str_nok; /* state of str_nval */
-};
-
-/* the following macro updates any magic values this str is associated with */
-
-#define STABSET(x) (x->str_link.str_magic && stabset(x->str_link.str_magic,x))
-
-EXT STR **tmps_list;
-EXT long tmps_max INIT(-1);
-
-char * str_2ptr ( STR *str );
-void str_cat ( STR *str, const char *ptr );
-void str_free ( STR *str );
-char * str_gets ( STR *str, FILE *fp );
-int str_len ( STR *str );
-STR * str_make ( const char *s );
-void str_ncat ( STR *str, const char *ptr, int len );
-STR * str_new ( int len );
-void str_nset ( STR *str, const char *ptr, int len );
-void str_numset ( STR *str, double num );
-void str_scat ( STR *dstr, STR *sstr );
-void str_set ( STR *str, const char *ptr );
-void str_sset ( STR *dstr, STR *sstr );
diff --git a/x2p/util.c b/x2p/util.c
deleted file mode 100644
index 113c3818ff..0000000000
--- a/x2p/util.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* util.c
- *
- * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
- * 2000, 2001, 2005 by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- */
-
-#include "EXTERN.h"
-#include "a2p.h"
-#include "INTERN.h"
-#include "util.h"
-
-#include <stdarg.h>
-#define FLUSH
-
-static const char nomem[] = "Out of memory!\n";
-
-/* paranoid version of malloc */
-
-
-Malloc_t
-safemalloc(MEM_SIZE size)
-{
- Malloc_t ptr;
-
- /* malloc(0) is NASTY on some systems */
- ptr = malloc(size ? size : 1);
-#ifdef DEBUGGING
- if (debug & 128)
- fprintf(stderr,"0x%lx: (%05d) malloc %ld bytes\n",(unsigned long)ptr,
- an++,(long)size);
-#endif
- if (ptr != NULL)
- return ptr;
- else {
- fputs(nomem,stdout) FLUSH;
- exit(1);
- }
- /*NOTREACHED*/
- return 0;
-}
-
-/* paranoid version of realloc */
-
-Malloc_t
-saferealloc(Malloc_t where, MEM_SIZE size)
-{
- Malloc_t ptr;
-
- /* realloc(0) is NASTY on some systems */
- ptr = realloc(where, size ? size : 1);
-#ifdef DEBUGGING
- if (debug & 128) {
- fprintf(stderr,"0x%lx: (%05d) rfree\n",(unsigned long)where,an++);
- fprintf(stderr,"0x%lx: (%05d) realloc %ld bytes\n",(unsigned long)ptr,an++,(long)size);
- }
-#endif
- if (ptr != NULL)
- return ptr;
- else {
- fputs(nomem,stdout) FLUSH;
- exit(1);
- }
- /*NOTREACHED*/
- return 0;
-}
-
-/* safe version of free */
-
-Free_t
-safefree(Malloc_t where)
-{
-#ifdef DEBUGGING
- if (debug & 128)
- fprintf(stderr,"0x%lx: (%05d) free\n",(unsigned long)where,an++);
-#endif
- free(where);
-}
-
-/* copy a string up to some (non-backslashed) delimiter, if any */
-
-char *
-cpytill(char *to, char *from, int delim)
-{
- for (; *from; from++,to++) {
- if (*from == '\\') {
- if (from[1] == delim)
- from++;
- else if (from[1] == '\\')
- *to++ = *from++;
- }
- else if (*from == delim)
- break;
- *to = *from;
- }
- *to = '\0';
- return from;
-}
-
-
-char *
-cpy2(char *to, char *from, int delim)
-{
- for (; *from; from++,to++) {
- if (*from == '\\')
- *to++ = *from++;
- else if (*from == '$')
- *to++ = '\\';
- else if (*from == delim)
- break;
- *to = *from;
- }
- *to = '\0';
- return from;
-}
-
-/* return ptr to little string in big string, NULL if not found */
-
-char *
-instr(char *big, const char *little)
-{
- char *t, *x;
- const char *s;
-
- for (t = big; *t; t++) {
- for (x=t,s=little; *s; x++,s++) {
- if (!*x)
- return NULL;
- if (*s != *x)
- break;
- }
- if (!*s)
- return t;
- }
- return NULL;
-}
-
-/* copy a string to a safe spot */
-
-char *
-savestr(const char *str)
-{
- char * const newaddr = (char *) safemalloc((MEM_SIZE)(strlen(str)+1));
-
- (void)strcpy(newaddr,str);
- return newaddr;
-}
-
-/* grow a static string to at least a certain length */
-
-void
-growstr(char **strptr, int *curlen, int newlen)
-{
- if (newlen > *curlen) { /* need more room? */
- if (*curlen)
- *strptr = (char *) saferealloc(*strptr,(MEM_SIZE)newlen);
- else
- *strptr = (char *) safemalloc((MEM_SIZE)newlen);
- *curlen = newlen;
- }
-}
-
-void
-fatal(const char *pat,...)
-{
-#if defined(HAS_VPRINTF)
- va_list args;
-
- va_start(args, pat);
- vfprintf(stderr,pat,args);
- va_end(args);
-#else
- fprintf(stderr,pat,a1,a2,a3,a4);
-#endif
- exit(1);
-}
-
-#if defined(DARWIN)
-__private_extern__ /* warn() conflicts with libc */
-#endif
-void
-warn(const char *pat,...)
-{
-#if defined(HAS_VPRINTF)
- va_list args;
-
- va_start(args, pat);
- vfprintf(stderr,pat,args);
- va_end(args);
-#else
- fprintf(stderr,pat,a1,a2,a3,a4);
-#endif
-}
-
diff --git a/x2p/util.h b/x2p/util.h
deleted file mode 100644
index 3330a60957..0000000000
--- a/x2p/util.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* util.h
- *
- * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2005
- * by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- */
-
-/* is the string for makedir a directory name or a filename? */
-
-#define fatal Myfatal
-
-#define MD_DIR 0
-#define MD_FILE 1
-
-#ifdef SETUIDGID
- int eaccess();
-#endif
-
-char * cpy2 ( char *to, char *from, int delim );
-char * cpytill ( char *to, char *from, int delim );
-void growstr ( char **strptr, int *curlen, int newlen );
-char * instr ( char *big, const char *little );
-char * savestr ( const char *str );
-void fatal ( const char *pat, ... );
-void warn ( const char *pat, ... );
-int prewalk ( int numit, int level, int node, int *numericptr );
-
-Malloc_t safemalloc (MEM_SIZE nbytes);
-Malloc_t saferealloc (Malloc_t where, MEM_SIZE nbytes);
-Free_t safefree (Malloc_t where);
diff --git a/x2p/walk.c b/x2p/walk.c
deleted file mode 100644
index d6962ede0f..0000000000
--- a/x2p/walk.c
+++ /dev/null
@@ -1,2055 +0,0 @@
-/* walk.c
- *
- * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999,
- * 2000, 2001, 2002, 2005 by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- */
-
-#include "EXTERN.h"
-#include "a2p.h"
-#include "util.h"
-
-bool exitval = FALSE;
-bool realexit = FALSE;
-bool saw_getline = FALSE;
-bool subretnum = FALSE;
-bool saw_FNR = FALSE;
-bool saw_argv0 = FALSE;
-bool saw_fh = FALSE;
-int maxtmp = 0;
-const char *lparen;
-const char *rparen;
-const char *limit;
-STR *subs;
-STR *curargs = NULL;
-
-static void addsemi ( STR *str );
-static void emit_split ( STR *str, int level );
-static void fixtab ( STR *str, int lvl );
-static void numericize ( int node );
-static void tab ( STR *str, int lvl );
-
-int prewalk ( int numit, int level, int node, int *numericptr );
-STR * walk ( int useval, int level, int node, int *numericptr, int minprec );
-#ifdef NETWARE
-char *savestr(char *str);
-char *cpytill(char *to, char *from, int delim);
-char *instr(char *big, const char *little);
-#endif
-
-STR *
-walk(int useval, int level, int node, int *numericptr, int minprec)
-{
- int len;
- STR *str;
- int type;
- int i;
- STR *tmpstr;
- STR *tmp2str;
- STR *tmp3str;
- char *t;
- char *d, *s;
- int numarg;
- int numeric = FALSE;
- STR *fstr;
- int prec = P_MAX; /* assume no parens needed */
-
- if (!node) {
- *numericptr = 0;
- return str_make("");
- }
- type = ops[node].ival;
- len = type >> 8;
- type &= 255;
- switch (type) {
- case OPROG:
- arymax = 0;
- if (namelist) {
- while (isALPHA(*namelist)) {
- for (d = tokenbuf,s=namelist;
- isWORDCHAR(*s);
- *d++ = *s++) ;
- *d = '\0';
- while (*s && !isALPHA(*s)) s++;
- namelist = s;
- nameary[++arymax] = savestr(tokenbuf);
- }
- }
- if (maxfld < arymax)
- maxfld = arymax;
- opens = str_new(0);
- subs = str_new(0);
- str = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- if (do_split && need_entire && !absmaxfld)
- split_to_array = TRUE;
- if (fswitch && !const_FS)
- const_FS = fswitch;
- if (saw_FS > 1 || saw_RS)
- const_FS = 0;
- if (saw_ORS && need_entire)
- do_chop = TRUE;
- if (fswitch) {
- str_cat(str,"$FS = '");
- if (strchr("*+?.[]()|^$\\",fswitch))
- str_cat(str,"\\");
- sprintf(tokenbuf,"%c",fswitch);
- str_cat(str,tokenbuf);
- str_cat(str,"';\t\t# field separator from -F switch\n");
- }
- else if (saw_FS && !const_FS) {
- str_cat(str,"$FS = ' ';\t\t# set field separator\n");
- }
- if (saw_OFS) {
- str_cat(str,"$, = ' ';\t\t# set output field separator\n");
- }
- if (saw_ORS) {
- str_cat(str,"$\\ = \"\\n\";\t\t# set output record separator\n");
- }
- if (saw_argv0) {
- str_cat(str,"$ARGV0 = $0;\t\t# remember what we ran as\n");
- }
- if (str->str_cur > 20)
- str_cat(str,"\n");
- if (ops[node+2].ival) {
- str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,"\n\n");
- }
- fstr = walk(0,level+1,ops[node+3].ival,&numarg,P_MIN);
- if (*fstr->str_ptr) {
- if (saw_line_op)
- str_cat(str,"line: ");
- str_cat(str,"while (<>) {\n");
- tab(str,++level);
- if (saw_FS && !const_FS)
- do_chop = TRUE;
- if (do_chop) {
- str_cat(str,"chomp;\t# strip record separator\n");
- tab(str,level);
- }
- if (do_split)
- emit_split(str,level);
- str_scat(str,fstr);
- str_free(fstr);
- fixtab(str,--level);
- str_cat(str,"}\n");
- if (saw_FNR)
- str_cat(str,"continue {\n $FNRbase = $. if eof;\n}\n");
- }
- else if (old_awk)
- str_cat(str,"while (<>) { } # (no line actions)\n");
- if (ops[node+4].ival) {
- realexit = TRUE;
- str_cat(str,"\n");
- tab(str,level);
- str_scat(str,fstr=walk(0,level,ops[node+4].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,"\n");
- }
- if (exitval)
- str_cat(str,"exit $ExitValue;\n");
- if (subs->str_ptr) {
- str_cat(str,"\n");
- str_scat(str,subs);
- }
- if (saw_getline) {
- for (len = 0; len < 4; len++) {
- if (saw_getline & (1 << len)) {
- sprintf(tokenbuf,"\nsub Getline%d {\n",len);
- str_cat(str, tokenbuf);
- if (len & 2) {
- if (do_fancy_opens)
- str_cat(str," &Pick('',@_);\n");
- else
- str_cat(str," ($fh) = @_;\n");
- }
- else {
- if (saw_FNR)
- str_cat(str," $FNRbase = $. if eof;\n");
- }
- if (len & 1)
- str_cat(str," local($_);\n");
- if (len & 2)
- str_cat(str,
- " if ($getline_ok = (($_ = <$fh>) ne ''))");
- else
- str_cat(str,
- " if ($getline_ok = (($_ = <>) ne ''))");
- str_cat(str, " {\n");
- level += 2;
- tab(str,level);
- i = 0;
- if (do_chop) {
- i++;
- str_cat(str,"chomp;\t# strip record separator\n");
- tab(str,level);
- }
- if (do_split && !(len & 1)) {
- i++;
- emit_split(str,level);
- }
- if (!i)
- str_cat(str,";\n");
- fixtab(str,--level);
- str_cat(str,"}\n $_;\n}\n");
- --level;
- }
- }
- }
- if (do_fancy_opens) {
- str_cat(str,"\n\
-sub Pick {\n\
- local($mode,$name,$pipe) = @_;\n\
- $fh = $name;\n\
- open($name,$mode.$name.$pipe) unless $opened{$name}++;\n\
-}\n\
-");
- }
- break;
- case OHUNKS:
- str = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- if (len == 3) {
- str_scat(str,fstr=walk(0,level,ops[node+3].ival,&numarg,P_MIN));
- str_free(fstr);
- }
- else {
- }
- break;
- case ORANGE:
- prec = P_DOTDOT;
- str = walk(1,level,ops[node+1].ival,&numarg,prec+1);
- str_cat(str," .. ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1));
- str_free(fstr);
- break;
- case OPAT:
- goto def;
- case OREGEX:
- str = str_new(0);
- str_set(str,"/");
- tmpstr=walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- /* translate \nnn to [\nnn] */
- for (s = tmpstr->str_ptr, d = tokenbuf; *s; s++, d++) {
- if (*s == '\\' && isDIGIT(s[1]) && isDIGIT(s[2]) && isDIGIT(s[3])){
- *d++ = '[';
- *d++ = *s++;
- *d++ = *s++;
- *d++ = *s++;
- *d++ = *s;
- *d = ']';
- }
- else
- *d = *s;
- }
- *d = '\0';
- for (d=tokenbuf; *d; d++)
- *d += (char)128;
- str_cat(str,tokenbuf);
- str_free(tmpstr);
- str_cat(str,"/");
- break;
- case OHUNK:
- if (len == 1) {
- str = walk(0,level,oper1(OPRINT,0),&numarg,P_MIN);
- str_cat(str," if ");
- str_scat(str,fstr=walk(0,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,";");
- }
- else {
- tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- if (*tmpstr->str_ptr) {
- str = str_new(0);
- str_set(str,"if (");
- str_scat(str,tmpstr);
- str_cat(str,") {\n");
- tab(str,++level);
- str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- fixtab(str,--level);
- str_cat(str,"}\n");
- tab(str,level);
- }
- else {
- str = walk(0,level,ops[node+2].ival,&numarg,P_MIN);
- }
- }
- break;
- case OPPAREN:
- str = str_new(0);
- str_set(str,"(");
- str_scat(str,fstr=walk(useval != 0,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,")");
- break;
- case OPANDAND:
- prec = P_ANDAND;
- str = walk(1,level,ops[node+1].ival,&numarg,prec);
- str_cat(str," && ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1));
- str_free(fstr);
- str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1));
- str_free(fstr);
- break;
- case OPOROR:
- prec = P_OROR;
- str = walk(1,level,ops[node+1].ival,&numarg,prec);
- str_cat(str," || ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1));
- str_free(fstr);
- str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1));
- str_free(fstr);
- break;
- case OPNOT:
- prec = P_UNARY;
- str = str_new(0);
- str_set(str,"!");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,prec));
- str_free(fstr);
- break;
- case OCOND:
- prec = P_COND;
- str = walk(1,level,ops[node+1].ival,&numarg,prec);
- str_cat(str," ? ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1));
- str_free(fstr);
- str_cat(str," : ");
- str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1));
- str_free(fstr);
- break;
- case OCPAREN:
- str = str_new(0);
- str_set(str,"(");
- str_scat(str,fstr=walk(useval != 0,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- numeric |= numarg;
- str_cat(str,")");
- break;
- case OCANDAND:
- prec = P_ANDAND;
- str = walk(1,level,ops[node+1].ival,&numarg,prec);
- numeric = 1;
- str_cat(str," && ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1));
- str_free(fstr);
- str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1));
- str_free(fstr);
- break;
- case OCOROR:
- prec = P_OROR;
- str = walk(1,level,ops[node+1].ival,&numarg,prec);
- numeric = 1;
- str_cat(str," || ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1));
- str_free(fstr);
- str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1));
- str_free(fstr);
- break;
- case OCNOT:
- prec = P_UNARY;
- str = str_new(0);
- str_set(str,"!");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,prec));
- str_free(fstr);
- numeric = 1;
- break;
- case ORELOP:
- prec = P_REL;
- str = walk(1,level,ops[node+2].ival,&numarg,prec+1);
- numeric |= numarg;
- tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- tmp2str = walk(1,level,ops[node+3].ival,&numarg,prec+1);
- numeric |= numarg;
- if (!numeric ||
- (!numarg && (*tmp2str->str_ptr == '"' || *tmp2str->str_ptr == '\''))) {
- t = tmpstr->str_ptr;
- if (strEQ(t,"=="))
- str_set(tmpstr,"eq");
- else if (strEQ(t,"!="))
- str_set(tmpstr,"ne");
- else if (strEQ(t,"<"))
- str_set(tmpstr,"lt");
- else if (strEQ(t,"<="))
- str_set(tmpstr,"le");
- else if (strEQ(t,">"))
- str_set(tmpstr,"gt");
- else if (strEQ(t,">="))
- str_set(tmpstr,"ge");
- if (!strchr(tmpstr->str_ptr,'\'') && !strchr(tmpstr->str_ptr,'"') &&
- !strchr(tmp2str->str_ptr,'\'') && !strchr(tmp2str->str_ptr,'"') )
- numeric |= 2;
- }
- if (numeric & 2) {
- if (numeric & 1) /* numeric is very good guess */
- str_cat(str," ");
- else
- str_cat(str,"\377");
- numeric = 1;
- }
- else
- str_cat(str," ");
- str_scat(str,tmpstr);
- str_free(tmpstr);
- str_cat(str," ");
- str_scat(str,tmp2str);
- str_free(tmp2str);
- numeric = 1;
- break;
- case ORPAREN:
- str = str_new(0);
- str_set(str,"(");
- str_scat(str,fstr=walk(useval != 0,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- numeric |= numarg;
- str_cat(str,")");
- break;
- case OMATCHOP:
- prec = P_MATCH;
- str = walk(1,level,ops[node+2].ival,&numarg,prec+1);
- str_cat(str," ");
- tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- if (strEQ(tmpstr->str_ptr,"~"))
- str_cat(str,"=~");
- else {
- str_scat(str,tmpstr);
- str_free(tmpstr);
- }
- str_cat(str," ");
- str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1));
- str_free(fstr);
- numeric = 1;
- break;
- case OMPAREN:
- str = str_new(0);
- str_set(str,"(");
- str_scat(str,
- fstr=walk(useval != 0,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- numeric |= numarg;
- str_cat(str,")");
- break;
- case OCONCAT:
- prec = P_ADD;
- type = ops[ops[node+1].ival].ival & 255;
- str = walk(1,level,ops[node+1].ival,&numarg,prec+(type != OCONCAT));
- str_cat(str," . ");
- type = ops[ops[node+2].ival].ival & 255;
- str_scat(str,
- fstr=walk(1,level,ops[node+2].ival,&numarg,prec+(type != OCONCAT)));
- str_free(fstr);
- break;
- case OASSIGN:
- prec = P_ASSIGN;
- str = walk(0,level,ops[node+2].ival,&numarg,prec+1);
- str_cat(str," ");
- tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- str_scat(str,tmpstr);
- if (str_len(tmpstr) > 1)
- numeric = 1;
- str_free(tmpstr);
- str_cat(str," ");
- str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec));
- str_free(fstr);
- numeric |= numarg;
- if (strEQ(str->str_ptr,"$/ = ''"))
- str_set(str, "$/ = \"\\n\\n\"");
- break;
- case OADD:
- prec = P_ADD;
- str = walk(1,level,ops[node+1].ival,&numarg,prec);
- str_cat(str," + ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1));
- str_free(fstr);
- numeric = 1;
- break;
- case OSUBTRACT:
- prec = P_ADD;
- str = walk(1,level,ops[node+1].ival,&numarg,prec);
- str_cat(str," - ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1));
- str_free(fstr);
- numeric = 1;
- break;
- case OMULT:
- prec = P_MUL;
- str = walk(1,level,ops[node+1].ival,&numarg,prec);
- str_cat(str," * ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1));
- str_free(fstr);
- numeric = 1;
- break;
- case ODIV:
- prec = P_MUL;
- str = walk(1,level,ops[node+1].ival,&numarg,prec);
- str_cat(str," / ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1));
- str_free(fstr);
- numeric = 1;
- break;
- case OPOW:
- prec = P_POW;
- str = walk(1,level,ops[node+1].ival,&numarg,prec+1);
- str_cat(str," ** ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec));
- str_free(fstr);
- numeric = 1;
- break;
- case OMOD:
- prec = P_MUL;
- str = walk(1,level,ops[node+1].ival,&numarg,prec);
- str_cat(str," % ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,prec+1));
- str_free(fstr);
- numeric = 1;
- break;
- case OPOSTINCR:
- prec = P_AUTO;
- str = walk(1,level,ops[node+1].ival,&numarg,prec+1);
- str_cat(str,"++");
- numeric = 1;
- break;
- case OPOSTDECR:
- prec = P_AUTO;
- str = walk(1,level,ops[node+1].ival,&numarg,prec+1);
- str_cat(str,"--");
- numeric = 1;
- break;
- case OPREINCR:
- prec = P_AUTO;
- str = str_new(0);
- str_set(str,"++");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,prec+1));
- str_free(fstr);
- numeric = 1;
- break;
- case OPREDECR:
- prec = P_AUTO;
- str = str_new(0);
- str_set(str,"--");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,prec+1));
- str_free(fstr);
- numeric = 1;
- break;
- case OUMINUS:
- prec = P_UNARY;
- str = str_new(0);
- str_set(str,"-");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,prec));
- str_free(fstr);
- numeric = 1;
- break;
- case OUPLUS:
- numeric = 1;
- goto def;
- case OPAREN:
- str = str_new(0);
- str_set(str,"(");
- str_scat(str,
- fstr=walk(useval != 0,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,")");
- numeric |= numarg;
- break;
- case OGETLINE:
- str = str_new(0);
- if (useval)
- str_cat(str,"(");
- if (len > 0) {
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
- if (!*fstr->str_ptr) {
- str_cat(str,"$_");
- len = 2; /* a legal fiction */
- }
- str_free(fstr);
- }
- else
- str_cat(str,"$_");
- if (len > 1) {
- tmpstr=walk(1,level,ops[node+3].ival,&numarg,P_MIN);
- fstr=walk(1,level,ops[node+2].ival,&numarg,P_MIN);
- if (!do_fancy_opens) {
- t = tmpstr->str_ptr;
- if (*t == '"' || *t == '\'')
- t = cpytill(tokenbuf,t+1,*t);
- else
- fatal("Internal error: OGETLINE %s", t);
- d = savestr(t);
- s = savestr(tokenbuf);
- for (t = tokenbuf; *t; t++) {
- *t &= 127;
- if (isLOWER(*t))
- *t = toUPPER(*t);
- if (!isALPHANUMERIC(*t))
- *t = '_';
- }
- if (!strchr(tokenbuf,'_'))
- strcpy(t,"_FH");
- tmp3str = hfetch(symtab,tokenbuf);
- if (!tmp3str) {
- do_opens = TRUE;
- str_cat(opens,"open(");
- str_cat(opens,tokenbuf);
- str_cat(opens,", ");
- d[1] = '\0';
- str_cat(opens,d);
- str_cat(opens,tmpstr->str_ptr+1);
- opens->str_cur--;
- if (*fstr->str_ptr == '|')
- str_cat(opens,"|");
- str_cat(opens,d);
- if (*fstr->str_ptr == '|')
- str_cat(opens,") || die 'Cannot pipe from \"");
- else
- str_cat(opens,") || die 'Cannot open file \"");
- if (*d == '"')
- str_cat(opens,"'.\"");
- str_cat(opens,s);
- if (*d == '"')
- str_cat(opens,"\".'");
- str_cat(opens,"\".';\n");
- hstore(symtab,tokenbuf,str_make("x"));
- }
- safefree(s);
- safefree(d);
- str_set(tmpstr,"'");
- str_cat(tmpstr,tokenbuf);
- str_cat(tmpstr,"'");
- }
- if (*fstr->str_ptr == '|')
- str_cat(tmpstr,", '|'");
- str_free(fstr);
- }
- else
- tmpstr = str_make("");
- sprintf(tokenbuf," = &Getline%d(%s)",len,tmpstr->str_ptr);
- str_cat(str,tokenbuf);
- str_free(tmpstr);
- if (useval)
- str_cat(str,",$getline_ok)");
- saw_getline |= 1 << len;
- break;
- case OSPRINTF:
- str = str_new(0);
- str_set(str,"sprintf(");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,")");
- break;
- case OSUBSTR:
- str = str_new(0);
- str_set(str,"substr(");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_COMMA+1));
- str_free(fstr);
- str_cat(str,", (");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_COMMA+1));
- str_free(fstr);
- str_cat(str,")-1");
- if (len == 3) {
- str_cat(str,", ");
- str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,P_COMMA+1));
- str_free(fstr);
- }
- str_cat(str,")");
- break;
- case OSTRING:
- str = str_new(0);
- str_set(str,ops[node+1].cval);
- break;
- case OSPLIT:
- str = str_new(0);
- limit = ", -1)";
- numeric = 1;
- tmpstr = walk(1,level,ops[node+2].ival,&numarg,P_MIN);
- if (useval)
- str_set(str,"(@");
- else
- str_set(str,"@");
- str_scat(str,tmpstr);
- str_cat(str," = split(");
- if (len == 3) {
- fstr = walk(1,level,ops[node+3].ival,&numarg,P_COMMA+1);
- if (str_len(fstr) == 3 && *fstr->str_ptr == '\'') {
- i = fstr->str_ptr[1] & 127;
- if (strchr("*+?.[]()|^$\\",i))
- sprintf(tokenbuf,"/\\%c/",i);
- else if (i == ' ')
- sprintf(tokenbuf,"' '");
- else
- sprintf(tokenbuf,"/%c/",i);
- str_cat(str,tokenbuf);
- }
- else
- str_scat(str,fstr);
- str_free(fstr);
- }
- else if (const_FS) {
- sprintf(tokenbuf,"/[%c\\n]/",const_FS);
- str_cat(str,tokenbuf);
- }
- else if (saw_FS)
- str_cat(str,"$FS");
- else {
- str_cat(str,"' '");
- limit = ")";
- }
- str_cat(str,", ");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_COMMA+1));
- str_free(fstr);
- str_cat(str,limit);
- if (useval) {
- str_cat(str,")");
- }
- str_free(tmpstr);
- break;
- case OINDEX:
- str = str_new(0);
- str_set(str,"(1+index(");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_COMMA+1));
- str_free(fstr);
- str_cat(str,", ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_COMMA+1));
- str_free(fstr);
- str_cat(str,"))");
- numeric = 1;
- break;
- case OMATCH:
- str = str_new(0);
- prec = P_ANDAND;
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MATCH+1));
- str_free(fstr);
- str_cat(str," =~ ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_MATCH+1));
- str_free(fstr);
- str_cat(str," ? scalar($RLENGTH = length($&), $RSTART = length($`)+1) : 0");
- numeric = 1;
- break;
- case OUSERDEF:
- str = str_new(0);
- subretnum = FALSE;
- fstr=walk(1,level-1,ops[node+2].ival,&numarg,P_MIN);
- curargs = str_new(0);
- str_sset(curargs,fstr);
- str_cat(curargs,",");
- tmp2str=walk(1,level,ops[node+5].ival,&numarg,P_MIN);
- str_free(curargs);
- curargs = NULL;
- level--;
- subretnum |= numarg;
- s = NULL;
- t = tmp2str->str_ptr;
- while ((t = instr(t,"return ")))
- s = t++;
- if (s) {
- i = 0;
- for (t = s+7; *t; t++) {
- if (*t == ';' || *t == '}')
- i++;
- }
- if (i == 1) {
- strcpy(s,s+7);
- tmp2str->str_cur -= 7;
- }
- }
- str_set(str,"\n");
- tab(str,level);
- str_cat(str,"sub ");
- str_scat(str,tmpstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
- str_cat(str," {\n");
- tab(str,++level);
- if (fstr->str_cur) {
- str_cat(str,"local(");
- str_scat(str,fstr);
- str_cat(str,") = @_;");
- }
- str_free(fstr);
- str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,P_MIN));
- str_free(fstr);
- fixtab(str,level);
- str_scat(str,fstr=walk(1,level,ops[node+4].ival,&numarg,P_MIN));
- str_free(fstr);
- fixtab(str,level);
- str_scat(str,tmp2str);
- str_free(tmp2str);
- fixtab(str,--level);
- str_cat(str,"}\n");
- tab(str,level);
- str_scat(subs,str);
- str_set(str,"");
- str_cat(tmpstr,"(");
- tmp2str = str_new(0);
- if (subretnum)
- str_set(tmp2str,"1");
- hstore(symtab,tmpstr->str_ptr,tmp2str);
- str_free(tmpstr);
- level++;
- break;
- case ORETURN:
- str = str_new(0);
- if (len > 0) {
- str_cat(str,"return ");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_UNI+1));
- str_free(fstr);
- if (numarg)
- subretnum = TRUE;
- }
- else
- str_cat(str,"return");
- break;
- case OUSERFUN:
- str = str_new(0);
- str_set(str,"&");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,"(");
- tmpstr = hfetch(symtab,str->str_ptr+3);
- if (tmpstr && tmpstr->str_ptr)
- numeric |= atoi(tmpstr->str_ptr);
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,")");
- break;
- case OGSUB:
- case OSUB: {
- int gsub = type == OGSUB ? 1 : 0;
- str = str_new(0);
- tmpstr = str_new(0);
- i = 0;
- if (len == 3) {
- tmpstr = walk(1,level,ops[node+3].ival,&numarg,P_MATCH+1);
- if (strNE(tmpstr->str_ptr,"$_")) {
- str_cat(tmpstr, " =~ s");
- i++;
- }
- else
- str_set(tmpstr, "s");
- }
- else
- str_set(tmpstr, "s");
- type = ops[ops[node+2].ival].ival;
- len = type >> 8;
- type &= 255;
- tmp3str = str_new(0);
- {
- const char *s;
- if (type == OSTR) {
- tmp2str=walk(1,level,ops[ops[node+2].ival+1].ival,&numarg,P_MIN);
- for (t = tmp2str->str_ptr, d=tokenbuf; *t; d++,t++) {
- if (*t == '&')
- *d++ = '$' + (char)128;
- else if (*t == '$' || *t == '/')
- *d++ = '\\' + (char)128;
- *d = *t + 128;
- }
- *d = '\0';
- str_set(tmp2str,tokenbuf);
- s = (gsub ? "/g" : "/");
- }
- else {
- tmp2str=walk(1,level,ops[node+2].ival,&numarg,P_MIN);
- str_set(tmp3str,"($s_ = '\"'.(");
- str_scat(tmp3str,tmp2str);
- str_cat(tmp3str,").'\"') =~ s/&/\\$&/g, ");
- str_set(tmp2str,"eval $s_");
- s = (gsub ? "/ge" : "/e");
- i++;
- }
- str_cat(tmp2str,s);
- }
- type = ops[ops[node+1].ival].ival;
- len = type >> 8;
- type &= 255;
- fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN);
- if (type == OREGEX) {
- if (useval && i)
- str_cat(str,"(");
- str_scat(str,tmp3str);
- str_scat(str,tmpstr);
- str_scat(str,fstr);
- str_scat(str,tmp2str);
- }
- else if ((type == OFLD && !split_to_array) || (type == OVAR && len == 1)) {
- if (useval && i)
- str_cat(str,"(");
- str_scat(str,tmp3str);
- str_scat(str,tmpstr);
- str_cat(str,"/");
- str_scat(str,fstr);
- str_cat(str,"/");
- str_scat(str,tmp2str);
- }
- else {
- i++;
- if (useval)
- str_cat(str,"(");
- str_cat(str,"$s = ");
- str_scat(str,fstr);
- str_cat(str,", ");
- str_scat(str,tmp3str);
- str_scat(str,tmpstr);
- str_cat(str,"/$s/");
- str_scat(str,tmp2str);
- }
- if (useval && i)
- str_cat(str,")");
- str_free(fstr);
- str_free(tmpstr);
- str_free(tmp2str);
- str_free(tmp3str);
- numeric = 1;
- break; }
- case ONUM:
- str = walk(1,level,ops[node+1].ival,&numarg,P_MIN);
- numeric = 1;
- break;
- case OSTR:
- tmpstr = walk(1,level,ops[node+1].ival,&numarg,P_MIN);
- {
- const char *s = "'";
- for (t = tmpstr->str_ptr, d=tokenbuf; *t; d++,t++) {
- if (*t == '\'')
- s = "\"";
- else if (*t == '\\') {
- s = "\"";
- *d++ = *t++ + 128;
- switch (*t) {
- case '\\': case '"': case 'n': case 't': case '$':
- break;
- default: /* hide this from perl */
- *d++ = '\\' + (char)128;
- }
- }
- *d = *t + 128;
- }
- *d = '\0';
- str = str_new(0);
- str_set(str,s);
- str_cat(str,tokenbuf);
- str_free(tmpstr);
- str_cat(str,s);
- }
- break;
- case ODEFINED:
- prec = P_UNI;
- str = str_new(0);
- str_set(str,"defined $");
- goto addvar;
- case ODELETE:
- str = str_new(0);
- str_set(str,"delete $");
- goto addvar;
- case OSTAR:
- str = str_new(0);
- str_set(str,"*");
- goto addvar;
- case OVAR:
- str = str_new(0);
- str_set(str,"$");
- addvar:
- str_scat(str,tmpstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
- if (len == 1) {
- tmp2str = hfetch(symtab,tmpstr->str_ptr);
- if (tmp2str && atoi(tmp2str->str_ptr))
- numeric = 2;
- if (strEQ(str->str_ptr,"$FNR")) {
- numeric = 1;
- saw_FNR++;
- str_set(str,"($.-$FNRbase)");
- }
- else if (strEQ(str->str_ptr,"$NR")) {
- numeric = 1;
- str_set(str,"$.");
- }
- else if (strEQ(str->str_ptr,"$NF")) {
- numeric = 1;
- str_set(str,"($#Fld+1)");
- }
- else if (strEQ(str->str_ptr,"$0"))
- str_set(str,"$_");
- else if (strEQ(str->str_ptr,"$ARGC"))
- str_set(str,"($#ARGV+2)");
- }
- else {
-#ifdef NOTDEF
- if (curargs) {
- sprintf(tokenbuf,"$%s,",tmpstr->str_ptr);
- ??? if (instr(curargs->str_ptr,tokenbuf))
- str_cat(str,"\377"); /* can't translate yet */
- }
-#endif
- str_cat(tmpstr,"[]");
- tmp2str = hfetch(symtab,tmpstr->str_ptr);
- if (tmp2str && atoi(tmp2str->str_ptr))
- str_cat(str,"[(");
- else
- str_cat(str,"{");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- if (strEQ(str->str_ptr,"$ARGV[0")) {
- str_set(str,"$ARGV0");
- saw_argv0++;
- }
- else {
- if (tmp2str && atoi(tmp2str->str_ptr))
- strcpy(tokenbuf,")-1]");
- else
- strcpy(tokenbuf,"}");
- *tokenbuf += (char)128;
- str_cat(str,tokenbuf);
- }
- }
- str_free(tmpstr);
- break;
- case OFLD:
- str = str_new(0);
- if (split_to_array) {
- str_set(str,"$Fld");
- str_cat(str,"[(");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,")-1]");
- }
- else {
- i = atoi(walk(1,level,ops[node+1].ival,&numarg,P_MIN)->str_ptr);
- if (i <= arymax)
- sprintf(tokenbuf,"$%s",nameary[i]);
- else
- sprintf(tokenbuf,"$Fld%d",i);
- str_set(str,tokenbuf);
- }
- break;
- case OVFLD:
- str = str_new(0);
- str_set(str,"$Fld[");
- i = ops[node+1].ival;
- if ((ops[i].ival & 255) == OPAREN)
- i = ops[i+1].ival;
- tmpstr=walk(1,level,i,&numarg,P_MIN);
- str_scat(str,tmpstr);
- str_free(tmpstr);
- str_cat(str,"]");
- break;
- case OJUNK:
- goto def;
- case OSNEWLINE:
- str = str_new(2);
- str_set(str,";\n");
- tab(str,level);
- break;
- case ONEWLINE:
- str = str_new(1);
- str_set(str,"\n");
- tab(str,level);
- break;
- case OSCOMMENT:
- str = str_new(0);
- str_set(str,";");
- tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- for (s = tmpstr->str_ptr; *s && *s != '\n'; s++)
- *s += (char)128;
- str_scat(str,tmpstr);
- str_free(tmpstr);
- tab(str,level);
- break;
- case OCOMMENT:
- str = str_new(0);
- tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- for (s = tmpstr->str_ptr; *s && *s != '\n'; s++)
- *s += (char)128;
- str_scat(str,tmpstr);
- str_free(tmpstr);
- tab(str,level);
- break;
- case OCOMMA:
- prec = P_COMMA;
- str = walk(1,level,ops[node+1].ival,&numarg,prec);
- str_cat(str,", ");
- str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,prec+1));
- str_free(fstr);
- break;
- case OSEMICOLON:
- str = str_new(1);
- str_set(str,";\n");
- tab(str,level);
- break;
- case OSTATES:
- str = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- break;
- case OSTATE:
- str = str_new(0);
- if (len >= 1) {
- str_scat(str,fstr=walk(0,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- if (len >= 2) {
- tmpstr = walk(0,level,ops[node+2].ival,&numarg,P_MIN);
- if (*tmpstr->str_ptr == ';') {
- addsemi(str);
- str_cat(str,tmpstr->str_ptr+1);
- }
- str_free(tmpstr);
- }
- }
- break;
- case OCLOSE:
- str = str_make("close(");
- tmpstr = walk(1,level,ops[node+1].ival,&numarg,P_MIN);
- if (!do_fancy_opens) {
- t = tmpstr->str_ptr;
- if (*t == '"' || *t == '\'')
- cpytill(tokenbuf,t+1,*t);
- else
- fatal("Internal error: OCLOSE %s",t);
- s = savestr(tokenbuf);
- for (t = tokenbuf; *t; t++) {
- *t &= 127;
- if (isLOWER(*t))
- *t = toUPPER(*t);
- if (!isALPHANUMERIC(*t))
- *t = '_';
- }
- if (!strchr(tokenbuf,'_'))
- strcpy(t,"_FH");
- str_free(tmpstr);
- safefree(s);
- str_set(str,"close ");
- str_cat(str,tokenbuf);
- }
- else {
- sprintf(tokenbuf,"delete $opened{%s} && close(%s)",
- tmpstr->str_ptr, tmpstr->str_ptr);
- str_free(tmpstr);
- str_set(str,tokenbuf);
- }
- break;
- case OPRINTF:
- case OPRINT:
- lparen = ""; /* set to parens if necessary */
- rparen = "";
- str = str_new(0);
- if (len == 3) { /* output redirection */
- tmpstr = walk(1,level,ops[node+3].ival,&numarg,P_MIN);
- tmp2str = walk(1,level,ops[node+2].ival,&numarg,P_MIN);
- if (!do_fancy_opens) {
- t = tmpstr->str_ptr;
- if (*t == '"' || *t == '\'')
- t = cpytill(tokenbuf,t+1,*t);
- else
- fatal("Internal error: OPRINT");
- d = savestr(t);
- s = savestr(tokenbuf);
- for (t = tokenbuf; *t; t++) {
- *t &= 127;
- if (isLOWER(*t))
- *t = toUPPER(*t);
- if (!isALPHANUMERIC(*t))
- *t = '_';
- }
- if (!strchr(tokenbuf,'_'))
- strcpy(t,"_FH");
- tmp3str = hfetch(symtab,tokenbuf);
- if (!tmp3str) {
- str_cat(opens,"open(");
- str_cat(opens,tokenbuf);
- str_cat(opens,", ");
- d[1] = '\0';
- str_cat(opens,d);
- str_scat(opens,tmp2str);
- str_cat(opens,tmpstr->str_ptr+1);
- if (*tmp2str->str_ptr == '|')
- str_cat(opens,") || die 'Cannot pipe to \"");
- else
- str_cat(opens,") || die 'Cannot create file \"");
- if (*d == '"')
- str_cat(opens,"'.\"");
- str_cat(opens,s);
- if (*d == '"')
- str_cat(opens,"\".'");
- str_cat(opens,"\".';\n");
- hstore(symtab,tokenbuf,str_make("x"));
- }
- str_free(tmpstr);
- str_free(tmp2str);
- safefree(s);
- safefree(d);
- }
- else {
- sprintf(tokenbuf,"&Pick('%s', %s) &&\n",
- tmp2str->str_ptr, tmpstr->str_ptr);
- str_cat(str,tokenbuf);
- tab(str,level+1);
- strcpy(tokenbuf,"$fh");
- str_free(tmpstr);
- str_free(tmp2str);
- lparen = "(";
- rparen = ")";
- }
- }
- else
- strcpy(tokenbuf,"");
- str_cat(str,lparen); /* may be null */
- if (type == OPRINTF)
- str_cat(str,"printf");
- else
- str_cat(str,"print");
- saw_fh = 0;
- if (len == 3 || do_fancy_opens) {
- if (*tokenbuf) {
- str_cat(str," ");
- saw_fh = 1;
- }
- str_cat(str,tokenbuf);
- }
- tmpstr = walk(1+(type==OPRINT),level,ops[node+1].ival,&numarg,P_MIN);
- if (!*tmpstr->str_ptr && lval_field) {
- const char *t = (saw_OFS ? "$," : "' '");
- if (split_to_array) {
- sprintf(tokenbuf,"join(%s,@Fld)",t);
- str_cat(tmpstr,tokenbuf);
- }
- else {
- for (i = 1; i < maxfld; i++) {
- if (i <= arymax)
- sprintf(tokenbuf,"$%s, ",nameary[i]);
- else
- sprintf(tokenbuf,"$Fld%d, ",i);
- str_cat(tmpstr,tokenbuf);
- }
- if (maxfld <= arymax)
- sprintf(tokenbuf,"$%s",nameary[maxfld]);
- else
- sprintf(tokenbuf,"$Fld%d",maxfld);
- str_cat(tmpstr,tokenbuf);
- }
- }
- if (*tmpstr->str_ptr) {
- str_cat(str," ");
- if (!saw_fh && *tmpstr->str_ptr == '(') {
- str_cat(str,"(");
- str_scat(str,tmpstr);
- str_cat(str,")");
- }
- else
- str_scat(str,tmpstr);
- }
- else {
- str_cat(str," $_");
- }
- str_cat(str,rparen); /* may be null */
- str_free(tmpstr);
- break;
- case ORAND:
- str = str_make("rand(1)");
- break;
- case OSRAND:
- str = str_make("srand(");
- goto maybe0;
- case OATAN2:
- str = str_make("atan2(");
- goto maybe0;
- case OSIN:
- str = str_make("sin(");
- goto maybe0;
- case OCOS:
- str = str_make("cos(");
- goto maybe0;
- case OSYSTEM:
- str = str_make("system(");
- goto maybe0;
- case OLENGTH:
- str = str_make("length(");
- goto maybe0;
- case OLOG:
- str = str_make("log(");
- goto maybe0;
- case OEXP:
- str = str_make("exp(");
- goto maybe0;
- case OSQRT:
- str = str_make("sqrt(");
- goto maybe0;
- case OINT:
- str = str_make("int(");
- maybe0:
- numeric = 1;
- if (len > 0)
- tmpstr = walk(1,level,ops[node+1].ival,&numarg,P_MIN);
- else
- tmpstr = str_new(0);
- if (!tmpstr->str_ptr || !*tmpstr->str_ptr) {
- if (lval_field) {
- const char *t = (saw_OFS ? "$," : "' '");
- if (split_to_array) {
- sprintf(tokenbuf,"join(%s,@Fld)",t);
- str_cat(tmpstr,tokenbuf);
- }
- else {
- sprintf(tokenbuf,"join(%s, ",t);
- str_cat(tmpstr,tokenbuf);
- for (i = 1; i < maxfld; i++) {
- if (i <= arymax)
- sprintf(tokenbuf,"$%s,",nameary[i]);
- else
- sprintf(tokenbuf,"$Fld%d,",i);
- str_cat(tmpstr,tokenbuf);
- }
- if (maxfld <= arymax)
- sprintf(tokenbuf,"$%s)",nameary[maxfld]);
- else
- sprintf(tokenbuf,"$Fld%d)",maxfld);
- str_cat(tmpstr,tokenbuf);
- }
- }
- else
- str_cat(tmpstr,"$_");
- }
- if (strEQ(tmpstr->str_ptr,"$_")) {
- if (type == OLENGTH && !do_chop) {
- str = str_make("(length(");
- str_cat(tmpstr,") - 1");
- }
- }
- str_scat(str,tmpstr);
- str_free(tmpstr);
- str_cat(str,")");
- break;
- case OBREAK:
- str = str_new(0);
- str_set(str,"last");
- break;
- case ONEXT:
- str = str_new(0);
- str_set(str,"next line");
- break;
- case OEXIT:
- str = str_new(0);
- if (realexit) {
- prec = P_UNI;
- str_set(str,"exit");
- if (len == 1) {
- str_cat(str," ");
- exitval = TRUE;
- str_scat(str,
- fstr=walk(1,level,ops[node+1].ival,&numarg,prec+1));
- str_free(fstr);
- }
- }
- else {
- if (len == 1) {
- str_set(str,"$ExitValue = ");
- exitval = TRUE;
- str_scat(str,
- fstr=walk(1,level,ops[node+1].ival,&numarg,P_ASSIGN));
- str_free(fstr);
- str_cat(str,"; ");
- }
- str_cat(str,"last line");
- }
- break;
- case OCONTINUE:
- str = str_new(0);
- str_set(str,"next");
- break;
- case OREDIR:
- goto def;
- case OIF:
- str = str_new(0);
- str_set(str,"if (");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,") ");
- str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- if (len == 3) {
- i = ops[node+3].ival;
- if (i) {
- if ((ops[i].ival & 255) == OBLOCK) {
- i = ops[i+1].ival;
- if (i) {
- if ((ops[i].ival & 255) != OIF)
- i = 0;
- }
- }
- else
- i = 0;
- }
- if (i) {
- str_cat(str,"els");
- str_scat(str,fstr=walk(0,level,i,&numarg,P_MIN));
- str_free(fstr);
- }
- else {
- str_cat(str,"else ");
- str_scat(str,fstr=walk(0,level,ops[node+3].ival,&numarg,P_MIN));
- str_free(fstr);
- }
- }
- break;
- case OWHILE:
- str = str_new(0);
- str_set(str,"while (");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,") ");
- str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- break;
- case ODO:
- str = str_new(0);
- str_set(str,"do ");
- str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- if (str->str_ptr[str->str_cur - 1] == '\n')
- --str->str_cur;
- str_cat(str," while (");
- str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,");");
- break;
- case OFOR:
- str = str_new(0);
- str_set(str,"for (");
- str_scat(str,tmpstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
- i = numarg;
- if (i) {
- t = s = tmpstr->str_ptr;
- while (isWORDCHAR(*t) || *t == '$')
- t++;
- i = t - s;
- if (i < 2)
- i = 0;
- }
- str_cat(str,"; ");
- fstr=walk(1,level,ops[node+2].ival,&numarg,P_MIN);
- if (i && (t = strchr(fstr->str_ptr,0377))) {
- if (strnEQ(fstr->str_ptr,s,i))
- *t = ' ';
- }
- str_scat(str,fstr);
- str_free(fstr);
- str_free(tmpstr);
- str_cat(str,"; ");
- str_scat(str,fstr=walk(1,level,ops[node+3].ival,&numarg,P_MIN));
- str_free(fstr);
- str_cat(str,") ");
- str_scat(str,fstr=walk(0,level,ops[node+4].ival,&numarg,P_MIN));
- str_free(fstr);
- break;
- case OFORIN:
- tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- d = strchr(tmpstr->str_ptr,'$');
- if (!d)
- fatal("Illegal for loop: %s",tmpstr->str_ptr);
- s = strchr(d,'{');
- if (!s)
- s = strchr(d,'[');
- if (!s)
- fatal("Illegal for loop: %s",d);
- *s++ = '\0';
- for (t = s; (i = *t); t++) {
- i &= 127;
- if (i == '}' || i == ']')
- break;
- }
- if (*t)
- *t = '\0';
- str = str_new(0);
- str_set(str,d+1);
- str_cat(str,"[]");
- tmp2str = hfetch(symtab,str->str_ptr);
- if (tmp2str && atoi(tmp2str->str_ptr)) {
- sprintf(tokenbuf,
- "foreach %s (0 .. $#%s) ",
- s,
- d+1);
- }
- else {
- sprintf(tokenbuf,
- "foreach %s (keys %%%s) ",
- s,
- d+1);
- }
- str_set(str,tokenbuf);
- str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- str_free(tmpstr);
- break;
- case OBLOCK:
- str = str_new(0);
- str_set(str,"{");
- if (len >= 2 && ops[node+2].ival) {
- str_scat(str,fstr=walk(0,level,ops[node+2].ival,&numarg,P_MIN));
- str_free(fstr);
- }
- fixtab(str,++level);
- str_scat(str,fstr=walk(0,level,ops[node+1].ival,&numarg,P_MIN));
- str_free(fstr);
- addsemi(str);
- fixtab(str,--level);
- str_cat(str,"}\n");
- tab(str,level);
- if (len >= 3) {
- str_scat(str,fstr=walk(0,level,ops[node+3].ival,&numarg,P_MIN));
- str_free(fstr);
- }
- break;
- default:
- def:
- if (len) {
- if (len > 5)
- fatal("Garbage length in walk");
- str = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- for (i = 2; i<= len; i++) {
- str_scat(str,fstr=walk(0,level,ops[node+i].ival,&numarg,P_MIN));
- str_free(fstr);
- }
- }
- else {
- str = NULL;
- }
- break;
- }
- if (!str)
- str = str_new(0);
-
- if (useval && prec < minprec) { /* need parens? */
- fstr = str_new(str->str_cur+2);
- str_nset(fstr,"(",1);
- str_scat(fstr,str);
- str_ncat(fstr,")",1);
- str_free(str);
- str = fstr;
- }
-
- *numericptr = numeric;
-#ifdef DEBUGGING
- if (debug & 4) {
- printf("%3d %5d %15s %d %4d ",level,node,opname[type],len,str->str_cur);
- for (t = str->str_ptr; *t && t - str->str_ptr < 40; t++)
- if (*t == '\n')
- printf("\\n");
- else if (*t == '\t')
- printf("\\t");
- else
- putchar(*t);
- putchar('\n');
- }
-#endif
- return str;
-}
-
-static void
-tab(STR *str, int lvl)
-{
- while (lvl > 1) {
- str_cat(str,"\t");
- lvl -= 2;
- }
- if (lvl)
- str_cat(str," ");
-}
-
-static void
-fixtab(STR *str, int lvl)
-{
- char *s;
-
- /* strip trailing white space */
-
- s = str->str_ptr+str->str_cur - 1;
- while (s >= str->str_ptr && (*s == ' ' || *s == '\t' || *s == '\n'))
- s--;
- s[1] = '\0';
- str->str_cur = s + 1 - str->str_ptr;
- if (s >= str->str_ptr && *s != '\n')
- str_cat(str,"\n");
-
- tab(str,lvl);
-}
-
-static void
-addsemi(STR *str)
-{
- char *s;
-
- s = str->str_ptr+str->str_cur - 1;
- while (s >= str->str_ptr && (*s == ' ' || *s == '\t' || *s == '\n'))
- s--;
- if (s >= str->str_ptr && *s != ';' && *s != '}')
- str_cat(str,";");
-}
-
-static void
-emit_split(STR *str, int level)
-{
- int i;
-
- if (split_to_array)
- str_cat(str,"@Fld");
- else {
- str_cat(str,"(");
- for (i = 1; i < maxfld; i++) {
- if (i <= arymax)
- sprintf(tokenbuf,"$%s,",nameary[i]);
- else
- sprintf(tokenbuf,"$Fld%d,",i);
- str_cat(str,tokenbuf);
- }
- if (maxfld <= arymax)
- sprintf(tokenbuf,"$%s)",nameary[maxfld]);
- else
- sprintf(tokenbuf,"$Fld%d)",maxfld);
- str_cat(str,tokenbuf);
- }
- if (const_FS) {
- sprintf(tokenbuf," = split(/[%c\\n]/, $_, -1);\n",const_FS);
- str_cat(str,tokenbuf);
- }
- else if (saw_FS)
- str_cat(str," = split($FS, $_, -1);\n");
- else
- str_cat(str," = split(' ', $_, -1);\n");
- tab(str,level);
-}
-
-int
-prewalk(int numit, int level, int node, int *numericptr)
-{
- int len;
- int type;
- int i;
- int numarg;
- int numeric = FALSE;
- STR *tmpstr;
- STR *tmp2str;
-
- if (!node) {
- *numericptr = 0;
- return 0;
- }
- type = ops[node].ival;
- len = type >> 8;
- type &= 255;
- switch (type) {
- case OPROG:
- prewalk(0,level,ops[node+1].ival,&numarg);
- if (ops[node+2].ival) {
- prewalk(0,level,ops[node+2].ival,&numarg);
- }
- ++level;
- prewalk(0,level,ops[node+3].ival,&numarg);
- --level;
- if (ops[node+3].ival) {
- prewalk(0,level,ops[node+4].ival,&numarg);
- }
- break;
- case OHUNKS:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- if (len == 3) {
- prewalk(0,level,ops[node+3].ival,&numarg);
- }
- break;
- case ORANGE:
- prewalk(1,level,ops[node+1].ival,&numarg);
- prewalk(1,level,ops[node+2].ival,&numarg);
- break;
- case OPAT:
- goto def;
- case OREGEX:
- prewalk(0,level,ops[node+1].ival,&numarg);
- break;
- case OHUNK:
- if (len == 1) {
- prewalk(0,level,ops[node+1].ival,&numarg);
- }
- else {
- i = prewalk(0,level,ops[node+1].ival,&numarg);
- if (i) {
- ++level;
- prewalk(0,level,ops[node+2].ival,&numarg);
- --level;
- }
- else {
- prewalk(0,level,ops[node+2].ival,&numarg);
- }
- }
- break;
- case OPPAREN:
- prewalk(0,level,ops[node+1].ival,&numarg);
- break;
- case OPANDAND:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- break;
- case OPOROR:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- break;
- case OPNOT:
- prewalk(0,level,ops[node+1].ival,&numarg);
- break;
- case OCPAREN:
- prewalk(0,level,ops[node+1].ival,&numarg);
- numeric |= numarg;
- break;
- case OCANDAND:
- prewalk(0,level,ops[node+1].ival,&numarg);
- numeric = 1;
- prewalk(0,level,ops[node+2].ival,&numarg);
- break;
- case OCOROR:
- prewalk(0,level,ops[node+1].ival,&numarg);
- numeric = 1;
- prewalk(0,level,ops[node+2].ival,&numarg);
- break;
- case OCNOT:
- prewalk(0,level,ops[node+1].ival,&numarg);
- numeric = 1;
- break;
- case ORELOP:
- prewalk(0,level,ops[node+2].ival,&numarg);
- numeric |= numarg;
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+3].ival,&numarg);
- numeric |= numarg;
- numeric = 1;
- break;
- case ORPAREN:
- prewalk(0,level,ops[node+1].ival,&numarg);
- numeric |= numarg;
- break;
- case OMATCHOP:
- prewalk(0,level,ops[node+2].ival,&numarg);
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+3].ival,&numarg);
- numeric = 1;
- break;
- case OMPAREN:
- prewalk(0,level,ops[node+1].ival,&numarg);
- numeric |= numarg;
- break;
- case OCONCAT:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- break;
- case OASSIGN:
- prewalk(0,level,ops[node+2].ival,&numarg);
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+3].ival,&numarg);
- if (numarg || strlen(ops[ops[node+1].ival+1].cval) > (Size_t)1) {
- numericize(ops[node+2].ival);
- if (!numarg)
- numericize(ops[node+3].ival);
- }
- numeric |= numarg;
- break;
- case OADD:
- prewalk(1,level,ops[node+1].ival,&numarg);
- prewalk(1,level,ops[node+2].ival,&numarg);
- numeric = 1;
- break;
- case OSUBTRACT:
- prewalk(1,level,ops[node+1].ival,&numarg);
- prewalk(1,level,ops[node+2].ival,&numarg);
- numeric = 1;
- break;
- case OMULT:
- prewalk(1,level,ops[node+1].ival,&numarg);
- prewalk(1,level,ops[node+2].ival,&numarg);
- numeric = 1;
- break;
- case ODIV:
- prewalk(1,level,ops[node+1].ival,&numarg);
- prewalk(1,level,ops[node+2].ival,&numarg);
- numeric = 1;
- break;
- case OPOW:
- prewalk(1,level,ops[node+1].ival,&numarg);
- prewalk(1,level,ops[node+2].ival,&numarg);
- numeric = 1;
- break;
- case OMOD:
- prewalk(1,level,ops[node+1].ival,&numarg);
- prewalk(1,level,ops[node+2].ival,&numarg);
- numeric = 1;
- break;
- case OPOSTINCR:
- prewalk(1,level,ops[node+1].ival,&numarg);
- numeric = 1;
- break;
- case OPOSTDECR:
- prewalk(1,level,ops[node+1].ival,&numarg);
- numeric = 1;
- break;
- case OPREINCR:
- prewalk(1,level,ops[node+1].ival,&numarg);
- numeric = 1;
- break;
- case OPREDECR:
- prewalk(1,level,ops[node+1].ival,&numarg);
- numeric = 1;
- break;
- case OUMINUS:
- prewalk(1,level,ops[node+1].ival,&numarg);
- numeric = 1;
- break;
- case OUPLUS:
- prewalk(1,level,ops[node+1].ival,&numarg);
- numeric = 1;
- break;
- case OPAREN:
- prewalk(0,level,ops[node+1].ival,&numarg);
- numeric |= numarg;
- break;
- case OGETLINE:
- break;
- case OSPRINTF:
- prewalk(0,level,ops[node+1].ival,&numarg);
- break;
- case OSUBSTR:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(1,level,ops[node+2].ival,&numarg);
- if (len == 3) {
- prewalk(1,level,ops[node+3].ival,&numarg);
- }
- break;
- case OSTRING:
- break;
- case OSPLIT:
- numeric = 1;
- prewalk(0,level,ops[node+2].ival,&numarg);
- if (len == 3)
- prewalk(0,level,ops[node+3].ival,&numarg);
- prewalk(0,level,ops[node+1].ival,&numarg);
- break;
- case OINDEX:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- numeric = 1;
- break;
- case OMATCH:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- numeric = 1;
- break;
- case OUSERDEF:
- subretnum = FALSE;
- --level;
- tmpstr = walk(0,level,ops[node+1].ival,&numarg,P_MIN);
- ++level;
- prewalk(0,level,ops[node+2].ival,&numarg);
- prewalk(0,level,ops[node+4].ival,&numarg);
- prewalk(0,level,ops[node+5].ival,&numarg);
- --level;
- str_cat(tmpstr,"(");
- tmp2str = str_new(0);
- if (subretnum || numarg)
- str_set(tmp2str,"1");
- hstore(symtab,tmpstr->str_ptr,tmp2str);
- str_free(tmpstr);
- level++;
- break;
- case ORETURN:
- if (len > 0) {
- prewalk(0,level,ops[node+1].ival,&numarg);
- if (numarg)
- subretnum = TRUE;
- }
- break;
- case OUSERFUN:
- tmp2str = str_new(0);
- str_scat(tmp2str,tmpstr=walk(1,level,ops[node+1].ival,&numarg,P_MIN));
- fixrargs(tmpstr->str_ptr,ops[node+2].ival,0);
- str_free(tmpstr);
- str_cat(tmp2str,"(");
- tmpstr = hfetch(symtab,tmp2str->str_ptr);
- if (tmpstr && tmpstr->str_ptr)
- numeric |= atoi(tmpstr->str_ptr);
- prewalk(0,level,ops[node+2].ival,&numarg);
- str_free(tmp2str);
- break;
- case OGSUB:
- case OSUB:
- if (len >= 3)
- prewalk(0,level,ops[node+3].ival,&numarg);
- prewalk(0,level,ops[ops[node+2].ival+1].ival,&numarg);
- prewalk(0,level,ops[node+1].ival,&numarg);
- numeric = 1;
- break;
- case ONUM:
- prewalk(0,level,ops[node+1].ival,&numarg);
- numeric = 1;
- break;
- case OSTR:
- prewalk(0,level,ops[node+1].ival,&numarg);
- break;
- case ODEFINED:
- case ODELETE:
- case OSTAR:
- case OVAR:
- prewalk(0,level,ops[node+1].ival,&numarg);
- if (len == 1) {
- if (numit)
- numericize(node);
- }
- else {
- prewalk(0,level,ops[node+2].ival,&numarg);
- }
- break;
- case OFLD:
- prewalk(0,level,ops[node+1].ival,&numarg);
- break;
- case OVFLD:
- i = ops[node+1].ival;
- prewalk(0,level,i,&numarg);
- break;
- case OJUNK:
- goto def;
- case OSNEWLINE:
- break;
- case ONEWLINE:
- break;
- case OSCOMMENT:
- break;
- case OCOMMENT:
- break;
- case OCOMMA:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- prewalk(0,level,ops[node+3].ival,&numarg);
- break;
- case OSEMICOLON:
- break;
- case OSTATES:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- break;
- case OSTATE:
- if (len >= 1) {
- prewalk(0,level,ops[node+1].ival,&numarg);
- if (len >= 2) {
- prewalk(0,level,ops[node+2].ival,&numarg);
- }
- }
- break;
- case OCLOSE:
- prewalk(0,level,ops[node+1].ival,&numarg);
- break;
- case OPRINTF:
- case OPRINT:
- if (len == 3) { /* output redirection */
- prewalk(0,level,ops[node+3].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- }
- prewalk(0+(type==OPRINT),level,ops[node+1].ival,&numarg);
- break;
- case ORAND:
- break;
- case OSRAND:
- goto maybe0;
- case OATAN2:
- goto maybe0;
- case OSIN:
- goto maybe0;
- case OCOS:
- goto maybe0;
- case OSYSTEM:
- goto maybe0;
- case OLENGTH:
- goto maybe0;
- case OLOG:
- goto maybe0;
- case OEXP:
- goto maybe0;
- case OSQRT:
- goto maybe0;
- case OINT:
- maybe0:
- numeric = 1;
- if (len > 0)
- prewalk(type != OLENGTH && type != OSYSTEM,
- level,ops[node+1].ival,&numarg);
- break;
- case OBREAK:
- break;
- case ONEXT:
- break;
- case OEXIT:
- if (len == 1) {
- prewalk(1,level,ops[node+1].ival,&numarg);
- }
- break;
- case OCONTINUE:
- break;
- case OREDIR:
- goto def;
- case OIF:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- if (len == 3) {
- prewalk(0,level,ops[node+3].ival,&numarg);
- }
- break;
- case OWHILE:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- break;
- case OFOR:
- prewalk(0,level,ops[node+1].ival,&numarg);
- prewalk(0,level,ops[node+2].ival,&numarg);
- prewalk(0,level,ops[node+3].ival,&numarg);
- prewalk(0,level,ops[node+4].ival,&numarg);
- break;
- case OFORIN:
- prewalk(0,level,ops[node+2].ival,&numarg);
- prewalk(0,level,ops[node+1].ival,&numarg);
- break;
- case OBLOCK:
- if (len == 2) {
- prewalk(0,level,ops[node+2].ival,&numarg);
- }
- ++level;
- prewalk(0,level,ops[node+1].ival,&numarg);
- --level;
- break;
- default:
- def:
- if (len) {
- if (len > 5)
- fatal("Garbage length in prewalk");
- prewalk(0,level,ops[node+1].ival,&numarg);
- for (i = 2; i<= len; i++) {
- prewalk(0,level,ops[node+i].ival,&numarg);
- }
- }
- break;
- }
- *numericptr = numeric;
- return 1;
-}
-
-static void
-numericize(int node)
-{
- int len;
- int type;
- STR *tmpstr;
- STR *tmp2str;
- int numarg;
-
- type = ops[node].ival;
- len = type >> 8;
- type &= 255;
- if (type == OVAR && len == 1) {
- tmpstr=walk(0,0,ops[node+1].ival,&numarg,P_MIN);
- tmp2str = str_make("1");
- hstore(symtab,tmpstr->str_ptr,tmp2str);
- }
-}