summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/runlabel.cc
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/runlabel.cc')
-rw-r--r--Build/source/utils/asymptote/runlabel.cc75
1 files changed, 33 insertions, 42 deletions
diff --git a/Build/source/utils/asymptote/runlabel.cc b/Build/source/utils/asymptote/runlabel.cc
index 04425513b37..1f7ea7417e1 100644
--- a/Build/source/utils/asymptote/runlabel.cc
+++ b/Build/source/utils/asymptote/runlabel.cc
@@ -182,7 +182,6 @@ array *readpath(const string& psname, bool keep, bool pdf=false,
mem::vector<solvedKnot> nodes;
solvedKnot node;
- bool cyclic=false;
bool active=false;
array *P=new array(0);
@@ -196,28 +195,6 @@ array *readpath(const string& psname, bool keep, bool pdf=false,
switch(c) {
case 'M':
{
- if(active) {
- if(cyclic) {
- if(node.point == nodes[0].point)
- nodes[0].pre=node.pre;
- else {
- pair delta=(nodes[0].point-node.point)*third;
- node.post=node.point+delta;
- nodes[0].pre=nodes[0].point-delta;
- node.straight=true;
- nodes.push_back(node);
- }
- } else {
- node.post=node.point;
- node.straight=false;
- nodes.push_back(node);
- }
- if(cyclic) // Discard noncyclic paths.
- P->push(path(nodes,nodes.size(),cyclic));
- nodes.clear();
- }
- active=false;
- cyclic=false;
node.pre=node.point=readpair(buf,hscale,vscale);
node.straight=false;
break;
@@ -248,7 +225,21 @@ array *readpath(const string& psname, bool keep, bool pdf=false,
}
case 'c':
{
- cyclic=true;
+ if(active) {
+ if(node.point == nodes[0].point)
+ nodes[0].pre=node.pre;
+ else {
+ pair delta=(nodes[0].point-node.point)*third;
+ node.post=node.point+delta;
+ nodes[0].pre=nodes[0].point-delta;
+ node.straight=true;
+ nodes.push_back(node);
+ }
+ P->push(path(nodes,nodes.size(),true)); // Discard noncyclic paths
+ nodes.clear();
+ }
+ active=false;
+ node.straight=false;
break;
}
}
@@ -272,7 +263,7 @@ array *readpath(const string& psname, bool keep, bool pdf=false,
#endif
namespace run {
-#line 223 "runlabel.in"
+#line 214 "runlabel.in"
// void label(picture *f, string *s, string *size, transform t, pair position, pair align, pen p);
void gen_runlabel0(stack *Stack)
{
@@ -283,26 +274,26 @@ void gen_runlabel0(stack *Stack)
string * size=vm::pop<string *>(Stack);
string * s=vm::pop<string *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 225 "runlabel.in"
+#line 216 "runlabel.in"
f->append(new drawLabel(*s,*size,t,position,align,p));
}
-#line 229 "runlabel.in"
+#line 220 "runlabel.in"
// bool labels(picture *f);
void gen_runlabel1(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 230 "runlabel.in"
+#line 221 "runlabel.in"
{Stack->push<bool>(f->havelabels()); return;}
}
-#line 234 "runlabel.in"
+#line 225 "runlabel.in"
// realarray* texsize(string *s, pen p=CURRENTPEN);
void gen_runlabel2(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
string * s=vm::pop<string *>(Stack);
-#line 235 "runlabel.in"
+#line 226 "runlabel.in"
texinit();
processDataStruct &pd=processData();
@@ -319,13 +310,13 @@ void gen_runlabel2(stack *Stack)
{Stack->push<realarray*>(t); return;}
}
-#line 252 "runlabel.in"
+#line 243 "runlabel.in"
// patharray2* _texpath(stringarray *s, penarray *p);
void gen_runlabel3(stack *Stack)
{
penarray * p=vm::pop<penarray *>(Stack);
stringarray * s=vm::pop<stringarray *>(Stack);
-#line 253 "runlabel.in"
+#line 244 "runlabel.in"
size_t n=checkArrays(s,p);
if(n == 0) {Stack->push<patharray2*>(new array(0)); return;}
@@ -468,13 +459,13 @@ void gen_runlabel3(stack *Stack)
readpath(psname,keep,false,0.12,-1.0)); return;}
}
-#line 396 "runlabel.in"
+#line 387 "runlabel.in"
// patharray2* textpath(stringarray *s, penarray *p);
void gen_runlabel4(stack *Stack)
{
penarray * p=vm::pop<penarray *>(Stack);
stringarray * s=vm::pop<stringarray *>(Stack);
-#line 397 "runlabel.in"
+#line 388 "runlabel.in"
size_t n=checkArrays(s,p);
if(n == 0) {Stack->push<patharray2*>(new array(0)); return;}
@@ -547,13 +538,13 @@ void gen_runlabel4(stack *Stack)
{Stack->push<patharray2*>(readpath(psname,keep,false,0.1)); return;}
}
-#line 470 "runlabel.in"
+#line 461 "runlabel.in"
// patharray* _strokepath(path g, pen p=CURRENTPEN);
void gen_runlabel5(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
path g=vm::pop<path>(Stack);
-#line 471 "runlabel.in"
+#line 462 "runlabel.in"
array *P=new array(0);
if(g.size() == 0) {Stack->push<patharray*>(P); return;}
@@ -583,17 +574,17 @@ namespace trans {
void gen_runlabel_venv(venv &ve)
{
-#line 223 "runlabel.in"
+#line 214 "runlabel.in"
addFunc(ve, run::gen_runlabel0, primVoid(), SYM(label), formal(primPicture(), SYM(f), false, false), formal(primString(), SYM(s), false, false), formal(primString(), SYM(size), false, false), formal(primTransform(), SYM(t), false, false), formal(primPair(), SYM(position), false, false), formal(primPair(), SYM(align), false, false), formal(primPen(), SYM(p), false, false));
-#line 229 "runlabel.in"
+#line 220 "runlabel.in"
addFunc(ve, run::gen_runlabel1, primBoolean(), SYM(labels), formal(primPicture(), SYM(f), false, false));
-#line 234 "runlabel.in"
+#line 225 "runlabel.in"
addFunc(ve, run::gen_runlabel2, realArray(), SYM(texsize), formal(primString(), SYM(s), false, false), formal(primPen(), SYM(p), true, false));
-#line 252 "runlabel.in"
+#line 243 "runlabel.in"
addFunc(ve, run::gen_runlabel3, pathArray2() , SYM(_texpath), formal(stringArray() , SYM(s), false, false), formal(penArray() , SYM(p), false, false));
-#line 396 "runlabel.in"
+#line 387 "runlabel.in"
addFunc(ve, run::gen_runlabel4, pathArray2() , SYM(textpath), formal(stringArray() , SYM(s), false, false), formal(penArray() , SYM(p), false, false));
-#line 470 "runlabel.in"
+#line 461 "runlabel.in"
addFunc(ve, run::gen_runlabel5, pathArray() , SYM(_strokepath), formal(primPath(), SYM(g), false, false), formal(primPen(), SYM(p), true, false));
}