[metapost] strings with > 4000 characters

Dan Luecking luecking at uark.edu
Mon Sep 12 18:00:03 CEST 2011


At 08:42 AM 9/12/2011, you wrote:
>In article
><CALBOmsad+S2kEptEDE=ct6ptBRZ24nscMxeS5VixQExUi+JM4Q at mail.gmail.com>,
>  Mojca Miklavec <mojca.miklavec.lists at gmail.com> wrote:
>
> > Dear list,
> >
> > I would like to ask if there is any trick that enables splitting
> > strings with > 4000 characters.
> >
> > I would like to use
> >     substring (10000,10006) of some string
> >
> > When drawing functions, one can scale down calculations towards lower
> > numbers and with some special care, one can still make it work. Is
> > there any similar trick (excluding metapost 2) for strings?
>
>Three tricks come to my mind (all untested!):
>
>1) Repeatedly eat chunks from your strings, e.g.
>
>for i = 1 upto 5 : s := substring(2000,infinity) of s; endfor
>s := substring(0,6) of s;

Note that infinity is a plain.mp variable that still
equals 4095.99998 so the above code would only see
the first 4096 characters of s.


>2) Set warningcheck:=0;

Or pass the numbers as sums:
   substring(4000+4000+2000, 4000+4000+2006) of s;
or products
   substring(10*1000, 10*1000+6) of s;
because intermediste calculations are allowed to be exceed
infinity without warnings or errors.


Dan


Daniel H. Luecking
Department of Mathematical Sciences
Fayetteville, Arkansas
http://www-cs-faculty.stanford.edu/~knuth/iaq.html 



More information about the metapost mailing list