From 9c6a401a440d27c602da80d8aa3efec2c310dd24 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 30 Nov 2005 00:00:00 +0100 Subject: stable 2005.11.30 --- scripts/context/perl/fdf2tan.pl | 121 --------------------- scripts/context/perl/fdf2tex.pl | 213 ------------------------------------- scripts/context/perl/makempy.pl | 6 +- scripts/context/ruby/base/kpse.rb | 6 +- scripts/context/ruby/newtexexec.rb | 7 ++ scripts/context/ruby/texmfstart.rb | 10 +- 6 files changed, 21 insertions(+), 342 deletions(-) delete mode 100644 scripts/context/perl/fdf2tan.pl delete mode 100644 scripts/context/perl/fdf2tex.pl (limited to 'scripts') diff --git a/scripts/context/perl/fdf2tan.pl b/scripts/context/perl/fdf2tan.pl deleted file mode 100644 index c612f9886..000000000 --- a/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 () - { if (/\/MediaBox\s*\[\s*($D+)\s*($D+)\s*($D+)\s*($D+)/o) - { $PDFllx = $1 ; $PDFlly = $2 ; $PDFurx = $3 ; $PDFury = $4 ; - last } } - -$_ = "" ; while ($Line=) { 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/\\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/scripts/context/perl/fdf2tex.pl b/scripts/context/perl/fdf2tex.pl deleted file mode 100644 index f9684cd9f..000000000 --- a/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=) { chomp $Line; $_ .= $Line } - -# or faster: dan ///s gebruiken (ipv m) - -# $/ = "\0777" ; $_ = ; - -# zoom in on the objects and remove the header and trialer - -if ($InpFile =~ /\.xml$/) - -{ # begin kind of xml alternative - -s/\>\s*\\/\\FDFfield\[$1\]\n/goms ; -s/(name|value)\=\"(.*?)\"/$1=\{$2\}/goms ; -s/\} (name|value)/\}\,$1/goms ; -s/\(.*?)\<\/fdfobject\>/\\beginFDFobject\n$1\\endFDFobject\n/goms ; -s/\(.*?)\<\/fdfdata\>/\\beginFDFdata\n$1\\endFDFdata\n/goms ; -s/\(.*?)\<\/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/ ; -s/\\234/\\oe/ ; -s/\\235/\\vs/ ; -s/\\236/\\vz/ ; -s/\\253/\\<>/ ; -s/\\300/\\`A/ ; -s/\\301/\\'A/ ; -s/\\302/\\^A/ ; -s/\\303/\\~A/ ; -s/\\304/\\"A/ ; -s/\\305/\\oA/ ; -s/\\306/\\AE/ ; -s/\\307/\\,C/ ; -s/\\310/\\`E/ ; -s/\\311/\\'E/ ; -s/\\312/\\^E/ ; -s/\\313/\\"E/ ; -s/\\314/\\`I/ ; -s/\\315/\\'I/ ; -s/\\316/\\^I/ ; -s/\\317/\\"I/ ; -s/\\321/\\~N/ ; -s/\\322/\\`O/ ; -s/\\323/\\'O/ ; -s/\\324/\\^O/ ; -s/\\325/\\~O/ ; -s/\\326/\\"O/ ; -s/\\330/\\\/O/ ; -s/\\331/\\`U/ ; -s/\\332/\\'U/ ; -s/\\333/\\^U/ ; -s/\\334/\\"U/ ; -s/\\335/\\'Y/ ; -s/\\337/\\ss/ ; -s/\\340/\\`a/ ; -s/\\341/\\'a/ ; -s/\\342/\\^a/ ; -s/\\343/\\~a/ ; -s/\\344/\\"a/ ; -s/\\345/\\oa/ ; -s/\\346/\\ae/ ; -s/\\347/\\,c/ ; -s/\\350/\\`e/ ; -s/\\351/\\'e/ ; -s/\\352/\\^e/ ; -s/\\353/\\"e/ ; -s/\\354/\\`i/ ; -s/\\355/\\'i/ ; -s/\\356/\\^i/ ; -s/\\357/\\"i/ ; -s/\\361/\\~n/ ; -s/\\362/\\`o/ ; -s/\\363/\\'o/ ; -s/\\364/\\^o/ ; -s/\\365/\\~o/ ; -s/\\366/\\"o/ ; -s/\\370/\\\/o/ ; -s/\\371/\\`u/ ; -s/\\372/\\'u/ ; -s/\\373/\\^u/ ; -s/\\374/\\"u/ ; -s/\\375/\\'y/ ; -s/\\377/\\"y/ ; - -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" } } diff --git a/scripts/context/perl/makempy.pl b/scripts/context/perl/makempy.pl index 49fd9bbd2..f263dd425 100644 --- a/scripts/context/perl/makempy.pl +++ b/scripts/context/perl/makempy.pl @@ -46,8 +46,6 @@ my $format = "plain" ; # can be "context" for plain users too "force" => \$force , "pdftops" => \$pmethod , "xpdf" => \$pmethod , -# "acrobat" => \$amethod , # nowadays the reader is not that clear about this being permitted - "reader" => \$amethod , "gs" => \$gmethod , "ghostscript" => \$gmethod , "noclean" => \$noclean ) ; @@ -202,15 +200,13 @@ sub show_help_info report ("--force : force processing (ignore checksum)" ) ; report ("--silent : don't show messages" ) ; print "\n" ; - report ("--acrobat : use acrobat (reader) for pdf->ps (on unix)") ; report ("--pdftops : use pdftops (xpdf) pdf->ps") ; report ("--ghostscript : use ghostscript (gs) for pdf->ps") ; print "\n" ; report ("input file : metapost file with graphics") ; report ("programs needed : texexec and english context") ; report (" : pdftops from the xpdf suite, or") ; # page size buggy - report (" : pdf2ps and ghostscript, or") ; - report (" : acrobat reader for unix, and") ; + report (" : pdf2ps and ghostscript, and") ; report (" : pstoedit and ghostscript") ; report ("output file : metapost file with pictures") ; exit } diff --git a/scripts/context/ruby/base/kpse.rb b/scripts/context/ruby/base/kpse.rb index dc4898ffc..7a7964127 100644 --- a/scripts/context/ruby/base/kpse.rb +++ b/scripts/context/ruby/base/kpse.rb @@ -32,7 +32,11 @@ module Kpse @@crossover = true @@mswindows = Config::CONFIG['host_os'] =~ /mswin/ - @@distribution = 'miktex' if ENV['PATH'] =~ /miktex[\\\/]bin/o + # @@distribution = 'miktex' if ENV['PATH'] =~ /miktex[\\\/]bin/o + + if ENV['PATH'] =~ /(.*?)miktex[\\\/]bin/i then + @@distribution = 'miktex' unless $1 =~ /(texmf\-mswin[\/\\]bin|bin[\/\\]win32)/i + end @@usekpserunner = false || ENV['KPSEFAST'] == 'yes' diff --git a/scripts/context/ruby/newtexexec.rb b/scripts/context/ruby/newtexexec.rb index 43d840e5b..8caf9de0f 100644 --- a/scripts/context/ruby/newtexexec.rb +++ b/scripts/context/ruby/newtexexec.rb @@ -525,6 +525,13 @@ class Commands end +# we will make this pluggable, i.e. load plugins from base/tex that +# extend the class and may even add switches +# +# commandline.load_plugins('base/tex') +# +# maybe it's too slow so for a while keep the --pdf* in here + logger = Logger.new(banner.shift) commandline = CommandLine.new diff --git a/scripts/context/ruby/texmfstart.rb b/scripts/context/ruby/texmfstart.rb index 94b89d170..4bea5e979 100644 --- a/scripts/context/ruby/texmfstart.rb +++ b/scripts/context/ruby/texmfstart.rb @@ -2,7 +2,7 @@ # program : texmfstart # copyright : PRAGMA Advanced Document Engineering -# version : 1.5.5 - 2003/2005 +# version : 1.7.1 - 2003/2005 # author : Hans Hagen # # project : ConTeXt / eXaMpLe @@ -36,7 +36,7 @@ require "rbconfig" $mswindows = Config::CONFIG['host_os'] =~ /mswin/ $separator = File::PATH_SEPARATOR -$version = "1.7.0" +$version = "1.7.1" if $mswindows then @@ -65,6 +65,7 @@ $predefined['texexec'] = 'texexec.pl' $predefined['texutil'] = 'texutil.pl' $predefined['texfont'] = 'texfont.pl' +$predefined['makempy'] = 'makempy.pl' $predefined['mptopdf'] = 'mptopdf.pl' $predefined['pstopdf'] = 'pstopdf.rb' @@ -82,10 +83,15 @@ $predefined['exatools'] = 'exatools.rb' $predefined['xmltools'] = 'xmltools.rb' $makelist = [ + # context 'texexec', 'texutil', + 'texfont', + # mp/ps 'pstopdf', 'mptopdf', + 'makempy', + # misc 'ctxtools', 'pdftools', 'xmltools', -- cgit v1.2.3