From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/82501 Path: news.gmane.org!not-for-mail From: "Keith J. Schultz" Newsgroups: gmane.comp.tex.context Subject: Re: MPLibrabray "txt" broken!? Date: Wed, 15 May 2013 12:15:56 +0200 Message-ID: References: <5D530638-CD82-4756-A842-7CFA967D3008@web.de> <51927AF9.8010101@wxs.nl> <98E44392-CC37-4045-B06E-649C5E09FA13@web.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Content-Type: multipart/mixed; boundary="===============1424346264==" X-Trace: ger.gmane.org 1368612978 17634 80.91.229.3 (15 May 2013 10:16:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 May 2013 10:16:18 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed May 15 12:16:19 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UcYks-0008Cv-Fo for gctc-ntg-context-518@m.gmane.org; Wed, 15 May 2013 12:16:18 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AEC90101E0; Wed, 15 May 2013 12:16:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id XsfQtzWEiy2J; Wed, 15 May 2013 12:16:13 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 2F124101E4; Wed, 15 May 2013 12:16:13 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E9F13101E4 for ; Wed, 15 May 2013 12:16:11 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ZOpZaN6TuVa5 for ; Wed, 15 May 2013 12:16:10 +0200 (CEST) Original-Received: from filter5-til.mf.surf.net (filter5-til.mf.surf.net [194.171.167.221]) by balder.ntg.nl (Postfix) with ESMTP id BEA7E101E0 for ; Wed, 15 May 2013 12:16:00 +0200 (CEST) Original-Received: from mout.web.de (mout.web.de [212.227.15.3]) by filter5-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r4FAFxbw007791 for ; Wed, 15 May 2013 12:15:59 +0200 Original-Received: from [10.0.62.5] ([84.58.236.75]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0MWAwH-1V0PGG2x6f-00XrCa for ; Wed, 15 May 2013 12:15:59 +0200 In-Reply-To: <98E44392-CC37-4045-B06E-649C5E09FA13@web.de> X-Mailer: Apple Mail (2.1503) X-Provags-ID: V02:K0:jSdC0PoYQb+5mRkXWxrcCHO400Vw0C+0I0fgK4XMRlx CofRH+lmfP35IaOT63cvg+Ra5ziUbMEZOI+pmZI9KSEk+xHHcK J00fszuxwaluaJw2kRtw3eDwt2XPnEQ9yJUEz2wo0GVDYIco9F tOE8M9W8IvhGWgnyUY2xB5+wNqDYzJxmDXuWeRaLWuXZxuV99n QOLL7e1xp0oA4ARO0HfIg== X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=212.227.15.3; country=DE; latitude=51.0000; longitude=9.0000; http://maps.google.com/maps?q=51.0000,9.0000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0WJAafXVu - 62292bebae26 - 20130515 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.221 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:82501 Archived-At: --===============1424346264== Content-Type: multipart/alternative; boundary="Apple-Mail=_471828F9-1420-4284-87CA-7D79E565C045" --Apple-Mail=_471828F9-1420-4284-87CA-7D79E565C045 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi Hans, Everybody, Am 15.05.2013 um 09:36 schrieb "Keith J. Schultz" = : > Hi Hans, >=20 > Am 14.05.2013 um 19:57 schrieb Hans Hagen : >=20 >>=20 [snip, snip] >> some kind of initialization issue .. i uploaded a fix (crossed = fingers) >=20 > Well, the fix work in a way , yet it has introduced a new = problem, > or revealed an unnoticed one. > =09 > The text is now display in the shape, yet there is no drawing = preformed! > The draw of the path is no preformed. > It is even worst. Metapost seems to be doing no drawing at all, = even in over > overlays! The all are related to a similar error : > metapost > initializing number mode 'scaled' > metapost > output file 'mpout.log', mode 'w', ftype 'log' > metapost > output file 'test2-mpgraph.mpd', mode 'w', ftype 0 > metapost > output file 'test2-mpgraph.mpd', mode 'w', ftype 0 > metapost > error: = (/Users/quayjay/context/tex/texmf-context/metapost/context/base/mp-text.mp= iv) >=20 >=20 >=20 > >> PageFraction > >> false > ! Equation cannot be performed (numeric=3Dboolean). > =20 > : > <*> ...0pt; VSize:=3D597.51323pt; PageFraction:=3D0>1: > (1-1)/(0-1)else:1fi; = defau... I believe the source of this is in meta-ini.mkiv: \startMPinitializations PageFraction:=3D\lastpage>1:(\realfolio-1)/(\lastpage-1)else:1fi; \stopMPinitializations Should this not be: \startMPinitializations PageFraction:=3Dif \lastpage>1:(\realfolio-1)/(\lastpage-1)else:1fi; \stopMPinitializations O.K. just rebuilt formats! Works. Attaching new meta-ini.mkiv Thanx! reagrds Keith. --Apple-Mail=_471828F9-1420-4284-87CA-7D79E565C045 Content-Type: multipart/mixed; boundary="Apple-Mail=_64C129EB-4489-4F84-BE58-46A5D60D5C2B" --Apple-Mail=_64C129EB-4489-4F84-BE58-46A5D60D5C2B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Hi = Hans, Everybody,

Am 15.05.2013 um 09:36 schrieb "Keith = J. Schultz" <keithjschultz@web.de>:
Hi Hans,

Am = 14.05.2013 um 19:57 schrieb Hans Hagen <pragma@wxs.nl>:


[snip, = snip]
some kind of initialization issue = .. i uploaded a fix (crossed = fingers)

Well, the = fix work in a way , yet it has introduced a new = problem,
or revealed an unnoticed = one.
=
The text is now display in the = shape, yet there is no drawing preformed!
The draw = of the path is no preformed.
It is even worst. Metapost seems = to be doing no drawing at all, even in over
overlays! = The all are related to a similar error :
metapost  =       > initializing number mode 'scaled'
metapost        = > output file 'test2-mpgraph.mpd', mode 'w', ftype 0
metapost    =     > error: = (/Users/quayjay/context/tex/texmf-context/metapost/context/base/mp-text.mp= iv)


>> = PageFraction
>> false
     =               :
    =                     =                     =       (1-1)/(0-1)else:1fi; = defau...

I believe the = source of this is in = meta-ini.mkiv:
\startMPinitializations
  =   = PageFraction:=3D\lastpage>1:(\realfolio-1)/(\lastpage-1)else:1fi;
=
\stopMPinitializations

Should this = not be:
\startMPinitializations
  =   PageFraction:=3Dif = \lastpage>1:(\realfolio-1)/(\lastpage-1)else:1fi;
\stopMPinit= ializations

O.K. just rebuilt = formats!

Works.

Attachin= g new = meta-ini.mkiv

Thanx!

rea= grds
= Keith.

= --Apple-Mail=_64C129EB-4489-4F84-BE58-46A5D60D5C2B Content-Disposition: attachment; filename=meta-ini.mkiv Content-Type: application/octet-stream; name="meta-ini.mkiv" Content-Transfer-Encoding: quoted-printable %D=20\module=0A%D=20=20=20[=20=20=20=20=20=20=20file=3Dmeta-ini,=0A%D=20=20= =20=20=20=20=20=20version=3D2008.03.25,=0A%D=20=20=20=20=20=20=20=20=20=20= title=3D\METAPOST\=20Graphics,=0A%D=20=20=20=20=20=20=20= subtitle=3DInitialization,=0A%D=20=20=20=20=20=20=20=20=20author=3DHans=20= Hagen,=0A%D=20=20=20=20=20=20=20=20=20=20=20date=3D\=20currentdate,=0A%D=20= =20=20=20=20=20copyright=3D{PRAGMA=20ADE=20\&=20\CONTEXT\=20Development=20= Team}]=0A%C=0A%C=20This=20module=20is=20part=20of=20the=20\CONTEXT\=20= macro||package=20and=20is=0A%C=20therefore=20copyrighted=20by=20\PRAGMA.=20= See=20mreadme.pdf=20for=0A%C=20details.=0A=0A%=20initializations:=0A%=0A= %=20-=20pass=20settings=20from=20tex=20to=20mp=20(delayed=20expansion)=0A= %=20-=20used=20by=20context=20core=20(and=20modules)=0A%=20-=20= cummulative=20definitions=0A%=20-=20flushed=20each=20graphic=0A%=20-=20= can=20be=20disabled=20per=20instance=0A%=20-=20managed=20at=20the=20tex=20= end=0A%=0A%=20extensions:=0A%=0A%=20-=20add=20mp=20functionality=20= (immediate=20expansion)=0A%=20-=20cummulative=0A%=20-=20all=20instances=20= or=20subset=20of=20instances=0A%=20-=20can=20be=20disabled=20per=20= instance=0A%=20-=20managed=20at=20the=20lua/mp=20end=0A%=20-=20could=20= be=20managed=20at=20the=20tex=20end=20but=20no=20real=20reason=20and=20= also=20messy=0A%=0A%=20definitions:=0A%=0A%=20-=20add=20mp=20= functionality=20(delayed=20expansion)=0A%=20-=20cummulative=0A%=20-=20= per=20instance=0A%=20-=20managed=20at=20the=20tex=20end=0A%=0A%=20= inclusions:=0A%=0A%=20-=20add=20mp=20functionality=20(delayed=20= expansion)=0A%=20-=20cummulative=20only=20when=20[+]=0A%=20-=20per=20= instance=0A%=20-=20managed=20at=20the=20tex=20end=0A%=0A%=20order=20of=20= execution:=0A%=0A%=20=20=20definitions=0A%=20=20=20extensions=0A%=20=20=20= inclusions=0A%=20=20=20beginfig=0A%=20=20=20=20=20initializations=0A%=20=20= =20=20=20graphic=0A%=20=20=20endfig=0A=0A%=20The=20instance=20will=20be=20= implemented=20stepwise=20...=20I=20should=20redo=20some=20code=20in=20= order=20to=0A%=20make=20the=20macros=20look=20better=20than=20they=20do=20= now.=0A=0A\writestatus{loading}{MetaPost=20Graphics=20/=20= Initializations}=0A=0A\registerctxluafile{meta-ini}{1.001}=0A=0A= \unprotect=0A=0A\newtoks=20\everyMPgraphic=20=20=20=20=20=20=20=20=20=20= %=20mp=20%=20public=20or=20not=20?=0A=0A\appendtoks=0A=20=20=20=20= \restoreendofline=20%=20see=20interferences-001.tex=0A\to=20= \everyMPgraphic=0A=0A\def\MPruntimefile=20=20=20=20{mprun}=0A= \def\currentMPformat=20=20{metafun}=0A\def\defaultMPinstance{metafun}=0A=0A= %installcorenamespace{graphicvariable}=20%=20todo=0A= \installcorenamespace{mpinstance}=0A\installcorenamespace{mpinclusions}=0A= \installcorenamespace{mpdefinitions}=0A\installcorenamespace{mpgraphic}=0A= \installcorenamespace{mpstaticgraphic}=0A\installcorenamespace{mpclip}=0A= =0A\newtoks=20\t_meta_initializations=20=20%=20tex,=20each=0A\def=20=20=20= =20=20\t_meta_inclusions=20=20=20=20=20{\csname\??mpinclusions=20= \currentMPinstance\endcsname}=20%=20token=20register=0A\def=20=20=20=20=20= \t_meta_definitions=20=20=20=20= {\csname\??mpdefinitions\currentMPinstance\endcsname}=20%=20token=20= register=0A=0A%=20The=20next=20command=20is,=20of=20course,=20dedicated=20= to=20Mojca,=20who=0A%=20needs=20it=20for=20gnuplot.=20Anyway,=20the=20= whole=20multiple=20engine=0A%=20mechanism=20is=20to=20keep=20her=20= gnuplot=20from=20interfering.=0A=0A\unexpanded\def\startMPdefinitions=0A=20= =20{\dosinglegroupempty\meta_start_definitions}=0A=0A= \def\meta_start_definitions#1#2\stopMPdefinitions=0A=20=20= {\let\m_meta_saved_instance\currentMPinstance=0A=20=20=20= \edef\currentMPinstance{#1}%=0A=20=20=20\ifx\currentMPinstance\empty=0A=20= =20=20=20=20\let\currentMPinstance\defaultMPinstance=0A=20=20=20\fi=0A=20= =20=20\global\t_meta_definitions\expandafter{\the\t_meta_definitions#2}%=0A= =20=20=20\let\currentMPinstance\m_meta_saved_instance}=0A=0A= \let\stopMPdefinitions\relax=0A=0A\unexpanded\def\startMPextensions=0A=20= =20{\dosinglegroupempty\meta_start_extensions}=0A=0A= \def\meta_start_extensions#1#2\stopMPextensions=20%=20we=20could=20use=20= buffers=20instead=0A=20=20= {\ctxlua{metapost.setextensions("#1",\!!bs#2\!!es)}}=0A=0A= \let\stopMPextensions\relax=0A=0A= \unexpanded\def\startMPinitializations#1\stopMPinitializations=20%=20for=20= all=20instances,=20when=20enabled=0A=20=20= {\global\t_meta_initializations\expandafter{\the\t_meta_initializations#1}= }=0A=0A\let\stopMPinitializations\relax=0A=0A= \unexpanded\def\startMPinclusions=0A=20=20= {\dosingleempty\meta_start_inclusions}=0A=0A= \unexpanded\def\meta_start_inclusions[#1]%=0A=20=20= {\edef\m_meta_option{#1}%=0A=20=20=20= \dosinglegroupempty\meta_start_inclusions_indeed}=0A=0A= \def\meta_start_inclusions_indeed#1#2\stopMPinclusions=0A=20=20= {\let\m_meta_saved_instance\currentMPinstance=0A=20=20=20= \edef\currentMPinstance{#1}%=0A=20=20=20\ifx\currentMPinstance\empty=0A=20= =20=20=20=20\let\currentMPinstance\defaultMPinstance=0A=20=20=20\fi=0A=20= =20=20\ifx\m_meta_option\!!plustoken=20\else=0A=20=20=20=20=20= \global\t_meta_inclusions\emptytoks=0A=20=20=20\fi=0A=20=20=20= \global\t_meta_inclusions\expandafter{\the\t_meta_inclusions#2}%=0A=20=20= =20\let\currentMPinstance\m_meta_saved_instance}=0A=0A= \let\stopMPinclusions\relax=0A=0A\unexpanded\def\MPinclusions=0A=20=20= {\dosingleempty\meta_inclusions}=0A=0A\def\meta_inclusions[#1]%=0A=20=20= {\edef\m_meta_option{#1}%=0A=20=20=20= \dosinglegroupempty\meta_inclusions_indeed}=0A=0A= \def\meta_inclusions_indeed#1#2%=0A=20=20= {\let\m_meta_saved_instance\currentMPinstance=0A=20=20=20= \edef\currentMPinstance{#1}%=0A=20=20=20\ifx\currentMPinstance\empty=0A=20= =20=20=20=20\let\currentMPinstance\defaultMPinstance=0A=20=20=20\fi=0A=20= =20=20\ifx\m_meta_option\!!plustoken=20\else=0A=20=20=20=20=20= \global\t_meta_inclusions\emptytoks=0A=20=20=20\fi=0A=20=20=20= \global\t_meta_inclusions\expandafter{\the\t_meta_inclusions#2}%=0A=20=20= =20\let\currentMPinstance\m_meta_saved_instance}=0A=0A= \def\meta_preset_definitions=0A=20=20{\edef\overlaywidth=20=20=20=20= {\overlaywidth=20=20=20=20\space}%=0A=20=20=20\edef\overlayheight=20=20=20= {\overlayheight=20=20=20\space}%=0A=20=20=20= \edef\overlaylinewidth{\overlaylinewidth\space}%=0A=20=20=20= \edef\currentwidth=20=20=20=20{\the\hsize=20=20=20=20=20=20=20\space}%=0A= =20=20=20\edef\currentheight=20=20=20{\the\vsize=20=20=20=20=20=20=20= \space}}=0A=0A\installcommandhandler=20\??mpinstance=20{MPinstance}=20= \??mpinstance=0A=0A\setupMPinstance=0A=20=20[\s!format=3Dmetafun,=0A=20=20= =20\s!extensions=3D\v!no,=0A=20=20=20\s!initializations=3D\v!no,=0A=20=20= =20\c!method=3D\s!default,=0A=20=20=20\c!textstyle=3D,=0A=20=20=20= \c!textcolor=3D]=0A=0A\appendtoks=0A=20=20=20=20= \ifcsname\??mpdefinitions\currentMPinstance\endcsname=20\else=0A=20=20=20= =20=20=20=20=20= \expandafter\newtoks\csname\??mpdefinitions\currentMPinstance\endcsname=0A= =20=20=20=20\fi=0A=20=20=20=20= \ifcsname\??mpinclusions\currentMPinstance\endcsname=20\else=0A=20=20=20=20= =20=20=20=20= \expandafter\newtoks\csname\??mpinclusions\currentMPinstance\endcsname=0A= =20=20=20=20\fi=0A=20=20=20=20\t_meta_definitions\emptytoks=20%=20in=20= case=20we=20redefine=0A=20=20=20=20\t_meta_inclusions=20\emptytoks=20%=20= in=20case=20we=20redefine=0A\to=20\everydefineMPinstance=0A=0A= \unexpanded\def\resetMPinstance[#1]%=0A=20=20= {\writestatus\m!metapost{reset=20will=20be=20implemented=20when=20= needed}}=0A=0A\def\meta_analyze_graphicname[#1]%=0A=20= %{\normalexpanded{\meta_analyze_graphicname_indeed[#1::::]}}=0A=20=20= {\normalexpanded{\meta_analyze_graphicname_indeed[#1}::::]}=0A=0A= \unexpanded\def\meta_analyze_graphicname_indeed[#1::#2::#3]%=20instance=20= ::=0A=20=20{\edef\currentMPgraphicname{#2}%=0A=20=20=20= \ifx\currentMPgraphicname\empty=0A=20=20=20=20=20= \edef\currentMPgraphicname{#1}%=0A=20=20=20=20=20= \let\currentMPinstance\defaultMPinstance=0A=20=20=20= \else\ifcsname\??mpdefinitions#1\endcsname=0A=20=20=20=20=20= \edef\currentMPinstance{#1}%=0A=20=20=20\else=0A=20=20=20=20=20= \let\currentMPinstance\defaultMPinstance=0A=20=20=20\fi\fi=0A=20=20=20= \edef\currentMPformat{\MPinstanceparameter\s!format}}=0A=0A= \def\currentMPinstance{\defaultMPinstance}=0A\def\currentMPformat=20=20= {\currentMPinstance}=0A=0A\defineMPinstance[metafun]=20=20=20= [\s!format=3Dmetafun,\s!extensions=3D\v!yes,\s!initializations=3D\v!yes]=0A= \defineMPinstance[extrafun]=20=20= [\s!format=3Dmetafun,\s!extensions=3D\v!yes,\s!initializations=3D\v!yes]=0A= \defineMPinstance[doublefun]=20= [\s!format=3Dmetafun,\s!extensions=3D\v!yes,\s!initializations=3D\v!yes,\c= !method=3D\s!double]=0A= \defineMPinstance[decimalfun][\s!format=3Dmetafun,\s!extensions=3D\v!yes,\= s!initializations=3D\v!yes,\c!method=3D\s!decimal]=0A= \defineMPinstance[mprun]=20=20=20=20=20= [\s!format=3Dmetafun,\s!extensions=3D\v!yes,\s!initializations=3D\v!yes]=0A= \defineMPinstance[metapost]=20=20[\s!format=3Dmpost]=0A= \defineMPinstance[nofun]=20=20=20=20=20[\s!format=3Dmpost]=0A=0A= \newconditional\c_meta_include_initializations=0A=0A= \def\meta_begin_graphic_group#1%=0A=20=20{\begingroup=0A=20=20=20= \meta_analyze_graphicname[#1]}=0A=0A\def\meta_end_graphic_group=0A=20=20= {\endgroup}=0A=0A\def\MPaskedfigure{false}=0A=0A= \def\meta_flush_current_initializations=0A=20=20= {\ifconditional\c_meta_include_initializations=0A=20=20=20=20=20= \the\t_meta_initializations=0A=20=20=20\fi=0A=20=20=20\theMPrandomseed;}=0A= =0A\def\meta_flush_current_inclusions=0A=20=20{\the\t_meta_inclusions}=0A= =0A\def\meta_flush_current_definitions=0A=20=20{\the\t_meta_definitions}=0A= =0A\def\meta_start_current_graphic=0A=20=20{\begingroup=0A=20=20=20= \meta_enable_include=0A=20=20=20\the\everyMPgraphic=0A=20=20=20= \meta_preset_definitions=0A=20=20=20\setMPrandomseed=20%=20this=20has=20= to=20change=0A=20=20=20= \edef\p_initializations{\MPinstanceparameter\s!initializations}%=0A=20=20= =20\ifx\p_initializations\v!yes=0A=20=20=20=20=20\settrue=20= \c_meta_include_initializations=0A=20=20=20\else=0A=20=20=20=20=20= \setfalse\c_meta_include_initializations=0A=20=20=20\fi=0A=20=20=20= \edef\p_setups{\MPinstanceparameter\c!setups}%=0A=20=20=20= \ifx\p_setups\empty=20\else=0A=20=20=20=20=20\setups[\p_setups]%=0A=20=20= =20\fi=0A=20=20=20\useMPinstancestyleandcolor\c!textstyle\c!textcolor}=0A= =0A\def\meta_stop_current_graphic=0A=20=20= {\global\t_meta_definitions\emptytoks=0A=20=20=20= \global\t_meta_inclusions\emptytoks=0A=20=20=20\endgroup}=0A=0A= \def\meta_process_graphic_start=0A=20=20= {\setbox\b_meta_graphic\hbox\bgroup}=0A=0A\def\meta_process_graphic_stop=0A= =20=20{\egroup=0A=20=20=20\meta_place_graphic}=0A=0A= \unexpanded\def\meta_process_graphic_instance#1%=0A=20=20= {\edef\currentMPinstance{#1}%=0A=20=20=20\ifx\currentMPinstance\empty=0A=20= =20=20=20=20\let\currentMPinstance\defaultMPinstance=0A=20=20=20\fi=0A=20= =20=20\edef\currentMPformat{\MPinstanceparameter\s!format}%=0A=20=20=20= \meta_process_graphic}=0A=0A\unexpanded\def\meta_process_graphic#1%=20= todo:=20extensions=20and=20inclusions=20outside=20beginfig=0A=20=20= {\meta_start_current_graphic=0A=20=20=20\forgetall=0A=20=20=20= \edef\p_extensions{\MPinstanceparameter\s!extensions}%=0A=20=20=20= \meta_process_graphic_start=0A=20=20=20=20=20= \normalexpanded{\noexpand\ctxlua{metapost.graphic=20{=0A=20=20=20=20=20=20= =20instance=20=20=20=20=20=20=20=20=3D=20"\currentMPinstance",=0A=20=20=20= =20=20=20=20format=20=20=20=20=20=20=20=20=20=20=3D=20= "\currentMPformat",=0A=20=20=20=20=20=20=20data=20=20=20=20=20=20=20=20=20= =20=20=20=3D=20\!!bs#1;\!!es,=0A=20=20=20=20=20=20=20initializations=20=3D= =20\!!bs\meta_flush_current_initializations\!!es,=0A%=20=20=20=20=20=20= useextensions=20=20=20=3D=20"\MPinstanceparameter\s!extensions",=0A= \ifx\p_extensions\v!yes=0A=20=20=20=20=20=20=20extensions=20=20=20=20=20=20= =3D=20\!!bs\ctxcommand{getmpextensions("\currentMPinstance")}\!!es,=0A= \fi=0A=20=20=20=20=20=20=20inclusions=20=20=20=20=20=20=3D=20= \!!bs\meta_flush_current_inclusions\!!es,=0A=20=20=20=20=20=20=20= definitions=20=20=20=20=20=3D=20= \!!bs\meta_flush_current_definitions\!!es,=0A=20=20=20=20=20=20=20figure=20= =20=20=20=20=20=20=20=20=20=3D=20"\MPaskedfigure",=0A=20=20=20=20=20=20=20= method=20=20=20=20=20=20=20=20=20=20=3D=20= "\MPinstanceparameter\c!method",=0A=20=20=20=20=20}}}%=0A=20=20=20= \meta_process_graphic_stop=0A=20=20=20\meta_stop_current_graphic}=0A=0A= \let\meta_process_graphic_figure_start\relax=0A= \let\meta_process_graphic_figure_stop=20\relax=0A=0A= \unexpanded\def\processMPfigurefile#1%=20special=20case:=20obeys=20= beginfig=20..=20endfig=20and=20makes=20pages=0A=20=20{\begingroup=0A=20=20= =20\let\normal_meta_process_graphic_start\meta_process_graphic_start=0A=20= =20=20\let\normal_meta_process_graphic_stop=20\meta_process_graphic_stop=0A= =20=20=20\let\meta_process_graphic_start\relax=0A=20=20=20= \let\meta_process_graphic_stop=20\relax=0A=20=20=20= \def\meta_process_graphic_figure_start{\startTEXpage\normal_meta_process_g= raphic_start}%=0A=20=20=20\def\meta_process_graphic_figure_stop=20= {\normal_meta_process_graphic_stop\stopTEXpage}=0A=20=20=20= \def\MPaskedfigure{all}%=0A=20=20=20\meta_process_graphic{input=20"#1"=20= ;}%=0A=20=20=20\endgroup}=0A=0A\newif\ifsetMPrandomseed=20= \setMPrandomseedtrue=20%=20false=20by=20default=0A=0A= \def\setMPrandomseed=0A=20=20{\let\theMPrandomseed\empty=0A=20=20=20= \ifsetMPrandomseed=20\ifx\getrandomnumber\undefined=20\else=0A=20=20=20=20= =20\getrandomnumber\localMPseed\zerocount{4095}%=0A=20=20=20=20=20= \def\theMPrandomseed{randomseed:=3D\localMPseed}%=0A=20=20=20\fi\fi}=0A=0A= %D=20Calling=20up=20previously=20defined=20graphics.=0A=0A= \def\includeMPgraphic#1%=20gets=20expanded=20!=0A=20=20= {\ifcsname\??mpgraphic#1\endcsname=0A=20=20=20=20=20= \csname\??mpgraphic#1\endcsname=20;=20%=20;=20is=20safeguard=0A=20=20=20= \fi}=0A=0A\unexpanded\def\meta_enable_include=20%=20public=0A=20=20= {\let\meta_handle_use_graphic=20=20=20=20=20\thirdofthreearguments=0A=20=20= =20\let\meta_handle_reusable_graphic\thirdofthreearguments}=0A=0A%D=20= Drawings=20(stepwise=20built):=0A=0A\newif\ifMPdrawingdone=20= \MPdrawingdonefalse=0A=0A\unexpanded\def\finalizeMPdrawing=0A=20=20= {\MPdrawingdonetrue}=0A=0A\let\MPdrawingdata\empty=0A=0A= \unexpanded\def\resetMPdrawing=0A=20=20{\global\let\MPdrawingdata\empty=0A= =20=20=20\global\MPdrawingdonefalse}=0A=0A\unexpanded\def\pushMPdrawing=0A= =20=20{\globalpushmacro\MPdrawingdata=0A=20=20=20= \global\let\MPdrawingdata\empty}=0A=0A\unexpanded\def\popMPdrawing=0A=20=20= {\globalpopmacro\MPdrawingdata}=0A=0A\unexpanded\def\getMPdrawing=0A=20=20= {\ifMPdrawingdone=0A=20=20=20=20=20= \expandafter\meta_process_graphic\expandafter{\MPdrawingdata}%=20is=20= this=20expansion=20still=20needed?=0A=20=20=20\fi}=0A=0A= \def\startMPdrawing=0A=20=20{\dosingleempty\meta_start_drawing}=0A=0A= \def\meta_start_drawing[#1]#2\stopMPdrawing=0A=20=20{\relax=0A=20=20=20= \bgroup=0A=20=20=20\meta_enable_include=0A=20=20=20= \meta_preset_definitions=20%=20in=20case=20#2=20has=20measures=0A=20=20=20= \doifelse{#1}{-}{\convertargument#2\to\asciia}{\def\asciia{#2}}%=0A=20=20= =20\xdef\MPdrawingdata{\MPdrawingdata\asciia}%=0A=20=20=20\egroup}=0A=0A= \let\stopMPdrawing\relax=0A=0A\def\MPdrawing#1%=0A=20=20{\relax=0A=20=20=20= \bgroup=0A=20=20=20\meta_enable_include=0A=20=20=20= \meta_preset_definitions=0A=20=20=20= \xdef\MPdrawingdata{\MPdrawingdata#1}%=0A=20=20=20\egroup}=0A=0A= \unexpanded\def\startMPclip#1#2\stopMPclip=20%=20todo:=20store=20at=20= the=20lua=20end=20or=20just=20store=20less=0A=20=20= {\setgvalue{\??mpclip#1}{#2}}=0A=0A\let\stopMPclip\relax=0A=0A= \unexpanded\def\meta_grab_clip_path#1#2#3#4%=20#4=20is=20alternative=20= (called=20in=20backend=20code)=0A=20=20{\begingroup=0A=20=20=20= \edef\width=20{#2\space}\let\overlaywidth=20\width=0A=20=20=20= \edef\height{#3\space}\let\overlayheight\height=0A=20=20=20= \ifcsname\??mpclip#1\endcsname=0A=20=20=20=20=20= \meta_start_current_graphic=0A=20=20=20=20=20=20=20= \xdef\MPclippath{\normalexpanded{\noexpand\ctxlua{metapost.theclippath=20= {=0A=20=20=20=20=20=20=20=20=20=20=20=20instance=20=20=20=20=20=20=20=20= =3D=20"\currentMPinstance",=0A=20=20=20=20=20=20=20=20=20=20=20=20format=20= =20=20=20=20=20=20=20=20=20=3D=20"\currentMPformat",=0A=20=20=20=20=20=20= =20=20=20=20=20=20data=20=20=20=20=20=20=20=20=20=20=20=20=3D=20= \!!bs\getvalue{\??mpclip#1}\!!es,=0A=20=20=20=20=20=20=20=20=20=20=20=20= initializations=20=3D=20\!!bs\meta_flush_current_initializations\!!es,=0A= =20=20=20=20=20=20=20=20=20=20=20=20useextensions=20=20=20=3D=20= "\MPinstanceparameter\s!extensions",=0A=20=20=20=20=20=20=20=20=20=20=20=20= inclusions=20=20=20=20=20=20=3D=20= \!!bs\meta_flush_current_inclusions\!!es,=0A=20=20=20=20=20=20=20=20=20=20= =20=20method=20=20=20=20=20=20=20=20=20=20=3D=20= "\MPinstanceparameter\c!method",=0A=20=20=20=20=20=20=20}}}}%=0A=20=20=20= =20=20\meta_stop_current_graphic=0A=20=20=20=20=20\ifx\MPclippath\empty=0A= =20=20=20=20=20=20=20\xdef\MPclippath{#4}%=0A=20=20=20=20=20\fi=0A=20=20=20= \else=0A=20=20=20=20=20\xdef\MPclippath{#4}%=0A=20=20=20\fi=0A=20=20=20= \endgroup}=0A=0A%D=20Since=20we=20want=20lables=20to=20follow=20the=20= document=20settings,=20we=0A%D=20also=20set=20the=20font=20related=20= variables.=0A=0A\unexpanded\def\MPfontsizehskip#1%=0A=20=20= {\dontleavehmode=0A=20=20=20\begingroup=0A=20=20=20\definedfont[#1]%=0A=20= =20=20= \hskip\cldcontext{fonts.hashes.parameters[font.current()].designsize}sp\re= lax=0A=20=20=20\endgroup}=0A=0A\startMPinitializations=20%=20scale=20is=20= not=20yet=20ok=0A=20=20=20=20defaultfont:=3D"\truefontname{Regular}";=0A=20= =20=20=20defaultscale:=3D\the\bodyfontsize/10pt;=0A= \stopMPinitializations=0A=0A%=20watch=20out,=20this=20is=20a=20type1=20= font=20because=20mp=20can=20only=20handle=208=20bit=20fonts=0A=0A= \startMPinitializations=20%=20scale=20is=20not=20yet=20ok=0A=20=20=20=20= defaultfont:=3D"rm-lmtt10";=0A\stopMPinitializations=0A=0A%D=20A=20= signal=20that=20we're=20in=20combined=20\CONTEXT||\METAFUN=20mode:=0A=0A= \startMPextensions=0A=20=20=20=20string=20contextversion;=0A=20=20=20=20= contextversion:=3D"\contextversion";=20%=20expanded=0A\stopMPextensions=0A= =0A%D=20\macros=0A%D=20=20=20{setupMPvariables}=0A%D=0A%D=20When=20we=20= build=20collections=20of=20\METAPOST\=20graphics,=20like=0A%D=20= background=20and=20buttons,=20the=20need=20for=20passing=20settings=0A%D=20= arises.=20By=20(mis|)|using=20the=20local=20prefix=20that=20belongs=20to=0A= %D=20\type=20{\framed},=20we=20get=20a=20rather=20natural=20interface=20= to=0A%D=20backgrounds.=20To=20prevent=20conflicts,=20we=20will=20use=20= the=20\type=0A%D=20{-}=20in=20\METAPOST\=20specific=20variables,=20like:=0A= %D=0A%D=20\starttyping=0A%D=20\setupMPvariables[meta:button][size=3D20pt]=0A= %D=20\stoptyping=0A=0A%=20\lineheight=20=202pt=20=202=20=20= \scratchcounter=20=20red=20=200.4=20=20.5\bodyfontsize=0A%=0A%=20see=20= cont-loc=20for=20test=20code=0A%=0A%=20currently=20the=20inheritance=20= of=20backgrounds=20does=20not=20work=20and=0A%=20we=20might=20drop=20it=20= anyway=20(too=20messy)=0A=0A\newbox\b_meta_variable_box=0A=0A\let=20= \currentmpvariableclass=20=20=20=20=20=20=20=20=20=20\empty=0A\let=20= \m_meta_current_variable=20=20=20=20=20=20=20=20=20\empty=0A\let=20= \m_meta_current_variable_template\empty=0A=0A= \installcorenamespace{graphicvariable}=0A=0A\def=20= \meta_prepare_variable_default=20=20=20{\MPcolor{black}}=20%=20just=20to=20= be=20sure=20we=20use=20a=20color=20but=20...=0A= \edef\meta_unknown_variable_template=20=20= {\??graphicvariable:\s!unknown}=0A=0A= \letvalue{\??graphicvariable:\s!unknown}\empty=0A=0A= \unexpanded\def\setupMPvariables=0A=20=20= {\dodoubleempty\meta_setup_variables}=0A=0A= \def\meta_setup_variables[#1][#2]%=0A=20=20{\ifsecondargument=0A=20=20=20= =20=20\getrawparameters[\??graphicvariable#1:][#2]%=0A=20=20=20\else=0A=20= =20=20=20=20\getrawparameters[\??graphicvariable:][#1]%=0A=20=20=20\fi}=0A= =0A\unexpanded\def\presetMPvariable=0A=20=20= {\dodoubleargument\meta_preset_variable}=0A=0A= \def\meta_preset_variable[#1][#2=3D#3]%=0A=20=20= {\ifcsname\??graphicvariable#1:#2\endcsname=20\else=0A=20=20=20=20=20= \setvalue{\??graphicvariable#1:#2}{#3}%=0A=20=20=20\fi}=0A=0A= \def\MPrawvar#1#2%=20no=20checking=0A=20=20= {\csname\??graphicvariable#1:#2\endcsname}=0A=0A\def\MPvariable#1%=20= todo:=20could=20be=20a=20framed=20chain=0A=20=20= {\csname\??graphicvariable\currentmpvariableclass:#1\endcsname}=0A=0A= \unexpanded\def\useMPvariables=0A=20=20= {\dodoubleargument\meta_use_variables}=0A=0A= \def\meta_use_variables[#1][#2]%=0A=20=20= {\edef\currentmpvariableclass{#1}%=0A=20=20=20= \meta_prepare_variables{#2}}=0A=0A= \unexpanded\def\meta_prepare_variables#1%=0A=20=20= {\processcommalist[#1]\meta_prepare_variable}=0A=0A= \unexpanded\def\meta_prepare_variable#1%=0A=20=20= {\edef\m_meta_current_variable_template=0A=20=20=20=20=20= {\??graphicvariable\currentmpvariableclass:#1}%=0A=20=20=20= \edef\m_meta_current_variable=0A=20=20=20=20=20= {\csname\ifcsname\m_meta_current_variable_template\endcsname=0A=20=20=20=20= =20=20=20=20= \m_meta_current_variable_template\else\meta_unknown_variable_template=0A=20= =20=20=20=20=20\fi\endcsname}%=0A=20=20=20= \ifx\m_meta_current_variable\empty=0A=20=20=20=20=20= \expandafter\meta_prepare_variable_nop=0A=20=20=20\else=0A=20=20=20=20=20= \expandafter\meta_prepare_variable_yes=0A=20=20=20\fi}=0A=0A= \unexpanded\def\meta_prepare_instance_variables=0A=20=20= {\expandafter\processcommalist\expandafter[\m_meta_instance_variables]\met= a_prepare_instance_variable}=0A=0A= \unexpanded\def\meta_prepare_instance_variable#1%=0A=20=20= {\edef\m_meta_current_variable_template=0A=20=20=20=20=20= {\??graphicvariable\currentmpvariableclass:#1}%=0A=20=20=20= \edef\m_meta_current_variable=0A=20=20=20=20=20{\csname=0A=20=20=20=20=20= =20=20=20\ifcsname\m_meta_current_variable_template\endcsname=0A=20=20=20= =20=20=20=20=20=20=20\m_meta_current_variable_template=0A=20=20=20=20=20=20= =20=20\else\ifcsname\??graphicvariable\currentMPgraphicname:#1\endcsname=0A= =20=20=20=20=20=20=20=20=20=20= \??graphicvariable\currentMPgraphicname:#1%=0A=20=20=20=20=20=20=20=20= \else=0A=20=20=20=20=20=20=20=20=20=20\meta_unknown_variable_template=0A=20= =20=20=20=20=20=20=20\fi\fi=0A=20=20=20=20=20=20\endcsname}%=0A=20=20=20= \ifx\m_meta_current_variable\empty=0A=20=20=20=20=20= \expandafter\meta_prepare_variable_nop=0A=20=20=20\else=0A=20=20=20=20=20= \expandafter\meta_prepare_variable_yes=0A=20=20=20\fi}=0A=0A= \def\meta_prepare_variable_nop=0A=20=20{\expandafter=20= \let\csname\m_meta_current_variable_template\endcsname\meta_prepare_variab= le_default}=0A=0A\def\meta_prepare_variable_color=0A=20=20= {\expandafter\edef\csname\m_meta_current_variable_template\endcsname{\MPco= lor\m_meta_current_variable}}=0A=0A\def\meta_prepare_variable_number=0A=20= =20= {\expandafter\edef\csname\m_meta_current_variable_template\endcsname{\numb= er\m_meta_current_variable}}%=20also=20accepts=200.number=0A=0A= \def\meta_prepare_variable_dimension=0A=20=20= {\expandafter\edef\csname\m_meta_current_variable_template\endcsname{\the\= dimexpr\m_meta_current_variable}}=0A=0A\def\meta_prepare_variable_yes=0A=20= =20{\defconvertedcommand\ascii\m_meta_current_variable=20%=20otherwise=20= problems=0A=20=20=20\doifcolorelse=20\ascii=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20%=20with=20= 2\bodyfontsize=0A=20=20=20=20=20{\meta_prepare_variable_color}=0A=20=20=20= =20=20{\begingroup=0A=20=20=20=20=20=20= \setbox\b_meta_variable_box\hbox{\scratchdimen\m_meta_current_variable=20= sp}%=0A=20=20=20=20=20=20\ifzeropt\wd\b_meta_variable_box=0A=20=20=20=20=20= =20=20=20\endgroup\meta_prepare_variable_number=0A=20=20=20=20=20=20= \else=0A=20=20=20=20=20=20=20=20= \endgroup\meta_prepare_variable_dimension=0A=20=20=20=20=20=20\fi}}=0A=0A= \let\MPvar=20=20=20=20=20=20=20=20=20\MPvariable=0A= \let\setMPvariables\setupMPvariables=0A=0A%D=20\macros=0A%D=20=20=20= {startuniqueMPgraphic,=20uniqueMPgraphic}=0A%D=0A%D=20This=20macros=20is=20= probably=20of=20most=20use=20to=20myself,=20since=20I=20like=0A%D=20to=20= use=20graphics=20that=20adapt=20themselves.=20The=20next=20\METAPOST\=0A= %D=20kind=20of=20graphic=20is=20both=20unique=20and=20reused=20when=20= possible.=0A%D=0A%D=20\starttyping=0A%D=20= \defineoverlay[example][\uniqueMPgraphic{test}]=0A%D=0A%D=20= \startuniqueMPgraphic=20{test}=0A%D=20=20=20draw=20unitsquare=20xscaled=20= \overlaywidth=20yscaled=20\overlayheight=20;=0A%D=20\stopuniqueMPgraphic=0A= %D=20\stoptyping=0A=0A\def\overlaystamp=20%=20watch=20the=20\MPcolor,=20= since=20colors=20can=20be=20redefined=0A=20=20= {\overlaywidth:\overlayheight:\overlaydepth:\MPcolor\overlaycolor:\MPcolor= \overlaylinecolor}=0A=0A%D=20A=20better=20approach=20is=20to=20let=20= additional=20variables=20play=20a=20role=0A%D=20in=20determining=20the=20= uniqueness.=20In=20the=20next=20macro,=20the=0A%D=20second,=20optional,=20= argument=20is=20used=20to=20guarantee=20the=0A%D=20uniqueness,=20as=20= well=20as=20prepare=20variables=20for=20passing=20them=20to=0A%D=20= \METAPOST.=0A%D=0A%D=20\starttyping=0A%D=20= \startuniqueMPgraphic{meta:hash}{gap,angle,...}=0A%D=20\stoptyping=0A%D=0A= %D=20The=20calling=20macro=20also=20accepts=20a=20second=20argument.=20= For=0A%D=20convenient=20use=20in=20overlay=20definitions,=20we=20use=20= \type=20{{}}=0A%D=20instead=20of=20\type=20{[]}.=0A%D=0A%D=20= \starttyping=0A%D=20\uniqueMPgraphic{meta:hash}{gap=3D10pt,angle=3D30}=0A= %D=20\stoptyping=0A=0A\newcount\c_meta_object_counter=0A\newbox=20=20= \b_meta_graphic=0A=0A%=20hm,=20isn't=20this=20already=20done=20= elsewhere?=0A=0A\unexpanded\def\meta_obey_box_depth=0A=20=20= {\setbox\b_meta_graphic\hbox\bgroup=0A=20=20=20=20=20= \raise\MPlly\box\b_meta_graphic=0A=20=20=20\egroup}=0A=0A= \unexpanded\def\meta_ignore_box_depth=0A=20=20{\normalexpanded=0A=20=20=20= =20=20{\meta_obey_box_depth=20%=20hence=20the=20\unexpanded=0A=20=20=20=20= =20=20\wd\b_meta_graphic\the\wd\b_meta_graphic=0A=20=20=20=20=20=20= \ht\b_meta_graphic\the\ht\b_meta_graphic=0A=20=20=20=20=20=20= \dp\b_meta_graphic\the\dp\b_meta_graphic}}=0A=0A= \unexpanded\def\meta_obey_box_origin=0A=20=20= {\setbox\b_meta_graphic\hbox\bgroup=0A=20=20=20=20=20= \kern\MPllx\raise\MPlly\box\b_meta_graphic=0A=20=20=20\egroup}=0A=0A= \unexpanded\def\obeyMPboxdepth=20=20= {\let\meta_relocate_box\meta_obey_box_depth=20=20}=0A= \unexpanded\def\ignoreMPboxdepth{\let\meta_relocate_box\meta_ignore_box_de= pth}=0A\unexpanded\def\obeyMPboxorigin=20= {\let\meta_relocate_box\meta_obey_box_origin=20}=0A= \unexpanded\def\normalMPboxdepth{\let\meta_relocate_box\relax=20=20=20=20= =20=20=20=20=20=20=20=20=20=20}=0A=0A\let\meta_relocate_box\relax=0A=0A= \unexpanded\def\meta_place_graphic=20%=20the=20converter=20also=20= displaces=20so=20in=20fact=20we=20revert=0A=20=20{\meta_relocate_box=0A=20= =20=20\box\b_meta_graphic}=0A=0A= \unexpanded\def\meta_reuse_box#1#2#3#4#5%=20space=20delimiting=20would=20= save=20some=20tokens=0A=20=20{\MPllx#2\MPlly#3\MPurx#4\MPury#5%=0A=20=20=20= \hbox{\forcecolorhack\getobject{MP}{#1}}}=20%=20else=20no=20proper=20= color=20intent=0A=0A\def\meta_handle_unique_graphic#1#2#3%=20when=20= there=20are=20too=20many,=20we=20can=20store=20data=20at=20the=20lua=20= end,=20although,=0A=20=20{\begingroup=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20%=20when=20there=20are=20that=20many=20they're=20= probably=20not=20that=20unique=20anyway=0A=20=20=20= \edef\currentmpvariableclass{#1}%=0A=20=20=20\extendMPoverlaystamp{#2}%=20= incl=20prepare=0A=20=20=20= \ifcsname\??mpgraphic\overlaystamp:#1\endcsname\else=0A=20=20=20=20=20= \meta_enable_include=20%=20redundant=0A=20=20=20=20=20= \global\advance\c_meta_object_counter\plusone=0A=20=20=20=20=20= \setobject{MP}{\number\c_meta_object_counter}\hbox{\meta_process_graphic{#= 3}}%=20was=20vbox,=20graphic=20must=20end=20up=20as=20hbox=0A=20=20=20=20= =20= \setxvalue{\??mpgraphic\overlaystamp:#1}{\meta_reuse_box{\number\c_meta_ob= ject_counter}{\the\MPllx}{\the\MPlly}{\the\MPurx}{\the\MPury}}%=0A=20=20=20= \fi=0A=20=20=20\getvalue{\??mpgraphic\overlaystamp:#1}%=0A=20=20=20= \endgroup}=0A=0A\unexpanded\def\startuniqueMPgraphic=0A=20=20= {\dodoublegroupempty\meta_start_unique_graphic}=0A=0A%=20= \def\meta_start_unique_graphic#1#2#3\stopuniqueMPgraphic=0A%=20=20=20= {\setgvalue{\??mpgraphic#1}{\meta_handle_unique_graphic{#1}{#2}{#3}}}=0A=0A= \def\meta_start_unique_graphic#1%=0A=20=20= {\normalexpanded{\meta_start_unique_graphic_indeed{#1}}}=0A=0A= \unexpanded\def\meta_start_unique_graphic_indeed#1#2#3\stopuniqueMPgraphic= =0A=20=20= {\setgvalue{\??mpgraphic#1}{\meta_handle_unique_graphic{#1}{#2}{#3}}}=0A=0A= \let\stopuniqueMPgraphic\relax=0A=0A\unexpanded\def\uniqueMPgraphic=0A=20= =20{\dodoublegroupempty\meta_unique_graphic}=0A=0A= \def\meta_unique_graphic#1#2%=0A=20=20{\meta_begin_graphic_group{#1}%=0A= %=20=20=20=20\setupMPvariables[\currentMPgraphicname][#2]%=0A=20=20=20= \setupMPvariables[#1][#2]%=0A=20=20=20\getvalue{\??mpgraphic#1}\empty=0A=20= =20=20\meta_end_graphic_group}=0A=0A\def\meta_handle_use_graphic#1#2#3%=0A= =20=20{\begingroup=0A=20=20=20\edef\currentmpvariableclass{#1}%=0A=20=20=20= \edef\m_meta_instance_variables{#2}%=0A=20=20=20= \ifx\m_meta_instance_variables\empty=20\else=0A=20=20=20=20=20= \meta_prepare_instance_variables=0A=20=20=20\fi=0A=20=20=20= \meta_enable_include=20%=20redundant=0A=20=20=20= \meta_process_graphic{#3}%=0A=20=20=20\endgroup}=0A=0A= \unexpanded\def\startuseMPgraphic=0A=20=20= {\dodoublegroupempty\meta_start_use_graphic}=0A=0A%=20= \def\meta_start_use_graphic#1#2#3\stopuseMPgraphic=0A%=20=20=20= {\setgvalue{\??mpgraphic#1}{\meta_handle_use_graphic{#1}{#2}{#3}}}=0A%=0A= %=20better,=20expansion=20of=20#1:=0A%=0A%=20= \def\meta_start_use_graphic#1#2#3\stopuseMPgraphic=0A%=20=20= %{\setgvalue{\??mpgraphic#1}{\meta_handle_use_graphic{#1}{#2}{#3}}}=0A%=20= =20= %{\setxvalue{\??mpgraphic#1}{\noexpand\meta_handle_use_graphic{#1}{\normal= unexpanded{#2}}{\normalunexpanded{#3}}}}=0A%=20=20=20= {\global\expandafter\gdef\csname\??mpgraphic#1\expandafter\endcsname\expan= dafter{\expandafter\meta_handle_use_graphic\expandafter{\normalexpanded{#1= }}{#2}{#3}}}=0A%=0A%=20cleaner:=0A=0A\def\meta_start_use_graphic#1%=0A=20= =20{\normalexpanded{\meta_start_use_graphic_indeed{#1}}}=0A=0A= \unexpanded\def\meta_start_use_graphic_indeed#1#2#3\stopuseMPgraphic=0A=20= =20{\setgvalue{\??mpgraphic#1}{\meta_handle_use_graphic{#1}{#2}{#3}}}=0A=0A= \let\stopuseMPgraphic\relax=0A=0A\unexpanded\def\startusableMPgraphic=20= %=20redundant=20but=20handy=0A=20=20= {\dodoublegroupempty\meta_start_usable_graphic}=0A=0A%=20= \def\meta_start_usable_graphic#1#2#3\stopusableMPgraphic=0A%=20=20=20= {\setgvalue{\??mpgraphic#1}{\meta_handle_use_graphic{#1}{#2}{#3}}}=0A=0A= \def\meta_start_usable_graphic#1%=0A=20=20= {\normalexpanded{\meta_start_usable_graphic_indeed{#1}}}=0A=0A= \unexpanded\def\meta_start_usable_graphic_indeed#1#2#3\stopusableMPgraphic= =0A=20=20= {\setgvalue{\??mpgraphic#1}{\meta_handle_use_graphic{#1}{#2}{#3}}}=0A=0A= \let\stopusableMPgraphic\relax=0A=0A= \def\meta_handle_reusable_graphic#1#2#3%=0A=20=20{\begingroup=0A=20=20=20= \edef\currentmpvariableclass{#1}%=0A=20=20=20= \edef\m_meta_instance_variables{#2}%=0A=20=20=20= \ifx\m_meta_instance_variables\empty=20\else=0A=20=20=20=20=20= \meta_prepare_instance_variables=0A=20=20=20\fi=0A=20=20=20= \meta_enable_include=20%=20redundant=0A=20=20=20= \global\advance\c_meta_object_counter\plusone=0A=20=20=20= \setobject{MP}{\number\c_meta_object_counter}\hbox{\meta_process_graphic{#= 3}}%=20was=20vbox,=20graphic=20must=20end=20up=20as=20hbox=0A=20=20=20= \setxvalue{\??mpgraphic#1}{\meta_reuse_box{\number\c_meta_object_counter}{= \the\MPllx}{\the\MPlly}{\the\MPurx}{\the\MPury}}%=0A=20=20=20= \getvalue{\??mpgraphic#1}%=0A=20=20=20\endgroup}=0A=0A= \unexpanded\def\startreusableMPgraphic=0A=20=20= {\dodoublegroupempty\meta_start_reusable_graphic}=0A=0A%=20= \def\meta_start_reusable_graphic#1#2#3\stopreusableMPgraphic=0A%=20=20=20= {\setgvalue{\??mpgraphic#1}{\meta_handle_reusable_graphic{#1}{#2}{#3}}}=0A= =0A\def\meta_start_reusable_graphic#1%=0A=20=20= {\normalexpanded{\meta_start_reusable_graphic_indeed{#1}}}=0A=0A= \unexpanded\def\meta_start_reusable_graphic_indeed#1#2#3\stopreusableMPgra= phic=0A=20=20= {\setgvalue{\??mpgraphic#1}{\meta_handle_reusable_graphic{#1}{#2}{#3}}}=0A= =0A\let\stopreusableMPgraphic\relax=0A=0A\unexpanded\def\useMPgraphic=0A=20= =20{\dodoublegroupempty\meta_use_graphic}=0A=0A= \def\meta_use_graphic#1#2%=0A=20=20{\meta_begin_graphic_group{#1}%=0A%=20= =20=20=20= \doifsomething{#2}{\setupMPvariables[\currentMPgraphicname][#2]}%=0A=20=20= =20\doifsomething{#2}{\setupMPvariables[#1][#2]}%=0A=20=20=20= \getvalue{\??mpgraphic#1}\empty=0A=20=20=20\meta_end_graphic_group}=0A=0A= \let\reuseMPgraphic=20=20=20\useMPgraphic=20=20=20%=20we=20can=20save=20= a=20setup=20here=20if=20needed=0A\let\reusableMPgraphic\reuseMPgraphic=20= %=20we=20can=20save=20a=20setup=20here=20if=20needed=0A=0A= \unexpanded\def\meta_enable_include=0A=20=20= {\let\meta_handle_use_graphic=20=20=20=20=20\thirdofthreearguments=0A=20=20= =20\let\meta_handle_reusable_graphic\thirdofthreearguments}=0A=0A%D=20= \macros=0A%D=20=20=20{startuniqueMPpagegraphic,uniqueMPpagegraphic}=0A%D=0A= %D=20Experimental.=0A=0A\def\m_meta_page_prefix{\doifoddpageelse=20oe}=0A= =0A\def\overlaypagestamp=0A=20=20= {\m_meta_page_prefix:\overlaywidth:\overlayheight:\overlaydepth:\MPcolor\o= verlaycolor:\MPcolor\overlaylinecolor}=0A=0A= \unexpanded\def\startuniqueMPpagegraphic=0A=20=20= {\dodoublegroupempty\meta_start_unique_page_graphic}=0A=0A%=20= \def\meta_start_unique_page_graphic#1#2#3\stopuniqueMPpagegraphic=20=20=20= =20=20=20=20=20=20=20=20=20=20=20%=20inefficient,=20double=20storage=0A%=20= =20=20{\setgvalue{\??mpgraphic=20= o:#1}{\meta_handle_unique_graphic{o:#1}{#2}{#3}}%=20=20=20%=20but=20= these=20also=20keep=20the=20state=0A%=20=20=20=20\setgvalue{\??mpgraphic=20= e:#1}{\meta_handle_unique_graphic{e:#1}{#2}{#3}}}=20=20=20%=20and=20= meaning=20will=20be=20redefined=0A=0A= \def\meta_start_unique_page_graphic#1%=0A=20=20= {\normalexpanded{\meta_start_unique_page_graphic_indeed{#1}}}=0A=0A= \unexpanded\def\meta_start_unique_page_graphic_indeed#1#2#3\stopuniqueMPpa= gegraphic=20%=20inefficient,=20double=20storage=0A=20=20= {\setgvalue{\??mpgraphic=20= o:#1}{\meta_handle_unique_graphic{o:#1}{#2}{#3}}%=20=20=20=20=20=20=20=20= %=20but=20these=20also=20keep=20the=20state=0A=20=20=20= \setgvalue{\??mpgraphic=20= e:#1}{\meta_handle_unique_graphic{e:#1}{#2}{#3}}}=20=20=20=20=20=20=20=20= %=20and=20meaning=20will=20be=20redefined=0A=0A= \let\stopuniqueMPpagegraphic\relax=0A=0A= \unexpanded\def\uniqueMPpagegraphic=0A=20=20= {\dodoublegroupempty\meta_unique_page_graphic}=0A=0A= \def\meta_unique_page_graphic#1#2%=0A=20=20= {\meta_begin_graphic_group{#1}%=0A=20=20=20= \let\overlaystamp\overlaypagestamp=0A%=20=20=20=20= \setupMPvariables[\m_meta_page_prefix:\currentMPgraphicname][#2]%=20= prefix=20is=20new=20here=0A=20=20=20= \setupMPvariables[\m_meta_page_prefix:#1][#2]%=20prefix=20is=20new=20= here=0A=20=20=20\getvalue{\??mpgraphic\m_meta_page_prefix:#1}{}%=0A=20=20= =20\meta_end_graphic_group}=0A=0A%D=20One=20way=20of=20defining=20a=20= stamp=20is:=0A%D=0A%D=20\starttyping=0A%D=20\def\extendMPoverlaystamp#1%=0A= %D=20=20=20{\def\docommand##1%=0A%D=20=20=20=20=20=20= {\edef\overlaystamp{\overlaystamp:\MPvariable{##1}}}%=0A%D=20=20=20=20= \processcommalist[#1]\docommand}=0A%D=20\stoptyping=0A=0A%D=20Since=20we=20= need=20to=20feed=20\METAPOST\=20with=20expanded=20dimensions,=0A%D=20we=20= introduce=20a=20dedicated=20expansion=20engine.=0A=0A%D=20We=20redefine=20= \type=20{\extendMPoverlaystamp}=20to=20preprocess=0A%D=20variables=20= using=20\type=20{\meta_prepare_variable}.=0A=0A= \unexpanded\def\extendMPoverlaystamp#1%=0A=20=20= {\processcommalist[#1]\meta_extend_overlay_stamp}=0A=0A= \def\meta_extend_overlay_stamp#1%=0A=20=20= {\meta_prepare_instance_variable{#1}%=0A=20=20=20= \edef\overlaystamp{\overlaystamp:\MPvariable{#1}}}=0A=0A%D=20\macros=0A= %D=20=20=20{MPdatafile}=0A%D=0A%D=20We=20redefine=20a=20macro=20from=20= \type=20{supp-mps.tex}:=0A=0A%=20This=20will=20change=20...=0A=0A= \def\MPdataMPDfile{\jobname-mpgraph.mpd}=0A= \def\MPdataMPOfile{\jobname-mpgraph.mpo}=0A= \def\MPdataMPYfile{\jobname-mpgraph.mpy}=0A=0A\startMPinitializations=0A=20= =20=20=20boolean=20collapse_data;=20collapse_data:=3Dtrue;=0A=20=20=20=20= def=20data_mpd_file=20=3D=20"\MPdataMPDfile"=20enddef=20;=0A=20=20=20=20= def=20data_mpo_file=20=3D=20"\MPdataMPOfile"=20enddef=20;=0A=20=20=20=20= def=20data_mpy_file=20=3D=20"\MPdataMPYfile"=20enddef=20;=0A= \stopMPinitializations=0A=0A\unexpanded\def\getMPdata=0A=20=20= {\let\MPdata\secondoftwoarguments=0A=20=20=20\startreadingfile=0A=20=20=20= %=20\startnointerference=20%=20no,=20else=20we=20need=20to=20do=20all=20= data=20global=0A=20=20=20\readlocfile\MPdataMPDfile\donothing\donothing=0A= =20=20=20%=20\stopnointerference=0A=20=20=20\stopreadingfile}=0A=0A%=20= We=20need=20this=20trick=20because=20we=20need=20to=20make=20sure=20that=20= the=20tex=20scanner=0A%=20sees=20newlines=20and=20does=20not=20quit.=20= Also,=20we=20do=20need=20to=20flush=20the=20buffer=0A%=20under=20a=20= normal=20catcode=20regime=20in=20order=20to=20expand=20embedded=20tex=20= macros.=0A%=20As=20usual=20with=20buffers,=20\type=20{#1}=20can=20be=20a=20= list.=0A=0A\unexpanded\def\processMPbuffer=0A=20=20= {\dosingleempty\meta_process_buffer}=0A=0A\def\meta_process_buffer[#1]%=0A= =20=20{\meta_begin_graphic_group{#1}%=0A=20=20=20= \meta_process_graphic{\ctxcommand{feedback("\currentMPgraphicname")}}%=0A= =20=20=20\meta_end_graphic_group}=0A=0A\unexpanded\def\runMPbuffer=0A=20=20= {\dosingleempty\meta_run_buffer}=0A=0A\def\meta_run_buffer[#1]%=20= processing=20only=0A=20=20= {\startnointerference\meta_process_buffer[#1]\stopnointerference}=0A=0A= %D=20\macros=0A%D=20=20=20{startMPenvironment,=20resetMPenvironment}=0A= %D=0A%D=20In=20order=20to=20synchronize=20the=20main=20\TEX\=20run=20and=20= the=20runs=0A%D=20local=20to=20\METAPOST,=20environments=20can=20be=20= passed.=0A=0A%=20\unexpanded\def\startMPenvironment=20%=20second=20arg=20= gobbles=20spaces,=20so=20that=20reset=20gives=20\emptytoks=0A%=20=20=20= {\dodoubleempty\dostartMPenvironment}=0A=0A%=20= \def\dostartMPenvironment[#1][#2]#3\stopMPenvironment=0A%=20=20=20= {\edef\m_meta_option{#1}=0A%=20=20=20=20\ifx\m_meta_option\s!reset=0A%=20= =20=20=20=20=20\resetMPenvironment=20%=20reset=20mp=20toks=0A%=20=20=20=20= \else\ifx\m_meta_option\v!global=0A%=20=20=20=20=20=20#3%=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20%=20use=20in=20main=20doc=20too=0A%=20=20= =20=20\else\ifx\m_meta_option\!!plustoken=0A%=20=20=20=20=20=20#3%=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20%=20use=20in=20main=20doc=20= too=0A%=20=20=20=20\fi\fi\fi=0A%=20=20=20=20= \ctxlua{metapost.tex.set(\!!bs\detokenize{#3}\!!es)}}=0A=0A= \unexpanded\def\startMPenvironment=0A=20=20{\begingroup=0A=20=20=20= \catcode\endoflineasciicode=20\ignorecatcode=0A=20=20=20= \dosingleempty\meta_start_environment}=0A=0A= \def\meta_start_environment[#1]#2\stopMPenvironment=0A=20=20{\endgroup=0A= =20=20=20\edef\m_meta_option{#1}=0A=20=20=20\ifx\m_meta_option\s!reset=0A= =20=20=20=20=20\resetMPenvironment=20%=20reset=20mp=20toks=0A=20=20=20= \else\ifx\m_meta_option\v!global=0A=20=20=20=20=20#2%=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20%=20use=20in=20main=20doc=20too=0A=20=20=20= \else\ifx\m_meta_option\!!plustoken=0A=20=20=20=20=20#2%=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20%=20use=20in=20main=20doc=20too=0A=20=20= =20\fi\fi\fi=0A=20=20=20= \ctxlua{metapost.tex.set(\!!bs\detokenize{#2}\!!es)}}=0A=0A= \let\stopMPenvironment\relax=0A=0A\unexpanded\def\resetMPenvironment=0A=20= =20{\ctxlua{metapost.tex.reset()}}=0A=0A= \unexpanded\def\useMPenvironmentbuffer[#1]%=0A=20=20= {\ctxlua{metapost.tex.set(buffers.content("#1"))}}=0A=0A%D=20This=20= command=20takes=20\type=20{[reset]}=20as=20optional=0A%D=20argument.=0A= %D=0A%D=20\starttyping=0A%D=20\startMPenvironment=0A%D=20=20=20= \setupbodyfont[pos,14.4pt]=0A%D=20\stopMPenvironment=0A%D=0A%D=20= \startMPcode=0A%D=20=20=20draw=20btex=20\sl=20Hans=20Hagen=20etex=20= scaled=205=20;=0A%D=20\stopMPcode=0A%D=20\stoptyping=0A%D=0A%D=20The=20= most=20simple=20case:=0A=0A\unexpanded\def\startMPcode=0A=20=20= {\dosinglegroupempty\meta_start_code}=0A=0A\def\meta_start_code=0A=20=20= {\iffirstargument=0A=20=20=20=20=20\expandafter\meta_start_code_instance=0A= =20=20=20\else=0A=20=20=20=20=20\expandafter\meta_start_code_standard=0A=20= =20=20\fi}=0A=0A\def\meta_start_code_instance#1#2\stopMPcode=0A=20=20= {\begingroup=0A=20=20=20\edef\currentMPinstance{#1}%=0A=20=20=20= \let\currentMPgraphicname\empty=0A=20=20=20= \edef\currentMPformat{\MPinstanceparameter\s!format}%=0A=20=20=20= \meta_enable_include=0A=20=20=20\meta_process_graphic{#2}%=0A=20=20=20= \endgroup}=0A=0A\def\meta_start_code_standard#1#2\stopMPcode=0A=20=20= {\begingroup=0A=20=20=20\let\currentMPinstance\defaultMPinstance=0A=20=20= =20\let\currentMPgraphicname\empty=0A=20=20=20= \edef\currentMPformat{\MPinstanceparameter\s!format}%=0A=20=20=20= \meta_process_graphic{#2}%=0A=20=20=20\endgroup}=0A=0A= \let\stopMPcode\relax=0A=0A\unexpanded\def\MPcode=0A=20=20= {\dodoublegroupempty\meta_code}=0A=0A\def\meta_code=0A=20=20= {\ifsecondargument=0A=20=20=20=20=20\expandafter\meta_code_instance=0A=20= =20=20\else=0A=20=20=20=20=20\expandafter\meta_code_standard=0A=20=20=20= \fi}=0A=0A\def\meta_code_instance#1#2%=0A=20=20= {\meta_begin_graphic_group{#1}%=0A=20=20=20\meta_enable_include=0A=20=20=20= \meta_process_graphic{#2}%=0A=20=20=20\meta_end_graphic_group}=0A=0A= \def\meta_code_standard#1#2%=0A=20=20= {\let\currentMPinstance\defaultMPinstance=0A=20=20=20= \meta_enable_include=0A=20=20=20\meta_process_graphic{#1}}=0A=0A%=20a=20= bit=20nasty=20(also=20needed=20for=20compatibility:=0A=0A%=20\startMPrun=20= input=20mp-www.mp=20;=20\stopMPrun=0A%=20= \externalfigure[mprun.3][width=3D10cm,height=3D8cm]=0A=0A%=20= \startMPrun{mprun}=20input=20mp-www.mp=20;=20\stopMPrun=20%=20instance=0A= %=20\externalfigure[mprun.4][width=3D10cm,height=3D8cm]=0A=0A= \let\MPruninstance\defaultMPinstance=0A=0A\unexpanded\def\useMPrun#1#2%=20= name=20n=0A=20=20{\begingroup=0A=20=20=20\def\MPaskedfigure{#2}%=0A=20=20= =20\doifelsenothing{#1}=0A=20=20=20=20=20{\useMPgraphic{mprun}}%=0A=20=20= =20=20=20{\useMPgraphic{#1}}%=0A=20=20=20\endgroup}=0A=0A= \unexpanded\def\startMPrun=0A=20=20{\dosinglegroupempty\meta_start_run}=0A= =0A\def\meta_start_run#1#2\stopMPrun=0A=20=20{\iffirstargument=0A=20=20=20= =20=20\startuseMPgraphic{#1}#2\stopuseMPgraphic=0A=20=20=20\else=0A=20=20= =20=20=20\startuseMPgraphic{mprun}#2\stopuseMPgraphic=0A=20=20=20\fi}=0A=0A= \let\stopMPrun\relax=0A=0A%D=20The=20\type=20{\resetMPenvironment}=20is=20= a=20quick=20way=20to=20erase=0A%D=20the=20token=20list.=0A%D=0A%D=20You=20= should=20be=20aware=20of=20independencies.=20For=20instance,=20if=20you=20= use=20a=20font=0A%D=20in=20a=20graphic=20that=20is=20not=20used=20in=20= the=20main=20document,=20you=20need=20to=20load=20the=0A%D=20typescript=20= at=20the=20outer=20level=20(either=20directly=20or=20by=20using=20the=20= global=0A%D=20option).=0A%D=0A%D=20\starttyping=0A%D=20= \usetypescript[palatino][texnansi]=0A%D=0A%D=20\startMPenvironment=0A%D=20= =20=20=20=20\usetypescript[palatino][texnansi]=0A%D=20=20=20=20=20= \enableregime[utf]=0A%D=20=20=20=20=20\setupbodyfont[palatino]=0A%D=20= \stopMPenvironment=0A%D=0A%D=20\startMPpage=0A%D=20=20=20=20=20draw=20= btex=20aap=E2=80=92noot=20co=C3=B6rdinatie=20=E2=80=93=20=C3=A9=C3=A9n=20= etex=20;=0A%D=20\stopMPpage=0A%D=20\stoptyping=0A=0A%D=20Loading=20= specific=20\METAPOST\=20related=20definitions=20is=0A%D=20accomplished=20= by:=0A=0A= \unexpanded\def\useMPlibrary[#1]{\ctxcommand{useMPlibrary(\!!bs#1\!!es)}}=0A= =0A%D=20\macros=0A%D=20=20=20{setMPtext,=20MPtext,=20MPstring,=20= MPbetex}=0A%D=0A%D=20To=20be=20documented:=0A%D=0A%D=20\starttyping=0A%D=20= \setMPtext{identifier}{text}=0A%D=0A%D=20\MPtext=20=20{identifier}=0A%D=20= \MPstring{identifier}=0A%D=20\MPbetex=20{identifier}=0A%D=20\stoptyping=0A= =0A\installcorenamespace{mptext}=0A=0A\unexpanded\def\setMPtext#1#2%=20= todo=20:=20#1=20must=20be=20made=20:=20safe=0A=20=20= {\defconvertedargument\ascii{#2}%=0A=20=20=20= \dodoglobal\letvalue{\??mptext#1}\ascii}=0A=0A\def\MPtext=20=20= #1{\executeifdefined{\??mptext#1}\empty}=0A= \def\MPstring#1{"\executeifdefined{\??mptext#1}\empty"}=0A\def\MPbetex=20= #1{btex=20\executeifdefined{\??mptext#1}\empty\space=20etex}=0A=0A%D=20= In=20order=20to=20communicate=20conveniently=20with=20the=20\TEX\=0A%D=20= engine,=20we=20introduce=20some=20typesetting=20variables.=0A=0A%=20= \setupcolors[state=3Dstop,conversion=3Dnever]=20%=20quite=20tricky=20...=20= type=20mismatch=0A=0A%=20A=20dirty=20trick,=20**=20in=20colo-ini.lua=20= (mpcolor).=0A=0A\def\m_meta_colo_initializations{%=20no=20vardef,=20goes=20= wrong=20with=20spot=20colors=0A=20=20=20=20def=20= OverlayLineColor=3D\MPcolor{\overlaylinecolor}=20enddef;=0A=20=20=20=20= def=20OverlayColor=3D\MPcolor{\overlaycolor}=20enddef;=0A}=0A=0A= \startMPextensions=0A=20=20=20=20color=20OverlayColor,OverlayLineColor;=0A= \stopMPextensions=0A=0A\startMPinitializations=0A=20=20=20=20= CurrentLayout:=3D"\currentlayout";=0A=20=20=20=20= OverlayWidth:=3D\overlaywidth;=0A=20=20=20=20= OverlayHeight:=3D\overlayheight;=0A=20=20=20=20= OverlayDepth:=3D\overlayheight;=0A=20=20=20=20= OverlayLineWidth:=3D\overlaylinewidth;=0A=20=20=20=20%=0A=20=20=20=20= \m_meta_colo_initializations=0A=20=20=20=20%=0A=20=20=20=20= BaseLineSkip:=3D\the\baselineskip;=0A=20=20=20=20= LineHeight:=3D\the\baselineskip;=0A=20=20=20=20= BodyFontSize:=3D\the\bodyfontsize;=0A=20=20=20=20%=0A=20=20=20=20= TopSkip:=3D\the\topskip;=0A=20=20=20=20StrutHeight:=3D\strutheight;=0A=20= =20=20=20StrutDepth:=3D\strutdepth;=0A=20=20=20=20%=0A=20=20=20=20= CurrentWidth:=3D\the\hsize;=0A=20=20=20=20CurrentHeight:=3D\the\vsize;=0A= =20=20=20=20%=0A=20=20=20=20EmWidth:=3D\the\emwidth;=0A=20=20=20=20= ExHeight:=3D\the\exheight;=0A=20=20=20=20%=0A=20=20=20=20= PageNumber:=3D\the\pageno;=0A=20=20=20=20= RealPageNumber:=3D\the\realpageno;=0A=20=20=20=20LastPageNumber:=3D=20= \lastpage;=0A\stopMPinitializations=0A=0A\appendtoks=0A=20=20=20=20= \disablediscretionaries=0A=20=20=20=20\disablecompoundcharacters=0A\to=20= \everyMPgraphic=0A=0A%=20\appendtoks=20%=20before=20color,=20= inefficient,=20replace=20by=20low=20level=20copy=0A%=20=20=20=20=20= \doregistercolor{currentcolor}\currentcolorname=0A%=20\to=20= \everyMPgraphic=0A=0A%=20\color[green]{abc=20\startMPcode=0A%=20fill=20= fullcircle=20scaled=203cm=20withoutcolor;=0A%=20fill=20fullcircle=20= scaled=202cm=20withcolor=20\MPcolor{currentcolor}=20;=0A%=20fill=20= fullcircle=20scaled=201cm=20withcolor=20\MPcolor{red}=20;=0A%=20= \stopMPcode=20def}=0A=0A\appendtoks=0A=20=20=20=20= \baselineskip1\baselineskip=0A=20=20=20=20\lineheight=20=201\lineheight=0A= =20=20=20=20\topskip=20=20=20=20=201\topskip=0A\to=20\everyMPgraphic=0A=0A= \appendtoks=0A=20=20=20=20\let=20\#=20\letterhash=0A=20=20=20=20\let=20= \_=20\letterunderscore=0A=20=20=20=20\let=20\&=20\letterampersand=0A=20=20= =20=20\let=20\{=20\letteropenbrace=0A=20=20=20=20\let=20\}=20= \letterclosebrace=0A\to=20\everyMPgraphic=0A=0A\startMPinitializations=0A= =20=20=20=20prologues:=3D0;=0A=20=20=20=20mpprocset:=3D1;=0A= \stopMPinitializations=0A=0A%D=20\macros=0A%D=20=20=20{PDFMPformoffset}=0A= %D=0A%D=20In=20\PDF,=20forms=20are=20clipped=20and=20therefore=20we=20= have=20to=20take=0A%D=20precautions=20to=20get=20this=20right.=20Since=20= this=20is=20related=20to=0A%D=20objects,=20we=20use=20the=20same=20= offset=20as=20used=20there.=0A=0A\def\PDFMPformoffset{\objectoffset}=0A=0A= %=20%D=20\macros=0A%=20%D=20=20=20{insertMPfile}=0A%=20%D=0A%=20%D=20= Bypassing=20the=20special=20driver=20and=20figure=20mechanism=20is=20not=0A= %=20%D=20that=20nice=20but=20saves=20upto=205\%=20time=20in=20embedding=20= \METAPOST\=0A%=20%D=20graphics=20by=20using=20the=20low=20level=20\PDF\=20= converter=20directly,=0A%=20%D=20given=20of=20course=20that=20we=20use=20= \PDFTEX.=20As=20a=20result=20we=20need=20to=0A%=20%D=20fool=20around=20= with=20the=20object=20trigger.=0A=0A\newtoks\everyinsertMPfile=0A=0A= \startMPextensions=0A=20=20=20=20def=20initialize_form_numbers=20=3D=0A=20= =20=20=20=20=20=20=20do_initialize_numbers;=0A=20=20=20=20enddef;=0A= \stopMPextensions=0A=0A\startMPinitializations=0A=20=20=20=20= HSize:=3D\the\hsize=20;=0A=20=20=20=20VSize:=3D\the\vsize=20;=0A= \stopMPinitializations=0A=0A\startMPextensions=0A=20=20=20=20vardef=20= ForegroundBox=20=3D=0A=20=20=20=20=20=20=20=20unitsquare=20= xysized(HSize,VSize)=0A=20=20=20=20enddef=20;=0A=20=20=20=20PageFraction=20= :=3D=201=20;=0A\stopMPextensions=0A=0A\startMPinitializations=0A=20=20=20= =20PageFraction:=3Dif=20= \lastpage>1:(\realfolio-1)/(\lastpage-1)else:1fi;=0A= \stopMPinitializations=0A=0A%D=20And=20some=20more.=20These=20are=20not=20= really=20needed=20since=20we=0A%D=20don't=20use=20the=20normal=20figure=20= inclusion=20macros=20any=20longer.=0A=0A\appendtoks=0A=20=20=20=20= \externalfigurepostprocessors\emptytoks=20%=20safeguard=0A\to=20= \everyinsertMPfile=0A=0A%D=20We=20also=20take=20care=20of=20disabling=20= fancy=20figure=20features,=20that=0A%D=20can=20terribly=20interfere=20= when=20dealing=20with=20symbols,=0A%D=20background=20graphics=20and=20= running=20(postponed)=20graphics.=0A%D=20You=20won't=20believe=20me=20if=20= I=20tell=20you=20what=20funny=20side=20effects=0A%D=20can=20occur.=20One=20= took=20me=20over=20a=20day=20to=20uncover=20when=0A%D=20processing=20the=20= screen=20version=20of=20the=20\METAFUN\=20manual.=0A=0A= \def\doifelseMPgraphic#1%=0A=20=20{\ifcsname\??mpgraphic=20=20=20= #1\endcsname=20\expandafter=20=20=20=20=20=20\firstoftwoarguments=20=20= \else=0A=20=20=20\ifcsname\??mpgraphic=20o:#1\endcsname=20= \doubleexpandafter\firstoftwoarguments=20=20\else=0A=20=20=20= \ifcsname\??mpgraphic=20e:#1\endcsname=20= \tripleexpandafter\firstoftwoarguments=20=20\else=0A=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20\tripleexpandafter\secondoftwoarguments=20= \fi\fi\fi}=0A=0A\let\doifMPgraphicelse\doifelseMPgraphic=0A=0A%D=20New:=0A= =0A\definelayerpreset=20%=20no=20dx,dy=20-=20else=20nasty=20non-mp=20= placement=0A=20=20[mp]=0A=20=20[\c!y=3D-\MPury,=0A=20=20=20\c!x=3D\MPllx,=0A= =20=20=20\c!method=3D\v!fit]=0A=0A\definelayer=0A=20=20[mp]=0A=20=20= [\c!preset=3Dmp]=0A=0A%D=20Usage:=0A%D=0A%D=20\starttyping=0A%D=20= \defineviewerlayer[one][state=3Dstart]=0A%D=20= \defineviewerlayer[two][state=3Dstop]=0A%D=0A%D=20= \startuseMPgraphic{step-1}=0A%D=20=20=20fill=20fullcircle=20scaled=20= 10cm=20withcolor=20red=20;=0A%D=20\stopuseMPgraphic=0A%D=0A%D=20= \startuseMPgraphic{step-2}=0A%D=20=20=20fill=20fullcircle=20scaled=205cm=20= withcolor=20green=20;=0A%D=20\stopuseMPgraphic=0A%D=0A%D=20= \setlayer[mp]{\viewerlayer[one]{\useMPgraphic{step-1}}}=0A%D=20= \setlayer[mp]{\viewerlayer[two]{\useMPgraphic{step-2}}}=0A%D=0A%D=20= \ruledhbox{\flushlayer[mp]}=0A%D=20\stoptyping=0A%D=0A%D=20Reusing=20= graphics=20is=20also=20possible=20(now):=0A%D=0A%D=20\starttyping=0A%D=20= \startreusableMPgraphic{axis}=0A%D=20=20=20tickstep=20:=3D=201cm=20;=20= ticklength=20:=3D=202mm=20;=0A%D=20=20=20drawticks=20unitsquare=20= xscaled=204cm=20yscaled=203cm=20shifted=20(-1cm,-1cm)=20;=0A%D=20=20=20= tickstep=20:=3D=20tickstep/2=20;=20ticklength=20:=3D=20ticklength/2=20;=0A= %D=20=20=20drawticks=20unitsquare=20xscaled=204cm=20yscaled=203cm=20= shifted=20(-1cm,-1cm)=20;=0A%D=20\stopreusableMPgraphic=0A%D=0A%D=20= \startuseMPgraphic{demo}=0A%D=20=20=20drawpoint=20"1cm,1.5cm"=20;=0A%D=20= \stopuseMPgraphic=0A%D=0A%D=20\definelayer[mp][preset=3Dmp]=0A%D=20= \setlayer[mp]{\reuseMPgraphic{axis}}=0A%D=20= \setlayer[mp]{\useMPgraphic{demo}}=0A%D=20\ruledhbox{\flushlayer[mp]}=0A= %D=20\stoptyping=0A=0A%D=20\macros=0A%D=20=20=20= {startstaticMPfigure,useMPstaticfigure}=0A%D=0A%D=20Static=20figures=20= are=20processed=20only=20when=20there=20has=20been=0A%D=20something=20= changed.=20Here=20is=20Aditya=20Mahajan's=20testcase:=0A%D=0A%D=20= \startbuffer=0A%D=20\startstaticMPfigure{circle}=0A%D=20=20=20fill=20= fullcircle=20scaled=201cm=20withcolor=20blue;=0A%D=20\stopstaticMPfigure=0A= %D=0A%D=20\startstaticMPfigure{axis}=0A%D=20=20=20drawarrow=20= (0,0)--(2cm,0)=20;=0A%D=20=20=20drawarrow=20(0,0)--(0,2cm)=20;=0A%D=20=20= =20label.llft(textext("(0,0)")=20,origin)=20;=0A%D=20\stopstaticMPfigure=0A= %D=20\stopbuffer=0A%D=0A%D=20\typebuffer=20\getbuffer=0A=0A= \unexpanded\def\startstaticMPfigure#1#2\stopstaticMPfigure=0A=20=20= {\startreusableMPgraphic{\??mpstaticgraphic#1}#2\stopreusableMPgraphic}=0A= =0A\unexpanded\def\startstaticMPgraphic=0A=20=20= {\dodoublegroupempty\meta_start_static_graphic}=0A=0A= \def\meta_start_static_graphic#1#2#3\stopstaticMPgraphic=0A=20=20= {\startreusableMPgraphic{\??mpstaticgraphic#1}{#2}#3\stopreusableMPgraphic= }=0A=0A\let\stopstaticMPfigure=20\relax=0A\let\stopstaticMPgraphic\relax=0A= =0A\unexpanded\def\usestaticMPfigure=0A=20=20= {\dodoubleempty\meta_use_static_figure}=0A=0A= \def\meta_use_static_figure[#1][#2]%=0A=20=20{\ifsecondargument=0A=20=20=20= =20=20\scale[#2]{\reuseMPgraphic{\??mpstaticgraphic#1}}%=0A=20=20=20= \else=0A=20=20=20=20=20\reuseMPgraphic{\??mpstaticgraphic#1}%=0A=20=20=20= \fi}=0A=0A%D=20Goody=20for=20preventing=20overflows:=0A=0A= \def\MPdivten[#1]{\withoutpt\the\dimexpr#1pt/10\relax}=0A=0A%D=20There=20= is=20no=20way=20to=20distinguish=20the=20black=20color=20that=20you=20= get=20when=0A%D=20you=20issue=20a=20\type=20{draw}=20without=20color=20= specification=20from=20a=20color=0A%D=20that=20has=20an=20explicit=20= black=20specification=20unless=20you=20set=20the=0A%D=20variable=20\type=20= {defaultcolormodel}=20to=201.=20Hoewever,=20in=20that=20case=0A%D=20you=20= cannot=20distinguish=20that=20draw=20from=20one=20with=20a=20\type=0A%D=20= {withoutcolor}=20specification.=20This=20means=20that=20we=20have=20to=20= provide=0A%D=20multiple=20variants=20of=20inheritance.=0A%D=0A%D=20In=20= any=20case=20we=20need=20to=20tell=20the=20converter=20what=20the=20= inherited=20color=0A%D=20is=20to=20start=20with.=20Case~3=20is=20kind=20= of=20unpredictable=20as=20it=20closely=0A%D=20relates=20to=20the=20order=20= in=20which=20paths=20are=20flushed.=20If=20you=20want=20to=0A%D=20= inherit=20automatically=20from=20the=20surrounding,=20you=20can=20best=20= stick=20to=0A%D=20variant=201.=20Variant=200=20(an=20isolated=20graphic)=20= is=20the=20default.=0A%D=0A%D=20\startbuffer=0A%D=20= \startuseMPgraphic{test}=0A%D=20=20=20=20=20drawoptions(withpen=20= pencircle=20scaled=201pt)=20;=0A%D=20=20=20=20=20def=20shift_cp=20=3D=20= currentpicture=20:=3D=20currentpicture=20shifted=20(-15pt,0)=20;=20= enddef=20;=0A%D=20=20=20=20=20draw=20fullcircle=20scaled=2010pt=20= withoutcolor=20=20;=20shift_cp=20;=0A%D=20=20=20=20=20fill=20fullcircle=20= scaled=2010pt=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;=20shift_cp=20= ;=0A%D=20=20=20=20=20draw=20fullcircle=20scaled=2010pt=20withoutcolor=20=20= ;=20shift_cp=20;=0A%D=20=20=20=20=20fill=20fullcircle=20scaled=2010pt=20= withcolor=20red=20;=20shift_cp=20;=0A%D=20=20=20=20=20draw=20fullcircle=20= scaled=2010pt=20withoutcolor=20=20;=20shift_cp=20;=0A%D=20=20=20=20=20= fill=20fullcircle=20scaled=2010pt=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20;=20shift_cp=20;=0A%D=20\stopuseMPgraphic=0A%D=0A%D=20\starttabulate=0A= %D=20\NC=200\quad=20\NC=20\MPcolormethod0=20\green=20XX\quad=20= \useMPgraphic{test}\quad=20XX=20\NC=20\NR=0A%D=20\NC=201\quad=20\NC=20= \MPcolormethod1=20\green=20XX\quad=20\useMPgraphic{test}\quad=20XX=20\NC=20= \NR=0A%D=20\NC=202\quad=20\NC=20\MPcolormethod2=20\green=20XX\quad=20= \useMPgraphic{test}\quad=20XX=20\NC=20\NR=0A%D=20\NC=203\quad=20\NC=20= \MPcolormethod3=20\green=20XX\quad=20\useMPgraphic{test}\quad=20XX=20\NC=20= \NR=0A%D=20\stoptabulate=0A%D=20\stopbuffer=0A%D=0A%D=20\typebuffer=20= \getbuffer=0A=0A\newconstant\MPcolormethod=0A=0A\appendtoks=0A=20=20=20=20= \ctxlua{metapost.setoutercolor(\number\MPcolormethod,\number\attribute\col= ormodelattribute,\number\attribute\colorattribute,\number\dogetattribute{t= ransparency})}%=0A\to=20\everyMPgraphic=0A=0A\startMPinitializations=0A=20= =20=20=20defaultcolormodel=20:=3D=20= \ifcase\MPcolormethod1\or1\or3\else3\fi;=0A\stopMPinitializations=0A=0A= %D=20\macros=0A%D=20=20=20{setupMPgraphics}=0A%D=0A%D=20Here=20is=20a=20= generic=20setup=20command:=0A=0A\installcorenamespace{MPgraphics}=0A=0A= \installsetuponlycommandhandler=20\??MPgraphics=20{MPgraphics}=0A=0A%D=20= Here=20we=20hook=20in=20the=20outer=20color.=20When=20\type=20{color}=20= is=20set=20to=20\type=0A%D=20{global}=20we=20get=20the=20outer=20color=20= automatically.=20If=20you=20change=20this=0A%D=20setting,=20you=20should=20= do=20it=20grouped=20in=20order=20not=20to=20make=20other=20graphics=0A%D=20= behave=20in=20unexpected=20ways.=0A=0A\appendtoks=0A=20=20=20=20= \doifelse{\directMPgraphicsparameter\c!color}\v!global{\MPcolormethod\plus= one}{\MPcolormethod\zerocount}%=0A\to=20\everysetupMPgraphics=0A=0A= \setupMPgraphics=0A=20=20[\c!color=3D\v!local]=0A=0A%D=20Done.=0A=0A= \protect=20\endinput=0A= --Apple-Mail=_64C129EB-4489-4F84-BE58-46A5D60D5C2B Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii

--Apple-Mail=_64C129EB-4489-4F84-BE58-46A5D60D5C2B-- --Apple-Mail=_471828F9-1420-4284-87CA-7D79E565C045-- --===============1424346264== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============1424346264==--