summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts')
-rw-r--r--Master/texmf-dist/scripts/context/perl/fdf2tan.pl121
-rw-r--r--Master/texmf-dist/scripts/context/perl/fdf2tex.pl213
2 files changed, 0 insertions, 334 deletions
diff --git a/Master/texmf-dist/scripts/context/perl/fdf2tan.pl b/Master/texmf-dist/scripts/context/perl/fdf2tan.pl
deleted file mode 100644
index c612f9886e1..00000000000
--- a/Master/texmf-dist/scripts/context/perl/fdf2tan.pl
+++ /dev/null
@@ -1,121 +0,0 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
- if 0;
-
-#D \module
-#D [ file=fdf2tan.pl,
-#D version=2000.02.06,
-#D title=converting \FDF\ annotations,
-#D subtitle=fdf2tan,
-#D author=Hans Hagen,
-#D date=\currentdate,
-#D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-#C
-#C This module is part of the \CONTEXT\ macro||package and is
-#C therefore copyrighted by \PRAGMA. See licen-en.pdf for
-#C details.
-
-#D This is a preliminary version, that will probably be changed
-#D and merged into a more general module.
-
-use Text::Wrap ;
-
-my $filename = $ARGV[0] ; exit if ($filename eq '') ;
-
-$filename =~ s/\..*$//o ;
-
-my $D = "[0-9\-\.]" ;
-my $nn = 0 ;
-
-my %stack ;
-
-sub saveobject
- { $n = shift ; $str = shift ;
- if ($n>$max) { $max = $n }
- if ($str =~ s/\/Type\s+\/Annot\s+\/Subtype\s+\/Text//o)
- { ++$nn ;
- $str =~ s/\/Page\s+(\d+)//o ;
- $page = $1 ; ++$page ;
- $str =~ s/\/Rect\s+\[\s*(.*?)\s*\]//o ;
- $rec = $1 ;
- if ($rec =~ /($D+)\s*($D+)\s*($D+)\s*($D+)/o)
- { $FDFllx = $1 ; $FDFlly = $2 ; $FDFurx = $3 ; $FDFury = $4 }
- $X = $FDFllx - $PDFllx ;
- $Y = $PDFury - $FDFury ;
- $str =~ s/\/M\s.*$//o ;
- $str =~ s/\/T\s.*$//o ;
- $str =~ s/^.*\/Contents\s.*?\(//o ;
- $str =~ s/\)\s+$//o ;
- $str =~ s/\\\\r/@@@@@@/o ;
- $str =~ s/\\r/\n/go;
- $str =~ s/@@@@@@/\\r/o ;
- $str =~ s/\\([\<\>\(\)\{\}\\])/$1/go ;
- $stack{sprintf("test:%3d %3d %3d\n",$page,$Y,$X)} =
- "\\startFDFcomment[$page]" .
- sprintf("[%.3f,%.3f]",$X,$Y) .
- "\n$str\n\\stopFDFcomment\n\n" } }
-
-exit unless (open (PDF,"<$filename.pdf")) ; binmode PDF ;
-exit unless (open (FDF,"<$filename.fdf")) ;
-exit unless (open (TAN,">$filename.tan")) ;
-
-print "processing $filename ... " ;
-
-$PDFllx = 0 ; $PDFlly = 0 ; $PDFurx = 597 ; $PDFury = 847 ;
-
-while (<PDF>)
- { if (/\/MediaBox\s*\[\s*($D+)\s*($D+)\s*($D+)\s*($D+)/o)
- { $PDFllx = $1 ; $PDFlly = $2 ; $PDFurx = $3 ; $PDFury = $4 ;
- last } }
-
-$_ = "" ; while ($Line=<FDF>) { chomp $Line; $_ .= $Line }
-
-s/\\n/ /go ;
-s/\\\s//go ;
-
-s/\\225/\\\/L/go ; s/\\226/\\OE/go ; s/\\227/\\vS/go ;
-s/\\230/\\"Y/go ; s/\\231/\\vZ/go ; s/\\233/\\\/l/go ;
-s/\\234/\\oe/go ; s/\\235/\\vs/go ; s/\\236/\\vz/go ;
-s/\\253/\\<</go ; s/\\273/\\>>/go ; s/\\300/\\`A/go ;
-s/\\301/\\'A/go ; s/\\302/\\^A/go ; s/\\303/\\~A/go ;
-s/\\304/\\"A/go ; s/\\305/\\oA/go ; s/\\306/\\AE/go ;
-s/\\307/\\,C/go ; s/\\310/\\`E/go ; s/\\311/\\'E/go ;
-s/\\312/\\^E/go ; s/\\313/\\"E/go ; s/\\314/\\`I/go ;
-s/\\315/\\'I/go ; s/\\316/\\^I/go ; s/\\317/\\"I/go ;
-s/\\321/\\~N/go ; s/\\322/\\`O/go ; s/\\323/\\'O/go ;
-s/\\324/\\^O/go ; s/\\325/\\~O/go ; s/\\326/\\"O/go ;
-s/\\330/\\\/O/go ; s/\\331/\\`U/go ; s/\\332/\\'U/go ;
-s/\\333/\\^U/go ; s/\\334/\\"U/go ; s/\\335/\\'Y/go ;
-s/\\337/\\SS/go ; s/\\340/\\`a/go ; s/\\341/\\'a/go ;
-s/\\342/\\^a/go ; s/\\343/\\~a/go ; s/\\344/\\"a/go ;
-s/\\345/\\oa/go ; s/\\346/\\ae/go ; s/\\347/\\,c/go ;
-s/\\350/\\`e/go ; s/\\351/\\'e/go ; s/\\352/\\^e/go ;
-s/\\353/\\"e/go ; s/\\354/\\`i/go ; s/\\355/\\'i/go ;
-s/\\356/\\^i/go ; s/\\357/\\"i/go ; s/\\361/\\~n/go ;
-s/\\362/\\`o/go ; s/\\363/\\'o/go ; s/\\364/\\^o/go ;
-s/\\365/\\~o/go ; s/\\366/\\"o/go ; s/\\370/\\\/o/go ;
-s/\\371/\\`u/go ; s/\\372/\\'u/go ; s/\\373/\\^u/go ;
-s/\\374/\\"u/go ; s/\\375/\\'y/go ; s/\\377/\\"y/go ;
-
-s/\\(\d\d\d)/[$1]/go ;
-
-while (s/(\d+)(\s+\d+\s+obj)(.*?)endobj/saveobject($1,$3)/goe) { }
-
-$wrap::columns = 80 ;
-
-foreach $key (sort keys %stack)
- { print TAN wrap("","",$stack{$key}) }
-
-close (PDF) ; close (FDF) ; close (TAN) ;
-
-if (open (TAN,">fdf-tan.tex"))
- { print TAN "% interface=en output=pdftex\n\n" .
- "\\setupcolors[state=start]\n\n" .
- "\\setupinteraction[state=start]\n\n" .
- "\\setupbodyfont[pos,10pt]\n\n" .
- "\\starttext\n\n" .
- "\\usemodule[fdfann]\n\n" .
- "\\annotatepages[$filename]\n\n" .
- "\\stoptext\n" ;
- close (TAN) }
-
-print "$nn annotations found, run 'texexec fdf-tan'\n" ;
diff --git a/Master/texmf-dist/scripts/context/perl/fdf2tex.pl b/Master/texmf-dist/scripts/context/perl/fdf2tex.pl
deleted file mode 100644
index f9684cd9f21..00000000000
--- a/Master/texmf-dist/scripts/context/perl/fdf2tex.pl
+++ /dev/null
@@ -1,213 +0,0 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
- if 0;
-
-# not yet public
-
-# We're dealing with:
-
-$InpFile = $ARGV[0] ; $OutFile = $ARGV[1] ; $Field = $ARGV[2] ;
-
-# beware: fields are funny sorted
-
-$Program = "fdf2tex 1.02 - ConTeXt / PRAGMA 1997-2000" ;
-
-if ($Field eq "")
- { print "\n$Program\n\n" }
-
-# filter \type{filename.fdf} into \type{filename.fdt}
-
-unless ($OutFile)
- { $OutFile = $InpFile ;
- $OutFile =~ s/\..*// }
-
-unless ($InpFile=~/\./)
- { if (-e "$InpFile.fdf")
- { $InpFile .= ".fdf" }
- elsif (-e "$InpFile.xml")
- { $InpFile .= ".xml" } }
-
-unless ($OutFile=~/\./)
- { $OutFile .= ".fdt" }
-
-if (open (FDF, "<$InpFile"))
- { binmode FDF ;
- open (FDT, ">$OutFile") ;
- if ($Field eq "")
- { print " input file : $InpFile\n" ;
- print " output file : $OutFile\n" } }
-else
- { if ($Field eq "")
- { print " error : $InpFile not found\n" }
- exit }
-
-# load the whole file in the buffer
-
-$_ = "" ; while ($Line=<FDF>) { chomp $Line; $_ .= $Line }
-
-# or faster: dan ///s gebruiken (ipv m)
-
-# $/ = "\0777" ; $_ = <FDF> ;
-
-# zoom in on the objects and remove the header and trialer
-
-if ($InpFile =~ /\.xml$/)
-
-{ # begin kind of xml alternative
-
-s/\>\s*\</\>\</goms ;
-$N = s/\<field\s+(.*?)\/\>/\\FDFfield\[$1\]\n/goms ;
-s/(name|value)\=\"(.*?)\"/$1=\{$2\}/goms ;
-s/\} (name|value)/\}\,$1/goms ;
-s/\<fdfobject\>(.*?)\<\/fdfobject\>/\\beginFDFobject\n$1\\endFDFobject\n/goms ;
-s/\<fdfdata\>(.*?)\<\/fdfdata\>/\\beginFDFdata\n$1\\endFDFdata\n/goms ;
-s/\<fdffields\>(.*?)\<\/fdffields\>/\\beginFDFfields\n$1\\endFDFfields\n/goms ;
-
-} # end kind of xml alternative
-
-else
-
-{ # begin fdf alternative
-
-s/.*?obj\s*?<<(.*?)>>\s*?endobj/\n\\beginFDFobject$1\n\\endFDFobject/go;
-s/trailer.*//;
-
-# zoom in on the FDF data
-
-s/\/FDF.*?<<(.*)>>/\n\\beginFDFdata$1\n\\endFDFdata/go;
-
-# zoom in on the Field collection and remove whatever else
-
-s/\/Fields.*?\[.*?<<.*?(.*).*?>>.*?\]/\n\\beginFDFfields<<$1>>\n\\endFDFfields/go;
-s/\\endFDFfields.*\n\\endFDFdata/\\endFDFfields\n\\endFDFdata/go;
-
-# tag each field
-
-$N = s/\<<(.*?)>>/\n\\FDFfield[$1]/go;
-
-# remove non relevant entries, but keep \type{/T} and \type{/V}
-
-s/\s*?\/[Kids|Opt]\s*?<<.*?>>//go;
-s/\s*?\/[Ff|setFf|ClrFf|F|SetF|ClrF]\s*?\d*?//go;
-s/\s*?\/[AP|A|AS]\s*?\[.*?\]//go;
-s/\s*?\/AS\s*?\/.*?\s//go;
-
-# format the field identifier
-
-s/(.*?)\/T.*?\((.*?)\)/$1 name=$2,/go;
-
-# format the value, which can be a name or string
-
-s/\/V\s?\((.*?)\)/value=\{$1\},/go;
-s/\/V\s?\/(.*?)[\s|\/]/value=\{$1\},/go;
-
-# sanitize some special \TeX\ tokens
-
-s/(\#|\$|\&|\^|\_|\|)/\\$1/go;
-
-# remove spaces and commas
-
-#s/\s?([name|value])/$1/go;
-s/\[\s*/\[/go;
-s/,\]/\]/go;
-
-# convert PDFDocEncoding
-
-s/\\225/\\\/L/ ;
-s/\\226/\\OE/ ;
-s/\\227/\\vS/ ;
-s/\\230/\\"Y/ ;
-s/\\231/\\vZ/ ;
-s/\\233/\\\/l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\</ ;
-s/\\\>/\>/ ;
-s/\\\(/\(/ ;
-s/\\\)/\)/ ;
-s/\#/\\#/ ;
-
-# convert newline and return commands
-
-s/\\n/ /go;
-s/\\r/\\par /go;
-
-} # end fdf alternative
-
-# flush buffer
-
-print FDT $_ ;
-
-close FDT ;
-close FDF ;
-
-# report some characteristics
-
-if ($Field eq "")
- { print " number of fields : $N\n" }
-else
- { if (/\\FDFfield\[value\=\{(.*)\}\,\s*name=$Field/mos)
- { print "$1" }
- elsif (/\\FDFfield\[name=$Field\,\s*value\=\{(.*)\}/mos)
- { print "$1" } }