diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
commit | 487ca4806cc046076293cf6cc5fbba0db282bac7 (patch) | |
tree | 847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/web2c/triptrap/trap.mp | |
parent | a3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff) |
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/triptrap/trap.mp')
-rw-r--r-- | Build/source/texk/web2c/triptrap/trap.mp | 215 |
1 files changed, 215 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/triptrap/trap.mp b/Build/source/texk/web2c/triptrap/trap.mp new file mode 100644 index 00000000000..92e1a55c05e --- /dev/null +++ b/Build/source/texk/web2c/triptrap/trap.mp @@ -0,0 +1,215 @@ +% This is a test file for MetaPost analogous to trap.mf +if not known inimp: .inimp.=.0. % next lines are skipped if format loaded + inimp; nonstopmode; tracingtitles:=day; showstopping:=year; + << == >> ::: || `` '' -- !! ?? ## && @@ $$ [[ ]] {{ }} . (( 5.5.5 )) ++ ".."; + begingroup save =; let=,; save,; newinternal $=,; let ):=, endgroup; + let year=month; showvariable errorstopmode,readstring,2,"2",,,(,),<<,year; + tracingrestores:=tracingcommands:=.00000762939453125; % that's 2^(-17) + if tracingcommands>0:tracingcommands:=if not cycle "":1.1 forever;fi; + tracingcommands:=2.1 exitif tracingcommands>2 endfor; showtoken |=:|>; + tracinglostchars:=1/.00001; tracingequations:=$+1; p~=tracinglostchars+.00001; + interim tracingspecs:=tracingchoices:=tracingstats:= + warningcheck:=tracingoutput:=tracingmacros:=1; $:=ASCII""; $:=x; p~:=p~; + delimiters (); delimiters begintext endtext; vardef foo(text t)=t enddef; + def lig(text t,|)=ligtable0::for *=1step1until60:0kern boundarychar+*,endfor + skipto0;ligtable t:t|0,skipto255;boundarychar:=boundarychar+51.29999enddef; + foo begintext interim tracinglostchars:=(.5;show urcorner("flubo"infont"trapf" + ),2+2endtext; for n=tracingspecs step 1 until $:fi endfor showstats; + let!!=skipto; path p~; p~=(0,0)..controls (15,4) and (-15,-12)..(4,0); + everyjob /*\;; vardef /*\`'@#=message @ & str#@ &jobname&char ASCII'`&str@#! + enddef;let next=endinput;vardef `'='` enddef;def '`="\*/"enddef; + begingroup errorstopmode; endgroup; +elseif known"": `'pass[2.]; nonstopmode; outer\; let next=\; delimiters ^~7! fi +next\; % the second pass will now compute silently; the first pass will halt +batchmode; ^~7,endgroup pausing:=1; exitif p exitif boolean pen pencircle endfor +scantokens begingroup message char0&"watch this"; "pair p[],';"&char-1endgroup +path p[][]p,w,qw; qw=(1,-2)..(2,-1)..(2.5,0.5)..(1,2)..(turningnumber',2.5); +numeric p[][]; p[[ [$] ]]=10000000000000000; "this string constant is incomplete +string foo[]p,p~if true:[]; +boolean p[]~,boolean fi.boolean; showvariable boolean; +inner \; def\\= =show enddef; outer \; picture e[]e[], e[], p~[]~[][]; +pen p~[]~,q["a",qq; p~1~=q=pencircle scaled mexp(-3016.57654); +transform p,pp0; if p=p:qq=makepen((7,0)..cycle) xscaled hex "1000";show qq;fi +qq:=makepen((4,1)..(1,2)..(5,3)..(3,2)..(1,1)..(0,1)..(1,0)..cycle);show qq; +vardef p[][]p~ begintext suffix a,b endtext())suffix@=show #@; p.a.b() enddef; +expandafter let\endtext\\; outer endtext,\,;; +(6,12)-p7=(0,1)transformed p=(2/(x-x),3/0)transformed p; +p1\2p=p007=begintext if string p~[$]: p.1.2-p.1.199999,1 endtext transformed p; +showstopping:=0;showvariable p; p=p; let [[=begingroup; let ]]=endgroup; +(xxpart p+.002,yxpart p)=1[p1,p2]=(5,y+.00001)=(5,y)=(yypart p,xypart p); +reverse(p~..cycle) transformed p=p2. 3.p; +p[000000000001]2p~(,[2]3p~,-)=p~1~2[pausing]; +vardef p~[]@# tertiary t:=if p@ @=@ @p fi; vardef p[][]p~[]=BAD; inner ;; +show p~[-2]~[3000,x]++4000>path p3; showvariable p,P; +numeric p[]~; p3~=2alpha; p[1/$]~=3beta; +begingroup save p; showvariable p; 3beta=1]]; showvariable p; +def//expr;=enddef;def!primary!false):!fi enddef; +def _aa__ secondary _a_=if(true enddef; qq:=makepen(qw..(qw scaled$)..cycle); +show qq; primarydef _**__=[[show _*__]] enddef; +secondarydef _***__=expandafter __ scantokens"**oct"_ enddef; +// //pencircle slanted length p~**makepen reverse subpath p7-p2 of + (p7{p2}..controls _aa__ not odd.1(15) and known p or !p2and-p2..{1,1}(-p2 + {curl- +1)..tension atleast1..cycle sqrt2++sqrt2***[[]]; +charcode:=-20.5;chardp:=-2048;shipout nullpicture; +if charexists -275.50002>known p0 0p=known p~: randomseed charcode; fi +randomseed:="goof"; a[($,18++1+-+18),(2,3)]=b[(3,2),(1,$); +show (^+1,~+2) slanted-1 yscaled-2 zscaled-(3,4), p transformed(pp xscaled 9), + pp shifted (1,2) transformed(p transformed p), -_[0][1,2]; show +floor sind mlog sqrt mexp200cosd angle(normaldeviate,uniformdeviate-chardp); +string s[]; s1=s2=s4; s3=s5; s1=s2; if s1<=s4<>(s1<>s3):show[[char34=s2:=s3]]fi; +substring penoffset point.1of.p~of[[pencircle]]rotated1080/2/1/3of decimal + directiontime postcontrol-1.5of(p~&cycle)-precontrol1/2of p~(p~)=s1:=s4:=s4; +path p~[]; p~1=p2{length" "}&cycle; p~1=p2=p~0; p2..controls-p2..cycle=p~2;(p7 +..tension1.2..p~[length p~2]..p~2&{0,1}p2..tension1and atleast1..cycle)..tension + x..{curl1}-p7{curl hex "IsBad"}..tension.75and.74999..p2{0,1}&p2{_,'}..cycle:=p + ~4; subpath(-9,9)of subpath(3.5001,7.00001)of p~4=p~6; +show p~6, directiontime(1,2) of p~6, directiontime(1,-1.00001) of p~6; +p~3=(0,0)..controls (1,1) and (0,1)..(1,0); show p2..p2{p7}&{$,$}cycle, + (directiontime(1,1) of subpath(.314159,1) of p~3)[.314159,1]; +p~5=(subpath(0,.25)of p~3&subpath(.25,1)of p~3)shifted begintext1,0; +p~3:=2/3'zscaled'{p~3}..controls(2,2/3(3))and penoffset(1/2x,y)of(0,1)(1,0); +show p~3 intersectiontimes reverse p~3, point.17227 of p~3, point1-.28339of p~3; +show point xpart(p~5 intersectiontimes p~5 shifted (.01,0))of p~5- + point ypart(p~5 intersectiontimes p~5 shifted (.01,0))of p~5; +[[ e[-1+-+ -1.00001]=nullpicture; addto e1 also[[ +addto e0 doublepath p~5 scaled 3 withpen q; e0=e1=e2; +nullpicture]];show e1, e2 shifted (-3,0) ]]; +addto e1 also e2 shifted(-2,$); e1:=e1 shifted(-4,$); +addto e1 doublepath (0,9) withcolor(.4,turningnumber p~4,0) + withpen qq xscaled(oct"180"++1) rotated-angle(64,$) shifted (9,8); +show e1; chardp:=charcode:=5; xoffset:=-1.5; shipout e1; e3=nullpicture; +showstats; addto e3doublepath(.5,0)..(3.5,1.5)dashed e0; + q:=makepen((1,1)..cycle) yscaled 1.5; +chardx:=chardp:=charext:=-14.5;charcode:=6;shipout e2; +p~9=(0,0)..(1,.5)..(5,1.5)..(7,2.5)..(12,3.5)..(13,4);addto e3 doublepath p~9; +addto doublepath (-4095,0)..tension +3/4 and 999..(0,2); show e3 rotated-90; +if "a" if "ab">"b" elseif path reverse (3,4): >="aa":foo elseif fi "bar" +else if '-(1,yy)<': :fi else def dup text t=[[t;save enddef;def|suffix$=,$ +enddef; def||tertiary p=show substring p of("a" enddef;||(2,$)&"bc"); +tertiarydef x++y=[[dup showtoken x;]];def quote x expr z of y=z enddef; + texts(quote x=(y+0)y+y)("xx",foo(x))=0]] enddef; def texts(text t,tt)expr?= + for n:=,for n"yy":n,length if false:endfor tt,t,:if string n:forsuffixes n= + foo1,[foo(n)],':show t,tt|(n;exitif not('<='+(?,yy)) endfor for m= :+endfor + for m=alpha step-1.1 3$: +m endfor fi endfor enddef; show (0,0){curl2}.. + subpath(23.3,4.5)of p~9{curl3}..($,$){curl4}..cycle;zzz=p~++2+3;[[ +let?=if;save if,\;def if=endinput?enddef;def texts=input enddef;texts trap ]]; +dup[[def texts secondary x=primarydef y++y=x@y enddef; showtoken++;x enddef]]\; +texts:="a"&"b";% strings "yy" and "ab" no longer appear in memory +texts-1.00001a1=-(a2+a3+a4+a5+a6);-(a3,a2)/.99999=-(a4+a5+[[showdependencies; +a6]],a3+a4+a5+a6)]]; 1.00001a4+1=a5+a6; alpha:=.9alpha+7; showdependencies; +a5=a6=2/3-a6; charcode:=chardp:=27; 3.1=aaz; show aaz; ligtable||:255|=:|>>0, +skipto0; show [[interim tracingcommands:=0; lig("g")(=:|); lig("h":"i")(|=:); +lig("j")(|=:>);lig("k")(=:|>); lig("l")(|=:|>)]]; +b1:=c.a[ [[let c=++;vardef b=enddef;1]] ]; ligtable"m":0=:0,skipto5; +!!; errhelp 0; errmessage "Be like Jane"; +errhelp "He%%%lp%"; errmessage""; errhelp ""; errmessage "Another"; +headerbyte 0; headerbyte(48.5)substring(-9,9)of"long"; for\=0:\ +headerbyte 9:2a6,"q"; fontdimen 9:2a6,"q"; fontdimen 1:2048; +fontmaking:=1; extensible 5 5,"c"255.5,"d"; charlist 0:5:"a":"d"; +ligtable255:255::"a"=:"b","d" kern -2048,"c":0:99.5:"e"|=:|"f",0kern'; +ligtable 5:0; def clear(text x)=interim x:=$ enddef; clear(hppp); vppp=0; +[[clear(tracingmacros); clear(tracingcommands); clear(tracingoutput\; + designsize:=.99999;charcode:=ASCII char-418.5; + def dp expr d = charcode:=charcode+1; chardp:=d; shipout nullpicture enddef; + dp 13; dp 12; dp 0; dp 21; dp -2; dp 17; dp 11; dp 3; charic:=-1000; dp -1; + dp 25; dp 31; dp 19; dp 7; charwd:=256; chardy:=6; dp 23; dp 30]]; +def f(suffix@@)(expr a,b)(text t)=numeric w; show a; % wipes out the old w +addto @@ contour (0,0)..(2,0)..(1,$)..(1,1)..cycle withpen qq; % strange path +addto @@ doublepath (0,0){1,1}..{2,1}(2,1) withpen qq; % carefully chosen +addto @@ doublepath(($,$){1,0}..(1,1){1,0})scaled.5 withpen nullpen; +enddef; def g(suffix$)=show $ enddef; +addto e0 contour (0,0){1,0}..{1,0}(1,0){0,$}..{0,1}cycle withpen qq; +f(e[3,w); g(e3,transformed p,penoffset-(1,1.3)of(pencircle scaled20 yscaled-.5), + directiontime (0,1) of ((0,0)..controls(1,1)and($,1)..(3,0)), + point 3.14159 of p~9 intersectiontimes subpath (3.14159,4) of p~9, + (($,1.1)..(1,$)) intersectiontimes precontrol$ of (0,0); +addto e3 doublepath(-4094.99998,0)..(4094.99998,-.00001) withpen penoffset 0 of +pencircle; addto e3 also e3 shifted (0,257); ,"flushed with pride"; numeric xx; +def f(expr x,y,z)=showdependencies;tracingcapsules:=1;showdependencies;show + 1/3(3,6)*((x+y)+(y-x)), (1,1)/sqrt2 zscaled (x+1,x+2) - (x+1,x+2) rotated 45, + (0,1) zscaled (1,y+2)-(1,y+2) rotated 90 enddef; f((xx+1)/.3,(yy-1)/.5,(xx,0)); +'=(1000o3-4000(o1-o2)+4000o2+9,-.01o3+3ooo+ + [[oo=9/10(o2+o4+o5-20);o4=o5=8/9(o1+.5o2); o6=-.0001o2;showdependencies; + numeric o[];xpart(alfa,[[pair alfa;0]])]])=-2/3[[save p;(p$,1-p$)]]; +xoffset:=yoffset:=4000[[oo=.5ooo=2*-1/2(ooo+[[numeric ooo;1]]);oo]]; +addto foo contour begingroup vardef foo=enddef; (0,0)..cycle endgroup; +p~7=p~8; p~8:=(0,0){-1,1}..(30,0); show p~8, directiontime (0,-1)of p~8; +show directiontime (1,0) of p~9, directiontime(1,-1) +of ((0,0){1,0}..(0,0){0,-1)..cycle); +e9=e4=nullpicture; addto e4 doublepath p~8; +addto e9 doublepath p~8 dashed e4; e9:=nullpicture; +e4:=nullpicture; addto e4 doublepath(1,1)..(4,1); +addto e9 doublepath p~8 dashed e4; e9:=nullpicture; +addto e4 doublepath makepath pencircle dashed e4 scaled -2; show e4; +e4:=e5=nullpicture; addto e4 doublepath (-4,-3)..tension 2..(-2,-2.7); +addto e5 doublepath p~5 shifted (0,4) scaled 3 dashed e4 withpen qq; +show llcorner e5; verbatimtex \font\tra=trapf at 10pt + \font\trb=trapf at 20pt % TeX comment only!" etex +e6:=nullpicture; addto e6 doublepath (0,0)..(30,0) dashed makepath pencircle +dashed e5 withpen pencircle scaled2 dashed e5shifted(0,-11) +withpen pencircle; show e6; def -- = {curl1}..{curl1}enddef; +p~7 := p~8 rotated 90 xscaled -1 .. cycle; linecap:=2; linejoin:=1; +e6=nullpicture; addto e6 doublepath p~8 dashed e5 withpen pencircle; +clip e6 to p~7; addto e6 also btex \tra Aqua \vrule\trb Brass etex + shifted(0,-2); addto e6 doublepath (1,0)..(2,1); addto e5 also + e6 withcolor .5*(1,1,1) dashed e4 withpen pencircle xscaled 2 rotated 45; +addto e5 also btex \tra mast etex shifted(0,10); +show e6, lrcorner e5, ulcorner e5; charcode:=200; shipout e5; +showstats; e5:=e6:="curb"infont"trapf" slanted-.5 scaled-1; showstats; +show penoffset(0,0)of pencircle, llcorner e5, urcorner e5; +e5:=e5 rotated 90 shifted "oops"; show llcorner e5, urcorner e5; +show urcorner (char220 infont "trapf"), makepath qq; +show subpath(-2,-1)of p~8, subpath(9,10)of makepath pencircle; +"hi" infont "qw99z"; special "ij"="ij"; show substring(-2,-1)of"abc"; +addto e5 contour [[ ]]; addto e5 contour true; pausing:=0;prologues:=1; +charcode:=197; shipout e5; p~10=(0,0){1,1.01}..tension atleast 1..{1,0} +(1,1){-1,1}..(2,0){1,-1}; prologues:=0; for d=(-1,1),(1,-1),(0,0): +show directiontime d of p~10; endfor linejoin:=linecap:=1; +e5:=nullpicture; addto e5 contour makepath(pencircle scaled 10) +withpen pencircle shifted(2,0); addto e5 doublepath (0,0)..(12,0) +withpen pencircle yscaled 3; charcode:=148; shipout e5; +e5:=nullpicture; clip p~8 to; clip e5 to e4; clip e5 to p~8; clip e5 to p~7; +addto e5 doublepath makepath(pencircle scaled 50) withpen qq; +addto e5 doublepath p~8 withpen pencircle xscaled 2 dashed e4; +addto e5 doublepath p~8 withpen pencircle dashed e4; +addto e5 doublepath p~8 shifted (10,0) dashed e4 scaled 1 withpen pencircle; +charcode:=149; shipout e5; addto 3; addto p~8 contour p~7; +e5:=nullpicture; linecap:=2; linejoin:=0; miterlimit:=10; +addto e5 contour (10,5)..cycle withpen qq; +addto e5 doublepath (5,10)..(5,15) withpen qq; +addto e5 doublepath (0,0)..controls(10,10)..(10,10)..(0,20){curl1}..(30,10) +withpen makepen((0,-5)..(0,5)..cycle); charcode:=150; prologues:=1; shipout e5; +for @=angle(sqrt$,mlog$):charext:=uniformdeviate$;charht:=2048; +addto e3 contour (0,-100)..tension 500..(100,-99)..tension 3000..cycle; +tracingoutput:=@; special "bye"; charcode:=151; shipout e3; +interim char 99 = "c"; true=false; show penoffset (2,1) of qq; +showstats; let f=faz; showtoken f; showstats; +e17=nullpicture; addto e17 doublepath (-4,-5)..(6,5); +setbounds e17 to makepath(pencircle scaled 9); show llcorner e17, urcorner e17; +addto e5 also e17 shifted (-5,-5); show llcorner e5; truecorners:=2; +show llcorner e5; truecorners:=-1; +setbounds e17 to makepath(pencircle xscaled 19); +addto e5 also e17 shifted(-5,-10); show llcorner e5, e5, urcorner pencircle; +e5:=nullpicture; path ap[]; +ap1=makepath(pencircle scaled 100); +ap2=(2,-14)..controls (14,-7) and (14,7)..(2,14); +ap3=(-50,0)..controls (-50,0) .. (50,0); +show arclength (ap2 scaled 1000), arclength(ap3 scaled 200); +show arclength ap1, arclength ap2; +show arctime 6.4 of ap3, arclength subpath(0,arctime 37 of ap3) of ap3; +show arctime -1000 of ap1, arctime -3 of ap2, arctime314 of (ap1 scaled .00001); +[[clear(tracingcommands); charcode:=ASCII char 269-13; shipout nullpicture; +"careful" quote for for = @ step 200 until 2*2600: &" METAFONT" endfor;]]; +scrollmode; "hello again"&char31; save p; +def f expr x=let )=]; let [=(; show _ enddef; begingroup tracingonline:=1; +tracingonline:=1; f xx[1); showdependencies; qq:=q; showstats; bye endtext +% things not tested: +% interaction (error insertion/deletion, interrupts, \pausing, files not there) +% date, time; initialization of random number generator without randomseed +% system-dependent parsing of file names, areas, extensions +% certain error messages, especially fatal ones +% things that can't happen in INIMP +% unusual cases of fixed-point arithmetic +% certain other unusual cases, especially when something similar is tested +% most events that trigger string pool compaction |