diff options
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mpiv/mp-luas.mpiv | 6 | ||||
-rw-r--r-- | metapost/context/base/mpiv/mp-mlib.mpiv | 14 |
2 files changed, 19 insertions, 1 deletions
diff --git a/metapost/context/base/mpiv/mp-luas.mpiv b/metapost/context/base/mpiv/mp-luas.mpiv index 3bc95349d..d025848ca 100644 --- a/metapost/context/base/mpiv/mp-luas.mpiv +++ b/metapost/context/base/mpiv/mp-luas.mpiv @@ -56,13 +56,15 @@ vardef mlib_luas_luacall(text t) = runscript("" for s = t : if string s : & s -% & mfun_lua_bs & s & mfun_lua_es + % & mfun_lua_bs & s & mfun_lua_es elseif numeric s : & decimal s elseif boolean s : & if s : "true" else : "false" fi elseif pair s : & mfun_pair_to_table(s) + elseif path s : + & mfun_path_to_table(s) elseif rgbcolor s : & mfun_rgb_to_table(s) elseif cmykcolor s : @@ -90,6 +92,8 @@ vardef mlib_luas_lualist(expr c)(text t) = & if s : "true" else : "false" fi elseif pair s : & mfun_pair_to_table(s) + elseif path s : + & mfun_path_to_table(s) elseif rgbcolor s : & mfun_rgb_to_table(s) elseif cmykcolor s : diff --git a/metapost/context/base/mpiv/mp-mlib.mpiv b/metapost/context/base/mpiv/mp-mlib.mpiv index 403b2d3ae..6fcc75d50 100644 --- a/metapost/context/base/mpiv/mp-mlib.mpiv +++ b/metapost/context/base/mpiv/mp-mlib.mpiv @@ -1489,6 +1489,20 @@ vardef mfun_pair_to_table(expr p) = "}" enddef ; +vardef mfun_point_to_table(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 ; + +vardef mfun_path_to_table(expr p) = + "{" & mfun_point_to_table(p,0) for i=1 upto length(p) : & "," & mfun_point_to_table(p,i) endfor & "}" +enddef ; + vardef mfun_rgbcolor_to_table(expr c) = "{" & decimal redpart c & "," & decimal greenpart c & |