From 6e58fd80fec5c2c79af58e74ba6930ea07e461bc Mon Sep 17 00:00:00 2001 From: Taco Hoekwater Date: Tue, 15 Apr 2008 16:09:44 +0000 Subject: Metapost 1.003 git-svn-id: svn://tug.org/texlive/trunk@7425 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/metapost/base/boxes.mp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Master/texmf-dist/metapost/base/boxes.mp') diff --git a/Master/texmf-dist/metapost/base/boxes.mp b/Master/texmf-dist/metapost/base/boxes.mp index 7a70c7b6f14..bd2d73aef80 100644 --- a/Master/texmf-dist/metapost/base/boxes.mp +++ b/Master/texmf-dist/metapost/base/boxes.mp @@ -20,8 +20,7 @@ enddef; % Take a string returned by the str operator and return the same string % with explicit numeric subscripts replaced by generic subscript symbols []. % -% This new version makes sure that variables with '[[' in them are treated -% correctly. +% Fixed version supplied by Eddie Kohler vardef generisize (expr ss) = save res, s, stest, l; string res, s, stest; @@ -32,16 +31,16 @@ vardef generisize (expr ss) = res := res & substring (0,l) of s; s := substring (l,infinity) of s; if s<>"": - if s>="[": - stest := substring (0,1) of s; + if (s>="[") and (length s > 1): + stest := substring (1,2) of s; if stest="[": - l := 1; - res := res & "["; + l := 2; + res := res & "[["; else: l := 1 + str_prefix(s, c<>"]"); res := res & "[]"; fi - else: + else: res := res & "[]"; l := str_prefix(s, (c=".") or ("0"<=c) and (c<="9")); fi @@ -51,6 +50,7 @@ vardef generisize (expr ss) = res enddef; + % Make sure the string _n_gen_ is generisize(_n_): vardef set_n_gen_ = if _n_ <> _n_cur_: -- cgit v1.2.3