diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2006-11-21 09:52:16 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2006-11-21 09:52:16 +0000 |
commit | 394787d539d045d9723e9aa8ec34531bda5cfab8 (patch) | |
tree | 254e870e890933f508eedfc558090864f60c5a4c /Master/texmf-dist/metapost | |
parent | 44c390272b38ef308e688d9533c7c3abae77d074 (diff) |
metapost lib files for 0.99
git-svn-id: svn://tug.org/texlive/trunk@2487 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r-- | Master/texmf-dist/metapost/base/TEX.mp | 18 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/base/boxes.mp | 33 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/base/format.mp | 17 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/base/graph.mp | 31 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/base/mfplain.mp | 10 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/base/mpost.mp | 7 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/base/plain.mp | 11 |
7 files changed, 103 insertions, 24 deletions
diff --git a/Master/texmf-dist/metapost/base/TEX.mp b/Master/texmf-dist/metapost/base/TEX.mp index 06a0b451f4f..8841d3eb07e 100644 --- a/Master/texmf-dist/metapost/base/TEX.mp +++ b/Master/texmf-dist/metapost/base/TEX.mp @@ -1,9 +1,27 @@ +% $Id: TEX.mp,v 1.5 2005/03/19 20:16:08 taco Exp $ +% Public domain. % This file defines TEX <string_primary> to return the picture % resulting from running the string through tex. It is slow, % but more general than the standard btex..etex construction +% +% New in this version (1.4), for metapost 0.9: +% support of pre- and post TeX texts. + +string preverbatimtex_, postverbatimtex_; + +vardef TEXPRE text s = preverbatimtex_ := s; enddef; + +vardef TEXPOST text s = postverbatimtex_ := s; enddef; vardef TEX primary s = + if known preverbatimtex_: + write "verbatimtex "&preverbatimtex_&" etex" to "mptextmp.mp"; + fi write "btex "&s&" etex" to "mptextmp.mp"; + if known postverbatimtex_: + write "verbatimtex "&postverbatimtex_&" etex" to "mptextmp.mp"; + fi write EOF to "mptextmp.mp"; scantokens "input mptextmp" enddef; + diff --git a/Master/texmf-dist/metapost/base/boxes.mp b/Master/texmf-dist/metapost/base/boxes.mp index 4ba1a6d2a45..7a70c7b6f14 100644 --- a/Master/texmf-dist/metapost/base/boxes.mp +++ b/Master/texmf-dist/metapost/base/boxes.mp @@ -1,3 +1,6 @@ +% $Id: boxes.mp,v 1.5 2005/02/25 11:28:56 taco Exp $ +% Public domain. + % Macros for boxes @@ -16,8 +19,12 @@ enddef; % Take a string returned by the str operator and return the same string % with explicit numeric subscripts replaced by generic subscript symbols []. -vardef generisize(expr ss) = - save res, s, l; string res, s; +% +% This new version makes sure that variables with '[[' in them are treated +% correctly. + +vardef generisize (expr ss) = + save res, s, stest, l; string res, s, stest; res = ""; % result so far s = ss; % left to process forever: exitif s=""; @@ -25,17 +32,25 @@ vardef generisize(expr ss) = res := res & substring (0,l) of s; s := substring (l,infinity) of s; if s<>"": - res := res & "[]"; - l := if s>="[": 1 + str_prefix(s, c<>"]") - else: str_prefix(s, (c=".") or ("0"<=c) and (c<="9")) - fi; + if s>="[": + stest := substring (0,1) of s; + if stest="[": + l := 1; + res := res & "["; + else: + l := 1 + str_prefix(s, c<>"]"); + res := res & "[]"; + fi + else: + res := res & "[]"; + l := str_prefix(s, (c=".") or ("0"<=c) and (c<="9")); + fi s := substring(l,infinity) of s; fi endfor res enddef; - % Make sure the string _n_gen_ is generisize(_n_): vardef set_n_gen_ = if _n_ <> _n_cur_: @@ -88,7 +103,7 @@ def beginbox_(expr pp,sp)(suffix $)(text t) = generic_declare(string) pproc_._n, sproc_._n; generic_declare(picture) pic_._n; pproc_$:=pp; sproc_$:=sp; - pic_$ = nullpicture; + pic_$ := nullpicture; for _p_=t: pic_$:= if picture _p_: _p_ @@ -119,7 +134,7 @@ enddef; extra_beginfig := extra_beginfig & "boxjoin();save pic_,sproc_,pproc_;def clearboxes=enddef;"; -extra_endfig := extra_endfig & "clearboxes"; +extra_endfig := extra_endfig & "clearboxes;"; % Given a list of box names, give whatever default values are necessary diff --git a/Master/texmf-dist/metapost/base/format.mp b/Master/texmf-dist/metapost/base/format.mp index 6a636c62ad9..84e4376a44e 100644 --- a/Master/texmf-dist/metapost/base/format.mp +++ b/Master/texmf-dist/metapost/base/format.mp @@ -1,3 +1,6 @@ +% $Id: format.mp,v 1.2 2004/09/19 21:47:10 karl Exp $ +% Public domain. + % Macros for generating typeset pictures of computed numbers % format(f,x) typeset generalized number x using format string f @@ -89,11 +92,15 @@ vardef Fsci_o_(expr x, e) = enddef; -% Assume prologues=1 implies troff mode. TeX users who what prologues on -% should use some other positive value. The mpx file mechanism requires -% separate input files here. -if prologues=1: input troffnum -else: input texnum +% Assume troffmode=1 implies troff mode. This internal is present +% since version 0.99, and should be set in the change file. +% As a default, fall back to the previous 'prologues=1' test. +% The mpx file mechanism requires separate input files here. +if troffmode=1: input troffnum +else: + if prologues=1: input troffnum + else: input texnum + fi fi diff --git a/Master/texmf-dist/metapost/base/graph.mp b/Master/texmf-dist/metapost/base/graph.mp index de3ee74c087..5f8286e1e86 100644 --- a/Master/texmf-dist/metapost/base/graph.mp +++ b/Master/texmf-dist/metapost/base/graph.mp @@ -1,3 +1,6 @@ +% $Id: graph.mp,v 1.2 2004/09/19 21:47:10 karl Exp $ +% Public domain. + % Macros for drawing graphs % begingraph(width,height) begin a new graph @@ -153,7 +156,7 @@ enddef; % Pair o is the value of p that makes tp (0,0). This implements the trick % whereby using 1 instead of 0 for th the width or height or the setbounds path % for a label picture supresses shifting in x or y. -vardef Gpconv_@#(expr q, o)(text tp) = +vardef old_Gpconv_@#(expr q, o)(text tp) = save p; if stroked q: path p; p=pathpart q; @@ -168,6 +171,32 @@ vardef Gpconv_@#(expr q, o)(text tp) = addto @# also q shifted ((tp)-llcorner q); fi enddef; +% TH: new version from code found at sarovar tracker. This makes +% grdaw clip the result to the window defined with setrange +vardef Gpconv_@#(expr q, o)(text tp) = + save p, tp_geclipt; + picture tp_geclipt; tp_geclipt:=nullpicture; + if stroked q: + path p; p=pathpart q; + %%% --- SDV added + addto tp_geclipt doublepath tp Gwithpc_(q) dashed dashpart q; + clip tp_geclipt to origin--(xpart Z_.gdim,0)--Z_.gdim--(0, ypart Z_.gdim)--cycle; + addto @# also tp_geclipt; + %%% + %%% --- SDV deleted + %%addto @# doublepath tp Gwithpc_(q) dashed dashpart q; + %%% + elseif filled q: + path p; p=pathpart q; + addto @# contour tp Gwithpc_(q); + else: + interim truecorners:=0; + pair p; p=llcorner q; + if urcorner q<>p: p:=p+Gcmul_(o-p,urcorner q-p); fi + addto @# also q shifted ((tp)-llcorner q); + fi +enddef; + def Gcmul_(expr a,b) = (xpart a*xpart b, ypart a*ypart b) enddef; diff --git a/Master/texmf-dist/metapost/base/mfplain.mp b/Master/texmf-dist/metapost/base/mfplain.mp index 3ef191f0c34..74e1867589d 100644 --- a/Master/texmf-dist/metapost/base/mfplain.mp +++ b/Master/texmf-dist/metapost/base/mfplain.mp @@ -1,6 +1,9 @@ +% $Id: mfplain.mp,v 1.9 2005/04/28 06:45:21 taco Exp $ +% Public domain. + % This is the plain MetaPost base that's look like what's described % in The METAFONTbook. -string base_name, base_version; base_name="mfplain"; base_version="0.62"; +string base_name, base_version; base_name="mfplain"; base_version="0.99"; message "Preloading the plain base, version "&base_version&": preliminaries,"; @@ -21,7 +24,7 @@ tracinglostchars:=1; smoothing:=1; autorounding:=2; % These are ignored by MetaPost turningcheck:=1; granularity:=1; -def gobble primary g = enddef; +def gobble primary g = enddef; def killtext text t = enddef; primarydef g gobbled gg = enddef; def hide(text t) = exitif numeric begingroup t;endgroup; enddef; def ??? = hide(interim showstopping:=1; showdependencies) enddef; @@ -438,7 +441,7 @@ defaultscale := 1; labeloffset := 3; vardef makelabel@#(expr s,z) = % puts string s near point z - picture p; + save p; picture p; if known z: p = s infont defaultfont scaled (defaultscale/bp_per_pixel); draw p shifted (z t_ + labeloffset/bp_per_pixel*laboff@# - @@ -562,6 +565,7 @@ def shipit = (identity shifted (xoffset,yoffset) scaled bp_per_pixel) fi enddef; +def cull text t = enddef; def cullit = enddef; newinternal xoffset, yoffset; diff --git a/Master/texmf-dist/metapost/base/mpost.mp b/Master/texmf-dist/metapost/base/mpost.mp index 949e5bd0540..616f5ecffc5 100644 --- a/Master/texmf-dist/metapost/base/mpost.mp +++ b/Master/texmf-dist/metapost/base/mpost.mp @@ -1,2 +1,5 @@ -\input plain -\dump +% $Id: mpost.mp,v 1.1 2005/05/06 09:11:09 taco Exp $ +% Public domain. + +input plain; +dump diff --git a/Master/texmf-dist/metapost/base/plain.mp b/Master/texmf-dist/metapost/base/plain.mp index bc0db8a57c1..52774f6fc67 100644 --- a/Master/texmf-dist/metapost/base/plain.mp +++ b/Master/texmf-dist/metapost/base/plain.mp @@ -1,8 +1,11 @@ +% $Id: plain.mp,v 1.3 2005/04/28 06:45:21 taco Exp $ +% Public domain. + % This file gives the macros for plain MetaPost % It contains all the features of plain METAFONT except those specific to % font-making. (See The METAFONTbook by D.E. Knuth). % There are also a number of macros for labeling figures, etc. -string base_name, base_version; base_name="plain"; base_version="0.64"; +string base_name, base_version; base_name="plain"; base_version="0.99"; message "Preloading the plain mem file, version "&base_version; @@ -473,10 +476,10 @@ enddef; def label = draw thelabel enddef; newinternal dotlabeldiam; dotlabeldiam:=3bp; -vardef dotlabel@#(expr s,z) = - label@#(s,z); +vardef dotlabel@#(expr s,z) text t_ = + label@#(s,z) t_; interim linecap:=rounded; - draw z withpen pencircle scaled dotlabeldiam; + draw z withpen pencircle scaled dotlabeldiam t_; enddef; def makelabel = dotlabel enddef; |