From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: MetaPost label direction prefix
Date: Fri, 23 Aug 2013 14:48:49 +0200 [thread overview]
Message-ID: <52175A31.5050601@wxs.nl> (raw)
In-Reply-To: <20130823094203.GG18239@homerow>
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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2013-08-23 12:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-23 9:42 Marco Patzer
2013-08-23 12:48 ` Hans Hagen [this message]
2013-08-23 13:14 ` Marco Patzer
2013-08-24 0:28 ` Hans Hagen
2013-08-24 12:31 ` Marco Patzer
2013-08-25 11:49 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52175A31.5050601@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).