summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-12-21 23:32:42 +0000
committerKarl Berry <karl@freefriends.org>2015-12-21 23:32:42 +0000
commitc5e89419297f1c23c42a0c11bab9fb3c12b97f91 (patch)
treefe216e80909f3182b6341572c282812791dc7e7b
parent3b683dc6d3ccfc16f1bdeb50e6d086143f119f72 (diff)
pn2pdf script for petri-nets (Enrico Gregorio mail, 21 Dec 2015 12:35:28)
git-svn-id: svn://tug.org/texlive/trunk@39165 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/texlive/linked_scripts/Makefile.am1
-rw-r--r--Build/source/texk/texlive/linked_scripts/Makefile.in1
-rwxr-xr-x[-rw-r--r--]Build/source/texk/texlive/linked_scripts/petri-nets/pn2pdf (renamed from Master/texmf-dist/doc/generic/petri-nets/pn2pdf)0
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/texlive/tlmgr.pl13
l---------Master/bin/alpha-linux/pn2pdf1
l---------Master/bin/amd64-freebsd/pn2pdf1
l---------Master/bin/amd64-netbsd/pn2pdf1
l---------Master/bin/armel-linux/pn2pdf1
l---------Master/bin/armhf-linux/pn2pdf1
l---------Master/bin/i386-cygwin/pn2pdf1
l---------Master/bin/i386-freebsd/pn2pdf1
l---------Master/bin/i386-linux/pn2pdf1
l---------Master/bin/i386-netbsd/pn2pdf1
l---------Master/bin/i386-solaris/pn2pdf1
l---------Master/bin/mipsel-linux/pn2pdf1
l---------Master/bin/powerpc-linux/pn2pdf1
l---------Master/bin/sparc-solaris/pn2pdf1
l---------Master/bin/universal-darwin/pn2pdf1
-rwxr-xr-xMaster/bin/win32/pn2pdf.exebin0 -> 1536 bytes
l---------Master/bin/x86_64-cygwin/pn2pdf1
l---------Master/bin/x86_64-darwin/pn2pdf1
l---------Master/bin/x86_64-linux/pn2pdf1
l---------Master/bin/x86_64-solaris/pn2pdf1
-rwxr-xr-xMaster/texmf-dist/scripts/petri-nets/pn2pdf211
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds1
-rw-r--r--Master/tlpkg/tlpsrc/petri-nets.tlpsrc1
26 files changed, 240 insertions, 6 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am
index 64c2b251c8d..d27610a7fd4 100644
--- a/Build/source/texk/texlive/linked_scripts/Makefile.am
+++ b/Build/source/texk/texlive/linked_scripts/Makefile.am
@@ -151,6 +151,7 @@ texmf_other_scripts = \
pdfcrop/pdfcrop.pl \
pedigree-perl/pedigree.pl \
perltex/perltex.pl \
+ petri-nets/pn2pdf \
pfarrei/a5toa4.tlu \
pfarrei/pfarrei.tlu \
pkfix-helper/pkfix-helper \
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in
index 59dcb3c1aa8..4191059aab6 100644
--- a/Build/source/texk/texlive/linked_scripts/Makefile.in
+++ b/Build/source/texk/texlive/linked_scripts/Makefile.in
@@ -367,6 +367,7 @@ texmf_other_scripts = \
pdfcrop/pdfcrop.pl \
pedigree-perl/pedigree.pl \
perltex/perltex.pl \
+ petri-nets/pn2pdf \
pfarrei/a5toa4.tlu \
pfarrei/pfarrei.tlu \
pkfix-helper/pkfix-helper \
diff --git a/Master/texmf-dist/doc/generic/petri-nets/pn2pdf b/Build/source/texk/texlive/linked_scripts/petri-nets/pn2pdf
index c42f9c38f30..c42f9c38f30 100644..100755
--- a/Master/texmf-dist/doc/generic/petri-nets/pn2pdf
+++ b/Build/source/texk/texlive/linked_scripts/petri-nets/pn2pdf
diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
index 173e69dedb3..7f3a9dc3e33 100755
--- a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
+++ b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
@@ -1,13 +1,13 @@
#!/usr/bin/env perl
-# $Id: tlmgr.pl 38967 2015-11-28 02:15:58Z preining $
+# $Id: tlmgr.pl 39104 2015-12-14 15:56:11Z karl $
#
# Copyright 2008-2015 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
#
-my $svnrev = '$Revision: 38967 $';
-my $datrev = '$Date: 2015-11-28 03:15:58 +0100 (Sat, 28 Nov 2015) $';
+my $svnrev = '$Revision: 39104 $';
+my $datrev = '$Date: 2015-12-14 16:56:11 +0100 (Mon, 14 Dec 2015) $';
my $tlmgrrevision;
my $prg;
if ($svnrev =~ m/: ([0-9]+) /) {
@@ -411,6 +411,7 @@ sub main {
if (defined($action) && $action eq "help") {
$opts{"help"} = 1;
+ $action = undef; # an option not an action
}
if (defined($action) && $action eq "print-platform") {
@@ -418,19 +419,19 @@ sub main {
exit 0;
}
- #
# ACTION massaging
# for backward compatibility and usability
# unify arguments so that the $action contains paper in all cases
# and push the first arg back to @ARGV for action_paper processing
- if ($action =~ /^(paper|xdvi|psutils|pdftex|dvips|dvipdfmx?|context)$/) {
+ if (defined $action
+ && $action =~ /^(paper|xdvi|psutils|pdftex|dvips|dvipdfmx?|context)$/) {
unshift(@ARGV, $action);
$action = "paper";
}
# backward compatibility with action "show" and "list" from before
- if ($action =~ /^(show|list)$/) {
+ if (defined $action && $action =~ /^(show|list)$/) {
$action = "info";
}
diff --git a/Master/bin/alpha-linux/pn2pdf b/Master/bin/alpha-linux/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/alpha-linux/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/amd64-freebsd/pn2pdf b/Master/bin/amd64-freebsd/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/amd64-freebsd/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/amd64-netbsd/pn2pdf b/Master/bin/amd64-netbsd/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/amd64-netbsd/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/armel-linux/pn2pdf b/Master/bin/armel-linux/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/armel-linux/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/armhf-linux/pn2pdf b/Master/bin/armhf-linux/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/armhf-linux/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/i386-cygwin/pn2pdf b/Master/bin/i386-cygwin/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/i386-cygwin/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/i386-freebsd/pn2pdf b/Master/bin/i386-freebsd/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/i386-freebsd/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/i386-linux/pn2pdf b/Master/bin/i386-linux/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/i386-linux/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/i386-netbsd/pn2pdf b/Master/bin/i386-netbsd/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/i386-netbsd/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/i386-solaris/pn2pdf b/Master/bin/i386-solaris/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/i386-solaris/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/mipsel-linux/pn2pdf b/Master/bin/mipsel-linux/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/mipsel-linux/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/powerpc-linux/pn2pdf b/Master/bin/powerpc-linux/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/powerpc-linux/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/sparc-solaris/pn2pdf b/Master/bin/sparc-solaris/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/sparc-solaris/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/universal-darwin/pn2pdf b/Master/bin/universal-darwin/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/universal-darwin/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/win32/pn2pdf.exe b/Master/bin/win32/pn2pdf.exe
new file mode 100755
index 00000000000..5777d90a17a
--- /dev/null
+++ b/Master/bin/win32/pn2pdf.exe
Binary files differ
diff --git a/Master/bin/x86_64-cygwin/pn2pdf b/Master/bin/x86_64-cygwin/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/x86_64-cygwin/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/x86_64-darwin/pn2pdf b/Master/bin/x86_64-darwin/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/x86_64-darwin/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/x86_64-linux/pn2pdf b/Master/bin/x86_64-linux/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/x86_64-linux/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/bin/x86_64-solaris/pn2pdf b/Master/bin/x86_64-solaris/pn2pdf
new file mode 120000
index 00000000000..e2c71e1f402
--- /dev/null
+++ b/Master/bin/x86_64-solaris/pn2pdf
@@ -0,0 +1 @@
+../../texmf-dist/scripts/petri-nets/pn2pdf \ No newline at end of file
diff --git a/Master/texmf-dist/scripts/petri-nets/pn2pdf b/Master/texmf-dist/scripts/petri-nets/pn2pdf
new file mode 100755
index 00000000000..c42f9c38f30
--- /dev/null
+++ b/Master/texmf-dist/scripts/petri-nets/pn2pdf
@@ -0,0 +1,211 @@
+#!/usr/bin/perl
+
+## This file is part of the Petri-nets packages. See file README for
+## copyright notice.
+
+use strict;
+use Digest::MD5 qw(md5_hex);
+use Getopt::Long;
+
+##
+## read options
+##
+
+Getopt::Long::Configure ("bundling");
+
+my $keep = 0;
+my $force = 0;
+my $verbose = 0;
+
+GetOptions ("k|keep" => \$keep,
+ "f|force" => \$force,
+ "v|verbose" => \$verbose,
+ "t|test" => \&Test,
+ "d|delete" => \&Delete,
+ "b|batch" => \&Batch,
+ "h|help" => \&Help);
+
+&Help if scalar @ARGV > 1;
+
+##
+## Global variables
+##
+
+my $figure = shift @ARGV;
+my $basename = $figure; $basename =~ s/\.pn$//;
+my $jobname = $basename; $jobname =~ s/-fig\d+$//;
+my $data = "";
+my %sum;
+
+##
+## Load checksums
+##
+
+if (-f "$jobname.sum") {
+ open SUM, "$jobname.sum"
+ or &Error ("could not open $jobname.sum -- $!");
+ while (<SUM>) {
+ next unless /^(.+)\s+(.+)$/;
+ $sum{$1} = $2;
+ }
+ close SUM;
+}
+
+##
+## Get preamble
+##
+
+if (-f "$jobname.pre") {
+ # read the existing preamble
+ my @lines;
+ open PRE, "$jobname.pre"
+ or &Error ("could not open $jobname.sum -- $!");
+ @lines = <PRE>;
+ close PRE;
+ $data .= join "", @lines;
+} else {
+ # create a new preamble
+ open TEX, "$jobname.tex"
+ or &Error ("could not open $jobname.tex -- $!");
+ while (<TEX>) {
+ $data .= $_;
+ last if /\\begin\{document\}/;
+ }
+ close TEX;
+ $data =~ s/(\\begin\{document\}).*$/$1\n/;
+ $data .= "\\pagestyle\{empty\}\n";
+ # save it
+ open PRE, ">$jobname.pre"
+ or &Error ("could not create $jobname.sum -- $!");
+ print PRE $data;
+ close PRE;
+}
+
+##
+## Read the figure
+##
+
+{
+ my $pre = 1;
+ open TEX, $figure or &Error ("could not open $figure -- $!");
+ open PRE, ">>$jobname.pre"
+ or &Error ("could not append $jobname.pre -- $!");
+ while (<TEX>) {
+ $pre = 0 if /^\\begin\{petrinet\}/;
+ print PRE if $pre;
+ $data .= $_;
+ }
+ close TEX;
+ close PRE;
+}
+
+##
+## Generate the EPDF
+##
+
+if (&SumChanged ($figure, "$data") or $force or (! -f "$basename.pdf")) {
+ open TEX, ">$basename.tex"
+ or &Error ("could not create file $basename.tex -- $!\n");
+ print TEX "$data\\end\{document\}\n";
+ close TEX;
+ system "latex", "$basename.tex";
+ system "dvips", "-E", "-Ppdf", "-o", "$basename.eps", "$basename";
+ system "epstopdf", "$basename.eps";
+}
+
+unlink ("$basename.tex", "$basename.log", "$basename.aux",
+ "$basename.dvi", "$basename.eps", "$basename.pn") unless $keep;
+
+##
+## Save checksums
+##
+
+open SUM, ">$jobname.sum"
+ or die "pn2pdf: could not create file $jobname.sum -- $!\n";
+foreach my $file (sort keys %sum) {
+ print SUM "$file $sum{$file}\n";
+}
+close SUM;
+
+exit 0;
+
+##
+## Sub programs
+##
+
+sub Help {
+ print <<"EOF";
+Usage: pn2pdf [OPTIONS]
+Create EPDF files for Petri net figures.
+
+ FIGURE process FIGURE
+ -b, --batch FILE process the commands in FILE
+ -k, --keep keep temporary files
+ -f, --force force the rendering of all pictures
+ -t, --test FILES create FILES for test purpose
+ -d, --delete FILES delete FILES (may be patterns)
+ -h, --help display this help and exit
+
+Report bugs to <pommereau\@univ-paris12.fr>
+EOF
+ exit 0; }
+
+sub Error {
+ foreach my $line (@_) {
+ warn "pn2pdf: $line\n";
+ }
+ exit 1;
+}
+
+sub Verbose {
+ return unless $verbose;
+ foreach my $line (@_) {
+ warn "[pn2pdf] $line\n";
+ }
+}
+
+sub SumChanged {
+ my ($file, $lines) = @_;
+ my $md5 = md5_hex ($lines);
+ if ($md5 eq $sum{$file}) {
+ return 0;
+ } else {
+ $sum{$file} = $md5;
+ return 1;
+ }
+}
+
+sub Test {
+ foreach my $file (@ARGV) {
+ open FILE, ">$file" or &Error ("could not create $file -- $!");
+ close FILE;
+ }
+ exit 0;
+}
+
+sub Delete {
+ foreach my $pattern (@ARGV) {
+ unlink glob $pattern unless $keep;
+ }
+ exit 0;
+}
+
+sub Batch {
+ my @lines;
+ foreach my $file (@ARGV) {
+ $file =~ s/(\.[a-z]{3})?$/.bpn/i;
+ open FILE, $file or &Error ("could not open $file -- $!");
+ while (<FILE>) {
+ next unless /^pn2pdf\s/;
+ s/^pn2pdf\s/pn2pdf --keep / if $keep;
+ s/^pn2pdf\s/pn2pdf --force / if $force;
+ s/^pn2pdf\s/pn2pdf --verbose / if $verbose;
+ push @lines, $_;
+ }
+ close FILE;
+ }
+ foreach (@lines) {
+ system $_;
+ }
+ exit 0;
+}
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 63603822a46..109041e1d31 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -2686,6 +2686,7 @@ $standardttf = '\.ttf|\.TTC';
'pkfix-helper' => 'pkfix-helper$',
'pmx' => '\.lua$',
'pmxchords' => 'pmxchords\.lua$',
+ 'petri-nets' => 'pn2pdf',
'pst2pdf' => 'pst2pdf\.pl$',
'ptex2pdf' => 'ptex2pdf\.lua$',
'purifyeps' => 'purifyeps$',
diff --git a/Master/tlpkg/tlpsrc/petri-nets.tlpsrc b/Master/tlpkg/tlpsrc/petri-nets.tlpsrc
index e69de29bb2d..eda013862f4 100644
--- a/Master/tlpkg/tlpsrc/petri-nets.tlpsrc
+++ b/Master/tlpkg/tlpsrc/petri-nets.tlpsrc
@@ -0,0 +1 @@
+binpattern f bin/${ARCH}/pn2pdf