summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-04-16 00:49:36 +0000
committerKarl Berry <karl@freefriends.org>2008-04-16 00:49:36 +0000
commit74b09c529472ec24454c2bfb95d41795233e7d9a (patch)
tree0ac085455e6e589f61024808c05988073278b79e /Master/texmf-dist/doc/metapost
parenta35845a36ac2ee5a72f83f3820bf60c59285f07c (diff)
metapost package epsincl
git-svn-id: svn://tug.org/texlive/trunk@7437 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/metapost')
-rw-r--r--Master/texmf-dist/doc/metapost/epsincl/0info.txt13
-rw-r--r--Master/texmf-dist/doc/metapost/epsincl/README13
-rw-r--r--Master/texmf-dist/doc/metapost/epsincl/epsincl.awk176
-rwxr-xr-xMaster/texmf-dist/doc/metapost/epsincl/epsincl.bat11
-rw-r--r--Master/texmf-dist/doc/metapost/epsincl/testinc0.eps114
-rwxr-xr-xMaster/texmf-dist/doc/metapost/epsincl/testincl.bat3
-rw-r--r--Master/texmf-dist/doc/metapost/epsincl/testincl.mp10
-rw-r--r--Master/texmf-dist/doc/metapost/epsincl/testincl.sh4
8 files changed, 344 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/metapost/epsincl/0info.txt b/Master/texmf-dist/doc/metapost/epsincl/0info.txt
new file mode 100644
index 00000000000..e8682f3eb7d
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/epsincl/0info.txt
@@ -0,0 +1,13 @@
+EPSINCL: made in BOP s.c., bop@bop.com.pl; public domain software
+history: 20.08.1999: ver. 0.1, pre-release
+ 05.01.2000: ver. 0.2, first release
+
+ENGLISH | POLSKI
+ |
+The package EPSINCL facilitates | Pakiet EPSINCL u/latwia w/l/aczanie
+including EPS files in METAPOST | plik/ow EPS do dokument/ow
+documents; it makes use of (G)AWK. | METAPOST-owych; wykorzystywany jest
+Using it is very simple -- see | (G)AWK. Spos/ob u/zycia demonstruje
+testincl.mp and testincl.bat | za/l/aczony przyk/lad (testincl.mp)
+(DOS/WIN32) or testincl.sh (U*X) | i pliki testincl.bat (DOS/WIN32)
+files to see this. | lub testincl.sh (U*X)
diff --git a/Master/texmf-dist/doc/metapost/epsincl/README b/Master/texmf-dist/doc/metapost/epsincl/README
new file mode 100644
index 00000000000..e8682f3eb7d
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/epsincl/README
@@ -0,0 +1,13 @@
+EPSINCL: made in BOP s.c., bop@bop.com.pl; public domain software
+history: 20.08.1999: ver. 0.1, pre-release
+ 05.01.2000: ver. 0.2, first release
+
+ENGLISH | POLSKI
+ |
+The package EPSINCL facilitates | Pakiet EPSINCL u/latwia w/l/aczanie
+including EPS files in METAPOST | plik/ow EPS do dokument/ow
+documents; it makes use of (G)AWK. | METAPOST-owych; wykorzystywany jest
+Using it is very simple -- see | (G)AWK. Spos/ob u/zycia demonstruje
+testincl.mp and testincl.bat | za/l/aczony przyk/lad (testincl.mp)
+(DOS/WIN32) or testincl.sh (U*X) | i pliki testincl.bat (DOS/WIN32)
+files to see this. | lub testincl.sh (U*X)
diff --git a/Master/texmf-dist/doc/metapost/epsincl/epsincl.awk b/Master/texmf-dist/doc/metapost/epsincl/epsincl.awk
new file mode 100644
index 00000000000..2c394da7ac9
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/epsincl/epsincl.awk
@@ -0,0 +1,176 @@
+# made in BOP s.c., bop@bop.com.pl; public domain software
+# history: 20.08.1999: ver. 0.1, pre-release
+# 05.01.2000: ver. 0.2, first release
+BEGIN {
+ hd["0"]=0; hd["1"]=1; hd["2"]=2; hd["3"]=3; hd["4"]=4
+ hd["5"]=5; hd["6"]=6; hd["7"]=7; hd["8"]=8; hd["9"]=9
+ hd["a"]=hd["A"]=10; hd["b"]=hd["B"]=11; hd["c"]=hd["C"]=12
+ hd["d"]=hd["D"]=13; hd["e"]=hd["E"]=14; hd["f"]=hd["F"]=15
+ #
+ hb["0"]="0000"; hb["1"]="0001"; hb["2"]="0010"; hb["3"]="0011"
+ hb["4"]="0100"; hb["5"]="0101"; hb["6"]="0110"; hb["7"]="0111"
+ hb["8"]="1000"; hb["9"]="1001"; hb["a"]="1010"; hb["b"]="1011"
+ hb["c"]="1100"; hb["d"]="1101"; hb["e"]="1110"; hb["f"]="1111"
+ #
+ for (i in hb) bh[hb[i]]=i
+ #
+ hb["A"]="1010"; hb["B"]="1011"; hb["C"]="1100"
+ hb["D"]="1101"; hb["E"]="1110"; hb["F"]="1111"
+ #
+ comments=1
+}
+
+/^[^%]/ && (comments==1) {comments=0; flush_prolog()}
+
+comments==1 {process_prolog()}
+
+(l==7) {l=0}
+
+(l==6) {
+ if ($0~/ *closepath/) {l=7; IncludeEPS(Anum)} else l=-6
+}
+
+(l==5) {
+ if (is_lineto()) {l=6}
+ else if (is_curveto()) {l=6}
+ else if ($0~/ *closepath/) {l=7; IncludeEPS(Anum)}
+ else l=-5
+}
+
+(l==4) {
+ if (is_lineto()) {l=5; Aulx=$1; Auly=$2}
+ else if (is_curveto()) {l=5; Aulx=$5; Auly=$6}
+ else l=-4
+}
+
+(l==3) {
+ if (is_lineto()) {l=4; Aurx=$1; Aury=$2}
+ else if (is_curveto()) {l=4; Aurx=$5; Aury=$6}
+ else l=-3
+}
+
+(l==2) {
+ if (is_lineto()) {l=3; Adrx=$1; Adry=$2}
+ else if (is_curveto()) {l=3; Adrx=$5; Adry=$6}
+ else l=-2
+}
+
+(l==1) {
+ if ($0~/^newpath -?[0-9\.]+ -?[0-9\.]+ moveto$/) {
+ l=2
+ Adlx=$2; Adly=$3
+ } else l=-1
+}
+
+(l<0) {
+ print "Something strange in EPS colour (" (-l) ")" > "CON"
+ print NR, is_lineto(), is_curveto() > "CON"
+ print $0 > "CON"
+ exit
+ l=0
+}
+
+/setrgbcolor$/ && (n>0) && (comments==0) {
+ for (i in Ename)
+ if ((Ecolr[i]==$1) && (Ecolg[i]==$2) && (Ecolb[i]==$3)) {
+ Anum=i; l=1
+ }
+}
+
+(l==0) && (comments==0) {gsub(/fshow/, "nshow"); print}
+
+function hexval(x) {return hd[substr(x,1,1)]*16+hd[substr(x,2,1)]}
+
+function process_prolog(){
+ if (/^%\*Font:/) {
+ f_ch[$2 "\001" $4]=fix_chars(f_ch[$2 "\001" $4],$5)
+ } else
+ if (/^%EPS/) {
+ Ecolr[++n]=$2+0; Ecolg[n]=$3+0; Ecolb[n]=$4+0
+ Ename[n]=$5 ""
+ Ebbl[n]=$6+0; Ebbd[n]=$7+0; Ebbr[n]=$8+0; Ebbu[n]=$9+0
+ } else
+ prolog[++prolog[0]]=$0
+}
+
+function flush_prolog( j,l){
+ for (l=1; l<=prolog[0]; ++l) {
+ if (prolog[l]~/^%%EndProlog/) j=flush_fonts();
+ print prolog[l]
+ }
+ if (j>0) print "/nshow {gsave 10 div dup scale 10 fshow grestore} def"
+ if (n>0) print "/MEPSDict 50 dict def"
+}
+
+function flush_fonts( i,j) {
+ j=0
+ for (i in f_ch) {
+ j++
+ split(i,a,"\001")
+ printf("%%*Font: %s 10.0 %s %s\n", a[1], a[2], out_chars(f_ch[i]))
+ }
+ return j
+}
+
+function fix_chars(f,c, a) {
+ split(c,a,":")
+ return mix_chars((f=="" ? sprintf("%0256d", 0) : f), a[2], hexval(a[1]))
+}
+
+function mix_chars(f,c,x, h,k,l) {
+ for (k=1; k<=length(c); k++) {
+ h=hb[substr(c,k,1)]
+ for (l=1; l<=length(h); l++)
+ if (substr(h,l,1)=="1") f=substr(f,1,x+4*k+l-5) "1" substr(f,x+4*k+l-3)
+ }
+ return f
+}
+
+function out_chars(f, i,j,k,g) {
+ while ((i<256) && (substr(f,i,1)=="0")) ++i
+ g=""
+ for (j=i; j<=length(f); j+=4) {
+ k=sprintf("%-4s", substr(f,j,4)); gsub(/ /,"0",k); g=g bh[k]
+ }
+ sub (/0+$/,"",g)
+ return sprintf("%02X", (i-1)) ":" g
+}
+
+function is_lineto() {
+ return ($0~/^-?[0-9\.]+ -?[0-9\.]+ lineto$/)
+}
+
+function is_curveto() {
+ return ($0~/^-?[0-9\.]+ -?[0-9\.]+ -?[0-9\.]+ -?[0-9\.]+ -?[0-9\.]+ -?[0-9\.]+ curveto$/)
+}
+
+function IncludeEPS(i, comments, s) {
+ print "%BeginInclude"
+ print "MEPSDict begin /MEPSSave save def gsave"
+ print "count /MEPSocount exch def /MEPSdcount countdictstack def"
+ print "/showpage {} def /erasepage {} def /copypage {} def"
+ print "/letter {} def /note {} def /a4 {} def /legal {} def"
+ printf ("[ %f %f %f %f %f %f ] matrix invertmatrix\n",
+ Ebbr[i]-Ebbl[i], 0, 0, Ebbu[i]-Ebbd[i], Ebbl[i], Ebbd[i])
+ printf ("[ %f %f %f %f %f %f ] matrix concatmatrix\n",
+ Adrx-Adlx, Adry-Adly, Aulx-Adlx, Auly-Adly, Adlx, Adly)
+ print "concat"
+ print "0 setlinecap 0 setlinejoin 10 setmiterlimit [] 0 setdash"
+ print "1 setlinewidth 0 setgray newpath"
+ print "%StartInclude"
+#
+ comments=1
+ while (getline s < Ename[i] >0)
+ if ((s!~/^%[%!\*]/) || (comments==0)) {
+ comments=0; gsub(/fshow/, "nshow", s); print s
+ }
+ close(Ename[i])
+#
+ print "%StopInclude"
+ print "count MEPSocount sub {pop} repeat"
+ print "countdictstack MEPSdcount sub {end} repeat"
+ print "grestore MEPSSave restore end"
+ print "%EndInclude"
+}
+
+
diff --git a/Master/texmf-dist/doc/metapost/epsincl/epsincl.bat b/Master/texmf-dist/doc/metapost/epsincl/epsincl.bat
new file mode 100755
index 00000000000..fd56369f7f4
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/epsincl/epsincl.bat
@@ -0,0 +1,11 @@
+:: made in BOP s.c., bop@bop.com.pl; public domain software
+:: history: 20.08.1999: ver. 0.1, pre-release
+:: 05.01.2000: ver. 0.2, first release
+@echo off
+if "%2"=="" goto USAGE
+gawk -f epsincl.awk %1 > %2
+goto DONE
+:USAGE
+echo USAGE:
+echo epsincl inputfile outputfile
+:DONE
diff --git a/Master/texmf-dist/doc/metapost/epsincl/testinc0.eps b/Master/texmf-dist/doc/metapost/epsincl/testinc0.eps
new file mode 100644
index 00000000000..28c3ea8001e
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/epsincl/testinc0.eps
@@ -0,0 +1,114 @@
+%!PS-Adobe-2.0 EPSF-2.0
+%%Creator: GhostScript rev. 540
+%%BoundingBox: -8.642 -147.685 210.468 22.11
+%%EndComments
+%%BeginProlog
+/GSexport 100 dict def GSexport begin
+/h {closepath} def
+/m {moveto} def
+/c {curveto} def
+/l {lineto} def
+/k {setcmykcolor} def
+/K {setcmykcolor} def
+/*u {/oper_kind -1 def} def
+/*U {*U*f *U*d *U*c} def
+/f {/oper_kind 0 def} def
+/*U*f {0 oper_kind eq {eofill} if} def
+/s {closepath /oper_kind 1 def} def
+/S {/oper_kind 1 def} def
+/*U*d {1 oper_kind eq {stroke} if} def
+/W {} def
+/n {/oper_kind 2 def} def
+/*U*c {2 oper_kind eq {eoclip newpath} if} def
+/w {setlinewidth} def
+/j {setlinejoin} def
+/J {setlinecap} def
+/M {setmiterlimit} def
+/d {setdash} def
+/setcmykcolor where {pop}
+ {/setcmykcolor {1 sub /mf exch def
+ 3 {mf add neg dup 0 lt {pop 0} if 3 1 roll} repeat
+ setrgbcolor} def} ifelse
+/q {gsave} def
+/Q {grestore} def
+%%EndProlog
+%%BeginSetup
+%%EndSetup
+*u
+1 1 0 0 k
+-6.137 -5.033 m
+0.643 -14.716 9.125 -23.088 18.897 -29.74 c
+29.082 -36.673 40.683 -41.669 53.008 -41.669 c
+63.424 -41.669 73.447 -38.22 82.504 -33.085 c
+90.97 -28.285 98.514 -22.085 105.999 -15.873 c
+112.765 -10.258 119.54 -4.595 127.194 -0.259 c
+133.852 3.513 141.161 6.236 148.819 6.236 c
+157.826 6.236 166.216 2.355 173.661 -2.707 c
+182.295 -8.575 189.764 -15.996 195.689 -24.592 c
+198.181 -28.207 203.352 -28.573 206.859 -25.696 c
+210.16 -22.989 210.468 -18.103 207.964 -14.526 c
+201.184 -4.843 192.701 3.529 182.93 10.181 c
+172.745 17.114 161.144 22.11 148.819 22.11 c
+138.402 22.11 128.379 18.661 119.323 13.526 c
+110.857 8.726 103.312 2.526 95.828 -3.686 c
+89.062 -9.301 82.286 -14.964 74.632 -19.3 c
+67.974 -23.072 60.665 -25.795 53.008 -25.795 c
+44.001 -25.795 35.611 -21.914 28.165 -16.852 c
+19.531 -10.984 12.062 -3.563 6.137 5.033 c
+3.646 8.648 -1.525 9.014 -5.033 6.137 c
+-8.334 3.43 -8.642 -1.456 -6.137 -5.033 c
+f
+*U
+*u
+1 1 0 0 k
+-6.137 -58.04 m
+0.643 -67.724 9.125 -76.096 18.897 -82.748 c
+29.082 -89.681 40.683 -94.677 53.008 -94.677 c
+63.424 -94.677 73.447 -91.228 82.504 -86.093 c
+90.97 -81.293 98.514 -75.092 105.999 -68.881 c
+112.765 -63.266 119.54 -57.603 127.194 -53.266 c
+133.852 -49.495 141.161 -46.772 148.819 -46.772 c
+157.826 -46.772 166.216 -50.653 173.661 -55.714 c
+182.295 -61.583 189.764 -69.004 195.689 -77.599 c
+198.181 -81.215 203.352 -81.58 206.859 -78.704 c
+210.16 -75.997 210.468 -71.111 207.964 -67.534 c
+201.184 -57.851 192.701 -49.479 182.93 -42.827 c
+172.745 -35.894 161.144 -30.898 148.819 -30.898 c
+138.402 -30.898 128.379 -34.347 119.323 -39.482 c
+110.857 -44.282 103.312 -50.482 95.828 -56.694 c
+89.062 -62.308 82.286 -67.972 74.632 -72.308 c
+67.974 -76.08 60.665 -78.803 53.008 -78.803 c
+44.001 -78.803 35.611 -74.921 28.165 -69.86 c
+19.531 -63.991 12.062 -56.571 6.137 -47.975 c
+3.646 -44.36 -1.525 -43.994 -5.033 -46.87 c
+-8.334 -49.577 -8.642 -54.463 -6.137 -58.04 c
+f
+*U
+*u
+1 1 0 0 k
+-6.137 -111.048 m
+0.643 -120.732 9.125 -129.103 18.897 -135.755 c
+29.082 -142.689 40.683 -147.685 53.008 -147.685 c
+63.424 -147.685 73.447 -144.235 82.504 -139.1 c
+90.97 -134.301 98.514 -128.1 105.999 -121.889 c
+112.765 -116.274 119.54 -110.61 127.194 -106.274 c
+133.852 -102.503 141.161 -99.779 148.819 -99.779 c
+157.826 -99.779 166.216 -103.661 173.661 -108.722 c
+182.295 -114.591 189.764 -122.012 195.689 -130.607 c
+198.181 -134.222 203.352 -134.588 206.859 -131.712 c
+210.16 -129.005 210.468 -124.119 207.964 -120.542 c
+201.184 -110.858 192.701 -102.487 182.93 -95.835 c
+172.745 -88.901 161.144 -83.905 148.819 -83.905 c
+138.402 -83.905 128.379 -87.355 119.323 -92.49 c
+110.857 -97.289 103.312 -103.49 95.828 -109.701 c
+89.062 -115.316 82.286 -120.98 74.632 -125.316 c
+67.974 -129.087 60.665 -131.811 53.008 -131.811 c
+44.001 -131.811 35.611 -127.929 28.165 -122.868 c
+19.531 -116.999 12.062 -109.578 6.137 -100.983 c
+3.646 -97.368 -1.525 -97.002 -5.033 -99.878 c
+-8.334 -102.585 -8.642 -107.471 -6.137 -111.048 c
+f
+*U
+%%Trailer
+end
+showpage
diff --git a/Master/texmf-dist/doc/metapost/epsincl/testincl.bat b/Master/texmf-dist/doc/metapost/epsincl/testincl.bat
new file mode 100755
index 00000000000..e09233f069c
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/epsincl/testincl.bat
@@ -0,0 +1,3 @@
+@echo off
+mpost testincl.mp
+call epsincl testincl.100 testincl.eps
diff --git a/Master/texmf-dist/doc/metapost/epsincl/testincl.mp b/Master/texmf-dist/doc/metapost/epsincl/testincl.mp
new file mode 100644
index 00000000000..0db25cca4a9
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/epsincl/testincl.mp
@@ -0,0 +1,10 @@
+input epsincl;
+
+tertiarydef p scaledto x = p scaled (x/xpart(urcorner(p)-llcorner(p))) enddef;
+
+beginfig(100);
+ label(use_eps("testinc0.eps") rotated 30 scaledto 100mm, origin);
+ label(image(fill unitsquare scaled 2mm rotated 45), origin) withcolor .7white;
+endfig;
+
+end
diff --git a/Master/texmf-dist/doc/metapost/epsincl/testincl.sh b/Master/texmf-dist/doc/metapost/epsincl/testincl.sh
new file mode 100644
index 00000000000..c5de96e7c59
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/epsincl/testincl.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+## test of EPS inclusion in METAPOST file
+mpost testincl.mp
+gawk -f epsincl.awk testincl.100 > testincl.eps