On 8/23/2013 11:42 AM, Marco Patzer wrote:
Hi,
what is the reason the label direction prefix variables (rt, bot, llft, etc.) are prefixed with mpfun_ in MkIV (mp-mlib.mpiv)? When new directional prefixes are being defined it fails when mplib is used unless the mpfun_ prefix is added. And likewise, code using the mpfun_ prefix fails on traditional MetaPost.
So is anyone using mkiv still using MkII?
Is this prefix required? It breaks old code and required a branch in every new project. And I don't really see a reason for this incompatibility. Here is an example defining a new direction “foo”:
The MpIV code has namespace protection. Why run traditional in MkIV?
\starttext \startMPcode label("first", origin);
%% MkIV %% pair mfun_laboff.foo ; mfun_laboff.foo := (.5,-1) ; %% mfun_labxf.foo := mfun_labyf.foo := 1 ;
%% MkII pair laboff.foo ; laboff.foo := (.5,-1) ; labxf.foo := labyf.foo := 1 ;
label.foo("second", origin); \stopMPcode \stoptext
I wasn't aware of users defining extra ones. I'll add this: \starttext \startMPcode label("first", origin); if known mfun_laboff : vardef installlabel@\# (expr type, x, y, offset) = numeric mfun_labtype @\# ; mfun_labtype @\# := type ; pair mfun_laboff @\# ; mfun_laboff @\# := offset ; numeric mfun_labxf @\# ; mfun_labxf @\# := x ; numeric mfun_labyf @\# ; mfun_labyf @\# := y ; enddef ; else : vardef installlabel@\# (expr type, x, y, offset) = numeric labtype @\# ; labtype @\# := type ; pair laboff @\# ; laboff @\# := offset ; numeric labxf @\# ; labxf @\# := x ; numeric labyf @\# ; labyf @\# := y ; enddef ; fi ; installlabel.foo ( 0, 1, 1, (.5,-1) ) ; label.foo("second", origin); \stopMPcode \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------