summaryrefslogtreecommitdiff
path: root/metapost/context/base/mpiv/mp-luas.mpiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-11-18 16:12:36 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2018-11-18 16:12:36 +0100
commit744095aa4676553437db0d71c281a74557a3222f (patch)
treebfdf5d203b5fbfa44ee7db705d3b3475361ad28f /metapost/context/base/mpiv/mp-luas.mpiv
parente2ee706a3114129601a30908d6b8cbb57068d32c (diff)
downloadcontext-744095aa4676553437db0d71c281a74557a3222f.tar.gz
2018-11-18 14:16:00
Diffstat (limited to 'metapost/context/base/mpiv/mp-luas.mpiv')
-rw-r--r--metapost/context/base/mpiv/mp-luas.mpiv19
1 files changed, 17 insertions, 2 deletions
diff --git a/metapost/context/base/mpiv/mp-luas.mpiv b/metapost/context/base/mpiv/mp-luas.mpiv
index 293ebadaf..e5cfe0371 100644
--- a/metapost/context/base/mpiv/mp-luas.mpiv
+++ b/metapost/context/base/mpiv/mp-luas.mpiv
@@ -225,8 +225,23 @@ vardef texstr(expr name) = lua.mp.texstr(name) enddef ;
% endfor cycle ;
% \stopMPcode
-def inpath suffix p =
- = 1 step 1 until lua.mp.mf_path_length(str p)
+% def inpath suffix p =
+% = 1 step 1 until lua.mp.mf_path_length(str p)
+% enddef ;
+
+% def inpath suffix p =
+% % = 1 step 1 until lua.mp.mf_path_length(str p)
+% = 1 step 1 until (begingroup save n ; n := lua.mp.mf_path_length(str p) ; if n = 0 : 1 else : n fi endgroup)
+% enddef ;
+
+def inpath suffix p = % permits p[0]
+ = 1 step 1 until
+ begingroup
+ save mfun_inpath_r,mfun_inpath_n ; path mfun_inpath_r ;
+ mfun_inpath_r = p ;
+ mfun_inpath_n := lua.mp.mf_path_length(str mfun_inpath_r) ;
+ if mfun_inpath_n = 0 : 1 else : mfun_inpath_n fi
+ endgroup
enddef ;
vardef pointof primary i = lua.mp.mf_path_point(i) enddef ;