diff options
author | Marius <mariausol@gmail.com> | 2013-09-10 18:00:25 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2013-09-10 18:00:25 +0300 |
commit | a6bce84a9da1f7e127c8434fba6c040b3cd5696e (patch) | |
tree | 59f51081f213810ba0f20f982a6a740abc6da476 /metapost | |
parent | c01cce54668e7d1ee5da843a2ce97b61ca759f90 (diff) | |
download | context-a6bce84a9da1f7e127c8434fba6c040b3cd5696e.tar.gz |
beta 2013.09.10 16:50
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mp-mlib.mpiv | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv index 214faec5b..1f1146def 100644 --- a/metapost/context/base/mp-mlib.mpiv +++ b/metapost/context/base/mp-mlib.mpiv @@ -769,3 +769,35 @@ enddef ; % draw textext.autoalign(160)("\strut oeps 2") ; % draw textext.autoalign(260)("\strut oeps 3") ; % draw textext.autoalign(360)("\strut oeps 4") ; + +% new +% +% passvariable("version","1.0") ; +% passvariable("number",123) ; +% passvariable("string","whatever") ; +% passvariable("point",(1,2)) ; +% passvariable("triplet",(1,2,3)) ; +% passvariable("quad",(1,2,3,4)) ; +% passvariable("boolean",false) ; +% passvariable("path",fullcircle scaled 1cm) ; + +vardef mfun_p_to_s(expr p,i) = + decimal xpart (point i of p) & " " & + decimal ypart (point i of p) & " " & + decimal xpart (precontrol i of p) & " " & + decimal ypart (precontrol i of p) & " " & + decimal xpart (postcontrol i of p) & " " & + decimal ypart (postcontrol i of p) +enddef ; + +def passvariable(expr key, value) = + special + if numeric value : "1:" & key & "=" & decimal value + elseif pair value : "4:" & key & "=" & ddecimal value + elseif rgbcolor value : "5:" & key & "=" & dddecimal value + elseif cmykcolor value : "6:" & key & "=" & ddddecimal value + elseif boolean value : "3:" & key & "=" & if value : "true" else : "false" fi + elseif path value : "7:" & key & "=" & mfun_p_to_s(value,1) for i=2 upto length(value) : & " " & mfun_p_to_s(value,i) endfor + else : "2:" & key & "=" & value + fi ; +enddef ; |