summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/utils/README2
-rw-r--r--Build/source/utils/asymptote/ChangeLog216
-rw-r--r--Build/source/utils/asymptote/Makefile.in2
-rw-r--r--Build/source/utils/asymptote/ReleaseNotes9
-rw-r--r--Build/source/utils/asymptote/TODO2
-rw-r--r--Build/source/utils/asymptote/application.cc8
-rw-r--r--Build/source/utils/asymptote/arrayop.h2
-rw-r--r--Build/source/utils/asymptote/asy-keywords.el2
-rw-r--r--Build/source/utils/asymptote/asymptote.spec2
-rw-r--r--Build/source/utils/asymptote/base/binarytree.asy2
-rw-r--r--Build/source/utils/asymptote/base/fontsize.asy2
-rw-r--r--Build/source/utils/asymptote/base/plain.asy4
-rw-r--r--Build/source/utils/asymptote/base/three.asy7
-rw-r--r--Build/source/utils/asymptote/builtin.cc4
-rw-r--r--Build/source/utils/asymptote/builtin.h4
-rw-r--r--Build/source/utils/asymptote/coder.cc66
-rw-r--r--Build/source/utils/asymptote/coder.h21
-rwxr-xr-xBuild/source/utils/asymptote/configure18
-rw-r--r--Build/source/utils/asymptote/configure.ac2
-rw-r--r--Build/source/utils/asymptote/constructor.cc6
-rw-r--r--Build/source/utils/asymptote/dec.cc8
-rw-r--r--Build/source/utils/asymptote/doc/CAD.pdfbin67565 -> 67395 bytes
-rw-r--r--Build/source/utils/asymptote/doc/FAQ/asy-faq.info2
-rw-r--r--Build/source/utils/asymptote/doc/asymptote.pdfbin1692650 -> 1553892 bytes
-rw-r--r--Build/source/utils/asymptote/doc/asymptote.sty108
-rw-r--r--Build/source/utils/asymptote/doc/asymptote.texi26
-rw-r--r--Build/source/utils/asymptote/doc/extra/intro.asy833
-rw-r--r--Build/source/utils/asymptote/doc/extra/intro_.bbl29
-rw-r--r--Build/source/utils/asymptote/doc/latexusage-1.asy55
-rw-r--r--Build/source/utils/asymptote/doc/latexusage-2.asy23
-rw-r--r--Build/source/utils/asymptote/doc/latexusage-3.asy38
-rw-r--r--Build/source/utils/asymptote/doc/latexusage.tex3
-rw-r--r--Build/source/utils/asymptote/doc/png/Makefile.in2
-rw-r--r--Build/source/utils/asymptote/doc/png/asymptote.info285
-rw-r--r--Build/source/utils/asymptote/entry.cc3
-rw-r--r--Build/source/utils/asymptote/entry.h9
-rw-r--r--Build/source/utils/asymptote/errors3
-rw-r--r--Build/source/utils/asymptote/errortest.asy16
-rw-r--r--Build/source/utils/asymptote/examples/arrows3.asy2
-rw-r--r--Build/source/utils/asymptote/examples/basealign.asy1
-rw-r--r--Build/source/utils/asymptote/examples/billboard.asy2
-rw-r--r--Build/source/utils/asymptote/examples/mergeExample.asy77
-rw-r--r--Build/source/utils/asymptote/examples/partitionExample.asy27
-rw-r--r--Build/source/utils/asymptote/examples/quilt.asy44
-rw-r--r--Build/source/utils/asymptote/examples/workcone.asy8
-rw-r--r--Build/source/utils/asymptote/examples/xstitch.asy5
-rw-r--r--Build/source/utils/asymptote/exp.cc62
-rw-r--r--Build/source/utils/asymptote/exp.h34
-rw-r--r--Build/source/utils/asymptote/fundec.cc14
-rw-r--r--Build/source/utils/asymptote/inst.h12
-rw-r--r--Build/source/utils/asymptote/item.h44
-rw-r--r--Build/source/utils/asymptote/opsymbols.h121
-rw-r--r--Build/source/utils/asymptote/process.cc4
-rw-r--r--Build/source/utils/asymptote/program.cc14
-rw-r--r--Build/source/utils/asymptote/program.h6
-rw-r--r--Build/source/utils/asymptote/record.cc4
-rw-r--r--Build/source/utils/asymptote/runarray.cc413
-rw-r--r--Build/source/utils/asymptote/runarray.in7
-rw-r--r--Build/source/utils/asymptote/runtime.cc855
-rw-r--r--Build/source/utils/asymptote/runtime.in3
-rw-r--r--Build/source/utils/asymptote/stack.cc28
-rw-r--r--Build/source/utils/asymptote/stm.cc76
-rw-r--r--Build/source/utils/asymptote/tests/array/fields.asy22
-rw-r--r--Build/source/utils/asymptote/texfile.cc2
64 files changed, 2234 insertions, 1477 deletions
diff --git a/Build/source/utils/README b/Build/source/utils/README
index 4f4eb3b5d1a..4309e7c1e7f 100644
--- a/Build/source/utils/README
+++ b/Build/source/utils/README
@@ -4,7 +4,7 @@ Public domain. Originally written 2005 by Karl Berry.
Extra utilities we (optionally) compile for TeX Live.
See comments in ../texk/README.
-asymptote 2.00 - checked 4jul10
+asymptote 2.01 - checked 6jul10
update to TL from CTAN, to include prebuilt doc.
see http://tug.org/texlive/build.html#asymptote
and tlpkg/bin/tl-update-asy
diff --git a/Build/source/utils/asymptote/ChangeLog b/Build/source/utils/asymptote/ChangeLog
index 5d7a5c6f5b8..c4bbb69a533 100644
--- a/Build/source/utils/asymptote/ChangeLog
+++ b/Build/source/utils/asymptote/ChangeLog
@@ -1,4 +1,220 @@
------------------------------------------------------------------------
+r5079 | jcbowman | 2010-07-05 01:23:04 -0600 (Mon, 05 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/png/Makefile.in
+
+Remove invalid option.
+
+------------------------------------------------------------------------
+r5078 | jcbowman | 2010-07-05 01:12:29 -0600 (Mon, 05 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/asymptote.sty
+ M /trunk/asymptote/doc/asymptote.texi
+ M /trunk/asymptote/doc/latexusage.tex
+
+Support individual processing of each figure within a LaTeX document.
+
+------------------------------------------------------------------------
+r5077 | jcbowman | 2010-07-05 01:03:52 -0600 (Mon, 05 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/extra/intro.asy
+ A /trunk/asymptote/examples/quilt.asy
+
+Update talk.
+
+------------------------------------------------------------------------
+r5076 | jcbowman | 2010-07-05 00:22:55 -0600 (Mon, 05 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/fontsize.asy
+ M /trunk/asymptote/doc/asymptote.texi
+
+Revert to type1cm.sty since fix-cm.sty does not work as advertised.
+
+------------------------------------------------------------------------
+r5075 | hammera | 2010-07-03 16:56:38 -0600 (Sat, 03 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/asymptote.texi
+
+For loop and var documentation.
+
+------------------------------------------------------------------------
+r5074 | hammera | 2010-07-03 16:52:23 -0600 (Sat, 03 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/errors
+ M /trunk/asymptote/errortest.asy
+ M /trunk/asymptote/stm.cc
+ M /trunk/asymptote/tests/array/fields.asy
+
+Allow var in extended for statement.
+
+------------------------------------------------------------------------
+r5073 | jcbowman | 2010-07-03 01:37:08 -0600 (Sat, 03 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/plain.asy
+
+Delete old aux file.
+
+------------------------------------------------------------------------
+r5072 | jcbowman | 2010-07-03 01:32:58 -0600 (Sat, 03 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/texfile.cc
+
+Use settings.outname().
+
+------------------------------------------------------------------------
+r5071 | hammera | 2010-07-01 17:05:34 -0600 (Thu, 01 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/Makefile.in
+
+Enabled transConditionalJump.
+
+------------------------------------------------------------------------
+r5070 | hammera | 2010-07-01 17:04:30 -0600 (Thu, 01 Jul 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/TODO
+ M /trunk/asymptote/application.cc
+ M /trunk/asymptote/builtin.cc
+ M /trunk/asymptote/builtin.h
+ M /trunk/asymptote/coder.cc
+ M /trunk/asymptote/coder.h
+ M /trunk/asymptote/constructor.cc
+ M /trunk/asymptote/dec.cc
+ M /trunk/asymptote/entry.cc
+ M /trunk/asymptote/entry.h
+ M /trunk/asymptote/exp.cc
+ M /trunk/asymptote/exp.h
+ M /trunk/asymptote/fundec.cc
+ M /trunk/asymptote/inst.h
+ M /trunk/asymptote/process.cc
+ M /trunk/asymptote/program.cc
+ M /trunk/asymptote/program.h
+ M /trunk/asymptote/record.cc
+ M /trunk/asymptote/runarray.in
+ M /trunk/asymptote/stack.cc
+ M /trunk/asymptote/stm.cc
+
+Slightly more optimized bytecode.
+
+------------------------------------------------------------------------
+r5069 | jcbowman | 2010-06-30 09:24:59 -0600 (Wed, 30 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/asymptote/doc/extra/intro.asy
+ M /trunk/asymptote/examples/arrows3.asy
+
+Update example.
+------------------------------------------------------------------------
+r5068 | jcbowman | 2010-06-30 03:51:04 -0600 (Wed, 30 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/asymptote/doc/extra/intro.asy
+ M /trunk/asymptote/doc/extra/intro_.bbl
+
+Update lecture.
+------------------------------------------------------------------------
+r5067 | jcbowman | 2010-06-30 02:50:12 -0600 (Wed, 30 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/examples/billboard.asy
+
+Fix normal vector for perspective projections.
+
+------------------------------------------------------------------------
+r5066 | jcbowman | 2010-06-30 02:43:26 -0600 (Wed, 30 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/runlabel.in
+
+Revert r5061.
+
+------------------------------------------------------------------------
+r5065 | jcbowman | 2010-06-30 02:20:14 -0600 (Wed, 30 Jun 2010) | 2 lines
+Changed paths:
+ A /trunk/asymptote/examples/mergeExample.asy
+ A /trunk/asymptote/examples/partitionExample.asy
+
+Add new examples.
+
+------------------------------------------------------------------------
+r5064 | jcbowman | 2010-06-29 23:55:45 -0600 (Tue, 29 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/asymptote/Makefile.in
+ M /trunk/asymptote/configure.ac
+
+Revert docdir changes since they break rpmbuild.
+------------------------------------------------------------------------
+r5063 | jcbowman | 2010-06-29 23:39:30 -0600 (Tue, 29 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/Makefile.in
+ M /trunk/asymptote/asymptote.spec
+ M /trunk/asymptote/configure.ac
+
+Fix docdir.
+
+------------------------------------------------------------------------
+r5062 | jcbowman | 2010-06-29 22:53:02 -0600 (Tue, 29 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/binarytree.asy
+ M /trunk/asymptote/doc/asymptote.texi
+ M /trunk/asymptote/doc/extra/intro.asy
+
+Use PenMargin in drawing a binarytree.
+
+------------------------------------------------------------------------
+r5061 | jcbowman | 2010-06-29 22:49:17 -0600 (Tue, 29 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/runlabel.in
+
+Check for \r as well as \n terminator.
+
+------------------------------------------------------------------------
+r5060 | jcbowman | 2010-06-28 18:45:05 -0600 (Mon, 28 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/asymptote/configure.ac
+
+Support docdir.
+------------------------------------------------------------------------
+r5059 | jcbowman | 2010-06-28 08:44:34 -0600 (Mon, 28 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/asymptote/examples/xstitch.asy
+
+Improve example.
+------------------------------------------------------------------------
+r5058 | jcbowman | 2010-06-28 08:29:15 -0600 (Mon, 28 Jun 2010) | 2 lines
+Changed paths:
+ M /trunk/asymptote/examples/basealign.asy
+
+Improve example.
+
+------------------------------------------------------------------------
+r5057 | jcbowman | 2010-06-27 17:57:33 -0600 (Sun, 27 Jun 2010) | 3 lines
+Changed paths:
+ M /trunk/asymptote/runtime.in
+
+Use values for BoolTruthValue and BoolFalseValue less likely confused with
+another type.
+
+------------------------------------------------------------------------
+r5056 | jcbowman | 2010-06-27 16:46:03 -0600 (Sun, 27 Jun 2010) | 4 lines
+Changed paths:
+ M /trunk/asymptote/arrayop.h
+ M /trunk/asymptote/item.h
+ M /trunk/asymptote/runtime.in
+
+Add quasi-type checking for bools.
+
+Clear uninitialized item bits.
+
+------------------------------------------------------------------------
+r5055 | jcbowman | 2010-06-25 21:44:33 -0600 (Fri, 25 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/asymptote/examples/workcone.asy
+
+Update example.
+------------------------------------------------------------------------
+r5054 | jcbowman | 2010-06-25 16:29:44 -0600 (Fri, 25 Jun 2010) | 1 line
+Changed paths:
+ M /trunk/asymptote/configure.ac
+
+Increment version to 2.01svn.
+------------------------------------------------------------------------
r5053 | jcbowman | 2010-06-25 13:27:05 -0600 (Fri, 25 Jun 2010) | 2 lines
Changed paths:
M /trunk/asymptote/builtin.cc
diff --git a/Build/source/utils/asymptote/Makefile.in b/Build/source/utils/asymptote/Makefile.in
index 13040078e88..8b06fbbef8d 100644
--- a/Build/source/utils/asymptote/Makefile.in
+++ b/Build/source/utils/asymptote/Makefile.in
@@ -51,7 +51,7 @@ ASY = ./asy -dir base -config "" -render=0
DEFS = @DEFS@ @OPTIONS@ \
-DPRESYM -DFASTCAST -DCALLEE_SEARCH -DEXACT_MATCH -DTEST_ADDED_OPS \
- -DNO_FUNC_OPS
+ -DNO_FUNC_OPS -DTRANSJUMP
CFLAGS = @CPPFLAGS@ @CFLAGS@
OPTS = $(DEFS) $(CFLAGS)
INCL = -I . @INCL@
diff --git a/Build/source/utils/asymptote/ReleaseNotes b/Build/source/utils/asymptote/ReleaseNotes
index 9614132eb82..d35e05a8ac1 100644
--- a/Build/source/utils/asymptote/ReleaseNotes
+++ b/Build/source/utils/asymptote/ReleaseNotes
@@ -1,3 +1,12 @@
+Release Notes for Version 2.01
+
+The normal vector for perspective projections was fixed. Individual
+processing of each figure within a LaTeX document is now supported.
+The fontsize package uses type1cm.sty again since fix-cm.sty does not
+appear to work as advertised. Uninitialized item bits are cleared.
+Extended for statements now support the var type. PenMargin is used in
+drawing a binarytree. Minor optimizations were made.
+
Release Notes for Version 2.00
The construction of 3D TeX labels was sped up greatly. Plain TeX page
diff --git a/Build/source/utils/asymptote/TODO b/Build/source/utils/asymptote/TODO
index 6265d3c0dd5..98c1c8195fa 100644
--- a/Build/source/utils/asymptote/TODO
+++ b/Build/source/utils/asymptote/TODO
@@ -2,6 +2,8 @@ Andy: Investigate bbox error in uofa-talk Shadowing slide
Andy: make var work in extended for
+Andy: change label in coder to a class not an Int
+
Andy: possible optimizations:
overloaded::simplify copies
straight guide which references a subset of a pair vector.
diff --git a/Build/source/utils/asymptote/application.cc b/Build/source/utils/asymptote/application.cc
index cbcb19620b0..0e6ad4421f6 100644
--- a/Build/source/utils/asymptote/application.cc
+++ b/Build/source/utils/asymptote/application.cc
@@ -491,7 +491,7 @@ bool halfExactMightMatch(env &e,
# define CASTABLE castable
#endif
- // These casting tests if successful will be repeating again by
+ // These casting tests if successful will be repeated again by
// application::match. It would be nice to avoid this somehow, but the
// additional complexity is probably not worth the minor speed improvement.
if (equivalent(formals[0].t, t1))
@@ -502,8 +502,8 @@ bool halfExactMightMatch(env &e,
}
// Most common after exact matches are cases such as
-// 2 + 3.4
-// that is, binary operations were one of the operands matches exactly and the
+// 2 + 3.4 (int, real) --> (real, real)
+// that is, binary operations where one of the operands matches exactly and the
// other does not. This function searches for these so-called "half-exact"
// matches. This should only be called after exactMultimatch has failed.
app_list halfExactMultimatch(env &e,
@@ -554,7 +554,7 @@ app_list halfExactMultimatch(env &e,
return l;
}
-// Simple check if there are two many arguments to match the candidate
+// Simple check if there are too many arguments to match the candidate
// function.
bool tooManyArgs(types::signature *target, types::signature *source) {
return source->getNumFormals() > target->getNumFormals() &&
diff --git a/Build/source/utils/asymptote/arrayop.h b/Build/source/utils/asymptote/arrayop.h
index 378b313627e..076f51417bb 100644
--- a/Build/source/utils/asymptote/arrayop.h
+++ b/Build/source/utils/asymptote/arrayop.h
@@ -7,8 +7,6 @@
#ifndef ARRAYOP_H
#define ARRAYOP_H
-#include <typeinfo>
-
#include "util.h"
#include "stack.h"
#include "array.h"
diff --git a/Build/source/utils/asymptote/asy-keywords.el b/Build/source/utils/asymptote/asy-keywords.el
index d49d2af2bfe..1b4365b88f5 100644
--- a/Build/source/utils/asymptote/asy-keywords.el
+++ b/Build/source/utils/asymptote/asy-keywords.el
@@ -2,7 +2,7 @@
;; This file is automatically generated by asy-list.pl.
;; Changes will be overwritten.
;;
-(defvar asy-keywords-version "2.00")
+(defvar asy-keywords-version "2.01")
(defvar asy-keyword-name '(
and controls tension atleast curl if else while for do return break continue struct typedef new access import unravel from include quote static public private restricted this explicit true false null cycle newframe operator ))
diff --git a/Build/source/utils/asymptote/asymptote.spec b/Build/source/utils/asymptote/asymptote.spec
index 076b13c553f..7972a8c5923 100644
--- a/Build/source/utils/asymptote/asymptote.spec
+++ b/Build/source/utils/asymptote/asymptote.spec
@@ -1,7 +1,7 @@
%{!?_texmf: %define _texmf %(eval "echo `kpsewhich -expand-var '$TEXMFLOCAL'`")}
Name: asymptote
-Version: 2.00
+Version: 2.01
Release: 1%{?dist}
Summary: Descriptive vector graphics language
diff --git a/Build/source/utils/asymptote/base/binarytree.asy b/Build/source/utils/asymptote/base/binarytree.asy
index 7bbd1de2148..0a80aec4b66 100644
--- a/Build/source/utils/asymptote/base/binarytree.asy
+++ b/Build/source/utils/asymptote/base/binarytree.asy
@@ -154,7 +154,7 @@ object draw(picture pic=currentpicture, binarytreeNode node, pair pos,
// calculate connection path
transform T=shift(nodeDiameter/2*unit(t*childPos-t*parentPos));
path arr=(T*t*parentPos)--(inverse(T)*t*childPos);
- draw(f,arr,p,Arrow(5));
+ draw(f,PenMargin(arr,p).g,p,Arrow(5));
});
pic.addPoint(parentPos);
pic.addPoint(childPos);
diff --git a/Build/source/utils/asymptote/base/fontsize.asy b/Build/source/utils/asymptote/base/fontsize.asy
index 4575f3480fa..54b01829550 100644
--- a/Build/source/utils/asymptote/base/fontsize.asy
+++ b/Build/source/utils/asymptote/base/fontsize.asy
@@ -1 +1 @@
-if(latex()) usepackage("fix-cm");
+if(latex()) usepackage("type1cm");
diff --git a/Build/source/utils/asymptote/base/plain.asy b/Build/source/utils/asymptote/base/plain.asy
index 4d0b4e566fb..76f77aaf52c 100644
--- a/Build/source/utils/asymptote/base/plain.asy
+++ b/Build/source/utils/asymptote/base/plain.asy
@@ -190,8 +190,7 @@ void usersetting()
// Conditionally process each file name in array s in a new environment.
void asy(string format, bool overwrite=false ... string[] s)
{
- for(int i=0; i < s.length; ++i) {
- string f=s[i];
+ for(string f : s) {
int n=rfind(f,".asy");
if(n != -1) f=erase(f,n,-1);
if(overwrite || error(input(f+"."+format,check=false))) {
@@ -201,6 +200,7 @@ void asy(string format, bool overwrite=false ... string[] s)
settings.outformat=format;
settings.interactiveView=false;
settings.batchView=false;
+ delete(outname()+"_"+".aux");
eval("defaultfilename=\""+f+"\"; import \""+f+
"\" as dummy; exitfunction()");
settings.outformat=outformat;
diff --git a/Build/source/utils/asymptote/base/three.asy b/Build/source/utils/asymptote/base/three.asy
index 528a1da13c1..4221646f632 100644
--- a/Build/source/utils/asymptote/base/three.asy
+++ b/Build/source/utils/asymptote/base/three.asy
@@ -251,9 +251,12 @@ projection operator * (transform3 t, projection P)
projection P=P.copy();
if(!P.absolute) {
P.camera=t*P.camera;
- P.normal=t*(P.target+P.normal);
+ triple target=P.target;
P.target=t*P.target;
- P.normal -= P.target;
+ if(P.infinity)
+ P.normal=t*(target+P.normal)-P.target;
+ else
+ P.normal=P.vector();
P.calculate();
}
return P;
diff --git a/Build/source/utils/asymptote/builtin.cc b/Build/source/utils/asymptote/builtin.cc
index 7435d08cb7a..4a8ed9c2216 100644
--- a/Build/source/utils/asymptote/builtin.cc
+++ b/Build/source/utils/asymptote/builtin.cc
@@ -877,4 +877,8 @@ void arrayDeleteHelper(stack *Stack)
(*a).erase((*a).begin()+i,(*a).begin()+j+1);
}
+// Used by coder to optimize conditional jumps.
+const bltin intLess = binaryOp<Int,less>;
+const bltin intGreater = binaryOp<Int,greater>;
+
}
diff --git a/Build/source/utils/asymptote/builtin.h b/Build/source/utils/asymptote/builtin.h
index 955063ca9a4..09a88133783 100644
--- a/Build/source/utils/asymptote/builtin.h
+++ b/Build/source/utils/asymptote/builtin.h
@@ -51,6 +51,10 @@ extern double infinity;
void single(vm::stack *Stack);
void arrayDeleteHelper(vm::stack *Stack);
+
+// Used by coder to optimize conditional jumps.
+extern const vm::bltin intLess;
+extern const vm::bltin intGreater;
}
#endif //BUILTIN_H
diff --git a/Build/source/utils/asymptote/coder.cc b/Build/source/utils/asymptote/coder.cc
index 6b08408ab2c..f2d3b4d6833 100644
--- a/Build/source/utils/asymptote/coder.cc
+++ b/Build/source/utils/asymptote/coder.cc
@@ -13,6 +13,7 @@
#include "coder.h"
#include "genv.h"
#include "entry.h"
+#include "builtin.h"
using namespace sym;
using namespace types;
@@ -37,7 +38,7 @@ vm::lambda *newLambda(string name) {
// The dummy environment of the global environment.
// Used purely for global variables and static code blocks of file
// level modules.
-coder::coder(string name, modifier sord)
+coder::coder(position pos, string name, modifier sord)
: level(new frame(name, 0, 0)),
recordLevel(0),
recordType(0),
@@ -49,14 +50,14 @@ coder::coder(string name, modifier sord)
perm(DEFAULT_PERM),
program(new vm::program),
numLabels(0),
- curPos(nullPos)
+ curPos(pos)
{
sord_stack.push(sord);
encodeAllocInstruction();
}
// Defines a new function environment.
-coder::coder(string name, function *t, coder *parent,
+coder::coder(position pos, string name, function *t, coder *parent,
modifier sord, bool reframe)
: level(reframe ? new frame(name,
parent->getFrame(),
@@ -72,7 +73,7 @@ coder::coder(string name, function *t, coder *parent,
perm(DEFAULT_PERM),
program(new vm::program),
numLabels(0),
- curPos(nullPos)
+ curPos(pos)
{
sord_stack.push(sord);
encodeAllocInstruction();
@@ -80,7 +81,7 @@ coder::coder(string name, function *t, coder *parent,
// Start encoding the body of the record. The function being encoded
// is the record's initializer.
-coder::coder(record *t, coder *parent, modifier sord)
+coder::coder(position pos, record *t, coder *parent, modifier sord)
: level(t->getLevel()),
recordLevel(t->getLevel()),
recordType(t),
@@ -92,20 +93,20 @@ coder::coder(record *t, coder *parent, modifier sord)
perm(DEFAULT_PERM),
program(new vm::program),
numLabels(0),
- curPos(nullPos)
+ curPos(pos)
{
sord_stack.push(sord);
encodeAllocInstruction();
}
-coder coder::newFunction(string name, function *t, modifier sord)
+coder coder::newFunction(position pos, string name, function *t, modifier sord)
{
- return coder(name, t, this, sord);
+ return coder(pos, name, t, this, sord);
}
-coder coder::newCodelet()
+coder coder::newCodelet(position pos)
{
- return coder("<codelet>", new function(primVoid()), this,
+ return coder(pos, "<codelet>", new function(primVoid()), this,
DEFAULT_DYNAMIC, false);
}
@@ -120,9 +121,9 @@ record *coder::newRecord(symbol id)
return r;
}
-coder coder::newRecordInit(record *r, modifier sord)
+coder coder::newRecordInit(position pos, record *r, modifier sord)
{
- return coder(r, this, sord);
+ return coder(pos, r, this, sord);
}
#ifdef DEBUG_BLTIN
@@ -136,6 +137,34 @@ void assertBltinLookup(inst::opcode op, item it)
#endif
+void coder::encodePop()
+{
+ if (isStatic() && !isTopLevel()) {
+ assert(parent);
+ parent->encodePop();
+ }
+ else {
+#ifdef COMBO
+ vm::program::label end = program->end();
+ --end;
+ inst& lastInst = *end;
+ if (lastInst.op == inst::varsave) {
+ lastInst.op = inst::varpop;
+ return;
+ }
+ if (lastInst.op == inst::fieldsave) {
+ lastInst.op = inst::fieldpop;
+ return;
+ }
+ // TODO: push+pop into no op.
+#endif
+
+ // No combo applicable. Just encode a usual pop.
+ encode(inst::pop);
+ }
+}
+
+
bool coder::encode(frame *f)
{
frame *toplevel = getFrame();
@@ -223,6 +252,19 @@ void coder::useLabel(inst::opcode op, Int label)
if (isStatic())
return parent->useLabel(op,label);
+#ifdef COMBO
+ if (op == inst::cjmp || op == inst::njmp) {
+ inst& last = program->back();
+ if (last.op == inst::builtin) {
+ bltin f = vm::get<bltin>(last);
+ if (f == run::intLess && op == inst::njmp) {
+ program->pop_back();
+ op = inst::gejmp;
+ }
+ }
+ }
+#endif
+
std::map<Int,vm::program::label>::iterator p = defs.find(label);
if (p != defs.end()) {
encode(op,p->second);
diff --git a/Build/source/utils/asymptote/coder.h b/Build/source/utils/asymptote/coder.h
index 92176cf774b..0405e6d18d7 100644
--- a/Build/source/utils/asymptote/coder.h
+++ b/Build/source/utils/asymptote/coder.h
@@ -18,6 +18,7 @@
#include "program.h"
#include "util.h"
#include "modifier.h"
+#include "inst.h"
namespace trans {
@@ -104,15 +105,18 @@ public:
// its own frame, which is the usual (sensible) thing to do. It is set to
// false for a line-at-a-time codelet, where variables should be allocated in
// the lower frame.
- coder(string name, function *t, coder *parent,
+ coder(position pos,
+ string name, function *t, coder *parent,
modifier sord = DEFAULT_DYNAMIC,
bool reframe=true);
// Start encoding the body of the record. The function being encoded
// is the record's initializer.
- coder(record *t, coder *parent, modifier sord = DEFAULT_DYNAMIC);
+ coder(position pos,
+ record *t, coder *parent, modifier sord = DEFAULT_DYNAMIC);
- coder(string name, modifier sord = DEFAULT_DYNAMIC);
+ coder(position pos,
+ string name, modifier sord = DEFAULT_DYNAMIC);
coder(const coder&);
@@ -179,17 +183,18 @@ public:
bool isRecord();
// Creates a new coder to handle the translation of a new function.
- coder newFunction(string name, function *t, modifier sord=DEFAULT_DYNAMIC);
+ coder newFunction(position pos,
+ string name, function *t, modifier sord=DEFAULT_DYNAMIC);
// Creates a new record type.
record *newRecord(symbol id);
// Create a coder for the initializer of the record.
- coder newRecordInit(record *r, modifier sord=DEFAULT_DYNAMIC);
+ coder newRecordInit(position pos, record *r, modifier sord=DEFAULT_DYNAMIC);
// Create a coder for translating a small piece of code. Used for
// line-at-a-time mode.
- coder newCodelet();
+ coder newCodelet(position pos);
frame *getFrame()
{
@@ -265,6 +270,10 @@ public:
encode(i);
}
+ // Encodes a pop instruction, or merges the pop into the previous
+ // instruction (ex. varsave+pop becomes varpop).
+ void encodePop();
+
// Puts the requested frame on the stack. If the frame is not that of
// this coder or its ancestors, false is returned.
bool encode(frame *f);
diff --git a/Build/source/utils/asymptote/configure b/Build/source/utils/asymptote/configure
index a49f969fb76..15b04f43890 100755
--- a/Build/source/utils/asymptote/configure
+++ b/Build/source/utils/asymptote/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for Asymptote 2.00.
+# Generated by GNU Autoconf 2.63 for Asymptote 2.01.
#
# Report bugs to <http://sourceforge.net/projects/asymptote>.
#
@@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='Asymptote'
PACKAGE_TARNAME='asymptote'
-PACKAGE_VERSION='2.00'
-PACKAGE_STRING='Asymptote 2.00'
+PACKAGE_VERSION='2.01'
+PACKAGE_STRING='Asymptote 2.01'
PACKAGE_BUGREPORT='http://sourceforge.net/projects/asymptote'
# Factoring default headers for most tests.
@@ -1294,7 +1294,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures Asymptote 2.00 to adapt to many kinds of systems.
+\`configure' configures Asymptote 2.01 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1355,7 +1355,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of Asymptote 2.00:";;
+ short | recursive ) echo "Configuration of Asymptote 2.01:";;
esac
cat <<\_ACEOF
@@ -1465,7 +1465,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-Asymptote configure 2.00
+Asymptote configure 2.01
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1479,7 +1479,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by Asymptote $as_me 2.00, which was
+It was created by Asymptote $as_me 2.01, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -12022,7 +12022,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by Asymptote $as_me 2.00, which was
+This file was extended by Asymptote $as_me 2.01, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -12081,7 +12081,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-Asymptote config.status 2.00
+Asymptote config.status 2.01
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/Build/source/utils/asymptote/configure.ac b/Build/source/utils/asymptote/configure.ac
index 1031be3f02d..a5529360128 100644
--- a/Build/source/utils/asymptote/configure.ac
+++ b/Build/source/utils/asymptote/configure.ac
@@ -3,7 +3,7 @@
# this file.
AC_PREREQ(2)
-AC_INIT([Asymptote],[2.00],[http://sourceforge.net/projects/asymptote])
+AC_INIT([Asymptote],[2.01],[http://sourceforge.net/projects/asymptote])
VERSION=$PACKAGE_VERSION
AC_SUBST(VERSION)
diff --git a/Build/source/utils/asymptote/constructor.cc b/Build/source/utils/asymptote/constructor.cc
index e1d240b9846..87960f18424 100644
--- a/Build/source/utils/asymptote/constructor.cc
+++ b/Build/source/utils/asymptote/constructor.cc
@@ -63,7 +63,7 @@ void transConstructorBody(position pos, coenv &e, record *r, varEntry *init)
// Initialize the object. a=new Foo;
newRecordExp::transFromTyEntry(pos, e, new tyEntry(r, 0, 0, position()));
v->encode(WRITE, pos, e.c);
- e.c.encode(inst::pop);
+ e.c.encodePop();
// Push the args onto the stack.
size_t numArgs=init->getSignature()->getNumFormals();
@@ -96,7 +96,7 @@ varEntry *constructorFromInitializer(position pos, coenv &e, record *r,
ft->printVar(out, symbol::trans("<constructor>"));
// Create a new function environment.
- coder fc = e.c.newFunction(out.str(), ft);
+ coder fc = e.c.newFunction(pos, out.str(), ft);
coenv fe(fc,e.e);
// Translate the function.
@@ -114,7 +114,7 @@ varEntry *constructorFromInitializer(position pos, coenv &e, record *r,
// Save it into a varEntry.
varEntry *v=makeVarEntry(pos, e, r, ft);
v->encode(WRITE, pos, e.c);
- e.c.encode(inst::pop);
+ e.c.encodePop();
return v;
}
diff --git a/Build/source/utils/asymptote/dec.cc b/Build/source/utils/asymptote/dec.cc
index b48bffaa338..731e4b9db1c 100644
--- a/Build/source/utils/asymptote/dec.cc
+++ b/Build/source/utils/asymptote/dec.cc
@@ -118,7 +118,7 @@ types::ty *tyEntryTy::trans(coenv &, bool) {
vm::lambda *runnable::transAsCodelet(coenv &e)
{
- coder c=e.c.newCodelet();
+ coder c=e.c.newCodelet(getPos());
coenv ce(c, e.e);
markTrans(ce);
return c.close();
@@ -168,7 +168,7 @@ record *block::transAsFile(genv& ge, symbol id)
// Create coder and environment to translate the module.
// File-level modules have dynamic fields by default.
- coder c(r, 0);
+ coder c(getPos(), r, 0);
env e(ge);
coenv ce(c, e);
@@ -434,7 +434,7 @@ void initializeVar(position pos, coenv &e, varEntry *v, varinit *init)
}
v->getLocation()->encode(WRITE, pos, e.c);
- e.c.encode(inst::pop);
+ e.c.encodePop();
}
types::ty *inferType(position pos, coenv &e, varinit *init)
@@ -831,7 +831,7 @@ void recorddec::transAsField(coenv &e, record *parent)
parent->e.addRecordOps(r);
// Start translating the initializer.
- coder c=e.c.newRecordInit(r);
+ coder c=e.c.newRecordInit(getPos(), r);
coenv re(c,e.e);
body->transAsRecordBody(re, r);
diff --git a/Build/source/utils/asymptote/doc/CAD.pdf b/Build/source/utils/asymptote/doc/CAD.pdf
index 7076ef94893..327f2ff3b0b 100644
--- a/Build/source/utils/asymptote/doc/CAD.pdf
+++ b/Build/source/utils/asymptote/doc/CAD.pdf
Binary files differ
diff --git a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info b/Build/source/utils/asymptote/doc/FAQ/asy-faq.info
index 4741db226ae..64d6def87ce 100644
--- a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info
+++ b/Build/source/utils/asymptote/doc/FAQ/asy-faq.info
@@ -9,7 +9,7 @@ END-INFO-DIR-ENTRY
File: $prefix.info, Node: Top, Next: Question 1.1, Up: (dir)
ASYMPTOTE FREQUENTLY ASKED QUESTIONS
- 25 Jun 2010
+ 05 Jul 2010
This is the list of Frequently Asked Questions about Asymptote (asy).
diff --git a/Build/source/utils/asymptote/doc/asymptote.pdf b/Build/source/utils/asymptote/doc/asymptote.pdf
index f21cc658464..d4a834d8dde 100644
--- a/Build/source/utils/asymptote/doc/asymptote.pdf
+++ b/Build/source/utils/asymptote/doc/asymptote.pdf
Binary files differ
diff --git a/Build/source/utils/asymptote/doc/asymptote.sty b/Build/source/utils/asymptote/doc/asymptote.sty
index 4dc89de1e52..4b0cda55ee1 100644
--- a/Build/source/utils/asymptote/doc/asymptote.sty
+++ b/Build/source/utils/asymptote/doc/asymptote.sty
@@ -3,7 +3,7 @@
%%% Modified by John Bowman
%%% Adapted from comment.sty (Under GPL v2+)
-\ProvidesPackage{asymptote}[2010/04/15 v1.12 Asymptote style file for LaTeX]
+\ProvidesPackage{asymptote}[2010/07/05 v1.13 Asymptote style file for LaTeX]
\RequirePackage{keyval}
\RequirePackage{ifthen}
\newif\ifASYinline
@@ -24,25 +24,22 @@
\def\makeinnocent#1{\catcode`#1=12 }
\def\csarg#1#2{\expandafter#1\csname#2\endcsname}
\newwrite\AsyStream
-\newread\AsyTestStream
+\newwrite\AsyAllStream
\newread\AsyTestTeXStream
-\def\AsyFile{\jobname.asy}
-\openin\AsyTestStream=\jobname_.pre
-\ifeof\AsyTestStream
+\openin\AsyStream=\jobname_.pre
+\ifeof\AsyStream
\else
\input \jobname_.pre
\fi
-\closein\AsyTestStream%
+\closein\AsyStream%
-\immediate\openout\AsyStream=\AsyFile
-\immediate\write\AsyStream{if(!settings.multipleView)}%
-\immediate\write\AsyStream{ settings.batchView=false;}%
+\immediate\openout\AsyAllStream=\jobname.asy
\newif\ifASYattach
\newif\ifASYtex
-
\newif\ifASYPDF
+
\ifx\pdfoutput\undefined
\else
\ifcase\pdfoutput
@@ -50,19 +47,6 @@
\ASYPDFtrue
\fi
\fi
-\ifx\XeTeXversion\undefined
-\ifASYPDF
-\immediate\write\AsyStream{settings.tex="pdflatex";}%
-\fi
-\else
-\immediate\write\AsyStream{settings.tex="xelatex";}%
-\ASYPDFtrue
-\fi
-
-\ifASYinline
-\immediate\write\AsyStream{settings.inlinetex=true;}%
-\immediate\write\AsyStream{deletepreamble();}%
-\fi
\newbox\ASYbox
\newcounter{asy}
@@ -148,57 +132,57 @@
\gdef\ASYheight{}%
\gdef\ASYviewportwidth{\ASYdefaultviewportwidth}%
\gdef\ASYviewportheight{}%
- \immediate\write\AsyStream{\@charrb);}%
- \immediate\write\AsyStream{// End of Asymptote Figure \the\c@asy}%
+ \immediate\closeout\AsyStream
+
\ifASYtex
- \openin\AsyTestStream=\Jobname-\the\c@asy_.tex
+ \openin\AsyStream=\AsyFile_.tex
\else
\ifASYPDF
- \openin\AsyTestStream=\Jobname-\the\c@asy.pdf
+ \openin\AsyStream=\AsyFile.pdf
\else
- \openin\AsyTestStream=\Jobname-\the\c@asy.eps
+ \openin\AsyStream=\AsyFile.eps
\fi
\fi
- \ifeof\AsyTestStream
+ \ifeof\AsyStream
\ifASYtex
- \PackageWarning{asymptote}{file \Jobname-\the\c@asy_.tex does not exist}%
+ \PackageWarning{asymptote}{file \AsyFile_.tex does not exist}%
\else
- \openin\AsyTestTeXStream=\Jobname-\the\c@asy_.tex
+ \openin\AsyTestTeXStream=\AsyFile_.tex
\ifeof\AsyTestTeXStream
\ifASYPDF
- \PackageWarning{asymptote}{file \Jobname-\the\c@asy.pdf does not exist}%
+ \PackageWarning{asymptote}{file \AsyFile.pdf does not exist}%
\else
- \PackageWarning{asymptote}{file \Jobname-\the\c@asy.eps does not exist}%
+ \PackageWarning{asymptote}{file \AsyFile.eps does not exist}%
\fi
\else
\catcode`:=12
- \input \Jobname-\the\c@asy_.tex%
+ \input \AsyFile_.tex%
\fi
\closein\AsyTestTeXStream%
\fi
- \closein\AsyTestStream%
+ \closein\AsyStream%
\else
- \closein\AsyTestStream%
+ \closein\AsyStream%
\ifASYtex
\catcode`:=12
- \input \Jobname-\the\c@asy_.tex%
+ \input \AsyFile_.tex%
\else
\ifASYattach
\ifASYPDF
- \openin\AsyTestStream=\Jobname-\the\c@asy+0.pdf
+ \openin\AsyStream=\AsyFile+0.pdf
\fi
- \ifeof\AsyTestStream
- \setbox\ASYbox=\hbox{\includegraphics[hiresbb]{\Jobname-\the\c@asy}}%
+ \ifeof\AsyStream
+ \setbox\ASYbox=\hbox{\includegraphics[hiresbb]{\AsyFile}}%
\else
- \setbox\ASYbox=\hbox{\includegraphics[hiresbb]{\Jobname-\the\c@asy+0}}%
+ \setbox\ASYbox=\hbox{\includegraphics[hiresbb]{\AsyFile+0}}%
\fi
- \textattachfile{\Jobname-\the\c@asy.pdf}{\phantom{\copy\ASYbox}}%
+ \textattachfile{\AsyFile.pdf}{\phantom{\copy\ASYbox}}%
\vskip-\ht\ASYbox%
\indent%
\box\ASYbox%
- \closein\AsyTestStream%
+ \closein\AsyStream%
\else
- \includegraphics[hiresbb]{\Jobname-\the\c@asy}%
+ \includegraphics[hiresbb]{\AsyFile}%
\fi
\fi
\fi
@@ -229,22 +213,38 @@
\let\par\empty
\stepcounter{asy}%
\setkeys{ASYkeys}{#1}%
- \immediate\write\AsyStream{}%
- \immediate\write\AsyStream{// Beginning of Asymptote Figure \the\c@asy}%
- \immediate\write\AsyStream{eval(quote\@charlb}%
- \immediate\write\AsyStream{defaultfilename='\Jobname-\the\c@asy';}%
+ \immediate\write\AsyAllStream%
+ {eval(quote\@charlb include "\jobname-\the\c@asy";\@charrb);}%
+ \immediate\openout\AsyStream=\jobname-\the\c@asy.asy
+ \gdef\AsyFile{\Jobname-\the\c@asy}
+ \immediate\write\AsyStream{if(!settings.multipleView)}%
+ \immediate\write\AsyStream{ settings.batchView=false;}%
+ \ifx\XeTeXversion\undefined
+ \ifASYPDF
+ \immediate\write\AsyStream{settings.tex="pdflatex";}%
+ \fi
+ \else
+ \immediate\write\AsyStream{settings.tex="xelatex";}%
+ \ASYPDFtrue
+ \fi
+
+ \ifASYinline
+ \immediate\write\AsyStream{settings.inlinetex=true;}%
+ \immediate\write\AsyStream{deletepreamble();}%
+ \fi
+ \immediate\write\AsyStream{defaultfilename="\AsyFile";}%
\immediate\write\AsyStream{if(settings.render < 0) settings.render=4;}%
\ifASYattach
\immediate\write\AsyStream{settings.inlineimage=false;}%
\immediate\write\AsyStream{settings.embed=false;}%
- \immediate\write\AsyStream{settings.outformat='pdf';}%
+ \immediate\write\AsyStream{settings.outformat="pdf";}%
\immediate\write\AsyStream{settings.toolbar=true;}%
\else
\immediate\write\AsyStream{settings.inlineimage=true;}%
\immediate\write\AsyStream{settings.embed=true;}%
- \immediate\write\AsyStream{settings.outformat='';}%
+ \immediate\write\AsyStream{settings.outformat="";}%
\immediate\write\AsyStream{settings.toolbar=false;}%
- \immediate\write\AsyStream{viewportmargin=(1,1);}%
+ \immediate\write\AsyStream{viewportmargin=(2,2);}%
\fi
\immediate\write\AsyStream{\globalASYdefs}%
\let\ThisAsymptote\WriteAsyLine%
@@ -257,11 +257,11 @@
\AsymptoteEndDef{asydef}
\def\AfterasydefAsymptote{}
-\AtEndDocument{\immediate\closeout\AsyStream}
+\AtEndDocument{\immediate\closeout\AsyAllStream}
\newcommand{\ASYanimategraphics}[5][]{%
-\openin\AsyTestStream=_#3.pdf
-\ifeof\AsyTestStream%
+\openin\AsyStream=_#3.pdf
+\ifeof\AsyStream%
\else%
\animategraphics[{#1}]{#2}{_#3}{#4}{#5}%
\fi%
diff --git a/Build/source/utils/asymptote/doc/asymptote.texi b/Build/source/utils/asymptote/doc/asymptote.texi
index 7c4f3d4e9d3..8eb575e2b03 100644
--- a/Build/source/utils/asymptote/doc/asymptote.texi
+++ b/Build/source/utils/asymptote/doc/asymptote.texi
@@ -101,7 +101,7 @@ Programming
* Functions:: Traditional and high-order functions
* Arrays:: Dynamic vectors
* Casts:: Implicit and explicit casts
-* Import:: Importing external @code{Asymptote} packages
+* Import:: Importing external @code{Asymptote} modules
* Static:: Where to allocate your variable?
Operators
@@ -1735,7 +1735,7 @@ In addition, it supports many features beyond the ones found in those languages.
* Functions:: Traditional and high-order functions
* Arrays:: Dynamic vectors
* Casts:: Implicit and explicit casts
-* Import:: Importing external @code{Asymptote} packages
+* Import:: Importing external @code{Asymptote} modules
* Static:: Where to allocate your variable?
@end menu
@@ -2923,7 +2923,7 @@ The base align setting of a pen is returned by
@cindex @code{fontsize}
@cindex @code{lineskip}
@cindex @code{defaultpen}
-@cindex @code{fix-cm}
+@cindex @code{type1cm}
@item The font size is specified in @TeX{} points (1 pt = 1/72.27 inches) with
the function @code{pen fontsize(real size, real lineskip=1.2*size)}.
The default font size, 12pt, may be changed with @code{defaultpen(pen)}.
@@ -2931,10 +2931,10 @@ Nonstandard font sizes may require inserting
@verbatim
import fontsize;
@end verbatim
-at the beginning of the file (this requires the @code{fix-cm} package
+at the beginning of the file (this requires the @code{type1cm} package
available from
@quotation
-@url{http://www.ctan.org/tex-archive/help/Catalogue/entries/fix-cm}
+@url{http://www.ctan.org/tex-archive/help/Catalogue/entries/type1cm}
@end quotation
and included in recent @code{LaTeX} distributions). The font size and line
skip of a pen can be examined with the routines
@@ -3940,6 +3940,14 @@ real y=4.3;
pen reddash=red+dashed;
@end verbatim
+@code{var} may also be used with the extended @code{for} loop syntax.
+
+@verbatim
+int[] a = {1,2,3};
+for (var x : a)
+ write(x);
+@end verbatim
+
@node Structures
@section Structures
@cindex @code{struct}
@@ -5953,7 +5961,13 @@ pdflatex latexusage
To switch between using @code{latex} and @code{pdflatex} you may first
need to remove the files @code{latexusage-*}, @code{latexusage_.pre}, and
-@code{latexusage.aux}.
+@code{latexusage.aux}. Version 1.13 of @code{Asymptote.sty} supports
+processing each figure separately: @code{asy latexusage} is equivalent
+to @code{asy latexusage-*.asy}. For example, one may wish to reduce
+memory usage by generating each figure in a separate @code{UNIX} process:
+@verbatim
+/bin/ls latexusage-*.asy | xargs --replace=% asy %
+@end verbatim
@cindex @code{width}
@cindex @code{height}
diff --git a/Build/source/utils/asymptote/doc/extra/intro.asy b/Build/source/utils/asymptote/doc/extra/intro.asy
index 4234b8cee8e..20b03c578dc 100644
--- a/Build/source/utils/asymptote/doc/extra/intro.asy
+++ b/Build/source/utils/asymptote/doc/extra/intro.asy
@@ -1,5 +1,3 @@
-// Introduction to Asymptote
-
orientation=Landscape;
settings.tex="pdflatex";
@@ -8,6 +6,10 @@ import slide;
import three;
import animate;
+bool long=true;
+
+usepackage("mflogo");
+
usersetting();
viewportsize=pagewidth-2pagemargin;
@@ -18,23 +20,39 @@ viewportsize=pagewidth-2pagemargin;
bibliographystyle("alpha");
itempen=fontsize(22pt);
-
-titlepage("Asymptote: The Vector Graphics Language",
- "Andy Hammerlindl and John Bowman",
- "University of Toronto and University of Alberta","August 16, 2007",
- "http://asymptote.sf.net");
+defaultpen(itempen);
+viewportmargin=(2,2);
+
+titlepage(long ? "Asymptote: The Vector Graphics Language" :
+ "Interactive TeX-Aware 3D Vector Graphics",
+ "John Bowman and Andy Hammerlindl",
+"Department of Mathematical and Statistical Sciences\\
+ University of Alberta\\
+%and Instituto Nacional de Matem\'atica Pura e Aplicada (IMPA)
+\medskip\Green{Collaborators: Orest Shardt, Michail Vidiassov}",
+"June 30, 2010",
+"http://asymptote.sf.net/intro.pdf");
title("History");
-item("\TeX\ and METAFONT (Knuth, 1979)");
-item("MetaPost (Hobby, 1989): 2D Bezier Control Point Selection");
-item("Asymptote (Hammerlindl, Bowman, Prince, 2004): 2D \& 3D Graphics");
-
-title("Statistics (as of April, 2007)");
-item("Runs on Windows, Mac OS X, Linux, etc.");
-item("1800 downloads a month from {\tt asymptote.sourceforge.net}.");
-item("33\ 000 lines of C++ code.");
-item("18\ 000 lines of Asymptote code.");
-
+item("1979: \TeX\ and \MF\ (Knuth)");
+item("1986: 2D B\'ezier control point selection (Hobby)");
+item("1989: MetaPost (Hobby)");
+item("2004: Asymptote");
+subitem("2004: initial public release (Hammerlindl, Bowman, \& Prince)");
+subitem("2005: 3D B\'ezier control point selection (Bowman)");
+subitem("2008: 3D interactive \TeX\ within PDF files (Shardt \& Bowman)");
+subitem("2009: 3D billboard labels that always face camera (Bowman)");
+subitem("2010: 3D PDF enhancements (Vidiassov \& Bowman)");
+
+title("Statistics (as of June, 2010)");
+item("Runs under Linux/UNIX, Mac OS X, Microsoft Windows.");
+item("4000 downloads/month from primary\hfill\\
+ {\tt asymptote.sourceforge.net} site alone.");
+item("80\ 000 lines of low-level C++ code.");
+item("36\ 000 lines of high-level Asymptote code.");
+item("Latest stable release: Version 2.00 (LGPL).");
+
+if(long) {
title("Vector Graphics");
item("Raster graphics assign colors to a grid of pixels.");
figure("pixel.pdf");
@@ -61,17 +79,24 @@ add(zoom(100), (0,0));
add(zoom(10), (200,0));
add(zoom(1), (400,0));
"));
+}
title("Cartesian Coordinates");
+
+item("Asymptote's graphical capabilities are based on four primitive
+ commands: {\tt draw}, {\tt label}, {\tt fill}, {\tt clip} \cite{Bowman08}");
+
asyfilecode("diagonal");
item("units are {\tt PostScript} {\it big points\/} (1 {\tt bp} =
1/72 {\tt inch})");
item("{\tt --} means join the points with a linear segment to create
a {\it path}");
-item("cyclic path:");
+item("{\it cyclic\/} path:");
-asyfilecode("square");
+asycode("
+draw((0,0)--(100,0)--(100,100)--(0,100)--cycle);
+");
title("Scaling to a Given Size");
@@ -79,11 +104,7 @@ item("{\tt PostScript} units are often inconvenient.");
item("Instead, scale user coordinates to a specified final size:");
-code("
-size(101,101);
-draw((0,0)--(1,0)--(1,1)--(0,1)--cycle);
-");
-asyfigure("square");
+asyfilecode("square");
item("One can also specify the size in {\tt cm}:");
@@ -96,18 +117,36 @@ title("Labels");
item("Adding and aligning \LaTeX\ labels is easy:");
-asyfilecode("labelsquare","height=6cm");
-
+asycode(preamble="defaultpen(fontsize("+string(fontsize(itempen))+"));",
+"size(6cm);
+draw(unitsquare);
+label(\"$A$\",(0,0),SW);
+label(\"$B$\",(1,0),SE);
+label(\"$C$\",(1,1),NE);
+label(\"$D$\",(0,1),NW);
+");
-title("2D Bezier Splines");
+title("2D B\'ezier Splines");
-item("Using {\tt ..} instead of {\tt --} specifies a {\it Bezier cubic
+item("Using {\tt ..} instead of {\tt --} specifies a {\it B\'ezier cubic
spline}:");
code("
draw(z0 .. controls c0 and c1 .. z1,blue);
");
-asyfigure("beziercurve","height=7cm");
+asyfigure(asywrite("defaultpen(fontsize("+string(fontsize(itempen))+"));
+size(0,7cm);
+pair z0=(0,0);
+pair c0=(1,1);
+pair c1=(2,1);
+pair z1=(3,0);
+draw(z0..controls c0 and c1 .. z1,blue);
+draw(z0--c0--c1--z1,dashed);
+dot(\"$z_0$\",z0,W,red);
+dot(\"$c_0$\",c0,NW,red);
+dot(\"$c_1$\",c1,NE,red);
+dot(\"$z_1$\",z1,red);
+"));
equation("(1-t)^3 z_0+3t(1-t)^2 c_0+3t^2(1-t) c_1+t^3 z_1, \qquad t\in [0,1].");
@@ -139,7 +178,7 @@ dot(z);
picture output;
save();
-for (int i=0; i<length(p); ++i) {
+for(int i=0; i<length(p); ++i) {
pair z=point(p,i), dir=dir(p,i);
draw((z-0.3dir)--(z+0.3dir), Arrow);
}
@@ -148,7 +187,7 @@ restore();
save();
guide g;
-for (int i=0; i<length(p); ++i) {
+for(int i=0; i<length(p); ++i) {
dot(precontrol(p,i));
dot(postcontrol(p,i));
g=g--precontrol(p,i)--point(p,i)--postcontrol(p,i);
@@ -161,16 +200,18 @@ shipout(output);
"));
title("Filling");
-item("Use {\tt fill} to fill the inside of a path:");
+item("The {\tt fill} primitive to fill the inside of a path:");
asycode(preamble="size(0,200);","
path star;
-for (int i=0; i<5; ++i)
+for(int i=0; i < 5; ++i)
star=star--dir(90+144i);
star=star--cycle;
-fill(shift(-1,0)*star,orange+zerowinding);
-draw(shift(-1,0)*star,linewidth(3));
-fill(shift(1,0)*star,blue+evenodd);
-draw(shift(1,0)*star,linewidth(3));
+
+fill(star,orange+zerowinding);
+draw(star,linewidth(3));
+
+fill(shift(2,0)*star,blue+evenodd);
+draw(shift(2,0)*star,linewidth(3));
");
title("Filling");
@@ -181,29 +222,23 @@ fill(p,green+zerowinding);
");
title("Clipping");
-item("Pictures can be clipped to lie inside a path:");
+item("Pictures can be clipped to a path:");
asycode(preamble="
size(0,200);
guide star;
-for (int i=0; i<5; ++i)
+for(int i=0; i<5; ++i)
star=star--dir(90+144i);
star=star--cycle;","
fill(star,orange+zerowinding);
clip(scale(0.7)*unitcircle);
draw(scale(0.7)*unitcircle);
");
-item("All of Asymptote's graphical capabilities are based on four primitive
- commands: {\tt draw}, {\tt fill}, {\tt clip}, and {\tt label}.");
title("Affine Transforms");
-item("Affine transformations: shifts, rotations, reflections, and scalings.");
-code("
-transform t=rotate(90);
-write(t*(1,0)); // Writes (0,1).
-");
+item("Affine transformations: shifts, rotations, reflections, and scalings
+ can be applied to pairs, paths, pens, strings, and even whole pictures:");
-item("Pairs, paths, pens, strings, and whole pictures can be transformed.");
code("
fill(P,blue);
fill(shift(2,0)*reflect((0,0),(0,1))*P, red);
@@ -231,6 +266,7 @@ fill(shift(4,0)*rotate(30)*P, yellow);
fill(shift(6,0)*yscale(0.7)*xscale(2)*P, green);
"));
+if(long) {
title("C++/Java-like Programming Syntax");
code("// Declaration: Declare x to be real:
@@ -250,287 +286,11 @@ if(x == 1.0) {
for(int i=0; i < 10; ++i) {
write(i);
}");
-
-title("Helpful Math Notation");
-
-item("Integer division returns a {\tt real}. Use {\tt quotient} for an integer
- result:");
-code("3/4==0.75 quotient(3,4)==0");
-
-item("Caret for real and integer exponentiation:");
-code("2^3 2.7^3 2.7^3.2");
-
-item("Many expressions can be implicitly scaled by a numeric constant:");
-code("2pi 10cm 2x^2 3sin(x) 2(a+b)");
-
-item("Pairs are complex numbers:");
-code("(0,1)*(0,1)==(-1,0)");
-
-title("Function Calls");
-
-item("Functions can take default arguments in any position. Arguments are
- matched to the first possible location:");
-string unitsize="unitsize(0.65cm);";
-string preamble="void drawEllipse(real xsize=1, real ysize=xsize, pen p=blue) {
- draw(xscale(xsize)*yscale(ysize)*unitcircle, p);
-}
-";
-
-asycode(preamble=unitsize,preamble+"
-drawEllipse(2);
-drawEllipse(red);
-");
-
-item("Arguments can be given by name:");
-asycode(preamble=unitsize+preamble,"
-drawEllipse(xsize=2, ysize=1);
-drawEllipse(ysize=2, xsize=3, green);
-");
-
-title("Rest Arguments");
-item("Rest arguments allow one to write a function that takes an arbitrary
- number of arguments:");
-code("
-int sum(... int[] nums) {
- int total=0;
- for (int i=0; i < nums.length; ++i)
- total += nums[i];
- return total;
-}
-
-sum(1,2,3,4); // returns 10
-sum(); // returns 0
-sum(1,2,3 ... new int[] {4,5,6}); // returns 21
-
-int subtract(int start ... int[] subs) {
- return start - sum(... subs);
-}
-");
-
-title("Higher-Order Functions");
-
-item("Functions are first-class values. They can be passed to other
- functions:");
-code("real f(real x) {
- return x*sin(10x);
-}
-draw(graph(f,-3,3,300),red);");
-asyfigure(asywrite("
-import graph;
-size(300,0);
-real f(real x) {
- return x*sin(10x);
-}
-draw(graph(f,-3,3,300),red);
-"));
-
-title("Higher-Order Functions");
-item("Functions can return functions:");
-equation("f_n(x)=n\sin\left(\frac{x}{n}\right).");
-skip();
-string preamble="
-import graph;
-size(300,0);
-";
-string graphfunc2="
-typedef real func(real);
-func f(int n) {
- real fn(real x) {
- return n*sin(x/n);
- }
- return fn;
-}
-
-func f1=f(1);
-real y=f1(pi);
-
-for (int i=1; i<=5; ++i)
- draw(graph(f(i),-10,10),red);
-";
-code(graphfunc2);
-string name=asywrite(graphfunc2,preamble=preamble);
-asy(nativeformat(),name+".asy");
-label(graphic(name+"."+nativeformat()),(0.5,0),
- Fill(figureborder,figuremattpen));
-
-title("Anonymous Functions");
-
-item("Create new functions with {\tt new}:");
-code("
-path p=graph(new real (real x) { return x*sin(10x); },-3,3,red);
-
-func f(int n) {
- return new real (real x) { return n*sin(x/n); };
-}");
-
-item("Function definitions are just syntactic sugar for assigning function
-objects to variables.");
-code("
-real square(real x) {
- return x^2;
-}
-");
-
-remark("is equivalent to");
-code("
-real square(real x);
-square=new real (real x) {
- return x^2;
-};
-");
-
-title("Structures");
-
-item("As in other languages, structures group together data.");
-code("
-struct Person {
- string firstname, lastname;
- int age;
-}
-Person bob=new Person;
-bob.firstname=\"Bob\";
-bob.lastname=\"Chesterton\";
-bob.age=24;
-");
-
-item("Any code in the structure body will be executed every time a new structure
- is allocated...");
-code("
-struct Person {
- write(\"Making a person.\");
- string firstname, lastname;
- int age=18;
-}
-Person eve=new Person; // Writes \"Making a person.\"
-write(eve.age); // Writes 18.
-");
-
-title("Object-Oriented Programming");
-item("Functions are defined for each instance of a structure.");
-code("
-struct Quadratic {
- real a,b,c;
- real discriminant() {
- return b^2-4*a*c;
- }
- real eval(real x) {
- return a*x^2 + b*x + c;
- }
-}
-");
-
-item("This allows us to construct ``methods'' which are just normal functions
- declared in the environment of a particular object:");
-code("
-Quadratic poly=new Quadratic;
-poly.a=-1; poly.b=1; poly.c=2;
-
-real f(real x)=poly.eval;
-real y=f(2);
-draw(graph(poly.eval, -5, 5));
-");
-
-title("Specialization");
-
-item("Can create specialized objects just by redefining methods:");
-code("
-struct Shape {
- void draw();
- real area();
-}
-
-Shape rectangle(real w, real h) {
- Shape s=new Shape;
- s.draw = new void () {
- fill((0,0)--(w,0)--(w,h)--(0,h)--cycle); };
- s.area = new real () { return w*h; };
- return s;
-}
-
-Shape circle(real radius) {
- Shape s=new Shape;
- s.draw = new void () { fill(scale(radius)*unitcircle); };
- s.area = new real () { return pi*radius^2; }
- return s;
-}
-");
-
-title("Overloading");
-item("Consider the code:");
-code("
-int x1=2;
-int x2() {
- return 7;
-}
-int x3(int y) {
- return 2y;
-}
-
-write(x1+x2()); // Writes 9.
-write(x3(x1)+x2()); // Writes 11.
-");
-
-title("Overloading");
-item("{\tt x1}, {\tt x2}, and {\tt x3} are never used in the same context, so
- they can all be renamed {\tt x} without ambiguity:");
-code("
-int x=2;
-int x() {
- return 7;
-}
-int x(int y) {
- return 2y;
}
-write(x+x()); // Writes 9.
-write(x(x)+x()); // Writes 11.
-");
-
-item("Function definitions are just variable definitions, but variables are
- distinguished by their signatures to allow overloading.");
-
-title("Operators");
-item("Operators are just syntactic sugar for functions, and can be addressed or
- defined as functions with the {\tt operator} keyword.");
-code("
-int add(int x, int y)=operator +;
-write(add(2,3)); // Writes 5.
-
-// Don't try this at home.
-int operator +(int x, int y) {
- return add(2x,y);
-}
-write(2+3); // Writes 7.
-");
-item("This allows operators to be defined for new types.");
-
-title("Operators");
-item("Operators for constructing paths are also functions:");
-code("a.. controls b and c .. d--e");
-remark("is equivalent to");
-code(
- "operator --(operator ..(a, operator controls(b,c), d), e)");
-item("This allowed us to redefine all of the path operators for 3D paths.");
-asyfigure("helix","height=10cm");
-
-title("Packages");
-
-item("Function and structure definitions can be grouped into packages:");
-code("
-// powers.asy
-real square(real x) { return x^2; }
-real cube(real x) { return x^3; }
-");
-remark("and imported:");
-code("
-import powers;
-real eight=cube(2.0);
-draw(graph(powers.square, -1, 1));
-");
-
-title("Packages");
+title("Modules");
-item("There are packages for Feynman diagrams,");
+item("There are modules for Feynman diagrams,");
asyfigure("eetomumu","height=6cm");
remark("data structures,");
asyfigure(asywrite("
@@ -547,6 +307,7 @@ equations("\Phi\Phi(x_1,x_2,x_3,x_4,x_5)
+ &\rho_{4a}(x_1,x_2+x_3,x_4,x_5) - \rho_{4b}(x_1,x_2,x_3,x_4+x_5) \\
- &\rho_{4a}(x_1+x_2,x_3,x_4,x_5) - \rho_{4a}(x_1,x_2,x_4,x_5).");
+if(long) {
title("Textbook Graph");
asy(nativeformat(),"exp");
filecode("exp.asy");
@@ -564,18 +325,20 @@ asyfilecode("filegraph","height=15cm",newslide=true);
title("Logarithmic Graph");
asyfilecode("loggraph","height=15cm",newslide=true);
-
title("Secondary Axis");
+} else
+title("Scientific Graph");
+
asyfigure("secondaryaxis","height=15cm");
-title("Images");
+title("Images and Contours");
asyfigure("imagecontour","height=17cm");
title("Multiple Graphs");
asyfigure("diatom","height=17cm");
title("Hobby's 2D Direction Algorithm");
-item("A tridiagonal system of linear equations is solved to determine any unspecified directions $\theta_k$ and $\phi_k$ through each knot $z_k$:");
+item("A tridiagonal system of linear equations is solved to determine any unspecified directions $\phi_k$ and $\theta_k$ through each knot $z_k$:");
equation("\frac{\theta_{k-1}-2\phi_k}{\ell_k}=
\frac{\phi_{k+1}-2\theta_k}{\ell_{k+1}}.");
@@ -584,39 +347,43 @@ asyfigure("Hobbydir","height=9cm");
item("The resulting shape may be adjusted by modifying optional {\it tension\/} parameters and {\it curl\/} boundary conditions.");
-//involving the curvature
-
title("Hobby's 2D Control Point Algorithm");
item("Having prescribed outgoing and incoming path directions $e^{i\theta}$
at node~$z_0$ and $e^{i\phi}$ at node $z_1$ relative to the
vector $z_1-z_0$, the control points are determined as:");
+skip(-3);
+
equations("u&=&z_0+e^{i\theta}(z_1-z_0)f(\theta,-\phi),\nonumber\\
v&=&z_1-e^{i\phi}(z_1-z_0)f(-\phi,\theta),");
+skip(-3);
+
remark("where the relative distance function $f(\theta,\phi)$ is given by Hobby [1986].");
asyfigure("Hobbycontrol","height=9cm");
-title("Bezier Curves in 3D");
+if(long) {
+title("B\'ezier Curves in 3D");
item("Apply an affine transformation");
equation("x'_i=A_{ij} x_j+C_i");
-remark("to a Bezier curve:");
+remark("to a B\'ezier curve:");
-equation("x(t)=\sum_{k=0}^3 B_k(t) P_k, \qquad t\in [0,1].");
+equation("\displaystyle x(t)=\sum_{k=0}^3 B_k(t) P_k, \qquad t\in [0,1].");
-item("The resulting curve is also a Bezier curve:");
+item("The resulting curve is also a B\'ezier curve:");
equations("x'_i(t)&=&\sum_{k=0}^3 B_k(t) A_{ij}(P_k)_j+C_i\nonumber\\
&=&\sum_{k=0}^3 B_k(t) P'_k,");
remark("where $P'_k$ is the transformed $k^{\rm th}$ control point, noting
$\displaystyle\sum_{k=0}^3 B_k(t)=1.$");
+}
-title("3D Generalization of Hobby's algorithm");
+title("3D Generalization of Direction Algorithm");
item("Must reduce to 2D algorithm in planar case.");
@@ -625,12 +392,12 @@ item("Determine directions by applying Hobby's algorithm in the plane containing
// Reformulate Hobby's equations in terms of the angle $\psi_k=$
item("The only ambiguity that can arise is the overall sign of the angles, which relates to viewing each 2D plane from opposing normal directions.");
-item("A reference vector based on the mean unit normal of successive segments can be used to resolve such ambiguities.");
+item("A reference vector based on the mean unit normal of successive segments can be used to resolve such ambiguities \cite{Bowman07,Bowman09}");
title("3D Control Point Algorithm");
-item("Hobby's control point algorithm can be generalized to 3D by expressing it in terms of the absolute directions $\omega_0$ and $\omega_1$:");
-
+item("Express Hobby's algorithm in terms of the absolute directions $\omega_0$ and~$\omega_1$:");
+skip(-1);
equation("u=z_0+\omega_0\left|z_1-z_0\right|f(\theta,-\phi),");
equation("v=z_1-\omega_1\left|z_1-z_0\right|f(-\phi,\theta),");
@@ -638,29 +405,46 @@ asyfigure("Hobbycontrol");
remark("interpreting $\theta$ and $\phi$ as the angle between the corresponding path direction vector and $z_1-z_0$.");
-item("In this case there is an unambiguous reference vector for determining the relative sign of the angles $\phi$ and $\theta$.");
+item("Here there is an unambiguous reference vector for determining the relative sign of the angles $\phi$ and $\theta$.");
-viewportmargin=(0,0.5cm);
-defaultpen(1.0);
+viewportmargin=(2,0.5cm);
+//defaultpen(1.0);
title("Interactive 3D Saddle");
-item("A unit circle in the $X$--$Y$ plane may be filled and drawn with:
-(1,0,0)..(0,1,0)..(-1,0,0)..(0,-1,0)..cycle");
+item("A unit circle in the $X$--$Y$ plane may be constructed with:
+{\tt (1,0,0)..(0,1,0)..(-1,0,0)..(0,-1,0)..cycle}:");
asyinclude("unitcircle3",8cm);
-remark("and then distorted into a saddle:\\ (1,0,0)..(0,1,1)..(-1,0,0)..(0,-1,1)..cycle");
+remark("and then distorted into the saddle\\
+{\tt (1,0,0)..(0,1,1)..(-1,0,0)..(0,-1,1)..cycle}:");
asyinclude("saddle",8cm);
+//defaultpen(0.5);
+
+title("Lifting TeX to 3D");
+item("Glyphs are first split into simply connected regions and then decomposed into planar B\'ezier surface patches \cite{Bowman09,Shardt10}:");
+asyfigure("../examples/partitionExample");
+
+viewportmargin=(2,1cm);
+title("Label Manipulation");
+item("They can then be extruded and/or arbitrarily transformed:");
+asyinclude("../examples/label3solid");
+
+title("Billboard Labels");
+defaultpen(fontsize(36pt));
+asyinclude("../examples/billboard",15cm);
+defaultpen(itempen);
-viewportmargin=(0,2cm);
title("Smooth 3D surfaces");
-asyinclude("GaussianSurface",15cm);
-defaultpen(0.5);
+asyinclude("../examples/sinc",25cm);
+
+title("Curved 3D Arrows");
+asyinclude("../examples/arrows3",20cm);
title("Slide Presentations");
-item("Asymptote has a package for preparing slides.");
+item("Asymptote has a module for preparing slides.");
item("It even supports embedded high-resolution PDF movies.");
code('
title("Slide Presentations");
-item("Asymptote has a package for preparing slides.");
+item("Asymptote has a module for preparing slides.");
item("It even supports embedded high-resolution PDF movies.");
');
remark("\quad\ldots");
@@ -729,8 +513,8 @@ frame cardsize(real w=0, real h=0, bool keepAspect=Aspect) {
guide g=polargraph(f,0,2pi,operator ..)--cycle;
filldraw(pic,g,pink);
- xaxis(pic,\"$x$\");
- yaxis(pic,\"$y$\");
+ xaxis(pic,\"$x$\",above=true);
+ yaxis(pic,\"$y$\",above=true);
dot(pic,\"$(a,0)$\",(1,0),N);
dot(pic,\"$(2a,0)$\",(2,0),N+E);
@@ -748,7 +532,7 @@ add(cardsize(0,200), (540,0));
title("Deferred Drawing");
item("We can't draw a graphical object until we know the scaling
factors for the user coordinates.");
-item("Instead, store a function that when given the scaling information, draws
+item("Instead, store a function that, given the scaling information, draws
the scaled object.");
code("
void draw(picture pic=currentpicture, path g, pen p=currentpen) {
@@ -791,7 +575,7 @@ pic.addPoint(max(g),max(p));");
item("Filling ignores the pen width:");
code("pic.addPoint(min(g),(0,0));
pic.addPoint(max(g),(0,0));");
-item("Communicate with \LaTeX\ to determine label sizes:");
+item("Communicate with \LaTeX\ {\it via\/} a pipe to determine label sizes:");
asyfigure(asywrite("
size(0,100);
@@ -807,14 +591,16 @@ title("Sizing");
item("When scaling the final figure to a given size $S$, we first need to
determine a scaling factor $a>0$ and a shift $b$ so that all of the
- coordinates when transformed will lie in the interval $[0,S]$. That is, if
- $u$ and $t$ are the user and truesize components:");
+ coordinates when transformed will lie in the interval $[0,S]$.");
+
+item("That is, if $u$ and $t$ are the user and truesize components:");
equation("0\le au+t+b \le S.");
-item("We are maximizing the variable $a$ subject to a number of inequalities.
- This is a linear programming problem that can be solved by the simplex
- method.");
+item("Maximize the variable $a$ subject to a number of inequalities.");
+item("Use the simplex method to solve the resulting linear programming problem.");
+
+if(long) {
title("Sizing");
item("Every addition of a coordinate $(t,u)$ adds two restrictions");
equation("au+t+b\ge 0,");
@@ -829,7 +615,7 @@ asyfigure(asywrite("
import palette;
size(160,0);
pen[] p=Rainbow(NColors=11);
-for (int i=1; i<10; ++i) {
+for(int i=1; i<10; ++i) {
draw(scale(i)*unitcircle, p[i]+linewidth(2));
}
"));
@@ -845,6 +631,7 @@ item("This defines a partial ordering on coordinates. When sizing a picture,
item("In practice, the linear programming problem will have less than a dozen
restraints.");
item("All picture sizing is implemented in Asymptote code.");
+}
title("Infinite Lines");
item("Deferred drawing allows us to draw infinite lines.");
@@ -852,59 +639,321 @@ code("drawline(P, Q);");
asyfigure("elliptic","height=12cm");
-title("A Final Example: Quilting");
+title("Helpful Math Notation");
+
+item("Integer division returns a {\tt real}. Use {\tt quotient} for an integer
+ result:");
+code("3/4 == 0.75 quotient(3,4) == 0");
+
+item("Caret for real and integer exponentiation:");
+code("2^3 2.7^3 2.7^3.2");
+
+item("Many expressions can be implicitly scaled by a numeric constant:");
+code("2pi 10cm 2x^2 3sin(x) 2(a+b)");
+
+item("Pairs are complex numbers:");
+code("(0,1)*(0,1) == (-1,0)");
+
+title("Function Calls");
+
+item("Functions can take default arguments in any position. Arguments are
+ matched to the first possible location:");
+string unitsize="unitsize(0.65cm);";
+string preamble="void drawEllipse(real xsize=1, real ysize=xsize, pen p=blue) {
+ draw(xscale(xsize)*yscale(ysize)*unitcircle, p);
+}
+";
+
+asycode(preamble=unitsize,preamble+"
+drawEllipse(2);
+drawEllipse(red);
+");
+
+item("Arguments can be given by name:");
+asycode(preamble=unitsize+preamble,"
+drawEllipse(xsize=2, ysize=1);
+drawEllipse(ysize=2, xsize=3, green);
+");
+
+if(long) {
+title("Rest Arguments");
+item("Rest arguments allow one to write a function that takes an arbitrary
+ number of arguments:");
+code("
+int sum(... int[] nums) {
+ int total=0;
+ for(int i=0; i < nums.length; ++i)
+ total += nums[i];
+ return total;
+}
+
+sum(1,2,3,4); // returns 10
+sum(); // returns 0
+sum(1,2,3 ... new int[] {4,5,6}); // returns 21
+
+int subtract(int start ... int[] subs) {
+ return start - sum(... subs);
+}
+");
+}
+
+title("High-Order Functions");
+
+item("Functions are first-class values. They can be passed to other
+ functions:");
+code("import graph;
+real f(real x) {
+ return x*sin(10x);
+}
+draw(graph(f,-3,3,300),red);");
asyfigure(asywrite("
-import math;
+import graph;
+size(300,0);
+real f(real x) {
+ return x*sin(10x);
+}
+draw(graph(f,-3,3,300),red);
+"));
-int n=8, skip=3;
+if(long) {
+title("Higher-Order Functions");
+item("Functions can return functions:");
+equation("f_n(x)=n\sin\left(\frac{x}{n}\right).");
+skip();
+string preamble="
+import graph;
+size(300,0);
+";
+string graphfunc2="
+typedef real func(real);
+func f(int n) {
+ real fn(real x) {
+ return n*sin(x/n);
+ }
+ return fn;
+}
-pair r(int k) { return unityroot(n,k); }
+func f1=f(1);
+real y=f1(pi);
+
+for(int i=1; i<=5; ++i)
+ draw(graph(f(i),-10,10),red);
+";
+code(graphfunc2);
+string name=asywrite(graphfunc2,preamble=preamble);
+asy(nativeformat(),name+".asy");
+label(graphic(name+"."+nativeformat()),(0.5,0),
+ Fill(figureborder,figuremattpen));
-pen col=blue, col2=purple;
+title("Anonymous Functions");
-guide square=box((1,1),(-1,-1));
+item("Create new functions with {\tt new}:");
+code("
+path p=graph(new real (real x) { return x*sin(10x); },-3,3,red);
-guide step(int mult)
-{
- guide g;
- for (int k=0; k<n; ++k)
- g=g--r(mult*k);
- g=g--cycle;
- return g;
+func f(int n) {
+ return new real (real x) { return n*sin(x/n); };
+}");
+
+item("Function definitions are just syntactic sugar for assigning function
+objects to variables.");
+code("
+real square(real x) {
+ return x^2;
}
+");
-guide oct=step(1), star=step(skip);
+remark("is equivalent to");
+code("
+real square(real x);
+square=new real (real x) {
+ return x^2;
+};
+");
-guide wedge(pair z, pair v, real r, real a)
-{
- pair w=expi(a/2.0);
- v=unit(v)*r;
- return shift(z)*((0,0)--v*w--v*conj(w)--cycle);
+title("Structures");
+
+item("As in other languages, structures group together data.");
+code("
+struct Person {
+ string firstname, lastname;
+ int age;
}
+Person bob=new Person;
+bob.firstname=\"Bob\";
+bob.lastname=\"Chesterton\";
+bob.age=24;
+");
-filldraw(square, col);
-filldraw(oct, yellow);
+item("Any code in the structure body will be executed every time a new structure
+ is allocated...");
+code("
+struct Person {
+ write(\"Making a person.\");
+ string firstname, lastname;
+ int age=18;
+}
+Person eve=new Person; // Writes \"Making a person.\"
+write(eve.age); // Writes 18.
+");
-// The interior angle of the points of the star.
-real intang=pi*(1-((real)2skip)/((real)n));
+title("Modules");
-for (int k=0; k<n; ++k) {
- pair z=midpoint(r(k)--r(k+1));
- guide g=wedge(z,-z,1,intang);
- filldraw(g,col2);
+item("Function and structure definitions can be grouped into modules:");
+code("
+// powers.asy
+real square(real x) { return x^2; }
+real cube(real x) { return x^3; }
+");
+remark("and imported:");
+code("
+import powers;
+real eight=cube(2.0);
+draw(graph(powers.square, -1, 1));
+");
}
-fill(star,yellow);
-filldraw(star,evenodd+col);
+title("Object-Oriented Programming");
+item("Functions are defined for each instance of a structure.");
+code("
+struct Quadratic {
+ real a,b,c;
+ real discriminant() {
+ return b^2-4*a*c;
+ }
+ real eval(real x) {
+ return a*x^2 + b*x + c;
+ }
+}
+");
-size(5inch,0);
-"));
+item("This allows us to construct ``methods'' which are just normal functions
+ declared in the environment of a particular object:");
+code("
+Quadratic poly=new Quadratic;
+poly.a=-1; poly.b=1; poly.c=2;
+
+real f(real x)=poly.eval;
+real y=f(2);
+draw(graph(poly.eval, -5, 5));
+");
+
+title("Specialization");
+
+item("Can create specialized objects just by redefining methods:");
+code("
+struct Shape {
+ void draw();
+ real area();
+}
+
+Shape rectangle(real w, real h) {
+ Shape s=new Shape;
+ s.draw = new void () {
+ fill((0,0)--(w,0)--(w,h)--(0,h)--cycle); };
+ s.area = new real () { return w*h; };
+ return s;
+}
+
+Shape circle(real radius) {
+ Shape s=new Shape;
+ s.draw = new void () { fill(scale(radius)*unitcircle); };
+ s.area = new real () { return pi*radius^2; }
+ return s;
+}
+");
+
+title("Overloading");
+item("Consider the code:");
+code("
+int x1=2;
+int x2() {
+ return 7;
+}
+int x3(int y) {
+ return 2y;
+}
+
+write(x1+x2()); // Writes 9.
+write(x3(x1)+x2()); // Writes 11.
+");
+
+title("Overloading");
+item("{\tt x1}, {\tt x2}, and {\tt x3} are never used in the same context, so
+ they can all be renamed {\tt x} without ambiguity:");
+code("
+int x=2;
+int x() {
+ return 7;
+}
+int x(int y) {
+ return 2y;
+}
+
+write(x+x()); // Writes 9.
+write(x(x)+x()); // Writes 11.
+");
+
+item("Function definitions are just variable definitions, but variables are
+ distinguished by their signatures to allow overloading.");
+
+title("Operators");
+item("Operators are just syntactic sugar for functions, and can be addressed or
+ defined as functions with the {\tt operator} keyword.");
+code("
+int add(int x, int y)=operator +;
+write(add(2,3)); // Writes 5.
+
+// Don't try this at home.
+int operator +(int x, int y) {
+ return add(2x,y);
+}
+write(2+3); // Writes 7.
+");
+item("This allows operators to be defined for new types.");
+
+title("Operators");
+item("Operators for constructing paths are also functions:");
+code("a.. controls b and c .. d--e");
+remark("is equivalent to");
+code(
+ "operator --(operator ..(a, operator controls(b,c), d), e)");
+item("This allowed us to redefine all of the path operators for 3D paths.");
+
+title("Summary");
+
+item("Asymptote:");
+subitem("uses IEEE floating point numerics;");
+subitem("uses C++/Java-like syntax;");
+subitem("supports deferred drawing for automatic picture sizing;");
+subitem("supports Grayscale, RGB, CMYK, and HSV colour spaces;");
+subitem("supports PostScript shading, pattern fills, and function shading;");
+subitem("can fill nonsimply connected regions;");
+subitem("generalizes MetaPost path construction algorithms to 3D;");
+subitem("lifts \TeX\ to 3D;");
+subitem("supports 3D billboard labels and PDF grouping.");
bibliography("refs");
-viewportsize=viewportmargin=0;
+viewportmargin=(2,2);
+viewportsize=0;
+defaultpen(0.5);
title("\mbox{Asymptote: 2D \& 3D Vector Graphics Language}");
asyinclude("../examples/logo3");
skip();
center("\tt http://asymptote.sf.net");
-center("(freely available under the GNU public license)");
+center("(freely available under the LGPL license)");
+
+// LocalWords: pdflatex mflogo viewportsize pagewidth pagemargin goysr bibtex
+// LocalWords: itempen defaultrender medskip Orest Shardt Vidiassov MF ezier
+// LocalWords: Hammerlindl MetaPost PDF hfill LGPL pdf asywrite zoombox LaTeX
+// LocalWords: asyfilecode PostScript asycode unitsquare beziercurve grey bw
+// LocalWords: lightgrey zerowinding evenodd sw unitsize drawEllipse nums fn
+// LocalWords: frac graphfunc func nativeformat figureborder figuremattpen bt
+// LocalWords: firstname lastname eval eetomumu binarytree filecode datagraph
+// LocalWords: lineargraph filegraph loggraph secondaryaxis imagecontour ij
+// LocalWords: tridiagonal Hobbydir nonumber Hobbycontrol th viewportmargin
+// LocalWords: asyinclude dotpen wheelpoint yequals xaxis yaxis cardsize mc
+// LocalWords: polargraph filldraw addPoint lightblue truesize le au NColors
+// LocalWords: drawline unityroot mult oct intang IEEE numerics HSV colour
+// LocalWords: nonsimply
diff --git a/Build/source/utils/asymptote/doc/extra/intro_.bbl b/Build/source/utils/asymptote/doc/extra/intro_.bbl
index b3e55e47eee..cf591457f05 100644
--- a/Build/source/utils/asymptote/doc/extra/intro_.bbl
+++ b/Build/source/utils/asymptote/doc/extra/intro_.bbl
@@ -1,4 +1,23 @@
-\begin{thebibliography}{Knu86}
+\begin{thebibliography}{Bow07}
+
+\bibitem[BH08]{Bowman08}
+John~C. Bowman and Andy Hammerlindl.
+\newblock Asymptote: A vector graphics language.
+\newblock {\em TUGboat: The Communications of the \TeX\ Users Group},
+ 29(2):288--294, 2008.
+
+\bibitem[Bow07]{Bowman07}
+John~C. Bowman.
+\newblock {The 3D {A}symptote generalization of MetaPost B\'ezier
+ interpolation}.
+\newblock {\em Proceedings in Applied Mathematics and Mechanics},
+ 7(1):2010021--2010022, 2007.
+
+\bibitem[BS09]{Bowman09}
+John~C. Bowman and Orest Shardt.
+\newblock Asymptote: Lifting {\TeX} to three dimensions.
+\newblock {\em TUGboat: The Communications of the \TeX\ Users Group},
+ 30(1):58--63, 2009.
\bibitem[Hob86]{Hobby86}
John~D. Hobby.
@@ -7,7 +26,13 @@ John~D. Hobby.
\bibitem[Knu86]{Knuth86b}
Donald~E. Knuth.
-\newblock {\em The METAFONTbook}.
+\newblock {\em The \MF{}book}.
\newblock Addison-Wesley, Reading, Massachusetts, 1986.
+\bibitem[SB10]{Shardt10}
+Orest Shardt and John~C. Bowman.
+\newblock Surface parametrization of nonsimply connected planar {B\'ezier}
+ regions.
+\newblock {\em Submitted to Computer Aided Design}, 2010.
+
\end{thebibliography}
diff --git a/Build/source/utils/asymptote/doc/latexusage-1.asy b/Build/source/utils/asymptote/doc/latexusage-1.asy
new file mode 100644
index 00000000000..7f0d6a2b3aa
--- /dev/null
+++ b/Build/source/utils/asymptote/doc/latexusage-1.asy
@@ -0,0 +1,55 @@
+if(!settings.multipleView)
+ settings.batchView=false;
+defaultfilename="latexusage-1";
+if(settings.render < 0) settings.render=4;
+settings.inlineimage=true;
+settings.embed=true;
+settings.outformat="";
+settings.toolbar=false;
+viewportmargin=(2,2);
+
+// Global Asymptote definitions can be put here.
+import three;
+usepackage("bm");
+texpreamble("\def\V#1{\bm{#1}}");
+// One can globally override the default toolbar settings here:
+// settings.toolbar=true;
+
+size(4cm,0);
+pen colour1=red;
+pen colour2=green;
+
+pair z0=(0,0);
+pair z1=(-1,0);
+pair z2=(1,0);
+real r=1.5;
+path c1=circle(z1,r);
+path c2=circle(z2,r);
+fill(c1,colour1);
+fill(c2,colour2);
+
+picture intersection=new picture;
+fill(intersection,c1,colour1+colour2);
+clip(intersection,c2);
+
+add(intersection);
+
+draw(c1);
+draw(c2);
+
+//draw("$\A$",box,z1); // Requires [inline] package option.
+//draw(Label("$\B$","$B$"),box,z2); // Requires [inline] package option.
+draw("$A$",box,z1);
+draw("$\V{B}$",box,z2);
+
+pair z=(0,-2);
+real m=3;
+margin BigMargin=Margin(0,m*dot(unit(z1-z),unit(z0-z)));
+
+draw(Label("$A\cap B$",0),conj(z)--z0,Arrow,BigMargin);
+draw(Label("$A\cup B$",0),z--z0,Arrow,BigMargin);
+draw(z--z1,Arrow,Margin(0,m));
+draw(z--z2,Arrow,Margin(0,m));
+
+shipout(bbox(0.25cm));
+viewportsize=(390.0pt,0);
diff --git a/Build/source/utils/asymptote/doc/latexusage-2.asy b/Build/source/utils/asymptote/doc/latexusage-2.asy
new file mode 100644
index 00000000000..b91be72419f
--- /dev/null
+++ b/Build/source/utils/asymptote/doc/latexusage-2.asy
@@ -0,0 +1,23 @@
+if(!settings.multipleView)
+ settings.batchView=false;
+defaultfilename="latexusage-2";
+if(settings.render < 0) settings.render=4;
+settings.inlineimage=true;
+settings.embed=true;
+settings.outformat="";
+settings.toolbar=false;
+viewportmargin=(2,2);
+
+// Global Asymptote definitions can be put here.
+import three;
+usepackage("bm");
+texpreamble("\def\V#1{\bm{#1}}");
+// One can globally override the default toolbar settings here:
+// settings.toolbar=true;
+
+
+currentprojection=orthographic(5,4,2);
+draw(unitcube,blue);
+label("$V-E+F=2$",(0,1,0.5),3Y,blue+fontsize(17pt));
+size(0,4cm);
+viewportsize=(390.0pt,0);
diff --git a/Build/source/utils/asymptote/doc/latexusage-3.asy b/Build/source/utils/asymptote/doc/latexusage-3.asy
new file mode 100644
index 00000000000..d3990c9cbfb
--- /dev/null
+++ b/Build/source/utils/asymptote/doc/latexusage-3.asy
@@ -0,0 +1,38 @@
+if(!settings.multipleView)
+ settings.batchView=false;
+defaultfilename="latexusage-3";
+if(settings.render < 0) settings.render=4;
+settings.inlineimage=true;
+settings.embed=true;
+settings.outformat="";
+settings.toolbar=false;
+viewportmargin=(2,2);
+
+// Global Asymptote definitions can be put here.
+import three;
+usepackage("bm");
+texpreamble("\def\V#1{\bm{#1}}");
+// One can globally override the default toolbar settings here:
+// settings.toolbar=true;
+
+
+pair z0=(0,0);
+pair z1=(2,0);
+pair z2=(5,0);
+pair zf=z1+0.75*(z2-z1);
+
+draw(z1--z2);
+dot(z1,red+0.15cm);
+dot(z2,darkgreen+0.3cm);
+label("$m$",z1,1.2N,red);
+label("$M$",z2,1.5N,darkgreen);
+label("$\hat{\ }$",zf,0.2*S,fontsize(24pt)+blue);
+
+pair s=-0.2*I;
+draw("$x$",z0+s--z1+s,N,red,Arrows,Bars,PenMargins);
+s=-0.5*I;
+draw("$\bar{x}$",z0+s--zf+s,blue,Arrows,Bars,PenMargins);
+s=-0.95*I;
+draw("$X$",z0+s--z2+s,darkgreen,Arrows,Bars,PenMargins);
+size(390.0pt,0);
+viewportsize=(390.0pt,0);
diff --git a/Build/source/utils/asymptote/doc/latexusage.tex b/Build/source/utils/asymptote/doc/latexusage.tex
index bc0638098c2..6324238f1a2 100644
--- a/Build/source/utils/asymptote/doc/latexusage.tex
+++ b/Build/source/utils/asymptote/doc/latexusage.tex
@@ -16,6 +16,7 @@
\begin{asydef}
// Global Asymptote definitions can be put here.
+import three;
usepackage("bm");
texpreamble("\def\V#1{\bm{#1}}");
// One can globally override the default toolbar settings here:
@@ -80,8 +81,6 @@ this requires the optional \verb+\usepackage{attachfile2}+ package and
the \verb+{attach=true}+ option:
\begin{center}
\begin{asy}[height=4cm,attach=false]
-import three;
-defaultrender.margin=3pt;
currentprojection=orthographic(5,4,2);
draw(unitcube,blue);
label("$V-E+F=2$",(0,1,0.5),3Y,blue+fontsize(17pt));
diff --git a/Build/source/utils/asymptote/doc/png/Makefile.in b/Build/source/utils/asymptote/doc/png/Makefile.in
index 4c01b40d2b7..af5ba0c8b31 100644
--- a/Build/source/utils/asymptote/doc/png/Makefile.in
+++ b/Build/source/utils/asymptote/doc/png/Makefile.in
@@ -46,5 +46,5 @@ install-all: all install
uninstall:
-install-info --remove --infodir=$(infodir) asymptote.info
-cd $(infodir)/asymptote && rm -f asymptote.info *.png
- -rmdir -f $(infodir)/asymptote
+ -rmdir $(infodir)/asymptote
FORCE:
diff --git a/Build/source/utils/asymptote/doc/png/asymptote.info b/Build/source/utils/asymptote/doc/png/asymptote.info
index 45ab814b89a..af0f271a9d2 100644
--- a/Build/source/utils/asymptote/doc/png/asymptote.info
+++ b/Build/source/utils/asymptote/doc/png/asymptote.info
@@ -1,7 +1,7 @@
This is asymptote.info, produced by makeinfo version 4.13 from
../asymptote.texi.
-This file documents `Asymptote', version 2.00.
+This file documents `Asymptote', version 2.01.
`http://asymptote.sourceforge.net'
@@ -23,7 +23,7 @@ File: asymptote.info, Node: Top, Next: Description, Up: (dir)
Asymptote
*********
-This file documents `Asymptote', version 2.00.
+This file documents `Asymptote', version 2.01.
`http://asymptote.sourceforge.net'
@@ -89,7 +89,7 @@ Programming
* Functions:: Traditional and high-order functions
* Arrays:: Dynamic vectors
* Casts:: Implicit and explicit casts
-* Import:: Importing external `Asymptote' packages
+* Import:: Importing external `Asymptote' modules
* Static:: Where to allocate your variable?
Operators
@@ -1382,7 +1382,7 @@ languages.
* Functions:: Traditional and high-order functions
* Arrays:: Dynamic vectors
* Casts:: Implicit and explicit casts
-* Import:: Importing external `Asymptote' packages
+* Import:: Importing external `Asymptote' modules
* Static:: Where to allocate your variable?

@@ -2322,10 +2322,10 @@ number, until it saturates with one or more color components equal to 1.
lineskip=1.2*size)'. The default font size, 12pt, may be changed
with `defaultpen(pen)'. Nonstandard font sizes may require
inserting import fontsize;
- at the beginning of the file (this requires the `fix-cm' package
+ at the beginning of the file (this requires the `type1cm' package
available from
- `http://www.ctan.org/tex-archive/help/Catalogue/entries/fix-cm'
+ `http://www.ctan.org/tex-archive/help/Catalogue/entries/type1cm'
and included in recent `LaTeX' distributions). The font size and
line skip of a pen can be examined with the routines `real
fontsize(pen p=currentpen)' and `real lineskip(pen p=currentpen)',
@@ -3083,6 +3083,12 @@ int x=5;
real y=4.3;
pen reddash=red+dashed;
+ `var' may also be used with the extended `for' loop syntax.
+
+int[] a = {1,2,3};
+for (var x : a)
+ write(x);
+

File: asymptote.info, Node: Structures, Next: Operators, Prev: Variable initializers, Up: Programming
@@ -4658,7 +4664,11 @@ pdflatex latexusage
To switch between using `latex' and `pdflatex' you may first need to
remove the files `latexusage-*', `latexusage_.pre', and
-`latexusage.aux'.
+`latexusage.aux'. Version 1.13 of `Asymptote.sty' supports processing
+each figure separately: `asy latexusage' is equivalent to `asy
+latexusage-*.asy'. For example, one may wish to reduce memory usage by
+generating each figure in a separate `UNIX' process:
+/bin/ls latexusage-*.asy | xargs --replace=% asy %
One can specify `width', `height', `viewportwidth',
`viewportheight', and `attach' `keyval'-style options to the `asy'
@@ -4707,6 +4717,7 @@ and `LaTeX' is available at `http://dario.dse.nl/projects/asylatex/'.
\begin{asydef}
// Global Asymptote definitions can be put here.
+import three;
usepackage("bm");
texpreamble("\def\V#1{\bm{#1}}");
// One can globally override the default toolbar settings here:
@@ -4771,8 +4782,6 @@ this requires the optional \verb+\usepackage{attachfile2}+ package and
the \verb+{attach=true}+ option:
\begin{center}
\begin{asy}[height=4cm,attach=false]
-import three;
-defaultrender.margin=3pt;
currentprojection=orthographic(5,4,2);
draw(unitcube,blue);
label("$V-E+F=2$",(0,1,0.5),3Y,blue+fontsize(17pt));
@@ -8519,7 +8528,7 @@ Index
(line 6)
* atleast: Bezier curves. (line 56)
* attach <1>: graph. (line 415)
-* attach: LaTeX usage. (line 31)
+* attach: LaTeX usage. (line 35)
* autoadjust: three. (line 354)
* autoimport: Options. (line 110)
* automatic scaling: graph. (line 682)
@@ -8867,7 +8876,6 @@ Index
* firstcut: Paths and guides. (line 247)
* fit: Frames and pictures. (line 103)
* fit3: three. (line 269)
-* fix-cm: Pens. (line 178)
* fixedscaling: Frames and pictures. (line 74)
* floor: Mathematical functions.
(line 26)
@@ -8934,7 +8942,7 @@ Index
* guide: Paths and guides. (line 300)
* guide3: three. (line 6)
* hatch: Pens. (line 267)
-* height: LaTeX usage. (line 31)
+* height: LaTeX usage. (line 35)
* help <1>: Debugger. (line 30)
* help <2>: Help. (line 6)
* help: Interactive mode. (line 44)
@@ -9561,6 +9569,7 @@ Index
* tube <1>: tube. (line 6)
* tube: three. (line 110)
* tutorial: Tutorial. (line 6)
+* type1cm: Pens. (line 178)
* typedef <1>: Functions. (line 36)
* typedef: Data types. (line 344)
* undefined: Paths and guides. (line 268)
@@ -9603,10 +9612,10 @@ Index
* verbatim: Frames and pictures. (line 271)
* vertex-dependent colors: three. (line 81)
* Vertical: flowchart. (line 81)
-* viewportheight: LaTeX usage. (line 31)
+* viewportheight: LaTeX usage. (line 35)
* viewportmargin: three. (line 262)
* viewportsize: three. (line 262)
-* viewportwidth: LaTeX usage. (line 31)
+* viewportwidth: LaTeX usage. (line 35)
* views: three. (line 231)
* vim: Editing modes. (line 33)
* virtual functions: Structures. (line 181)
@@ -9617,7 +9626,7 @@ Index
* wheel mouse: GUI. (line 6)
* while: Programming. (line 29)
* white-space string delimiter mode: Arrays. (line 359)
-* width: LaTeX usage. (line 31)
+* width: LaTeX usage. (line 35)
* windingnumber: Paths and guides. (line 268)
* word: Arrays. (line 359)
* write <1>: Arrays. (line 399)
@@ -9688,41 +9697,41 @@ Index

Tag Table:
Node: Top574
-Node: Description6833
-Node: Installation10334
-Node: UNIX binary distributions11387
-Node: MacOS X binary distributions12493
-Node: Microsoft Windows13377
-Ref: psview14087
-Node: Configuring15008
-Node: Search paths19229
-Node: Compiling from UNIX source20026
-Ref: multisampling20615
-Node: Editing modes23025
-Node: Subversion25457
-Node: Uninstall25920
-Node: Tutorial26270
-Ref: unitcircle30496
-Node: Drawing commands32432
-Node: draw34143
-Ref: arrows35291
-Node: fill40534
-Ref: gradient shading41578
-Node: clip45806
-Node: label46398
-Ref: Label47097
-Node: Bezier curves52822
-Node: Programming56399
-Ref: array iteration57213
-Node: Data types58295
-Ref: format67303
-Node: Paths and guides70906
-Ref: circle71160
-Ref: arctime76648
-Ref: extension80503
-Node: Pens87186
-Ref: fillrule94552
-Ref: basealign95449
+Node: Description6832
+Node: Installation10333
+Node: UNIX binary distributions11386
+Node: MacOS X binary distributions12492
+Node: Microsoft Windows13376
+Ref: psview14086
+Node: Configuring15007
+Node: Search paths19228
+Node: Compiling from UNIX source20025
+Ref: multisampling20614
+Node: Editing modes23024
+Node: Subversion25456
+Node: Uninstall25919
+Node: Tutorial26269
+Ref: unitcircle30495
+Node: Drawing commands32431
+Node: draw34142
+Ref: arrows35290
+Node: fill40533
+Ref: gradient shading41577
+Node: clip45805
+Node: label46397
+Ref: Label47096
+Node: Bezier curves52821
+Node: Programming56398
+Ref: array iteration57212
+Node: Data types58293
+Ref: format67301
+Node: Paths and guides70904
+Ref: circle71158
+Ref: arctime76646
+Ref: extension80501
+Node: Pens87184
+Ref: fillrule94550
+Ref: basealign95447
Ref: transparency98274
Ref: makepen101717
Ref: overwrite102555
@@ -9740,93 +9749,93 @@ Node: Files120055
Ref: cd121020
Ref: scroll125452
Node: Variable initializers128525
-Node: Structures131138
-Node: Operators138582
-Node: Arithmetic & logical138896
-Node: Self & prefix operators140870
-Node: User-defined operators141658
-Node: Implicit scaling142569
-Node: Functions143132
-Ref: stack overflow145885
-Node: Default arguments146449
-Node: Named arguments147188
-Node: Rest arguments149350
-Node: Mathematical functions152160
-Node: Arrays156767
-Ref: sort163817
-Ref: tridiagonal166221
-Ref: solve167449
-Node: Slices171642
-Node: Casts175532
-Node: Import177497
-Node: Static182724
-Node: LaTeX usage185618
-Node: Base modules191092
-Node: plain193592
-Node: simplex194244
-Node: math194517
-Node: interpolate197222
-Node: geometry197501
-Node: trembling198095
-Node: stats198446
-Node: patterns198706
-Node: markers198942
-Node: tree200725
-Node: binarytree200913
-Node: drawtree201502
-Node: syzygy201706
-Node: feynman201980
-Node: roundedpath202255
-Node: animation202538
-Ref: animate202955
-Node: embed204094
-Node: slide205883
-Node: MetaPost206223
-Node: unicode206939
-Node: latin1207827
-Node: babel208195
-Node: labelpath208424
-Node: labelpath3209244
-Node: annotate209555
-Node: CAD210026
-Node: graph210336
-Ref: ticks217465
-Ref: pathmarkers230744
-Ref: marker231209
-Ref: markuniform231560
-Ref: errorbars233351
-Ref: automatic scaling237407
-Node: palette248053
-Ref: images248171
-Ref: image252342
-Ref: logimage252820
-Ref: penimage253626
-Node: three254070
-Ref: PostScript3D278612
-Node: obj280304
-Node: graph3280556
-Ref: GaussianSurface285681
-Node: grid3286785
-Node: solids287525
-Node: tube288473
-Node: flowchart290708
-Node: contour295277
-Node: contour3300402
-Node: slopefield300709
-Node: ode302146
-Node: Options302406
-Ref: configuration file308251
-Ref: settings308251
-Ref: convert309452
-Node: Interactive mode312419
-Ref: history314572
-Node: GUI315877
-Node: GUI installation316380
-Node: GUI usage317510
-Node: PostScript to Asymptote318413
-Node: Help319169
-Node: Debugger320905
-Node: Credits322690
-Node: Index323622
+Node: Structures131250
+Node: Operators138694
+Node: Arithmetic & logical139008
+Node: Self & prefix operators140982
+Node: User-defined operators141770
+Node: Implicit scaling142681
+Node: Functions143244
+Ref: stack overflow145997
+Node: Default arguments146561
+Node: Named arguments147300
+Node: Rest arguments149462
+Node: Mathematical functions152272
+Node: Arrays156879
+Ref: sort163929
+Ref: tridiagonal166333
+Ref: solve167561
+Node: Slices171754
+Node: Casts175644
+Node: Import177609
+Node: Static182836
+Node: LaTeX usage185730
+Node: Base modules191468
+Node: plain193968
+Node: simplex194620
+Node: math194893
+Node: interpolate197598
+Node: geometry197877
+Node: trembling198471
+Node: stats198822
+Node: patterns199082
+Node: markers199318
+Node: tree201101
+Node: binarytree201289
+Node: drawtree201878
+Node: syzygy202082
+Node: feynman202356
+Node: roundedpath202631
+Node: animation202914
+Ref: animate203331
+Node: embed204470
+Node: slide206259
+Node: MetaPost206599
+Node: unicode207315
+Node: latin1208203
+Node: babel208571
+Node: labelpath208800
+Node: labelpath3209620
+Node: annotate209931
+Node: CAD210402
+Node: graph210712
+Ref: ticks217841
+Ref: pathmarkers231120
+Ref: marker231585
+Ref: markuniform231936
+Ref: errorbars233727
+Ref: automatic scaling237783
+Node: palette248429
+Ref: images248547
+Ref: image252718
+Ref: logimage253196
+Ref: penimage254002
+Node: three254446
+Ref: PostScript3D278988
+Node: obj280680
+Node: graph3280932
+Ref: GaussianSurface286057
+Node: grid3287161
+Node: solids287901
+Node: tube288849
+Node: flowchart291084
+Node: contour295653
+Node: contour3300778
+Node: slopefield301085
+Node: ode302522
+Node: Options302782
+Ref: configuration file308627
+Ref: settings308627
+Ref: convert309828
+Node: Interactive mode312795
+Ref: history314948
+Node: GUI316253
+Node: GUI installation316756
+Node: GUI usage317886
+Node: PostScript to Asymptote318789
+Node: Help319545
+Node: Debugger321281
+Node: Credits323066
+Node: Index323998

End Tag Table
diff --git a/Build/source/utils/asymptote/entry.cc b/Build/source/utils/asymptote/entry.cc
index 4cf0059b340..325438f48d3 100644
--- a/Build/source/utils/asymptote/entry.cc
+++ b/Build/source/utils/asymptote/entry.cc
@@ -536,8 +536,9 @@ varEntry *venv::lookBySignature(symbol name, signature *sig) {
// safely return it.
varEntry *result = lookByType(key(name, sig));
#if 0
- if (!result)
+ if (!result) {
cout << "FAIL BY NO-MATCH" << endl;
+ }
#endif
return result;
#else
diff --git a/Build/source/utils/asymptote/entry.h b/Build/source/utils/asymptote/entry.h
index bffec3aa6aa..c9eeb2e54ff 100644
--- a/Build/source/utils/asymptote/entry.h
+++ b/Build/source/utils/asymptote/entry.h
@@ -358,18 +358,13 @@ class venv {
// The number of scopes begun (but not yet ended) when the venv was empty.
size_t empty_scopes;
public:
- venv() : empty_scopes(0) {
- beginScope();
- }
+ venv() : empty_scopes(0) {}
// Most file level modules automatically import plain, so allocate hashtables
// big enough to hold it in advance.
struct file_env_tag {};
venv(file_env_tag)
- : all(fileAllSize), names(namesAllSize), empty_scopes(0)
- {
- beginScope();
- }
+ : all(fileAllSize), names(namesAllSize), empty_scopes(0) {}
void enter(symbol name, varEntry *v);
diff --git a/Build/source/utils/asymptote/errors b/Build/source/utils/asymptote/errors
index c5bec4882a4..aa16dfd0d32 100644
--- a/Build/source/utils/asymptote/errors
+++ b/Build/source/utils/asymptote/errors
@@ -111,3 +111,6 @@ errortest.asy: 438.17: cannot cast 'int' to 'var'
errortest.asy: 442.7: could not infer type of initializer
errortest.asy: 446.7: could not infer type of initializer
errortest.asy: 448.7: could not infer type of initializer
+errortest.asy: 452.3: expression is not an array
+errortest.asy: 457.3: could not infer type of initializer
+errortest.asy: 463.3: could not infer type of initializer
diff --git a/Build/source/utils/asymptote/errortest.asy b/Build/source/utils/asymptote/errortest.asy
index a3867598bd8..ea6885dbff8 100644
--- a/Build/source/utils/asymptote/errortest.asy
+++ b/Build/source/utils/asymptote/errortest.asy
@@ -447,3 +447,19 @@
A a;
var h = a.f;
}
+{
+ int x;
+ for (var i : x)
+ ;
+}
+{
+ int x, x();
+ for (var i : x)
+ ;
+}
+{
+ int x, x();
+ int[] x = {2,3,4};
+ for (var i : x)
+ ;
+}
diff --git a/Build/source/utils/asymptote/examples/arrows3.asy b/Build/source/utils/asymptote/examples/arrows3.asy
index 12ad43463ee..57fc4b3d338 100644
--- a/Build/source/utils/asymptote/examples/arrows3.asy
+++ b/Build/source/utils/asymptote/examples/arrows3.asy
@@ -2,6 +2,8 @@ import three;
size(15cm);
+defaultrender.merge=true;
+
currentprojection=perspective(24,14,13);
currentlight=light(gray(0.5),specularfactor=3,viewport=false,
(0.5,-0.5,-0.25),(0.5,0.5,0.25),(0.5,0.5,1),(-0.5,-0.5,-1));
diff --git a/Build/source/utils/asymptote/examples/basealign.asy b/Build/source/utils/asymptote/examples/basealign.asy
index 4bf83c94033..d653ec3c043 100644
--- a/Build/source/utils/asymptote/examples/basealign.asy
+++ b/Build/source/utils/asymptote/examples/basealign.asy
@@ -2,6 +2,7 @@ import fontsize;
import three;
settings.autobillboard=false;
+settings.embed=false;
currentprojection=orthographic(Z);
defaultpen(fontsize(100pt));
diff --git a/Build/source/utils/asymptote/examples/billboard.asy b/Build/source/utils/asymptote/examples/billboard.asy
index e126c1c5157..6e5df871007 100644
--- a/Build/source/utils/asymptote/examples/billboard.asy
+++ b/Build/source/utils/asymptote/examples/billboard.asy
@@ -2,6 +2,8 @@ import three;
size(100);
+currentprojection=perspective(1,-2,1);
+
draw(unitbox);
label("Billboard",X,red,Billboard);
diff --git a/Build/source/utils/asymptote/examples/mergeExample.asy b/Build/source/utils/asymptote/examples/mergeExample.asy
new file mode 100644
index 00000000000..e0fdcd0f6c7
--- /dev/null
+++ b/Build/source/utils/asymptote/examples/mergeExample.asy
@@ -0,0 +1,77 @@
+size(16cm);
+import bezulate;
+
+pen edgepen=linewidth(1)+blue;
+pen dotpen=deepgreen;
+pen labelpen=fontsize(8pt);
+
+path outer = (0.5,5){E}..(5,-1){S}..{W}(4,-4)..{W}(2.5,-1.5){W}..(-0.3,-2.5){W}..(-3,0)..cycle;
+outer = subdivide(outer);
+path[] p = {outer,shift(-0.5,1.0)*rotate(-22)*scale(1.5,2.4)*subdivide(unitcircle),shift(2.3,0.3)*scale(0.7)*unitcircle};
+
+// a
+filldraw(p,lightgrey+evenodd);
+
+real w = 1.1*(max(p).x-min(p).x);
+
+// b
+p = shift(w)*p;
+draw(p);
+path l = point(p[1],2)--point(p[0],4);
+draw(l,red);
+for(int i = 0; i < p.length; ++i)
+{
+ real[][] ts = intersections(l,p[i]);
+ for(real[] t:ts)
+ dot(point(l,t[0]));
+}
+path l2 = point(l,intersections(l,p[0])[0][0])--point(l,intersections(l,p[2])[1][0]);
+real to = intersections(l,p[0])[0][1];
+real ti = intersections(l,p[2])[1][1];
+draw(l2,edgepen);
+label("$A$",point(l2,1),2E,labelpen);
+label("$B$",point(l2,0),1.5E,labelpen);
+
+// c
+p = shift(w)*p;
+l2 = shift(w)*l2;
+draw(p);
+real timeoffset=2;
+path t1=subpath(p[0],to,to+timeoffset);
+t1=t1--point(p[2],ti)--cycle;
+fill(t1,lightgrey);
+draw(point(p[2],ti)--point(p[0],to+4),red);
+dot(Label("$A$",labelpen),point(p[2],ti),2E,dotpen);
+dot(Label("$B$",labelpen),point(p[0],to),1.5E,dotpen);
+dot(Label("$C$",labelpen),point(p[0],to+timeoffset),1.5S,dotpen);
+draw(t1,edgepen);
+dot(point(p[0],to+4));
+draw(shift(-0.5,-0.5)*subpath(p[0],to+4,to+timeoffset+0.5),Arrow(4));
+
+// d
+p = shift(w)*p;
+p[0] = subpath(p[0],to+timeoffset,to+length(p[0]))--uncycle(p[2],ti)--cycle;
+p.delete(2);
+draw(p);
+
+// e
+p = shift(w)*p;
+path q=point(p[1],0)--subpath(p[0],15.4,16)--cycle;
+p[0] = subpath(p[0],16,15.4+length(p[0]))--uncycle(p[1],0)--cycle;
+p.delete(1);
+filldraw(p,lightgrey);
+
+// f
+p = shift(w)*p;
+filldraw(bezulate(p),lightgrey);
+filldraw(shift(3w)*t1,lightgrey);
+filldraw(shift(w)*q,lightgrey);
+
+
+real x = min(p).x - 4.5w;
+string l = "abcdef";
+for(int i = 0; i < 6; ++i)
+{
+ label("("+substr(l,i,1)+")",(x,min(p).y),3S,fontsize(10pt));
+ x += w;
+}
diff --git a/Build/source/utils/asymptote/examples/partitionExample.asy b/Build/source/utils/asymptote/examples/partitionExample.asy
new file mode 100644
index 00000000000..4974d99d9ca
--- /dev/null
+++ b/Build/source/utils/asymptote/examples/partitionExample.asy
@@ -0,0 +1,27 @@
+size(15cm);
+import bezulate;
+
+path[] p = texpath("$\sigma \Theta$");
+pair m = min(p);
+pair M = max(p);
+real midy = 0.5(M.y+m.y);
+
+path[] alpha = p[0:2];
+path[] theta = p[2:5];
+filldraw(p,lightgrey,black);
+
+draw("{\tt partition}",(M.x+1mm,midy)--(M.x+5mm,midy),Arrow);
+draw((M.x+1mm,midy+1mm)--(M.x+5mm,midy+2mm),Arrow);
+draw((M.x+1mm,midy-1mm)--(M.x+5mm,midy-2mm),Arrow);
+
+filldraw(shift((M.x+8.5mm,midy+3.5mm))*alpha,lightgrey,black);
+filldraw(shift((M.x+5.5mm,0))*theta[0:2],lightgrey,black);
+filldraw(shift(M.x+5.5mm,midy-2.5mm)*theta[2:3],lightgrey,black);
+
+draw("{\tt merge}, {\tt bezulate}",(M.x+9mm,midy+3mm)--(M.x+15mm,midy+3mm),Arrow);
+draw("{\tt merge}, {\tt bezulate}",(M.x+9mm,midy)--(M.x+15mm,midy),Arrow);
+draw("{\tt bezulate}",(M.x+9mm,midy-2.5mm)--(M.x+15mm,midy-2.5mm),Arrow);
+
+filldraw(shift(M.x+16mm-min(alpha).x,midy+3.5mm)*bezulate(alpha),lightgrey,black);
+filldraw(shift(M.x+16mm-min(theta[0:2]).x,0)*bezulate(theta[0:2]),lightgrey,black);
+filldraw(shift(M.x+16mm-min(theta[0:2]).x,midy-2.5mm)*bezulate(theta[2:3]),lightgrey,black);
diff --git a/Build/source/utils/asymptote/examples/quilt.asy b/Build/source/utils/asymptote/examples/quilt.asy
new file mode 100644
index 00000000000..7a84017762c
--- /dev/null
+++ b/Build/source/utils/asymptote/examples/quilt.asy
@@ -0,0 +1,44 @@
+import math;
+
+int n=8, skip=3;
+
+pair r(int k) { return unityroot(n,k); }
+
+pen col=blue, col2=purple;
+
+guide square=box((1,1),(-1,-1));
+
+guide step(int mult)
+{
+ guide g;
+ for(int k=0; k<n; ++k)
+ g=g--r(mult*k);
+ g=g--cycle;
+ return g;
+}
+
+guide oct=step(1), star=step(skip);
+
+guide wedge(pair z, pair v, real r, real a)
+{
+ pair w=expi(a/2.0);
+ v=unit(v)*r;
+ return shift(z)*((0,0)--v*w--v*conj(w)--cycle);
+}
+
+filldraw(square, col);
+filldraw(oct, yellow);
+
+// The interior angle of the points of the star.
+real intang=pi*(1-((real)2skip)/((real)n));
+
+for(int k=0; k<n; ++k) {
+ pair z=midpoint(r(k)--r(k+1));
+ guide g=wedge(z,-z,1,intang);
+ filldraw(g,col2);
+}
+
+fill(star,yellow);
+filldraw(star,evenodd+col);
+
+size(5inch,0);
diff --git a/Build/source/utils/asymptote/examples/workcone.asy b/Build/source/utils/asymptote/examples/workcone.asy
index 37efb5cc86b..5d102d86214 100644
--- a/Build/source/utils/asymptote/examples/workcone.asy
+++ b/Build/source/utils/asymptote/examples/workcone.asy
@@ -16,22 +16,22 @@ real x1=r*s1/h;
real s2=sr+0.2;
real x2=r*s2/h;
-//render render=render(compression=Low,merge=true);
+render render=render(compression=0,merge=true);
path3 p=(0,0,0)--(x,0,s);
revolution a=revolution(p,Z);
-draw(surface(a,4),lightblue+opacity(0.5));
+draw(surface(a,4),lightblue+opacity(0.5),render);
path3 q=(x,0,s)--(r,0,h);
revolution b=revolution(q,Z);
-draw(surface(b),white+opacity(0.5));
+draw(surface(b),white+opacity(0.5),render);
draw((-r-1,0,0)--(r+1,0,0));
draw((0,0,0)--(0,0,h+1),dashed);
path3 w=(x1,0,s1)--(x2,0,s2)--(0,0,s2);
revolution b=revolution(w,Z);
-draw(surface(b),blue+opacity(0.5));
+draw(surface(b),blue+opacity(0.5),render);
draw(circle((0,0,s2),x2));
draw(circle((0,0,s1),x1));
diff --git a/Build/source/utils/asymptote/examples/xstitch.asy b/Build/source/utils/asymptote/examples/xstitch.asy
index 6e692643ae1..5f332881733 100644
--- a/Build/source/utils/asymptote/examples/xstitch.asy
+++ b/Build/source/utils/asymptote/examples/xstitch.asy
@@ -155,11 +155,12 @@ void drawSection(int xmin, int xmax, int ymin, int ymax) {
write("stitch count: ",stitchCount);
- shipout("xstitch"+string(shipoutNumber),pic);
+ // shipout("xstitch"+string(shipoutNumber),pic);
+ shipout(pic);
++shipoutNumber;
}
-drawSection(-1,width+1,-1,height+1);
+//drawSection(-1,width+1,-1,height+1);
//drawSection(-1,80,height-80,height+1);
diff --git a/Build/source/utils/asymptote/exp.cc b/Build/source/utils/asymptote/exp.cc
index 44957414f38..c464c697cb0 100644
--- a/Build/source/utils/asymptote/exp.cc
+++ b/Build/source/utils/asymptote/exp.cc
@@ -108,6 +108,11 @@ void exp::transCall(coenv &e, types::ty *target)
e.c.encode(inst::popcall);
}
+void exp::transConditionalJump(coenv &e, bool cond, Int dest) {
+ transToType(e, primBoolean());
+ e.c.useLabel(cond ? inst::cjmp : inst::njmp, dest);
+}
+
exp *exp::evaluate(coenv &e, types::ty *target) {
return new tempExp(e, this, target);
}
@@ -118,7 +123,7 @@ tempExp::tempExp(coenv &e, varinit *v, types::ty *t)
{
v->transToType(e, t);
a->encode(WRITE, getPos(), e.c);
- e.c.encode(inst::pop);
+ e.c.encodePop();
}
void tempExp::prettyprint(ostream &out, Int indent) {
@@ -160,7 +165,8 @@ void varEntryExp::transAct(action act, coenv &e, types::ty *target) {
void varEntryExp::transAsType(coenv &e, types::ty *target) {
transAct(READ, e, target);
}
-void varEntryExp::transWrite(coenv &e, types::ty *target) {
+void varEntryExp::transWrite(coenv &e, types::ty *target, exp *value) {
+ value->transToType(e, target);
transAct(WRITE, e, target);
}
void varEntryExp::transCall(coenv &e, types::ty *target) {
@@ -295,14 +301,19 @@ types::ty *subscriptExp::getType(coenv &e)
primError();
}
-void subscriptExp::transWrite(coenv &e, types::ty *t)
+void subscriptExp::transWrite(coenv &e, types::ty *t, exp *value)
{
+ // Put array, index, and value on the stack in that order, then call
+ // arrayWrite.
array *a = transArray(e);
if (!a)
return;
assert(equivalent(a->celltype, t));
index->transToType(e, types::primInt());
+
+ value->transToType(e, t);
+
e.c.encode(inst::builtin, run::arrayWrite);
}
@@ -360,7 +371,7 @@ types::ty *sliceExp::getType(coenv &e)
return a ? a : primError();
}
-void sliceExp::transWrite(coenv &e, types::ty *t)
+void sliceExp::transWrite(coenv &e, types::ty *t, exp *value)
{
array *a = transArray(e);
if (!a)
@@ -369,6 +380,8 @@ void sliceExp::transWrite(coenv &e, types::ty *t)
index->trans(e);
+ value->transToType(e, t);
+
e.c.encode(inst::builtin, index->getRight() ? run::arraySliceWrite :
run::arraySliceWriteToEnd);
}
@@ -1253,6 +1266,21 @@ types::ty *orExp::trans(coenv &e)
return getType(e);
}
+void orExp::transConditionalJump(coenv &e, bool cond, Int dest)
+{
+ if (cond == true) {
+ left->transConditionalJump(e, true, dest);
+ right->transConditionalJump(e, true, dest);
+ } else { /* cond == false */
+ Int end = e.c.fwdLabel();
+
+ left->transConditionalJump(e, true, end);
+ right->transConditionalJump(e, false, dest);
+
+ e.c.defLabel(end);
+ }
+}
+
void andExp::prettyprint(ostream &out, Int indent)
{
@@ -1274,6 +1302,20 @@ types::ty *andExp::trans(coenv &e)
return getType(e);
}
+void andExp::transConditionalJump(coenv &e, bool cond, Int dest)
+{
+ if (cond == true) {
+ Int end = e.c.fwdLabel();
+
+ left->transConditionalJump(e, false, end);
+ right->transConditionalJump(e, true, dest);
+
+ e.c.defLabel(end);
+ } else { /* cond == false */
+ left->transConditionalJump(e, false, dest);
+ right->transConditionalJump(e, false, dest);
+ }
+}
void joinExp::prettyprint(ostream &out, Int indent)
{
@@ -1319,11 +1361,16 @@ void assignExp::prettyprint(ostream &out, Int indent)
void assignExp::transAsType(coenv &e, types::ty *target)
{
+#if 0
// For left-to-right order, we have to evaluate the side-effects of the
// destination first.
exp *temp=dest->evaluate(e, target);
ultimateValue(temp)->transToType(e, target);
temp->transWrite(e, target);
+#endif
+
+ // All of the heavy work is handled by transWrite.
+ dest->transWrite(e, target, value);
}
types::ty *assignExp::trans(coenv &e)
@@ -1373,6 +1420,13 @@ void selfExp::prettyprint(ostream &out, Int indent)
value->prettyprint(out, indent+1);
}
+void selfExp::transAsType(coenv &e, types::ty *target)
+{
+ // Create a temp expression for the destination, so it is not evaluated
+ // twice.
+ exp *temp=dest->evaluate(e, target);
+ temp->transWrite(e, target, ultimateValue(dest));
+}
void prefixExp::prettyprint(ostream &out, Int indent)
{
diff --git a/Build/source/utils/asymptote/exp.h b/Build/source/utils/asymptote/exp.h
index fa4e464a5b4..38d6eabe8d3 100644
--- a/Build/source/utils/asymptote/exp.h
+++ b/Build/source/utils/asymptote/exp.h
@@ -134,18 +134,29 @@ public:
void testCachedType(coenv &e);
- // The expression is being used as an address to write to. This writes code
- // so that the value on top of stack is put into the address (but not popped
- // off the stack).
- virtual void transWrite(coenv &, types::ty *) {
+ // The expression is being written. Translate code such that the value
+ // (represented by the exp value) is stored into the address represented by
+ // this expression.
+ // In terms of side-effects, this expression must be evaluated (once) before
+ // value is evaluated (once).
+ virtual void transWrite(coenv &e, types::ty *t, exp *value) {
em.error(getPos());
em << "expression cannot be used as an address";
+
+ // Translate the value for errors.
+ value->transToType(e, t);
}
// Translates code for calling a function. The arguments, in the order they
// appear in the function's signature, must all be on the stack.
virtual void transCall(coenv &e, types::ty *target);
+ // transConditionalJump must produce code equivalent to the following:
+ // Evaluate the expression as a boolean. If the result equals cond, jump to
+ // the label dest, otherwise do not jump. In either case, no value is left
+ // on the stack.
+ virtual void transConditionalJump(coenv &e, bool cond, Int dest);
+
// This is used to ensure the proper order and number of evaluations. When
// called, it immediately translates code to perform the side-effects
// consistent with a corresponding call to transAsType(e, target).
@@ -203,7 +214,7 @@ public:
void transAct(action act, coenv &e, types::ty *target);
void transAsType(coenv &e, types::ty *target);
- void transWrite(coenv &e, types::ty *target);
+ void transWrite(coenv &e, types::ty *t, exp *value);
void transCall(coenv &e, types::ty *target);
};
@@ -267,8 +278,9 @@ public:
return value->getCallee(e, sig);
}
- void transWrite(coenv &e, types::ty *target) {
- value->varTrans(trans::WRITE, e, target);
+ void transWrite(coenv &e, types::ty *target, exp *newValue) {
+ newValue->transToType(e, target);
+ this->value->varTrans(trans::WRITE, e, target);
ct=0; // See note in transAsType.
}
@@ -399,7 +411,7 @@ public:
types::ty *trans(coenv &e);
types::ty *getType(coenv &e);
- void transWrite(coenv &e, types::ty *target);
+ void transWrite(coenv &e, types::ty *t, exp *value);
exp *evaluate(coenv &e, types::ty *) {
return new subscriptExp(getPos(),
@@ -444,7 +456,7 @@ public:
types::ty *trans(coenv &e);
types::ty *getType(coenv &e);
- void transWrite(coenv &e, types::ty *target);
+ void transWrite(coenv &e, types::ty *t, exp *value);
exp *evaluate(coenv &e, types::ty *) {
return new sliceExp(getPos(),
@@ -929,6 +941,7 @@ public:
void prettyprint(ostream &out, Int indent);
types::ty *trans(coenv &e);
+ void transConditionalJump(coenv &e, bool cond, Int dest);
};
class andExp : public andOrExp {
@@ -939,6 +952,7 @@ public:
void prettyprint(ostream &out, Int indent);
types::ty *trans(coenv &e);
+ void transConditionalJump(coenv &e, bool cond, Int dest);
};
class joinExp : public callExp {
@@ -1013,6 +1027,8 @@ public:
: assignExp(pos, dest, value), op(op) {}
void prettyprint(ostream &out, Int indent);
+
+ void transAsType(coenv &e, types::ty *target);
};
class prefixExp : public exp {
diff --git a/Build/source/utils/asymptote/fundec.cc b/Build/source/utils/asymptote/fundec.cc
index aff8a741c63..4f6218dc8f5 100644
--- a/Build/source/utils/asymptote/fundec.cc
+++ b/Build/source/utils/asymptote/fundec.cc
@@ -110,24 +110,24 @@ void formals::addOps(coenv &e, record *r)
// Another helper class. Does an assignment, but relying only on the
// destination for the type.
class basicAssignExp : public exp {
- exp *dest;
+ varEntry *dest;
varinit *value;
public:
- basicAssignExp(position pos, exp *dest, varinit *value)
+ basicAssignExp(position pos, varEntry *dest, varinit *value)
: exp(pos), dest(dest), value(value) {}
void prettyprint(ostream &out, Int indent) {
prettyname(out, "basicAssignExp", indent);
}
- types::ty *getType(coenv &e) {
- return dest->getType(e);
+ types::ty *getType(coenv &) {
+ return dest->getType();
}
types::ty *trans(coenv &e) {
// This doesn't handle overloaded types for the destination.
value->transToType(e, getType(e));
- dest->transWrite(e, getType(e));
+ dest->encode(WRITE, pos, e.c);
return getType(e);
}
};
@@ -147,7 +147,7 @@ void transDefault(coenv &e, position pos, varEntry *v, varinit *init) {
&vee),
new expStm(pos,
new basicAssignExp(pos,
- &vee,
+ v,
init)));
is.trans(e);
}
@@ -237,7 +237,7 @@ void fundef::baseTrans(coenv &e, types::function *ft)
string name = id ? string(id) : string("<anonymous function>");
// Create a new function environment.
- coder fc = e.c.newFunction(name, ft);
+ coder fc = e.c.newFunction(getPos(), name, ft);
coenv fe(fc,e.e);
// Translate the function.
diff --git a/Build/source/utils/asymptote/inst.h b/Build/source/utils/asymptote/inst.h
index 391f3c99461..b1b0511f660 100644
--- a/Build/source/utils/asymptote/inst.h
+++ b/Build/source/utils/asymptote/inst.h
@@ -54,7 +54,17 @@ struct inst : public gc {
varpush, varsave, fieldpush, fieldsave,
builtin, jmp, cjmp, njmp, popcall,
pushclosure, makefunc, ret,
- alloc, pushframe, popframe
+ alloc, pushframe, popframe,
+
+#ifdef COMBO
+ // Combo instructions:
+ // varpop = varsave+pop and fieldpop = fieldsave+pop
+ varpop, fieldpop,
+
+ // gejmp = bltin greater-than-equal (for ints) + cjmp OR
+ // = bltin less-than-equal + njmp
+ gejmp
+#endif
};
opcode op;
position pos;
diff --git a/Build/source/utils/asymptote/item.h b/Build/source/utils/asymptote/item.h
index 9a42f8bf2e2..7c4eec4522f 100644
--- a/Build/source/utils/asymptote/item.h
+++ b/Build/source/utils/asymptote/item.h
@@ -11,8 +11,12 @@
#include "common.h"
#include <cfloat>
#include <cmath>
-#include <typeinfo>
+
+#if COMPACT
#include <cassert>
+#else
+#include <typeinfo>
+#endif
namespace vm {
@@ -28,6 +32,14 @@ extern const Int DefaultValue;
// Identify an undefined item.
extern const Int Undefined;
+
+// Values for true and false unlikely to match other values.
+extern const Int BoolTruthValue;
+extern const Int BoolFalseValue;
+
+inline Int valueFromBool(bool b) {
+ return b ? BoolTruthValue : BoolFalseValue;
+}
#endif
extern const item Default;
@@ -35,14 +47,12 @@ extern const item Default;
class item : public gc {
private:
-#if !COMPACT
- const std::type_info *kind;
-#endif
-
union {
Int i;
double x;
+#if !COMPACT
bool b;
+#endif
void *p;
};
@@ -60,7 +70,7 @@ public:
item(double x)
: x(x) {}
item(bool b)
- : b(b) {}
+ : i(valueFromBool(b)) {}
item& operator= (int a)
{ i=a; return *this; }
@@ -70,29 +80,31 @@ public:
{ i=a; return *this; }
item& operator= (double a)
{ x=a; return *this; }
- item& operator= (bool a)
- { b=a; return *this; }
+ item& operator= (bool b)
+ { i=valueFromBool(b); return *this; }
template<class T>
item(T *p)
- : p((void *) p) {
+ : i((Int) p) {
assert(!empty());
}
template<class T>
- item(const T &P)
- : p(new(UseGC) T(P)) {
+ item(const T &p)
+ : i((Int) new(UseGC) T(p)) {
assert(!empty());
}
template<class T>
item& operator= (T *a)
- { p=(void *) a; return *this; }
+ { i=(Int) a; return *this; }
template<class T>
item& operator= (const T &it)
- { p=new(UseGC) T(it); return *this; }
+ { i=(Int) new(UseGC) T(it); return *this; }
#else
+ const std::type_info *kind;
+
bool empty() const
{return *kind == typeid(void);}
@@ -257,8 +269,10 @@ template <>
inline bool get<bool>(const item& it)
{
#if COMPACT
- if(!it.empty())
- return it.b;
+ if(it.i == BoolTruthValue)
+ return true;
+ if(it.i == BoolFalseValue)
+ return false;
#else
if(*it.kind == typeid(bool))
return it.b;
diff --git a/Build/source/utils/asymptote/opsymbols.h b/Build/source/utils/asymptote/opsymbols.h
deleted file mode 100644
index 94f3878dcb8..00000000000
--- a/Build/source/utils/asymptote/opsymbols.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*****
- * This file is automatically generated by opsymbols.pl
- * Changes will be overwritten.
- *****/
-
-// If the OPSYMBOL macro is not defined for a specific purpose, define it with
-// the default purpose of using SYM_PLUS etc. as external pre-translated
-// symbols.
-
-#ifndef OPSYMBOL
-#define OPSYMBOL(str, name) extern sym::symbol name
-#endif
-
-OPSYMBOL("+", SYM_PLUS);
-#ifndef PRESYM
-#define SYM_PLUS sym::symbol::opTrans("+")
-#endif
-OPSYMBOL("-", SYM_MINUS);
-#ifndef PRESYM
-#define SYM_MINUS sym::symbol::opTrans("-")
-#endif
-OPSYMBOL("*", SYM_TIMES);
-#ifndef PRESYM
-#define SYM_TIMES sym::symbol::opTrans("*")
-#endif
-OPSYMBOL("/", SYM_DIVIDE);
-#ifndef PRESYM
-#define SYM_DIVIDE sym::symbol::opTrans("/")
-#endif
-OPSYMBOL("%", SYM_MOD);
-#ifndef PRESYM
-#define SYM_MOD sym::symbol::opTrans("%")
-#endif
-OPSYMBOL("^", SYM_CARET);
-#ifndef PRESYM
-#define SYM_CARET sym::symbol::opTrans("^")
-#endif
-OPSYMBOL("==", SYM_EQ);
-#ifndef PRESYM
-#define SYM_EQ sym::symbol::opTrans("==")
-#endif
-OPSYMBOL("!=", SYM_NEQ);
-#ifndef PRESYM
-#define SYM_NEQ sym::symbol::opTrans("!=")
-#endif
-OPSYMBOL("<", SYM_LT);
-#ifndef PRESYM
-#define SYM_LT sym::symbol::opTrans("<")
-#endif
-OPSYMBOL("<=", SYM_LE);
-#ifndef PRESYM
-#define SYM_LE sym::symbol::opTrans("<=")
-#endif
-OPSYMBOL(">", SYM_GT);
-#ifndef PRESYM
-#define SYM_GT sym::symbol::opTrans(">")
-#endif
-OPSYMBOL(">=", SYM_GE);
-#ifndef PRESYM
-#define SYM_GE sym::symbol::opTrans(">=")
-#endif
-OPSYMBOL("&&", SYM_CAND);
-#ifndef PRESYM
-#define SYM_CAND sym::symbol::opTrans("&&")
-#endif
-OPSYMBOL("||", SYM_COR);
-#ifndef PRESYM
-#define SYM_COR sym::symbol::opTrans("||")
-#endif
-OPSYMBOL("!", SYM_LOGNOT);
-#ifndef PRESYM
-#define SYM_LOGNOT sym::symbol::opTrans("!")
-#endif
-OPSYMBOL("^^", SYM_CARETS);
-#ifndef PRESYM
-#define SYM_CARETS sym::symbol::opTrans("^^")
-#endif
-OPSYMBOL("::", SYM_COLONS);
-#ifndef PRESYM
-#define SYM_COLONS sym::symbol::opTrans("::")
-#endif
-OPSYMBOL("++", SYM_INCR);
-#ifndef PRESYM
-#define SYM_INCR sym::symbol::opTrans("++")
-#endif
-OPSYMBOL("..", SYM_DOTS);
-#ifndef PRESYM
-#define SYM_DOTS sym::symbol::opTrans("..")
-#endif
-OPSYMBOL("--", SYM_DASHES);
-#ifndef PRESYM
-#define SYM_DASHES sym::symbol::opTrans("--")
-#endif
-OPSYMBOL("---", SYM_LONGDASH);
-#ifndef PRESYM
-#define SYM_LONGDASH sym::symbol::opTrans("---")
-#endif
-OPSYMBOL("&", SYM_AMPERSAND);
-#ifndef PRESYM
-#define SYM_AMPERSAND sym::symbol::opTrans("&")
-#endif
-OPSYMBOL("|", SYM_BAR);
-#ifndef PRESYM
-#define SYM_BAR sym::symbol::opTrans("|")
-#endif
-OPSYMBOL("controls", SYM_CONTROLS);
-#ifndef PRESYM
-#define SYM_CONTROLS sym::symbol::opTrans("controls")
-#endif
-OPSYMBOL("tension", SYM_TENSION);
-#ifndef PRESYM
-#define SYM_TENSION sym::symbol::opTrans("tension")
-#endif
-OPSYMBOL("atleast", SYM_ATLEAST);
-#ifndef PRESYM
-#define SYM_ATLEAST sym::symbol::opTrans("atleast")
-#endif
-OPSYMBOL("curl", SYM_CURL);
-#ifndef PRESYM
-#define SYM_CURL sym::symbol::opTrans("curl")
-#endif
diff --git a/Build/source/utils/asymptote/process.cc b/Build/source/utils/asymptote/process.cc
index accf5b4b5a7..474b2f3d752 100644
--- a/Build/source/utils/asymptote/process.cc
+++ b/Build/source/utils/asymptote/process.cc
@@ -197,7 +197,7 @@ public:
penv pe;
env base_env(pe.ge());
- coder base_coder("icore::doRun");
+ coder base_coder(nullPos, "icore::doRun");
coenv e(base_coder,base_env);
vm::interactiveStack s;
@@ -885,7 +885,7 @@ void runPromptEmbedded(trans::coenv &e, istack &s) {
void doUnrestrictedList() {
penv pe;
env base_env(pe.ge());
- coder base_coder("doUnrestictedList");
+ coder base_coder(nullPos, "doUnrestictedList");
coenv e(base_coder,base_env);
if (getSetting<bool>("autoplain"))
diff --git a/Build/source/utils/asymptote/program.cc b/Build/source/utils/asymptote/program.cc
index 244b658057d..8c59b5f4c67 100644
--- a/Build/source/utils/asymptote/program.cc
+++ b/Build/source/utils/asymptote/program.cc
@@ -18,7 +18,12 @@ static const char* opnames[] = {
"varpush", "varsave", "fieldpush", "fieldsave",
"builtin", "jmp", "cjmp", "njmp", "call",
"pushclosure", "makefunc", "ret",
- "alloc", "pushframe", "popframe"
+ "alloc", "pushframe", "popframe",
+
+#ifdef COMBO
+ "varpop", "fieldpop",
+ "gejmp"
+#endif
};
static const Int numOps = (Int)(sizeof(opnames)/sizeof(char *));
@@ -82,6 +87,10 @@ void printInst(ostream& out, const program::label& code,
case inst::fieldpush:
case inst::fieldsave:
case inst::alloc:
+#ifdef COMBO
+ case inst::varpop:
+ case inst::fieldpop:
+#endif
{
out << " " << get<Int>(*code);
break;
@@ -106,6 +115,9 @@ void printInst(ostream& out, const program::label& code,
case inst::jmp:
case inst::cjmp:
case inst::njmp:
+#ifdef COMBO
+ case inst::gejmp:
+#endif
{
char f = out.fill('0');
out << " i";
diff --git a/Build/source/utils/asymptote/program.h b/Build/source/utils/asymptote/program.h
index c6e37562bc5..4e3e8e8f986 100644
--- a/Build/source/utils/asymptote/program.h
+++ b/Build/source/utils/asymptote/program.h
@@ -21,6 +21,8 @@ public:
void encode(inst i);
label begin();
label end();
+ inst &back();
+ void pop_back();
private:
friend class label;
typedef mem::vector<inst> code_t;
@@ -64,6 +66,10 @@ inline program::label program::end()
{ return label(code.size(), this); }
inline program::label program::begin()
{ return label(0, this); }
+inline inst& program::back()
+{ return code.back(); }
+inline void program::pop_back()
+{ return code.pop_back(); }
inline void program::encode(inst i)
{ code.push_back(i); }
inline inst& program::operator[](size_t n)
diff --git a/Build/source/utils/asymptote/record.cc b/Build/source/utils/asymptote/record.cc
index 191a39267f2..8bb26176aa0 100644
--- a/Build/source/utils/asymptote/record.cc
+++ b/Build/source/utils/asymptote/record.cc
@@ -52,7 +52,7 @@ dummyRecord::dummyRecord(symbol name)
{
// Encode the instructions to put an placeholder instance of the record
// on the stack.
- trans::coder c(this, 0);
+ trans::coder c(nullPos, this, 0);
c.closeRecord();
}
@@ -61,7 +61,7 @@ dummyRecord::dummyRecord(string s)
{
// Encode the instructions to put an placeholder instance of the record
// on the stack.
- trans::coder c(this, 0);
+ trans::coder c(nullPos, this, 0);
c.closeRecord();
}
diff --git a/Build/source/utils/asymptote/runarray.cc b/Build/source/utils/asymptote/runarray.cc
index 97df85c93d1..85f5f2c1d84 100644
--- a/Build/source/utils/asymptote/runarray.cc
+++ b/Build/source/utils/asymptote/runarray.cc
@@ -656,13 +656,14 @@ void arrayArrayRead(stack *Stack)
}
// Write an element to an array. Increase size if necessary.
-#line 567 "runarray.in"
+// TODO: Add arrayWriteAndPop
+#line 568 "runarray.in"
void arrayWrite(stack *Stack)
{
+ item value=vm::pop(Stack);
Int n=vm::pop<Int>(Stack);
array * a=vm::pop<array *>(Stack);
- item value=vm::pop(Stack);
-#line 568 "runarray.in"
+#line 569 "runarray.in"
size_t len=checkArray(a);
bool cyclic=a->cyclic();
if(cyclic && len > 0) n=imod(n,len);
@@ -676,27 +677,27 @@ void arrayWrite(stack *Stack)
{Stack->push(value); return;}
}
-#line 582 "runarray.in"
+#line 583 "runarray.in"
void arraySliceWrite(stack *Stack)
{
+ array * src=vm::pop<array *>(Stack);
Int right=vm::pop<Int>(Stack);
Int left=vm::pop<Int>(Stack);
array * dest=vm::pop<array *>(Stack);
- array * src=vm::pop<array *>(Stack);
-#line 583 "runarray.in"
+#line 584 "runarray.in"
checkArray(src);
checkArray(dest);
dest->setSlice(left, right, src);
{Stack->push<array*>(src); return;}
}
-#line 590 "runarray.in"
+#line 591 "runarray.in"
void arraySliceWriteToEnd(stack *Stack)
{
+ array * src=vm::pop<array *>(Stack);
Int left=vm::pop<Int>(Stack);
array * dest=vm::pop<array *>(Stack);
- array * src=vm::pop<array *>(Stack);
-#line 591 "runarray.in"
+#line 592 "runarray.in"
checkArray(src);
size_t len=checkArray(dest);
dest->setSlice(left, (Int) len, src);
@@ -704,20 +705,20 @@ void arraySliceWriteToEnd(stack *Stack)
}
// Returns the length of an array.
-#line 599 "runarray.in"
+#line 600 "runarray.in"
void arrayLength(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 600 "runarray.in"
+#line 601 "runarray.in"
{Stack->push<Int>((Int) checkArray(a)); return;}
}
// Returns an array of integers representing the keys of the array.
-#line 605 "runarray.in"
+#line 606 "runarray.in"
void arrayKeys(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 606 "runarray.in"
+#line 607 "runarray.in"
size_t size=checkArray(a);
array *keys=new array();
@@ -731,33 +732,33 @@ void arrayKeys(stack *Stack)
}
// Return the cyclic flag for an array.
-#line 620 "runarray.in"
+#line 621 "runarray.in"
void arrayCyclicFlag(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 621 "runarray.in"
+#line 622 "runarray.in"
checkArray(a);
{Stack->push<bool>(a->cyclic()); return;}
}
-#line 626 "runarray.in"
+#line 627 "runarray.in"
void arraySetCyclicFlag(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
bool b=vm::pop<bool>(Stack);
-#line 627 "runarray.in"
+#line 628 "runarray.in"
checkArray(a);
a->cyclic(b);
{Stack->push<bool>(b); return;}
}
// Check to see if an array element is initialized.
-#line 634 "runarray.in"
+#line 635 "runarray.in"
void arrayInitializedHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
Int n=vm::pop<Int>(Stack);
-#line 635 "runarray.in"
+#line 636 "runarray.in"
size_t len=checkArray(a);
bool cyclic=a->cyclic();
if(cyclic && len > 0) n=imod(n,len);
@@ -767,62 +768,62 @@ void arrayInitializedHelper(stack *Stack)
}
// Returns the initialize method for an array.
-#line 645 "runarray.in"
+#line 646 "runarray.in"
void arrayInitialized(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 646 "runarray.in"
+#line 647 "runarray.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayInitializedHelper),a)); return;}
}
// The helper function for the cyclic method that sets the cyclic flag.
-#line 651 "runarray.in"
+#line 652 "runarray.in"
void arrayCyclicHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
bool b=vm::pop<bool>(Stack);
-#line 652 "runarray.in"
+#line 653 "runarray.in"
checkArray(a);
a->cyclic(b);
}
// Set the cyclic flag for an array.
-#line 658 "runarray.in"
+#line 659 "runarray.in"
void arrayCyclic(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 659 "runarray.in"
+#line 660 "runarray.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayCyclicHelper),a)); return;}
}
// The helper function for the push method that does the actual operation.
-#line 664 "runarray.in"
+#line 665 "runarray.in"
void arrayPushHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
item x=vm::pop(Stack);
-#line 665 "runarray.in"
+#line 666 "runarray.in"
checkArray(a);
a->push(x);
{Stack->push(x); return;}
}
// Returns the push method for an array.
-#line 672 "runarray.in"
+#line 673 "runarray.in"
void arrayPush(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 673 "runarray.in"
+#line 674 "runarray.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayPushHelper),a)); return;}
}
// The helper function for the append method that appends b to a.
-#line 678 "runarray.in"
+#line 679 "runarray.in"
void arrayAppendHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
array * b=vm::pop<array *>(Stack);
-#line 679 "runarray.in"
+#line 680 "runarray.in"
checkArray(a);
size_t size=checkArray(b);
for(size_t i=0; i < size; i++)
@@ -830,20 +831,20 @@ void arrayAppendHelper(stack *Stack)
}
// Returns the append method for an array.
-#line 687 "runarray.in"
+#line 688 "runarray.in"
void arrayAppend(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 688 "runarray.in"
+#line 689 "runarray.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayAppendHelper),a)); return;}
}
// The helper function for the pop method.
-#line 693 "runarray.in"
+#line 694 "runarray.in"
void arrayPopHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 694 "runarray.in"
+#line 695 "runarray.in"
size_t asize=checkArray(a);
if(asize == 0)
error("cannot pop element from empty array");
@@ -851,22 +852,22 @@ void arrayPopHelper(stack *Stack)
}
// Returns the pop method for an array.
-#line 702 "runarray.in"
+#line 703 "runarray.in"
void arrayPop(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 703 "runarray.in"
+#line 704 "runarray.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayPopHelper),a)); return;}
}
// The helper function for the insert method.
-#line 708 "runarray.in"
+#line 709 "runarray.in"
void arrayInsertHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
array * x=vm::pop<array *>(Stack);
Int i=vm::pop<Int>(Stack);
-#line 709 "runarray.in"
+#line 710 "runarray.in"
size_t asize=checkArray(a);
checkArray(x);
if(a->cyclic() && asize > 0) i=imod(i,asize);
@@ -876,39 +877,39 @@ void arrayInsertHelper(stack *Stack)
}
// Returns the insert method for an array.
-#line 719 "runarray.in"
+#line 720 "runarray.in"
void arrayInsert(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 720 "runarray.in"
+#line 721 "runarray.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayInsertHelper),a)); return;}
}
// Returns the delete method for an array.
-#line 725 "runarray.in"
+#line 726 "runarray.in"
void arrayDelete(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 726 "runarray.in"
+#line 727 "runarray.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayDeleteHelper),a)); return;}
}
-#line 730 "runarray.in"
+#line 731 "runarray.in"
void arrayAlias(stack *Stack)
{
array * b=vm::pop<array *>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 731 "runarray.in"
+#line 732 "runarray.in"
{Stack->push<bool>(a==b); return;}
}
// Return array formed by indexing array a with elements of integer array b
-#line 736 "runarray.in"
+#line 737 "runarray.in"
void arrayIntArray(stack *Stack)
{
array * b=vm::pop<array *>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 737 "runarray.in"
+#line 738 "runarray.in"
size_t asize=checkArray(a);
size_t bsize=checkArray(b);
array *r=new array(bsize);
@@ -926,13 +927,13 @@ void arrayIntArray(stack *Stack)
// returns the complement of the integer array a in {0,2,...,n-1},
// so that b[complement(a,b.length)] yields the complement of b[a].
-#line 755 "runarray.in"
+#line 756 "runarray.in"
// Intarray* complement(Intarray *a, Int n);
void gen_runarray33(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
Intarray * a=vm::pop<Intarray *>(Stack);
-#line 756 "runarray.in"
+#line 757 "runarray.in"
size_t asize=checkArray(a);
array *r=new array(0);
bool *keep=new bool[n];
@@ -949,12 +950,12 @@ void gen_runarray33(stack *Stack)
}
// Generate the sequence {f(i) : i=0,1,...n-1} given a function f and integer n
-#line 773 "runarray.in"
+#line 774 "runarray.in"
void arraySequence(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
callable * f=vm::pop<callable *>(Stack);
-#line 774 "runarray.in"
+#line 775 "runarray.in"
if(n < 0) n=0;
array *a=new array(n);
for(Int i=0; i < n; ++i) {
@@ -966,12 +967,12 @@ void arraySequence(stack *Stack)
}
// Return the array {0,1,...n-1}
-#line 786 "runarray.in"
+#line 787 "runarray.in"
// Intarray* sequence(Int n);
void gen_runarray35(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 787 "runarray.in"
+#line 788 "runarray.in"
if(n < 0) n=0;
array *a=new array(n);
for(Int i=0; i < n; ++i) {
@@ -981,12 +982,12 @@ void gen_runarray35(stack *Stack)
}
// Apply a function to each element of an array
-#line 797 "runarray.in"
+#line 798 "runarray.in"
void arrayFunction(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
callable * f=vm::pop<callable *>(Stack);
-#line 798 "runarray.in"
+#line 799 "runarray.in"
size_t size=checkArray(a);
array *b=new array(size);
for(size_t i=0; i < size; ++i) {
@@ -997,12 +998,12 @@ void arrayFunction(stack *Stack)
{Stack->push<array*>(b); return;}
}
-#line 809 "runarray.in"
+#line 810 "runarray.in"
void arraySort(stack *Stack)
{
callable * less=vm::pop<callable *>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 810 "runarray.in"
+#line 811 "runarray.in"
array *c=copyArray(a);
compareFunc=less;
FuncStack=Stack;
@@ -1010,13 +1011,13 @@ void arraySort(stack *Stack)
{Stack->push<array*>(c); return;}
}
-#line 818 "runarray.in"
+#line 819 "runarray.in"
void arraySearch(stack *Stack)
{
callable * less=vm::pop<callable *>(Stack);
item key=vm::pop(Stack);
array * a=vm::pop<array *>(Stack);
-#line 819 "runarray.in"
+#line 820 "runarray.in"
size_t size=a->size();
compareFunc=less;
FuncStack=Stack;
@@ -1034,12 +1035,12 @@ void arraySearch(stack *Stack)
{Stack->push<Int>(0); return;}
}
-#line 837 "runarray.in"
+#line 838 "runarray.in"
// bool all(boolarray *a);
void gen_runarray39(stack *Stack)
{
boolarray * a=vm::pop<boolarray *>(Stack);
-#line 838 "runarray.in"
+#line 839 "runarray.in"
size_t size=checkArray(a);
bool c=true;
for(size_t i=0; i < size; i++)
@@ -1047,12 +1048,12 @@ void gen_runarray39(stack *Stack)
{Stack->push<bool>(c); return;}
}
-#line 846 "runarray.in"
+#line 847 "runarray.in"
// boolarray* !(boolarray* a);
void gen_runarray40(stack *Stack)
{
boolarray* a=vm::pop<boolarray*>(Stack);
-#line 847 "runarray.in"
+#line 848 "runarray.in"
size_t size=checkArray(a);
array *c=new array(size);
for(size_t i=0; i < size; i++)
@@ -1060,12 +1061,12 @@ void gen_runarray40(stack *Stack)
{Stack->push<boolarray*>(c); return;}
}
-#line 855 "runarray.in"
+#line 856 "runarray.in"
// Int sum(boolarray *a);
void gen_runarray41(stack *Stack)
{
boolarray * a=vm::pop<boolarray *>(Stack);
-#line 856 "runarray.in"
+#line 857 "runarray.in"
size_t size=checkArray(a);
Int sum=0;
for(size_t i=0; i < size; i++)
@@ -1073,19 +1074,19 @@ void gen_runarray41(stack *Stack)
{Stack->push<Int>(sum); return;}
}
-#line 864 "runarray.in"
+#line 865 "runarray.in"
void arrayCopy(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 865 "runarray.in"
+#line 866 "runarray.in"
{Stack->push<array*>(copyArray(a)); return;}
}
-#line 869 "runarray.in"
+#line 870 "runarray.in"
void arrayConcat(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 870 "runarray.in"
+#line 871 "runarray.in"
// a is an array of arrays to be concatenated together.
// The signature is
// T[] concat(... T[][] a);
@@ -1112,27 +1113,27 @@ void arrayConcat(stack *Stack)
{Stack->push<array*>(result); return;}
}
-#line 897 "runarray.in"
+#line 898 "runarray.in"
void array2Copy(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 898 "runarray.in"
+#line 899 "runarray.in"
{Stack->push<array*>(copyArray2(a)); return;}
}
-#line 902 "runarray.in"
+#line 903 "runarray.in"
void array3Copy(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 903 "runarray.in"
+#line 904 "runarray.in"
{Stack->push<array*>(copyArray3(a)); return;}
}
-#line 907 "runarray.in"
+#line 908 "runarray.in"
void array2Transpose(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 908 "runarray.in"
+#line 909 "runarray.in"
size_t asize=checkArray(a);
array *c=new array(0);
for(size_t i=0; i < asize; i++) {
@@ -1159,12 +1160,12 @@ void array2Transpose(stack *Stack)
// permutation (021 or 120, etc; original is 012).
// Transpose by sending respective members to the permutated locations:
// return the array obtained by putting a[i][j][k] into position perm{ijk}.
-#line 935 "runarray.in"
+#line 936 "runarray.in"
void array3Transpose(stack *Stack)
{
array * perm=vm::pop<array *>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 936 "runarray.in"
+#line 937 "runarray.in"
const size_t DIM=3;
if(checkArray(perm) != DIM) {
@@ -1248,13 +1249,13 @@ void array3Transpose(stack *Stack)
// In a boolean array, find the index of the nth true value or -1 if not found
// If n is negative, search backwards.
-#line 1020 "runarray.in"
+#line 1021 "runarray.in"
// Int find(boolarray *a, Int n=1);
void gen_runarray48(stack *Stack)
{
Int n=vm::pop<Int>(Stack,1);
boolarray * a=vm::pop<boolarray *>(Stack);
-#line 1021 "runarray.in"
+#line 1022 "runarray.in"
size_t size=checkArray(a);
Int j=-1;
if(n > 0)
@@ -1272,13 +1273,13 @@ void gen_runarray48(stack *Stack)
// construct vector obtained by replacing those elements of b for which the
// corresponding elements of a are false by the corresponding element of c.
-#line 1039 "runarray.in"
+#line 1040 "runarray.in"
void arrayConditional(stack *Stack)
{
array * c=vm::pop<array *>(Stack);
array * b=vm::pop<array *>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 1040 "runarray.in"
+#line 1041 "runarray.in"
size_t size=checkArray(a);
array *r=new array(size);
if(b && c) {
@@ -1302,22 +1303,22 @@ void arrayConditional(stack *Stack)
}
// Return an n x n identity matrix.
-#line 1064 "runarray.in"
+#line 1065 "runarray.in"
// realarray2* identity(Int n);
void gen_runarray50(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 1065 "runarray.in"
+#line 1066 "runarray.in"
{Stack->push<realarray2*>(Identity(n)); return;}
}
// Return the inverse of an n x n matrix a using Gauss-Jordan elimination.
-#line 1070 "runarray.in"
+#line 1071 "runarray.in"
// realarray2* inverse(realarray2 *a);
void gen_runarray51(stack *Stack)
{
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 1071 "runarray.in"
+#line 1072 "runarray.in"
a=copyArray2(a);
size_t n=checkArray(a);
checkSquare(a);
@@ -1410,14 +1411,14 @@ void gen_runarray51(stack *Stack)
// Solve the linear equation ax=b by LU decomposition, returning the
// solution x, where a is an n x n matrix and b is an array of length n.
// If no solution exists, return an empty array.
-#line 1164 "runarray.in"
+#line 1165 "runarray.in"
// realarray* solve(realarray2 *a, realarray *b, bool warn=true);
void gen_runarray52(stack *Stack)
{
bool warn=vm::pop<bool>(Stack,true);
realarray * b=vm::pop<realarray *>(Stack);
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 1165 "runarray.in"
+#line 1166 "runarray.in"
size_t n=checkArray(a);
if(n == 0) {Stack->push<realarray*>(new array(0)); return;}
@@ -1469,14 +1470,14 @@ void gen_runarray52(stack *Stack)
// Solve the linear equation ax=b by LU decomposition, returning the
// solution x, where a is an n x n matrix and b is an n x m matrix.
// If no solution exists, return an empty array.
-#line 1217 "runarray.in"
+#line 1218 "runarray.in"
// realarray2* solve(realarray2 *a, realarray2 *b, bool warn=true);
void gen_runarray53(stack *Stack)
{
bool warn=vm::pop<bool>(Stack,true);
realarray2 * b=vm::pop<realarray2 *>(Stack);
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 1218 "runarray.in"
+#line 1219 "runarray.in"
size_t n=checkArray(a);
if(n == 0) {Stack->push<realarray2*>(new array(0)); return;}
@@ -1538,12 +1539,12 @@ void gen_runarray53(stack *Stack)
}
// Compute the determinant of an n x n matrix.
-#line 1280 "runarray.in"
+#line 1281 "runarray.in"
// real determinant(realarray2 *a);
void gen_runarray54(stack *Stack)
{
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 1281 "runarray.in"
+#line 1282 "runarray.in"
real *A;
copyArray2C(A,a);
size_t n=checkArray(a);
@@ -1558,13 +1559,13 @@ void gen_runarray54(stack *Stack)
{Stack->push<real>(det); return;}
}
-#line 1296 "runarray.in"
+#line 1297 "runarray.in"
// realarray* *(realarray2 *a, realarray *b);
void gen_runarray55(stack *Stack)
{
realarray * b=vm::pop<realarray *>(Stack);
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 1297 "runarray.in"
+#line 1298 "runarray.in"
size_t n=checkArray(a);
size_t m=checkArray(b);
array *c=new array(n);
@@ -1582,13 +1583,13 @@ void gen_runarray55(stack *Stack)
{Stack->push<realarray*>(c); return;}
}
-#line 1315 "runarray.in"
+#line 1316 "runarray.in"
// realarray* *(realarray *a, realarray2 *b);
void gen_runarray56(stack *Stack)
{
realarray2 * b=vm::pop<realarray2 *>(Stack);
realarray * a=vm::pop<realarray *>(Stack);
-#line 1316 "runarray.in"
+#line 1317 "runarray.in"
size_t n=checkArray(a);
if(n != checkArray(b)) error(incommensurate);
real *A;
@@ -1616,53 +1617,53 @@ void gen_runarray56(stack *Stack)
{Stack->push<realarray*>(c); return;}
}
-#line 1344 "runarray.in"
+#line 1345 "runarray.in"
// Intarray2* *(Intarray2 *a, Intarray2 *b);
void gen_runarray57(stack *Stack)
{
Intarray2 * b=vm::pop<Intarray2 *>(Stack);
Intarray2 * a=vm::pop<Intarray2 *>(Stack);
-#line 1345 "runarray.in"
+#line 1346 "runarray.in"
{Stack->push<Intarray2*>(mult<Int>(a,b)); return;}
}
-#line 1349 "runarray.in"
+#line 1350 "runarray.in"
// realarray2* *(realarray2 *a, realarray2 *b);
void gen_runarray58(stack *Stack)
{
realarray2 * b=vm::pop<realarray2 *>(Stack);
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 1350 "runarray.in"
+#line 1351 "runarray.in"
{Stack->push<realarray2*>(mult<real>(a,b)); return;}
}
-#line 1354 "runarray.in"
+#line 1355 "runarray.in"
// pairarray2* *(pairarray2 *a, pairarray2 *b);
void gen_runarray59(stack *Stack)
{
pairarray2 * b=vm::pop<pairarray2 *>(Stack);
pairarray2 * a=vm::pop<pairarray2 *>(Stack);
-#line 1355 "runarray.in"
+#line 1356 "runarray.in"
{Stack->push<pairarray2*>(mult<pair>(a,b)); return;}
}
-#line 1359 "runarray.in"
+#line 1360 "runarray.in"
// triple *(realarray2 *t, triple v);
void gen_runarray60(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
realarray2 * t=vm::pop<realarray2 *>(Stack);
-#line 1360 "runarray.in"
+#line 1361 "runarray.in"
{Stack->push<triple>(*t*v); return;}
}
-#line 1364 "runarray.in"
+#line 1365 "runarray.in"
// pair project(triple v, realarray2 *t);
void gen_runarray61(stack *Stack)
{
realarray2 * t=vm::pop<realarray2 *>(Stack);
triple v=vm::pop<triple>(Stack);
-#line 1365 "runarray.in"
+#line 1366 "runarray.in"
size_t n=checkArray(t);
if(n != 4) error(incommensurate);
array *t0=read<array*>(t,0);
@@ -1687,13 +1688,13 @@ void gen_runarray61(stack *Stack)
}
// Compute the dot product of vectors a and b.
-#line 1390 "runarray.in"
+#line 1391 "runarray.in"
// real dot(realarray *a, realarray *b);
void gen_runarray62(stack *Stack)
{
realarray * b=vm::pop<realarray *>(Stack);
realarray * a=vm::pop<realarray *>(Stack);
-#line 1391 "runarray.in"
+#line 1392 "runarray.in"
size_t n=checkArrays(a,b);
real sum=0.0;
for(size_t i=0; i < n; ++i)
@@ -1702,13 +1703,13 @@ void gen_runarray62(stack *Stack)
}
// Compute the complex dot product of vectors a and b.
-#line 1400 "runarray.in"
+#line 1401 "runarray.in"
// pair dot(pairarray *a, pairarray *b);
void gen_runarray63(stack *Stack)
{
pairarray * b=vm::pop<pairarray *>(Stack);
pairarray * a=vm::pop<pairarray *>(Stack);
-#line 1401 "runarray.in"
+#line 1402 "runarray.in"
size_t n=checkArrays(a,b);
pair sum=zero;
for(size_t i=0; i < n; ++i)
@@ -1723,7 +1724,7 @@ void gen_runarray63(stack *Stack)
// [ a[2] b[2] c[2] ]
// [ ... ]
// [ c[n-1] a[n-1] b[n-1] ]
-#line 1416 "runarray.in"
+#line 1417 "runarray.in"
// realarray* tridiagonal(realarray *a, realarray *b, realarray *c, realarray *f);
void gen_runarray64(stack *Stack)
{
@@ -1731,7 +1732,7 @@ void gen_runarray64(stack *Stack)
realarray * c=vm::pop<realarray *>(Stack);
realarray * b=vm::pop<realarray *>(Stack);
realarray * a=vm::pop<realarray *>(Stack);
-#line 1417 "runarray.in"
+#line 1418 "runarray.in"
size_t n=checkArrays(a,b);
checkEqual(n,checkArray(c));
checkEqual(n,checkArray(f));
@@ -1828,7 +1829,7 @@ void gen_runarray64(stack *Stack)
}
// Root solve by Newton-Raphson
-#line 1514 "runarray.in"
+#line 1515 "runarray.in"
// real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x, bool verbose=false);
void gen_runarray65(stack *Stack)
{
@@ -1837,7 +1838,7 @@ void gen_runarray65(stack *Stack)
callableReal * fprime=vm::pop<callableReal *>(Stack);
callableReal * f=vm::pop<callableReal *>(Stack);
Int iterations=vm::pop<Int>(Stack,100);
-#line 1516 "runarray.in"
+#line 1517 "runarray.in"
static const real fuzz=1000.0*DBL_EPSILON;
Int i=0;
size_t oldPrec=0;
@@ -1883,7 +1884,7 @@ void gen_runarray65(stack *Stack)
// Root solve by Newton-Raphson bisection
// cf. routine rtsafe (Press et al., Numerical Recipes, 1991).
-#line 1562 "runarray.in"
+#line 1563 "runarray.in"
// real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x1, real x2, bool verbose=false);
void gen_runarray66(stack *Stack)
{
@@ -1893,7 +1894,7 @@ void gen_runarray66(stack *Stack)
callableReal * fprime=vm::pop<callableReal *>(Stack);
callableReal * f=vm::pop<callableReal *>(Stack);
Int iterations=vm::pop<Int>(Stack,100);
-#line 1564 "runarray.in"
+#line 1565 "runarray.in"
static const real fuzz=1000.0*DBL_EPSILON;
size_t oldPrec=0;
if(verbose)
@@ -1971,7 +1972,7 @@ void gen_runarray66(stack *Stack)
{Stack->push<real>((j == iterations) ? DBL_MAX : x); return;}
}
-#line 1642 "runarray.in"
+#line 1643 "runarray.in"
// real simpson(callableReal *f, real a, real b, real acc=DBL_EPSILON, real dxmax=0);
void gen_runarray67(stack *Stack)
{
@@ -1980,7 +1981,7 @@ void gen_runarray67(stack *Stack)
real b=vm::pop<real>(Stack);
real a=vm::pop<real>(Stack);
callableReal * f=vm::pop<callableReal *>(Stack);
-#line 1644 "runarray.in"
+#line 1645 "runarray.in"
real integral;
if(dxmax <= 0) dxmax=fabs(b-a);
Func=f;
@@ -1991,13 +1992,13 @@ void gen_runarray67(stack *Stack)
}
// Compute the fast Fourier transform of a pair array
-#line 1655 "runarray.in"
+#line 1656 "runarray.in"
// pairarray* fft(pairarray *a, Int sign=1);
void gen_runarray68(stack *Stack)
{
Int sign=vm::pop<Int>(Stack,1);
pairarray * a=vm::pop<pairarray *>(Stack);
-#line 1656 "runarray.in"
+#line 1657 "runarray.in"
unsigned n=(unsigned) checkArray(a);
#ifdef HAVE_LIBFFTW3
array *c=new array(n);
@@ -2026,12 +2027,12 @@ void gen_runarray68(stack *Stack)
{Stack->push<pairarray*>(c); return;}
}
-#line 1685 "runarray.in"
+#line 1686 "runarray.in"
// Intarray2* triangulate(pairarray *z);
void gen_runarray69(stack *Stack)
{
pairarray * z=vm::pop<pairarray *>(Stack);
-#line 1686 "runarray.in"
+#line 1687 "runarray.in"
size_t nv=checkArray(z);
// Call robust version of Gilles Dumoulin's port of Paul Bourke's
// triangulation code.
@@ -2065,12 +2066,12 @@ void gen_runarray69(stack *Stack)
{Stack->push<Intarray2*>(t); return;}
}
-#line 1720 "runarray.in"
+#line 1721 "runarray.in"
// real norm(realarray *a);
void gen_runarray70(stack *Stack)
{
realarray * a=vm::pop<realarray *>(Stack);
-#line 1721 "runarray.in"
+#line 1722 "runarray.in"
size_t n=checkArray(a);
real M=0.0;
for(size_t i=0; i < n; ++i) {
@@ -2080,12 +2081,12 @@ void gen_runarray70(stack *Stack)
{Stack->push<real>(M); return;}
}
-#line 1731 "runarray.in"
+#line 1732 "runarray.in"
// real norm(realarray2 *a);
void gen_runarray71(stack *Stack)
{
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 1732 "runarray.in"
+#line 1733 "runarray.in"
size_t n=checkArray(a);
real M=0.0;
for(size_t i=0; i < n; ++i) {
@@ -2099,12 +2100,12 @@ void gen_runarray71(stack *Stack)
{Stack->push<real>(M); return;}
}
-#line 1746 "runarray.in"
+#line 1747 "runarray.in"
// real norm(triplearray2 *a);
void gen_runarray72(stack *Stack)
{
triplearray2 * a=vm::pop<triplearray2 *>(Stack);
-#line 1747 "runarray.in"
+#line 1748 "runarray.in"
size_t n=checkArray(a);
real M=0.0;
for(size_t i=0; i < n; ++i) {
@@ -2118,12 +2119,12 @@ void gen_runarray72(stack *Stack)
{Stack->push<real>(sqrt(M)); return;}
}
-#line 1761 "runarray.in"
+#line 1762 "runarray.in"
// real change2(triplearray2 *a);
void gen_runarray73(stack *Stack)
{
triplearray2 * a=vm::pop<triplearray2 *>(Stack);
-#line 1762 "runarray.in"
+#line 1763 "runarray.in"
size_t n=checkArray(a);
if(n == 0) {Stack->push<real>(0.0); return;}
@@ -2144,13 +2145,13 @@ void gen_runarray73(stack *Stack)
{Stack->push<real>(M); return;}
}
-#line 1783 "runarray.in"
+#line 1784 "runarray.in"
// triple minbezier(triplearray2 *P, triple b);
void gen_runarray74(stack *Stack)
{
triple b=vm::pop<triple>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 1784 "runarray.in"
+#line 1785 "runarray.in"
real *A=copyTripleArray2Components(P,true,4);
b=triple(bound(A,::min,b.getx(),sqrtFuzz*norm(A,16)),
bound(A+16,::min,b.gety(),sqrtFuzz*norm(A+16,16)),
@@ -2159,13 +2160,13 @@ void gen_runarray74(stack *Stack)
{Stack->push<triple>(b); return;}
}
-#line 1793 "runarray.in"
+#line 1794 "runarray.in"
// triple maxbezier(triplearray2 *P, triple b);
void gen_runarray75(stack *Stack)
{
triple b=vm::pop<triple>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 1794 "runarray.in"
+#line 1795 "runarray.in"
real *A=copyTripleArray2Components(P,true,4);
b=triple(bound(A,::max,b.getx(),sqrtFuzz*norm(A,16)),
bound(A+16,::max,b.gety(),sqrtFuzz*norm(A+16,16)),
@@ -2174,13 +2175,13 @@ void gen_runarray75(stack *Stack)
{Stack->push<triple>(b); return;}
}
-#line 1803 "runarray.in"
+#line 1804 "runarray.in"
// pair minratio(triplearray2 *P, pair b);
void gen_runarray76(stack *Stack)
{
pair b=vm::pop<pair>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 1804 "runarray.in"
+#line 1805 "runarray.in"
triple *A;
copyArray2C(A,P,true,4);
real fuzz=sqrtFuzz*norm(A,16);
@@ -2190,13 +2191,13 @@ void gen_runarray76(stack *Stack)
{Stack->push<pair>(b); return;}
}
-#line 1814 "runarray.in"
+#line 1815 "runarray.in"
// pair maxratio(triplearray2 *P, pair b);
void gen_runarray77(stack *Stack)
{
pair b=vm::pop<pair>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 1815 "runarray.in"
+#line 1816 "runarray.in"
triple *A;
copyArray2C(A,P,true,4);
real fuzz=sqrtFuzz*norm(A,16);
@@ -2206,11 +2207,11 @@ void gen_runarray77(stack *Stack)
{Stack->push<pair>(b); return;}
}
-#line 1825 "runarray.in"
+#line 1826 "runarray.in"
// realarray* _projection();
void gen_runarray78(stack *Stack)
{
-#line 1826 "runarray.in"
+#line 1827 "runarray.in"
#ifdef HAVE_GL
array *a=new array(14);
gl::projection P=gl::camera();
@@ -2271,139 +2272,139 @@ void gen_runarray_venv(venv &ve)
REGISTER_BLTIN(run::arrayArrayRead,"arrayArrayRead");
#line 566 "runarray.in"
REGISTER_BLTIN(run::arrayWrite,"arrayWrite");
-#line 582 "runarray.in"
+#line 583 "runarray.in"
REGISTER_BLTIN(run::arraySliceWrite,"arraySliceWrite");
-#line 590 "runarray.in"
+#line 591 "runarray.in"
REGISTER_BLTIN(run::arraySliceWriteToEnd,"arraySliceWriteToEnd");
-#line 598 "runarray.in"
+#line 599 "runarray.in"
REGISTER_BLTIN(run::arrayLength,"arrayLength");
-#line 604 "runarray.in"
+#line 605 "runarray.in"
REGISTER_BLTIN(run::arrayKeys,"arrayKeys");
-#line 619 "runarray.in"
+#line 620 "runarray.in"
REGISTER_BLTIN(run::arrayCyclicFlag,"arrayCyclicFlag");
-#line 626 "runarray.in"
+#line 627 "runarray.in"
REGISTER_BLTIN(run::arraySetCyclicFlag,"arraySetCyclicFlag");
-#line 633 "runarray.in"
+#line 634 "runarray.in"
REGISTER_BLTIN(run::arrayInitializedHelper,"arrayInitializedHelper");
-#line 644 "runarray.in"
+#line 645 "runarray.in"
REGISTER_BLTIN(run::arrayInitialized,"arrayInitialized");
-#line 650 "runarray.in"
+#line 651 "runarray.in"
REGISTER_BLTIN(run::arrayCyclicHelper,"arrayCyclicHelper");
-#line 657 "runarray.in"
+#line 658 "runarray.in"
REGISTER_BLTIN(run::arrayCyclic,"arrayCyclic");
-#line 663 "runarray.in"
+#line 664 "runarray.in"
REGISTER_BLTIN(run::arrayPushHelper,"arrayPushHelper");
-#line 671 "runarray.in"
+#line 672 "runarray.in"
REGISTER_BLTIN(run::arrayPush,"arrayPush");
-#line 677 "runarray.in"
+#line 678 "runarray.in"
REGISTER_BLTIN(run::arrayAppendHelper,"arrayAppendHelper");
-#line 686 "runarray.in"
+#line 687 "runarray.in"
REGISTER_BLTIN(run::arrayAppend,"arrayAppend");
-#line 692 "runarray.in"
+#line 693 "runarray.in"
REGISTER_BLTIN(run::arrayPopHelper,"arrayPopHelper");
-#line 701 "runarray.in"
+#line 702 "runarray.in"
REGISTER_BLTIN(run::arrayPop,"arrayPop");
-#line 707 "runarray.in"
+#line 708 "runarray.in"
REGISTER_BLTIN(run::arrayInsertHelper,"arrayInsertHelper");
-#line 718 "runarray.in"
+#line 719 "runarray.in"
REGISTER_BLTIN(run::arrayInsert,"arrayInsert");
-#line 724 "runarray.in"
+#line 725 "runarray.in"
REGISTER_BLTIN(run::arrayDelete,"arrayDelete");
-#line 730 "runarray.in"
+#line 731 "runarray.in"
REGISTER_BLTIN(run::arrayAlias,"arrayAlias");
-#line 735 "runarray.in"
+#line 736 "runarray.in"
REGISTER_BLTIN(run::arrayIntArray,"arrayIntArray");
-#line 753 "runarray.in"
+#line 754 "runarray.in"
addFunc(ve, run::gen_runarray33, IntArray(), SYM(complement), formal(IntArray(), SYM(a), false, false), formal(primInt(), SYM(n), false, false));
-#line 772 "runarray.in"
+#line 773 "runarray.in"
REGISTER_BLTIN(run::arraySequence,"arraySequence");
-#line 785 "runarray.in"
+#line 786 "runarray.in"
addFunc(ve, run::gen_runarray35, IntArray(), SYM(sequence), formal(primInt(), SYM(n), false, false));
-#line 796 "runarray.in"
+#line 797 "runarray.in"
REGISTER_BLTIN(run::arrayFunction,"arrayFunction");
-#line 809 "runarray.in"
+#line 810 "runarray.in"
REGISTER_BLTIN(run::arraySort,"arraySort");
-#line 818 "runarray.in"
+#line 819 "runarray.in"
REGISTER_BLTIN(run::arraySearch,"arraySearch");
-#line 837 "runarray.in"
+#line 838 "runarray.in"
addFunc(ve, run::gen_runarray39, primBoolean(), SYM(all), formal(booleanArray(), SYM(a), false, false));
-#line 846 "runarray.in"
+#line 847 "runarray.in"
addFunc(ve, run::gen_runarray40, booleanArray(), SYM_LOGNOT, formal(booleanArray(), SYM(a), false, false));
-#line 855 "runarray.in"
+#line 856 "runarray.in"
addFunc(ve, run::gen_runarray41, primInt(), SYM(sum), formal(booleanArray(), SYM(a), false, false));
-#line 864 "runarray.in"
+#line 865 "runarray.in"
REGISTER_BLTIN(run::arrayCopy,"arrayCopy");
-#line 869 "runarray.in"
+#line 870 "runarray.in"
REGISTER_BLTIN(run::arrayConcat,"arrayConcat");
-#line 897 "runarray.in"
+#line 898 "runarray.in"
REGISTER_BLTIN(run::array2Copy,"array2Copy");
-#line 902 "runarray.in"
+#line 903 "runarray.in"
REGISTER_BLTIN(run::array3Copy,"array3Copy");
-#line 907 "runarray.in"
+#line 908 "runarray.in"
REGISTER_BLTIN(run::array2Transpose,"array2Transpose");
-#line 931 "runarray.in"
+#line 932 "runarray.in"
REGISTER_BLTIN(run::array3Transpose,"array3Transpose");
-#line 1018 "runarray.in"
+#line 1019 "runarray.in"
addFunc(ve, run::gen_runarray48, primInt(), SYM(find), formal(booleanArray(), SYM(a), false, false), formal(primInt(), SYM(n), true, false));
-#line 1037 "runarray.in"
+#line 1038 "runarray.in"
REGISTER_BLTIN(run::arrayConditional,"arrayConditional");
-#line 1063 "runarray.in"
+#line 1064 "runarray.in"
addFunc(ve, run::gen_runarray50, realArray2(), SYM(identity), formal(primInt(), SYM(n), false, false));
-#line 1069 "runarray.in"
+#line 1070 "runarray.in"
addFunc(ve, run::gen_runarray51, realArray2(), SYM(inverse), formal(realArray2(), SYM(a), false, false));
-#line 1161 "runarray.in"
+#line 1162 "runarray.in"
addFunc(ve, run::gen_runarray52, realArray(), SYM(solve), formal(realArray2(), SYM(a), false, false), formal(realArray(), SYM(b), false, false), formal(primBoolean(), SYM(warn), true, false));
-#line 1214 "runarray.in"
+#line 1215 "runarray.in"
addFunc(ve, run::gen_runarray53, realArray2(), SYM(solve), formal(realArray2(), SYM(a), false, false), formal(realArray2(), SYM(b), false, false), formal(primBoolean(), SYM(warn), true, false));
-#line 1279 "runarray.in"
+#line 1280 "runarray.in"
addFunc(ve, run::gen_runarray54, primReal(), SYM(determinant), formal(realArray2(), SYM(a), false, false));
-#line 1296 "runarray.in"
+#line 1297 "runarray.in"
addFunc(ve, run::gen_runarray55, realArray(), SYM_TIMES, formal(realArray2(), SYM(a), false, false), formal(realArray(), SYM(b), false, false));
-#line 1315 "runarray.in"
+#line 1316 "runarray.in"
addFunc(ve, run::gen_runarray56, realArray(), SYM_TIMES, formal(realArray(), SYM(a), false, false), formal(realArray2(), SYM(b), false, false));
-#line 1344 "runarray.in"
+#line 1345 "runarray.in"
addFunc(ve, run::gen_runarray57, IntArray2(), SYM_TIMES, formal(IntArray2(), SYM(a), false, false), formal(IntArray2(), SYM(b), false, false));
-#line 1349 "runarray.in"
+#line 1350 "runarray.in"
addFunc(ve, run::gen_runarray58, realArray2(), SYM_TIMES, formal(realArray2(), SYM(a), false, false), formal(realArray2(), SYM(b), false, false));
-#line 1354 "runarray.in"
+#line 1355 "runarray.in"
addFunc(ve, run::gen_runarray59, pairArray2(), SYM_TIMES, formal(pairArray2(), SYM(a), false, false), formal(pairArray2(), SYM(b), false, false));
-#line 1359 "runarray.in"
+#line 1360 "runarray.in"
addFunc(ve, run::gen_runarray60, primTriple(), SYM_TIMES, formal(realArray2(), SYM(t), false, false), formal(primTriple(), SYM(v), false, false));
-#line 1364 "runarray.in"
+#line 1365 "runarray.in"
addFunc(ve, run::gen_runarray61, primPair(), SYM(project), formal(primTriple(), SYM(v), false, false), formal(realArray2(), SYM(t), false, false));
-#line 1389 "runarray.in"
+#line 1390 "runarray.in"
addFunc(ve, run::gen_runarray62, primReal(), SYM(dot), formal(realArray(), SYM(a), false, false), formal(realArray(), SYM(b), false, false));
-#line 1399 "runarray.in"
+#line 1400 "runarray.in"
addFunc(ve, run::gen_runarray63, primPair(), SYM(dot), formal(pairArray(), SYM(a), false, false), formal(pairArray(), SYM(b), false, false));
-#line 1409 "runarray.in"
+#line 1410 "runarray.in"
addFunc(ve, run::gen_runarray64, realArray(), SYM(tridiagonal), formal(realArray(), SYM(a), false, false), formal(realArray(), SYM(b), false, false), formal(realArray(), SYM(c), false, false), formal(realArray(), SYM(f), false, false));
-#line 1513 "runarray.in"
+#line 1514 "runarray.in"
addFunc(ve, run::gen_runarray65, primReal(), SYM(newton), formal(primInt(), SYM(iterations), true, false), formal(realRealFunction(), SYM(f), false, false), formal(realRealFunction(), SYM(fprime), false, false), formal(primReal(), SYM(x), false, false), formal(primBoolean(), SYM(verbose), true, false));
-#line 1560 "runarray.in"
+#line 1561 "runarray.in"
addFunc(ve, run::gen_runarray66, primReal(), SYM(newton), formal(primInt(), SYM(iterations), true, false), formal(realRealFunction(), SYM(f), false, false), formal(realRealFunction(), SYM(fprime), false, false), formal(primReal(), SYM(x1), false, false), formal(primReal(), SYM(x2), false, false), formal(primBoolean(), SYM(verbose), true, false));
-#line 1642 "runarray.in"
+#line 1643 "runarray.in"
addFunc(ve, run::gen_runarray67, primReal(), SYM(simpson), formal(realRealFunction(), SYM(f), false, false), formal(primReal(), SYM(a), false, false), formal(primReal(), SYM(b), false, false), formal(primReal(), SYM(acc), true, false), formal(primReal(), SYM(dxmax), true, false));
-#line 1654 "runarray.in"
+#line 1655 "runarray.in"
addFunc(ve, run::gen_runarray68, pairArray(), SYM(fft), formal(pairArray(), SYM(a), false, false), formal(primInt(), SYM(sign), true, false));
-#line 1685 "runarray.in"
+#line 1686 "runarray.in"
addFunc(ve, run::gen_runarray69, IntArray2(), SYM(triangulate), formal(pairArray(), SYM(z), false, false));
-#line 1720 "runarray.in"
+#line 1721 "runarray.in"
addFunc(ve, run::gen_runarray70, primReal(), SYM(norm), formal(realArray(), SYM(a), false, false));
-#line 1731 "runarray.in"
+#line 1732 "runarray.in"
addFunc(ve, run::gen_runarray71, primReal(), SYM(norm), formal(realArray2(), SYM(a), false, false));
-#line 1746 "runarray.in"
+#line 1747 "runarray.in"
addFunc(ve, run::gen_runarray72, primReal(), SYM(norm), formal(tripleArray2(), SYM(a), false, false));
-#line 1761 "runarray.in"
+#line 1762 "runarray.in"
addFunc(ve, run::gen_runarray73, primReal(), SYM(change2), formal(tripleArray2(), SYM(a), false, false));
-#line 1783 "runarray.in"
+#line 1784 "runarray.in"
addFunc(ve, run::gen_runarray74, primTriple(), SYM(minbezier), formal(tripleArray2(), SYM(p), false, false), formal(primTriple(), SYM(b), false, false));
-#line 1793 "runarray.in"
+#line 1794 "runarray.in"
addFunc(ve, run::gen_runarray75, primTriple(), SYM(maxbezier), formal(tripleArray2(), SYM(p), false, false), formal(primTriple(), SYM(b), false, false));
-#line 1803 "runarray.in"
+#line 1804 "runarray.in"
addFunc(ve, run::gen_runarray76, primPair(), SYM(minratio), formal(tripleArray2(), SYM(p), false, false), formal(primPair(), SYM(b), false, false));
-#line 1814 "runarray.in"
+#line 1815 "runarray.in"
addFunc(ve, run::gen_runarray77, primPair(), SYM(maxratio), formal(tripleArray2(), SYM(p), false, false), formal(primPair(), SYM(b), false, false));
-#line 1825 "runarray.in"
+#line 1826 "runarray.in"
addFunc(ve, run::gen_runarray78, realArray(), SYM(_projection));
}
diff --git a/Build/source/utils/asymptote/runarray.in b/Build/source/utils/asymptote/runarray.in
index 31bb2aebe4c..1c113c9bb53 100644
--- a/Build/source/utils/asymptote/runarray.in
+++ b/Build/source/utils/asymptote/runarray.in
@@ -564,7 +564,8 @@ item :arrayArrayRead(array *a, Int n)
}
// Write an element to an array. Increase size if necessary.
-item :arrayWrite(item value, array *a, Int n)
+// TODO: Add arrayWriteAndPop
+item :arrayWrite(array *a, Int n, item value)
{
size_t len=checkArray(a);
bool cyclic=a->cyclic();
@@ -579,7 +580,7 @@ item :arrayWrite(item value, array *a, Int n)
return value;
}
-array * :arraySliceWrite(array *src, array *dest, Int left, Int right)
+array * :arraySliceWrite(array *dest, Int left, Int right, array *src)
{
checkArray(src);
checkArray(dest);
@@ -587,7 +588,7 @@ array * :arraySliceWrite(array *src, array *dest, Int left, Int right)
return src;
}
-array * :arraySliceWriteToEnd(array *src, array *dest, Int left)
+array * :arraySliceWriteToEnd(array *dest, Int left, array *src)
{
checkArray(src);
size_t len=checkArray(dest);
diff --git a/Build/source/utils/asymptote/runtime.cc b/Build/source/utils/asymptote/runtime.cc
index 1fb85676c60..e71103fd8d1 100644
--- a/Build/source/utils/asymptote/runtime.cc
+++ b/Build/source/utils/asymptote/runtime.cc
@@ -190,6 +190,9 @@ namespace vm {
const Int DefaultValue=0x7fffffffffffffffLL;
const Int Undefined=0x7ffffffffffffffeLL;
+const Int BoolTruthValue=0xABABABABABABABACLL;
+const Int BoolFalseValue=0xABABABABABABABABLL;
+
const item Default=DefaultValue;
#else
const item Default=item(default_t());
@@ -240,45 +243,45 @@ void unused(void *)
namespace run {
// Initializers
-#line 217 "runtime.in"
+#line 220 "runtime.in"
void IntZero(stack *Stack)
{
-#line 218 "runtime.in"
+#line 221 "runtime.in"
{Stack->push<Int>(0); return;}
}
-#line 223 "runtime.in"
+#line 226 "runtime.in"
void realZero(stack *Stack)
{
-#line 224 "runtime.in"
+#line 227 "runtime.in"
{Stack->push<real>(0.0); return;}
}
-#line 228 "runtime.in"
+#line 231 "runtime.in"
void boolFalse(stack *Stack)
{
-#line 229 "runtime.in"
+#line 232 "runtime.in"
{Stack->push<bool>(false); return;}
}
-#line 233 "runtime.in"
+#line 236 "runtime.in"
void pushNullArray(stack *Stack)
{
-#line 234 "runtime.in"
+#line 237 "runtime.in"
{Stack->push<array*>(0); return;}
}
-#line 238 "runtime.in"
+#line 241 "runtime.in"
void pushNullRecord(stack *Stack)
{
-#line 239 "runtime.in"
+#line 242 "runtime.in"
{Stack->push<frame*>(0); return;}
}
-#line 243 "runtime.in"
+#line 246 "runtime.in"
void pushNullFunction(stack *Stack)
{
-#line 244 "runtime.in"
+#line 247 "runtime.in"
{Stack->push(nullfunc::instance()); return;}
}
@@ -287,222 +290,222 @@ void pushNullFunction(stack *Stack)
// Put the default value token on the stack (in place of an argument when
// making a function call).
-#line 253 "runtime.in"
+#line 256 "runtime.in"
void pushDefault(stack *Stack)
{
-#line 254 "runtime.in"
+#line 257 "runtime.in"
{Stack->push(Default); return;}
}
// Test if the value on the stack is the default value token.
-#line 260 "runtime.in"
+#line 263 "runtime.in"
void isDefault(stack *Stack)
{
item i=vm::pop(Stack);
-#line 261 "runtime.in"
+#line 264 "runtime.in"
{Stack->push<bool>(isdefault(i)); return;}
}
// Casts
-#line 267 "runtime.in"
+#line 270 "runtime.in"
void pairToGuide(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 268 "runtime.in"
+#line 271 "runtime.in"
{Stack->push<guide*>(new pairguide(z)); return;}
}
-#line 273 "runtime.in"
+#line 276 "runtime.in"
void pathToGuide(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 274 "runtime.in"
+#line 277 "runtime.in"
{Stack->push<guide*>(new pathguide(p)); return;}
}
-#line 278 "runtime.in"
+#line 281 "runtime.in"
void guideToPath(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 279 "runtime.in"
+#line 282 "runtime.in"
{Stack->push<path>(g->solve()); return;}
}
// Pen operations
-#line 285 "runtime.in"
+#line 288 "runtime.in"
void newPen(stack *Stack)
{
-#line 286 "runtime.in"
+#line 289 "runtime.in"
{Stack->push<pen>(pen()); return;}
}
-#line 291 "runtime.in"
+#line 294 "runtime.in"
// bool ==(pen a, pen b);
void gen_runtime12(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 292 "runtime.in"
+#line 295 "runtime.in"
{Stack->push<bool>(a == b); return;}
}
-#line 296 "runtime.in"
+#line 299 "runtime.in"
// bool !=(pen a, pen b);
void gen_runtime13(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 297 "runtime.in"
+#line 300 "runtime.in"
{Stack->push<bool>(a != b); return;}
}
-#line 301 "runtime.in"
+#line 304 "runtime.in"
// pen +(pen a, pen b);
void gen_runtime14(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 302 "runtime.in"
+#line 305 "runtime.in"
{Stack->push<pen>(a+b); return;}
}
-#line 306 "runtime.in"
+#line 309 "runtime.in"
// pen *(real a, pen b);
void gen_runtime15(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
real a=vm::pop<real>(Stack);
-#line 307 "runtime.in"
+#line 310 "runtime.in"
{Stack->push<pen>(a*b); return;}
}
-#line 311 "runtime.in"
+#line 314 "runtime.in"
// pen *(pen a, real b);
void gen_runtime16(stack *Stack)
{
real b=vm::pop<real>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 312 "runtime.in"
+#line 315 "runtime.in"
{Stack->push<pen>(b*a); return;}
}
-#line 316 "runtime.in"
+#line 319 "runtime.in"
// pair max(pen p);
void gen_runtime17(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 317 "runtime.in"
+#line 320 "runtime.in"
{Stack->push<pair>(p.bounds().Max()); return;}
}
-#line 321 "runtime.in"
+#line 324 "runtime.in"
// pair min(pen p);
void gen_runtime18(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 322 "runtime.in"
+#line 325 "runtime.in"
{Stack->push<pair>(p.bounds().Min()); return;}
}
// Reset the meaning of pen default attributes.
-#line 327 "runtime.in"
+#line 330 "runtime.in"
// void resetdefaultpen();
void gen_runtime19(stack *)
{
-#line 328 "runtime.in"
+#line 331 "runtime.in"
processData().defaultpen=camp::pen::initialpen();
}
-#line 332 "runtime.in"
+#line 335 "runtime.in"
// void defaultpen(pen p);
void gen_runtime20(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 333 "runtime.in"
+#line 336 "runtime.in"
processData().defaultpen=pen(resolvepen,p);
}
-#line 337 "runtime.in"
+#line 340 "runtime.in"
// pen defaultpen();
void gen_runtime21(stack *Stack)
{
-#line 338 "runtime.in"
+#line 341 "runtime.in"
{Stack->push<pen>(processData().defaultpen); return;}
}
-#line 342 "runtime.in"
+#line 345 "runtime.in"
// bool invisible(pen p);
void gen_runtime22(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 343 "runtime.in"
+#line 346 "runtime.in"
{Stack->push<bool>(p.invisible()); return;}
}
-#line 347 "runtime.in"
+#line 350 "runtime.in"
// pen invisible();
void gen_runtime23(stack *Stack)
{
-#line 348 "runtime.in"
+#line 351 "runtime.in"
{Stack->push<pen>(pen(invisiblepen)); return;}
}
-#line 352 "runtime.in"
+#line 355 "runtime.in"
// pen gray(pen p);
void gen_runtime24(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 353 "runtime.in"
+#line 356 "runtime.in"
p.togrey();
{Stack->push<pen>(p); return;}
}
-#line 358 "runtime.in"
+#line 361 "runtime.in"
// pen rgb(pen p);
void gen_runtime25(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 359 "runtime.in"
+#line 362 "runtime.in"
p.torgb();
{Stack->push<pen>(p); return;}
}
-#line 364 "runtime.in"
+#line 367 "runtime.in"
// pen cmyk(pen p);
void gen_runtime26(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 365 "runtime.in"
+#line 368 "runtime.in"
p.tocmyk();
{Stack->push<pen>(p); return;}
}
-#line 370 "runtime.in"
+#line 373 "runtime.in"
// pen interp(pen a, pen b, real t);
void gen_runtime27(stack *Stack)
{
real t=vm::pop<real>(Stack);
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 371 "runtime.in"
+#line 374 "runtime.in"
{Stack->push<pen>(interpolate(a,b,t)); return;}
}
-#line 375 "runtime.in"
+#line 378 "runtime.in"
// pen rgb(real r, real g, real b);
void gen_runtime28(stack *Stack)
{
real b=vm::pop<real>(Stack);
real g=vm::pop<real>(Stack);
real r=vm::pop<real>(Stack);
-#line 376 "runtime.in"
+#line 379 "runtime.in"
{Stack->push<pen>(pen(r,g,b)); return;}
}
-#line 380 "runtime.in"
+#line 383 "runtime.in"
// pen cmyk(real c, real m, real y, real k);
void gen_runtime29(stack *Stack)
{
@@ -510,25 +513,25 @@ void gen_runtime29(stack *Stack)
real y=vm::pop<real>(Stack);
real m=vm::pop<real>(Stack);
real c=vm::pop<real>(Stack);
-#line 381 "runtime.in"
+#line 384 "runtime.in"
{Stack->push<pen>(pen(c,m,y,k)); return;}
}
-#line 385 "runtime.in"
+#line 388 "runtime.in"
// pen gray(real gray);
void gen_runtime30(stack *Stack)
{
real gray=vm::pop<real>(Stack);
-#line 386 "runtime.in"
+#line 389 "runtime.in"
{Stack->push<pen>(pen(gray)); return;}
}
-#line 390 "runtime.in"
+#line 393 "runtime.in"
// realarray* colors(pen p);
void gen_runtime31(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 391 "runtime.in"
+#line 394 "runtime.in"
size_t n=ColorComponents[p.colorspace()];
array *a=new array(n);
@@ -555,78 +558,78 @@ void gen_runtime31(stack *Stack)
{Stack->push<realarray*>(a); return;}
}
-#line 418 "runtime.in"
+#line 421 "runtime.in"
// string hex(pen p);
void gen_runtime32(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 419 "runtime.in"
+#line 422 "runtime.in"
{Stack->push<string>(p.hex()); return;}
}
-#line 423 "runtime.in"
+#line 426 "runtime.in"
// Int byte(real x);
void gen_runtime33(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 424 "runtime.in"
+#line 427 "runtime.in"
{Stack->push<Int>(byte(x)); return;}
}
-#line 428 "runtime.in"
+#line 431 "runtime.in"
// string colorspace(pen p);
void gen_runtime34(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 429 "runtime.in"
+#line 432 "runtime.in"
string s=ColorDeviceSuffix[p.colorspace()];
std::transform(s.begin(),s.end(),s.begin(),tolower);
{Stack->push<string>(s); return;}
}
-#line 435 "runtime.in"
+#line 438 "runtime.in"
// pen pattern(string *s);
void gen_runtime35(stack *Stack)
{
string * s=vm::pop<string *>(Stack);
-#line 436 "runtime.in"
+#line 439 "runtime.in"
{Stack->push<pen>(pen(setpattern,*s)); return;}
}
-#line 440 "runtime.in"
+#line 443 "runtime.in"
// string pattern(pen p);
void gen_runtime36(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 441 "runtime.in"
+#line 444 "runtime.in"
{Stack->push<string>(p.fillpattern()); return;}
}
-#line 445 "runtime.in"
+#line 448 "runtime.in"
// pen fillrule(Int n);
void gen_runtime37(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 446 "runtime.in"
+#line 449 "runtime.in"
{Stack->push<pen>(pen(n >= 0 && n < nFill ? (FillRule) n : DEFFILL)); return;}
}
-#line 450 "runtime.in"
+#line 453 "runtime.in"
// Int fillrule(pen p);
void gen_runtime38(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 451 "runtime.in"
+#line 454 "runtime.in"
{Stack->push<Int>(p.Fillrule()); return;}
}
-#line 455 "runtime.in"
+#line 458 "runtime.in"
// pen opacity(real opacity=1.0, string blend=defaulttransparency);
void gen_runtime39(stack *Stack)
{
string blend=vm::pop<string>(Stack,defaulttransparency);
real opacity=vm::pop<real>(Stack,1.0);
-#line 456 "runtime.in"
+#line 459 "runtime.in"
for(Int i=0; i < nBlendMode; ++i)
if(blend == BlendMode[i]) {Stack->push<pen>(pen(Transparency(blend,opacity))); return;}
@@ -635,25 +638,25 @@ void gen_runtime39(stack *Stack)
error(buf);
}
-#line 465 "runtime.in"
+#line 468 "runtime.in"
// real opacity(pen p);
void gen_runtime40(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 466 "runtime.in"
+#line 469 "runtime.in"
{Stack->push<real>(p.opacity()); return;}
}
-#line 470 "runtime.in"
+#line 473 "runtime.in"
// string blend(pen p);
void gen_runtime41(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 471 "runtime.in"
+#line 474 "runtime.in"
{Stack->push<string>(p.blend()); return;}
}
-#line 475 "runtime.in"
+#line 478 "runtime.in"
// pen linetype(realarray *pattern, real offset=0, bool scale=true, bool adjust=true);
void gen_runtime42(stack *Stack)
{
@@ -661,7 +664,7 @@ void gen_runtime42(stack *Stack)
bool scale=vm::pop<bool>(Stack,true);
real offset=vm::pop<real>(Stack,0);
realarray * pattern=vm::pop<realarray *>(Stack);
-#line 477 "runtime.in"
+#line 480 "runtime.in"
size_t size=checkArray(pattern);
array *a=new array(size);
for(size_t i=0; i < size; ++i)
@@ -670,272 +673,272 @@ void gen_runtime42(stack *Stack)
{Stack->push<pen>(pen(LineType(*a,offset,scale,adjust))); return;}
}
-#line 486 "runtime.in"
+#line 489 "runtime.in"
// realarray* linetype(pen p=CURRENTPEN);
void gen_runtime43(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 487 "runtime.in"
+#line 490 "runtime.in"
array a=p.linetype()->pattern;
{Stack->push<realarray*>(copyArray(&a)); return;}
}
-#line 492 "runtime.in"
+#line 495 "runtime.in"
// real offset(pen p);
void gen_runtime44(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 493 "runtime.in"
+#line 496 "runtime.in"
{Stack->push<real>(p.linetype()->offset); return;}
}
-#line 497 "runtime.in"
+#line 500 "runtime.in"
// bool scale(pen p);
void gen_runtime45(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 498 "runtime.in"
+#line 501 "runtime.in"
{Stack->push<bool>(p.linetype()->scale); return;}
}
-#line 502 "runtime.in"
+#line 505 "runtime.in"
// bool adjust(pen p);
void gen_runtime46(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 503 "runtime.in"
+#line 506 "runtime.in"
{Stack->push<bool>(p.linetype()->adjust); return;}
}
-#line 507 "runtime.in"
+#line 510 "runtime.in"
// pen adjust(pen p, real arclength, bool cyclic);
void gen_runtime47(stack *Stack)
{
bool cyclic=vm::pop<bool>(Stack);
real arclength=vm::pop<real>(Stack);
pen p=vm::pop<pen>(Stack);
-#line 508 "runtime.in"
+#line 511 "runtime.in"
{Stack->push<pen>(adjustdash(p,arclength,cyclic)); return;}
}
-#line 512 "runtime.in"
+#line 515 "runtime.in"
// pen linecap(Int n);
void gen_runtime48(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 513 "runtime.in"
+#line 516 "runtime.in"
{Stack->push<pen>(pen(setlinecap,n >= 0 && n < nCap ? n : DEFCAP)); return;}
}
-#line 517 "runtime.in"
+#line 520 "runtime.in"
// Int linecap(pen p=CURRENTPEN);
void gen_runtime49(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 518 "runtime.in"
+#line 521 "runtime.in"
{Stack->push<Int>(p.cap()); return;}
}
-#line 522 "runtime.in"
+#line 525 "runtime.in"
// pen linejoin(Int n);
void gen_runtime50(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 523 "runtime.in"
+#line 526 "runtime.in"
{Stack->push<pen>(pen(setlinejoin,n >= 0 && n < nJoin ? n : DEFJOIN)); return;}
}
-#line 527 "runtime.in"
+#line 530 "runtime.in"
// Int linejoin(pen p=CURRENTPEN);
void gen_runtime51(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 528 "runtime.in"
+#line 531 "runtime.in"
{Stack->push<Int>(p.join()); return;}
}
-#line 532 "runtime.in"
+#line 535 "runtime.in"
// pen miterlimit(real x);
void gen_runtime52(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 533 "runtime.in"
+#line 536 "runtime.in"
{Stack->push<pen>(pen(setmiterlimit,x >= 1.0 ? x : DEFJOIN)); return;}
}
-#line 537 "runtime.in"
+#line 540 "runtime.in"
// real miterlimit(pen p=CURRENTPEN);
void gen_runtime53(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 538 "runtime.in"
+#line 541 "runtime.in"
{Stack->push<real>(p.miter()); return;}
}
-#line 542 "runtime.in"
+#line 545 "runtime.in"
// pen linewidth(real x);
void gen_runtime54(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 543 "runtime.in"
+#line 546 "runtime.in"
{Stack->push<pen>(pen(setlinewidth,x >= 0.0 ? x : DEFWIDTH)); return;}
}
-#line 547 "runtime.in"
+#line 550 "runtime.in"
// real linewidth(pen p=CURRENTPEN);
void gen_runtime55(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 548 "runtime.in"
+#line 551 "runtime.in"
{Stack->push<real>(p.width()); return;}
}
-#line 552 "runtime.in"
+#line 555 "runtime.in"
// pen fontcommand(string *s);
void gen_runtime56(stack *Stack)
{
string * s=vm::pop<string *>(Stack);
-#line 553 "runtime.in"
+#line 556 "runtime.in"
{Stack->push<pen>(pen(setfont,*s)); return;}
}
-#line 557 "runtime.in"
+#line 560 "runtime.in"
// string font(pen p=CURRENTPEN);
void gen_runtime57(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 558 "runtime.in"
+#line 561 "runtime.in"
{Stack->push<string>(p.Font()); return;}
}
-#line 562 "runtime.in"
+#line 565 "runtime.in"
// pen fontsize(real size, real lineskip);
void gen_runtime58(stack *Stack)
{
real lineskip=vm::pop<real>(Stack);
real size=vm::pop<real>(Stack);
-#line 563 "runtime.in"
+#line 566 "runtime.in"
{Stack->push<pen>(pen(setfontsize,size > 0.0 ? size : 0.0,
lineskip > 0.0 ? lineskip : 0.0)); return;}
}
-#line 568 "runtime.in"
+#line 571 "runtime.in"
// real fontsize(pen p=CURRENTPEN);
void gen_runtime59(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 569 "runtime.in"
+#line 572 "runtime.in"
{Stack->push<real>(p.size()); return;}
}
-#line 573 "runtime.in"
+#line 576 "runtime.in"
// real lineskip(pen p=CURRENTPEN);
void gen_runtime60(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 574 "runtime.in"
+#line 577 "runtime.in"
{Stack->push<real>(p.Lineskip()); return;}
}
-#line 578 "runtime.in"
+#line 581 "runtime.in"
// pen overwrite(Int n);
void gen_runtime61(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 579 "runtime.in"
+#line 582 "runtime.in"
{Stack->push<pen>(pen(setoverwrite,n >= 0 && n < nOverwrite ? (overwrite_t) n :
DEFWRITE)); return;}
}
-#line 584 "runtime.in"
+#line 587 "runtime.in"
// Int overwrite(pen p=CURRENTPEN);
void gen_runtime62(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 585 "runtime.in"
+#line 588 "runtime.in"
{Stack->push<Int>(p.Overwrite()); return;}
}
-#line 589 "runtime.in"
+#line 592 "runtime.in"
// pen basealign(Int n);
void gen_runtime63(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 590 "runtime.in"
+#line 593 "runtime.in"
{Stack->push<pen>(pen(n >= 0 && n < nBaseLine ? (BaseLine) n : DEFBASE)); return;}
}
-#line 594 "runtime.in"
+#line 597 "runtime.in"
// Int basealign(pen p=CURRENTPEN);
void gen_runtime64(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 595 "runtime.in"
+#line 598 "runtime.in"
{Stack->push<Int>(p.Baseline()); return;}
}
-#line 599 "runtime.in"
+#line 602 "runtime.in"
// transform transform(pen p);
void gen_runtime65(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 600 "runtime.in"
+#line 603 "runtime.in"
{Stack->push<transform>(p.getTransform()); return;}
}
-#line 604 "runtime.in"
+#line 607 "runtime.in"
// path nib(pen p);
void gen_runtime66(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 605 "runtime.in"
+#line 608 "runtime.in"
{Stack->push<path>(p.Path()); return;}
}
-#line 609 "runtime.in"
+#line 612 "runtime.in"
// pen makepen(path p);
void gen_runtime67(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 610 "runtime.in"
+#line 613 "runtime.in"
{Stack->push<pen>(pen(p)); return;}
}
-#line 614 "runtime.in"
+#line 617 "runtime.in"
// pen colorless(pen p);
void gen_runtime68(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 615 "runtime.in"
+#line 618 "runtime.in"
p.colorless();
{Stack->push<pen>(p); return;}
}
// Interactive mode
-#line 621 "runtime.in"
+#line 624 "runtime.in"
// bool interactive();
void gen_runtime69(stack *Stack)
{
-#line 622 "runtime.in"
+#line 625 "runtime.in"
{Stack->push<bool>(interact::interactive); return;}
}
-#line 627 "runtime.in"
+#line 630 "runtime.in"
// bool uptodate();
void gen_runtime70(stack *Stack)
{
-#line 628 "runtime.in"
+#line 631 "runtime.in"
{Stack->push<bool>(interact::uptodate); return;}
}
// System commands
-#line 634 "runtime.in"
+#line 637 "runtime.in"
// Int system(stringarray *s);
void gen_runtime71(stack *Stack)
{
stringarray * s=vm::pop<stringarray *>(Stack);
-#line 635 "runtime.in"
+#line 638 "runtime.in"
if(safe) error("system() call disabled; override with option -nosafe");
size_t size=checkArray(s);
if(size == 0) {Stack->push<Int>(0); return;}
@@ -945,57 +948,57 @@ void gen_runtime71(stack *Stack)
{Stack->push<Int>(System(cmd)); return;}
}
-#line 646 "runtime.in"
+#line 649 "runtime.in"
// bool view();
void gen_runtime72(stack *Stack)
{
-#line 647 "runtime.in"
+#line 650 "runtime.in"
{Stack->push<bool>(view()); return;}
}
-#line 651 "runtime.in"
+#line 654 "runtime.in"
// string asydir();
void gen_runtime73(stack *Stack)
{
-#line 652 "runtime.in"
+#line 655 "runtime.in"
{Stack->push<string>(systemDir); return;}
}
-#line 656 "runtime.in"
+#line 659 "runtime.in"
// string locale(string s=emptystring);
void gen_runtime74(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
-#line 657 "runtime.in"
+#line 660 "runtime.in"
char *L=setlocale(LC_ALL,s.empty() ? NULL : s.c_str());
{Stack->push<string>(L != NULL ? string(L) : ""); return;}
}
-#line 662 "runtime.in"
+#line 665 "runtime.in"
// void abort(string s=emptystring);
void gen_runtime75(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
-#line 663 "runtime.in"
+#line 666 "runtime.in"
if(s.empty()) throw handled_error();
error(s.c_str());
}
-#line 668 "runtime.in"
+#line 671 "runtime.in"
// void exit();
void gen_runtime76(stack *)
{
-#line 669 "runtime.in"
+#line 672 "runtime.in"
throw quit();
}
-#line 673 "runtime.in"
+#line 676 "runtime.in"
// void assert(bool b, string s=emptystring);
void gen_runtime77(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
bool b=vm::pop<bool>(Stack);
-#line 674 "runtime.in"
+#line 677 "runtime.in"
flush(cout);
if(!b) {
ostringstream buf;
@@ -1005,34 +1008,34 @@ void gen_runtime77(stack *Stack)
}
}
-#line 684 "runtime.in"
+#line 687 "runtime.in"
// void sleep(Int seconds);
void gen_runtime78(stack *Stack)
{
Int seconds=vm::pop<Int>(Stack);
-#line 685 "runtime.in"
+#line 688 "runtime.in"
if(seconds <= 0) return;
sleep(seconds);
}
-#line 690 "runtime.in"
+#line 693 "runtime.in"
// void usleep(Int microseconds);
void gen_runtime79(stack *Stack)
{
Int microseconds=vm::pop<Int>(Stack);
-#line 691 "runtime.in"
+#line 694 "runtime.in"
if(microseconds <= 0) return;
usleep((unsigned long) microseconds);
}
-#line 696 "runtime.in"
+#line 699 "runtime.in"
// void _eval(string *s, bool embedded, bool interactiveWrite=false);
void gen_runtime80(stack *Stack)
{
bool interactiveWrite=vm::pop<bool>(Stack,false);
bool embedded=vm::pop<bool>(Stack);
string * s=vm::pop<string *>(Stack);
-#line 697 "runtime.in"
+#line 700 "runtime.in"
if(embedded) {
trans::coenv *e=Stack->getEnvironment();
vm::interactiveStack *is=dynamic_cast<vm::interactiveStack *>(Stack);
@@ -1044,13 +1047,13 @@ void gen_runtime80(stack *Stack)
runString(*s,interactiveWrite);
}
-#line 709 "runtime.in"
+#line 712 "runtime.in"
// void _eval(runnable *s, bool embedded);
void gen_runtime81(stack *Stack)
{
bool embedded=vm::pop<bool>(Stack);
runnable * s=vm::pop<runnable *>(Stack);
-#line 710 "runtime.in"
+#line 713 "runtime.in"
absyntax::block *ast=new absyntax::block(s->getPos(), false);
ast->add(s);
@@ -1065,31 +1068,31 @@ void gen_runtime81(stack *Stack)
runCode(ast);
}
-#line 725 "runtime.in"
+#line 728 "runtime.in"
// string location();
void gen_runtime82(stack *Stack)
{
-#line 726 "runtime.in"
+#line 729 "runtime.in"
ostringstream buf;
buf << getPos();
{Stack->push<string>(buf.str()); return;}
}
// Wrapper for the stack::load() method.
-#line 732 "runtime.in"
+#line 735 "runtime.in"
void loadModule(stack *Stack)
{
string * index=vm::pop<string *>(Stack);
-#line 733 "runtime.in"
+#line 736 "runtime.in"
Stack->load(*index);
}
-#line 737 "runtime.in"
+#line 740 "runtime.in"
// string cd(string s=emptystring);
void gen_runtime84(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
-#line 738 "runtime.in"
+#line 741 "runtime.in"
if(!s.empty() && !globalwrite()) {
string outname=getSetting<string>("outname");
string dir=stripDir(outname);
@@ -1098,13 +1101,13 @@ void gen_runtime84(stack *Stack)
{Stack->push<string>(setPath(s.c_str())); return;}
}
-#line 747 "runtime.in"
+#line 750 "runtime.in"
// void list(string *s, bool imports=false);
void gen_runtime85(stack *Stack)
{
bool imports=vm::pop<bool>(Stack,false);
string * s=vm::pop<string *>(Stack);
-#line 748 "runtime.in"
+#line 751 "runtime.in"
if(*s == "-") return;
trans::genv ge;
symbol name=symbol::trans(*s);
@@ -1114,18 +1117,18 @@ void gen_runtime85(stack *Stack)
// Guide operations
-#line 758 "runtime.in"
+#line 761 "runtime.in"
void nullGuide(stack *Stack)
{
-#line 759 "runtime.in"
+#line 762 "runtime.in"
{Stack->push<guide*>(new pathguide(path())); return;}
}
-#line 764 "runtime.in"
+#line 767 "runtime.in"
void dotsGuide(stack *Stack)
{
guidearray * a=vm::pop<guidearray *>(Stack);
-#line 765 "runtime.in"
+#line 768 "runtime.in"
guidevector v;
size_t size=checkArray(a);
for (size_t i=0; i < size; ++i)
@@ -1134,11 +1137,11 @@ void dotsGuide(stack *Stack)
{Stack->push<guide*>(new multiguide(v)); return;}
}
-#line 774 "runtime.in"
+#line 777 "runtime.in"
void dashesGuide(stack *Stack)
{
guidearray * a=vm::pop<guidearray *>(Stack);
-#line 775 "runtime.in"
+#line 778 "runtime.in"
static camp::curlSpec curly;
static specguide curlout(&curly, camp::OUT);
static specguide curlin(&curly, camp::IN);
@@ -1164,179 +1167,179 @@ void dashesGuide(stack *Stack)
{Stack->push<guide*>(new multiguide(v)); return;}
}
-#line 801 "runtime.in"
+#line 804 "runtime.in"
void newCycleToken(stack *Stack)
{
-#line 802 "runtime.in"
+#line 805 "runtime.in"
{Stack->push<cycleToken>(cycleToken()); return;}
}
-#line 806 "runtime.in"
+#line 809 "runtime.in"
// guide* operator cast(cycleToken tok);
void gen_runtime90(stack *Stack)
{
cycleToken tok=vm::pop<cycleToken>(Stack);
-#line 807 "runtime.in"
+#line 810 "runtime.in"
// Avoid unused variable warning messages.
unused(&tok);
{Stack->push<guide*>(new cycletokguide()); return;}
}
-#line 813 "runtime.in"
+#line 816 "runtime.in"
// guide* operator spec(pair z, Int p);
void gen_runtime91(stack *Stack)
{
Int p=vm::pop<Int>(Stack);
pair z=vm::pop<pair>(Stack);
-#line 814 "runtime.in"
+#line 817 "runtime.in"
camp::side d=(camp::side) p;
camp::dirSpec *sp=new camp::dirSpec(z);
{Stack->push<guide*>(new specguide(sp,d)); return;}
}
-#line 821 "runtime.in"
+#line 824 "runtime.in"
// curlSpecifier operator curl(real gamma, Int p);
void gen_runtime92(stack *Stack)
{
Int p=vm::pop<Int>(Stack);
real gamma=vm::pop<real>(Stack);
-#line 822 "runtime.in"
+#line 825 "runtime.in"
camp::side s=(camp::side) p;
{Stack->push<curlSpecifier>(curlSpecifier(gamma,s)); return;}
}
-#line 827 "runtime.in"
+#line 830 "runtime.in"
void curlSpecifierValuePart(stack *Stack)
{
curlSpecifier spec=vm::pop<curlSpecifier>(Stack);
-#line 828 "runtime.in"
+#line 831 "runtime.in"
{Stack->push<real>(spec.getValue()); return;}
}
-#line 832 "runtime.in"
+#line 835 "runtime.in"
void curlSpecifierSidePart(stack *Stack)
{
curlSpecifier spec=vm::pop<curlSpecifier>(Stack);
-#line 833 "runtime.in"
+#line 836 "runtime.in"
{Stack->push<Int>(spec.getSide()); return;}
}
-#line 837 "runtime.in"
+#line 840 "runtime.in"
// guide* operator cast(curlSpecifier spec);
void gen_runtime95(stack *Stack)
{
curlSpecifier spec=vm::pop<curlSpecifier>(Stack);
-#line 838 "runtime.in"
+#line 841 "runtime.in"
{Stack->push<guide*>(new specguide(spec)); return;}
}
-#line 842 "runtime.in"
+#line 845 "runtime.in"
// tensionSpecifier operator tension(real tout, real tin, bool atleast);
void gen_runtime96(stack *Stack)
{
bool atleast=vm::pop<bool>(Stack);
real tin=vm::pop<real>(Stack);
real tout=vm::pop<real>(Stack);
-#line 843 "runtime.in"
+#line 846 "runtime.in"
{Stack->push<tensionSpecifier>(tensionSpecifier(tout, tin, atleast)); return;}
}
-#line 847 "runtime.in"
+#line 850 "runtime.in"
void tensionSpecifierOutPart(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 848 "runtime.in"
+#line 851 "runtime.in"
{Stack->push<real>(t.getOut()); return;}
}
-#line 852 "runtime.in"
+#line 855 "runtime.in"
void tensionSpecifierInPart(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 853 "runtime.in"
+#line 856 "runtime.in"
{Stack->push<real>(t.getIn()); return;}
}
-#line 857 "runtime.in"
+#line 860 "runtime.in"
void tensionSpecifierAtleastPart(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 858 "runtime.in"
+#line 861 "runtime.in"
{Stack->push<bool>(t.getAtleast()); return;}
}
-#line 862 "runtime.in"
+#line 865 "runtime.in"
// guide* operator cast(tensionSpecifier t);
void gen_runtime100(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 863 "runtime.in"
+#line 866 "runtime.in"
{Stack->push<guide*>(new tensionguide(t)); return;}
}
-#line 867 "runtime.in"
+#line 870 "runtime.in"
// guide* operator controls(pair zout, pair zin);
void gen_runtime101(stack *Stack)
{
pair zin=vm::pop<pair>(Stack);
pair zout=vm::pop<pair>(Stack);
-#line 868 "runtime.in"
+#line 871 "runtime.in"
{Stack->push<guide*>(new controlguide(zout, zin)); return;}
}
-#line 872 "runtime.in"
+#line 875 "runtime.in"
// Int size(guide *g);
void gen_runtime102(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 873 "runtime.in"
+#line 876 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<Int>(f.size()); return;}
}
-#line 879 "runtime.in"
+#line 882 "runtime.in"
// Int length(guide *g);
void gen_runtime103(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 880 "runtime.in"
+#line 883 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<Int>(g->cyclic() ? f.size() : f.size()-1); return;}
}
-#line 886 "runtime.in"
+#line 889 "runtime.in"
// bool cyclic(guide *g);
void gen_runtime104(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 887 "runtime.in"
+#line 890 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<bool>(g->cyclic()); return;}
}
-#line 893 "runtime.in"
+#line 896 "runtime.in"
// pair point(guide *g, Int t);
void gen_runtime105(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 894 "runtime.in"
+#line 897 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<pair>(f.Nodes(adjustedIndex(t,f.size(),g->cyclic())).z); return;}
}
-#line 900 "runtime.in"
+#line 903 "runtime.in"
// pairarray* dirSpecifier(guide *g, Int t);
void gen_runtime106(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 901 "runtime.in"
+#line 904 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -1347,13 +1350,13 @@ void gen_runtime106(stack *Stack)
{Stack->push<pairarray*>(c); return;}
}
-#line 912 "runtime.in"
+#line 915 "runtime.in"
// pairarray* controlSpecifier(guide *g, Int t);
void gen_runtime107(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 913 "runtime.in"
+#line 916 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -1369,13 +1372,13 @@ void gen_runtime107(stack *Stack)
} else {Stack->push<pairarray*>(new array(0)); return;}
}
-#line 929 "runtime.in"
+#line 932 "runtime.in"
// tensionSpecifier tensionSpecifier(guide *g, Int t);
void gen_runtime108(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 930 "runtime.in"
+#line 933 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -1384,13 +1387,13 @@ void gen_runtime108(stack *Stack)
{Stack->push<tensionSpecifier>(tensionSpecifier(curr.tout.val,f.Nodes(t+1).tin.val,curr.tout.atleast)); return;}
}
-#line 939 "runtime.in"
+#line 942 "runtime.in"
// realarray* curlSpecifier(guide *g, Int t);
void gen_runtime109(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 940 "runtime.in"
+#line 943 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -1403,12 +1406,12 @@ void gen_runtime109(stack *Stack)
{Stack->push<realarray*>(c); return;}
}
-#line 953 "runtime.in"
+#line 956 "runtime.in"
// guide* reverse(guide *g);
void gen_runtime110(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 954 "runtime.in"
+#line 957 "runtime.in"
flatguide f;
g->flatten(f,false);
if(f.precyclic())
@@ -1461,11 +1464,11 @@ void gen_runtime110(stack *Stack)
{Stack->push<guide*>(new multiguide(v)); return;}
}
-#line 1008 "runtime.in"
+#line 1011 "runtime.in"
// realarray* _cputime();
void gen_runtime111(stack *Stack)
{
-#line 1009 "runtime.in"
+#line 1012 "runtime.in"
static const real ticktime=1.0/sysconf(_SC_CLK_TCK);
struct tms buf;
@@ -1480,103 +1483,103 @@ void gen_runtime111(stack *Stack)
// Transforms
-#line 1024 "runtime.in"
+#line 1027 "runtime.in"
// bool ==(transform a, transform b);
void gen_runtime112(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 1025 "runtime.in"
+#line 1028 "runtime.in"
{Stack->push<bool>(a == b); return;}
}
-#line 1030 "runtime.in"
+#line 1033 "runtime.in"
// bool !=(transform a, transform b);
void gen_runtime113(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 1031 "runtime.in"
+#line 1034 "runtime.in"
{Stack->push<bool>(a != b); return;}
}
-#line 1035 "runtime.in"
+#line 1038 "runtime.in"
// transform +(transform a, transform b);
void gen_runtime114(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 1036 "runtime.in"
+#line 1039 "runtime.in"
{Stack->push<transform>(a+b); return;}
}
-#line 1040 "runtime.in"
+#line 1043 "runtime.in"
// transform *(transform a, transform b);
void gen_runtime115(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 1041 "runtime.in"
+#line 1044 "runtime.in"
{Stack->push<transform>(a*b); return;}
}
-#line 1045 "runtime.in"
+#line 1048 "runtime.in"
// pair *(transform t, pair z);
void gen_runtime116(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 1046 "runtime.in"
+#line 1049 "runtime.in"
{Stack->push<pair>(t*z); return;}
}
-#line 1050 "runtime.in"
+#line 1053 "runtime.in"
// path *(transform t, path g);
void gen_runtime117(stack *Stack)
{
path g=vm::pop<path>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 1051 "runtime.in"
+#line 1054 "runtime.in"
{Stack->push<path>(transformed(t,g)); return;}
}
-#line 1055 "runtime.in"
+#line 1058 "runtime.in"
// pen *(transform t, pen p);
void gen_runtime118(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 1056 "runtime.in"
+#line 1059 "runtime.in"
{Stack->push<pen>(transformed(t,p)); return;}
}
-#line 1060 "runtime.in"
+#line 1063 "runtime.in"
// picture* *(transform t, picture *f);
void gen_runtime119(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 1061 "runtime.in"
+#line 1064 "runtime.in"
{Stack->push<picture*>(transformed(t,f)); return;}
}
-#line 1065 "runtime.in"
+#line 1068 "runtime.in"
// picture* *(realarray2 *t, picture *f);
void gen_runtime120(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
realarray2 * t=vm::pop<realarray2 *>(Stack);
-#line 1066 "runtime.in"
+#line 1069 "runtime.in"
{Stack->push<picture*>(transformed(*t,f)); return;}
}
-#line 1070 "runtime.in"
+#line 1073 "runtime.in"
// transform ^(transform t, Int n);
void gen_runtime121(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 1071 "runtime.in"
+#line 1074 "runtime.in"
transform T;
if(n < 0) {
n=-n;
@@ -1586,55 +1589,55 @@ void gen_runtime121(stack *Stack)
{Stack->push<transform>(T); return;}
}
-#line 1081 "runtime.in"
+#line 1084 "runtime.in"
void transformXPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1082 "runtime.in"
+#line 1085 "runtime.in"
{Stack->push<real>(t.getx()); return;}
}
-#line 1086 "runtime.in"
+#line 1089 "runtime.in"
void transformYPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1087 "runtime.in"
+#line 1090 "runtime.in"
{Stack->push<real>(t.gety()); return;}
}
-#line 1091 "runtime.in"
+#line 1094 "runtime.in"
void transformXXPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1092 "runtime.in"
+#line 1095 "runtime.in"
{Stack->push<real>(t.getxx()); return;}
}
-#line 1096 "runtime.in"
+#line 1099 "runtime.in"
void transformXYPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1097 "runtime.in"
+#line 1100 "runtime.in"
{Stack->push<real>(t.getxy()); return;}
}
-#line 1101 "runtime.in"
+#line 1104 "runtime.in"
void transformYXPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1102 "runtime.in"
+#line 1105 "runtime.in"
{Stack->push<real>(t.getyx()); return;}
}
-#line 1106 "runtime.in"
+#line 1109 "runtime.in"
void transformYYPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1107 "runtime.in"
+#line 1110 "runtime.in"
{Stack->push<real>(t.getyy()); return;}
}
-#line 1111 "runtime.in"
+#line 1114 "runtime.in"
void real6ToTransform(stack *Stack)
{
real yy=vm::pop<real>(Stack);
@@ -1643,127 +1646,127 @@ void real6ToTransform(stack *Stack)
real xx=vm::pop<real>(Stack);
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 1113 "runtime.in"
+#line 1116 "runtime.in"
{Stack->push<transform>(transform(x,y,xx,xy,yx,yy)); return;}
}
-#line 1117 "runtime.in"
+#line 1120 "runtime.in"
// transform shift(transform t);
void gen_runtime129(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1118 "runtime.in"
+#line 1121 "runtime.in"
{Stack->push<transform>(transform(t.getx(),t.gety(),0,0,0,0)); return;}
}
-#line 1122 "runtime.in"
+#line 1125 "runtime.in"
// transform shiftless(transform t);
void gen_runtime130(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1123 "runtime.in"
+#line 1126 "runtime.in"
{Stack->push<transform>(transform(0,0,t.getxx(),t.getxy(),t.getyx(),t.getyy())); return;}
}
-#line 1127 "runtime.in"
+#line 1130 "runtime.in"
// transform identity();
void transformIdentity(stack *Stack)
{
-#line 1128 "runtime.in"
+#line 1131 "runtime.in"
{Stack->push<transform>(identity); return;}
}
-#line 1132 "runtime.in"
+#line 1135 "runtime.in"
// transform inverse(transform t);
void gen_runtime132(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1133 "runtime.in"
+#line 1136 "runtime.in"
{Stack->push<transform>(inverse(t)); return;}
}
-#line 1137 "runtime.in"
+#line 1140 "runtime.in"
// transform shift(pair z);
void gen_runtime133(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 1138 "runtime.in"
+#line 1141 "runtime.in"
{Stack->push<transform>(shift(z)); return;}
}
-#line 1142 "runtime.in"
+#line 1145 "runtime.in"
// transform shift(real x, real y);
void gen_runtime134(stack *Stack)
{
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 1143 "runtime.in"
+#line 1146 "runtime.in"
{Stack->push<transform>(shift(pair(x,y))); return;}
}
-#line 1147 "runtime.in"
+#line 1150 "runtime.in"
// transform xscale(real x);
void gen_runtime135(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 1148 "runtime.in"
+#line 1151 "runtime.in"
{Stack->push<transform>(xscale(x)); return;}
}
-#line 1152 "runtime.in"
+#line 1155 "runtime.in"
// transform yscale(real y);
void gen_runtime136(stack *Stack)
{
real y=vm::pop<real>(Stack);
-#line 1153 "runtime.in"
+#line 1156 "runtime.in"
{Stack->push<transform>(yscale(y)); return;}
}
-#line 1157 "runtime.in"
+#line 1160 "runtime.in"
// transform scale(real x);
void gen_runtime137(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 1158 "runtime.in"
+#line 1161 "runtime.in"
{Stack->push<transform>(scale(x)); return;}
}
-#line 1162 "runtime.in"
+#line 1165 "runtime.in"
// transform scale(real x, real y);
void gen_runtime138(stack *Stack)
{
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 1163 "runtime.in"
+#line 1166 "runtime.in"
{Stack->push<transform>(scale(x,y)); return;}
}
-#line 1167 "runtime.in"
+#line 1170 "runtime.in"
// transform slant(real s);
void gen_runtime139(stack *Stack)
{
real s=vm::pop<real>(Stack);
-#line 1168 "runtime.in"
+#line 1171 "runtime.in"
{Stack->push<transform>(slant(s)); return;}
}
-#line 1172 "runtime.in"
+#line 1175 "runtime.in"
// transform rotate(real angle, pair z=0);
void gen_runtime140(stack *Stack)
{
pair z=vm::pop<pair>(Stack,0);
real angle=vm::pop<real>(Stack);
-#line 1173 "runtime.in"
+#line 1176 "runtime.in"
{Stack->push<transform>(rotatearound(z,radians(angle))); return;}
}
-#line 1177 "runtime.in"
+#line 1180 "runtime.in"
// transform reflect(pair a, pair b);
void gen_runtime141(stack *Stack)
{
pair b=vm::pop<pair>(Stack);
pair a=vm::pop<pair>(Stack);
-#line 1178 "runtime.in"
+#line 1181 "runtime.in"
{Stack->push<transform>(reflectabout(a,b)); return;}
}
@@ -1773,289 +1776,289 @@ namespace trans {
void gen_runtime_venv(venv &ve)
{
-#line 215 "runtime.in"
+#line 218 "runtime.in"
REGISTER_BLTIN(run::IntZero,"IntZero");
-#line 223 "runtime.in"
+#line 226 "runtime.in"
REGISTER_BLTIN(run::realZero,"realZero");
-#line 228 "runtime.in"
+#line 231 "runtime.in"
REGISTER_BLTIN(run::boolFalse,"boolFalse");
-#line 233 "runtime.in"
+#line 236 "runtime.in"
REGISTER_BLTIN(run::pushNullArray,"pushNullArray");
-#line 238 "runtime.in"
+#line 241 "runtime.in"
REGISTER_BLTIN(run::pushNullRecord,"pushNullRecord");
-#line 243 "runtime.in"
+#line 246 "runtime.in"
REGISTER_BLTIN(run::pushNullFunction,"pushNullFunction");
-#line 248 "runtime.in"
+#line 251 "runtime.in"
REGISTER_BLTIN(run::pushDefault,"pushDefault");
-#line 258 "runtime.in"
+#line 261 "runtime.in"
REGISTER_BLTIN(run::isDefault,"isDefault");
-#line 265 "runtime.in"
+#line 268 "runtime.in"
REGISTER_BLTIN(run::pairToGuide,"pairToGuide");
-#line 273 "runtime.in"
+#line 276 "runtime.in"
REGISTER_BLTIN(run::pathToGuide,"pathToGuide");
-#line 278 "runtime.in"
+#line 281 "runtime.in"
REGISTER_BLTIN(run::guideToPath,"guideToPath");
-#line 283 "runtime.in"
+#line 286 "runtime.in"
REGISTER_BLTIN(run::newPen,"newPen");
-#line 291 "runtime.in"
+#line 294 "runtime.in"
addFunc(ve, run::gen_runtime12, primBoolean(), SYM_EQ, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false));
-#line 296 "runtime.in"
+#line 299 "runtime.in"
addFunc(ve, run::gen_runtime13, primBoolean(), SYM_NEQ, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false));
-#line 301 "runtime.in"
+#line 304 "runtime.in"
addFunc(ve, run::gen_runtime14, primPen(), SYM_PLUS, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false));
-#line 306 "runtime.in"
+#line 309 "runtime.in"
addFunc(ve, run::gen_runtime15, primPen(), SYM_TIMES, formal(primReal(), SYM(a), false, false), formal(primPen(), SYM(b), false, false));
-#line 311 "runtime.in"
+#line 314 "runtime.in"
addFunc(ve, run::gen_runtime16, primPen(), SYM_TIMES, formal(primPen(), SYM(a), false, false), formal(primReal(), SYM(b), false, false));
-#line 316 "runtime.in"
+#line 319 "runtime.in"
addFunc(ve, run::gen_runtime17, primPair(), SYM(max), formal(primPen(), SYM(p), false, false));
-#line 321 "runtime.in"
+#line 324 "runtime.in"
addFunc(ve, run::gen_runtime18, primPair(), SYM(min), formal(primPen(), SYM(p), false, false));
-#line 326 "runtime.in"
+#line 329 "runtime.in"
addFunc(ve, run::gen_runtime19, primVoid(), SYM(resetdefaultpen));
-#line 332 "runtime.in"
+#line 335 "runtime.in"
addFunc(ve, run::gen_runtime20, primVoid(), SYM(defaultpen), formal(primPen(), SYM(p), false, false));
-#line 337 "runtime.in"
+#line 340 "runtime.in"
addFunc(ve, run::gen_runtime21, primPen(), SYM(defaultpen));
-#line 342 "runtime.in"
+#line 345 "runtime.in"
addFunc(ve, run::gen_runtime22, primBoolean(), SYM(invisible), formal(primPen(), SYM(p), false, false));
-#line 347 "runtime.in"
+#line 350 "runtime.in"
addFunc(ve, run::gen_runtime23, primPen(), SYM(invisible));
-#line 352 "runtime.in"
+#line 355 "runtime.in"
addFunc(ve, run::gen_runtime24, primPen(), SYM(gray), formal(primPen(), SYM(p), false, false));
-#line 358 "runtime.in"
+#line 361 "runtime.in"
addFunc(ve, run::gen_runtime25, primPen(), SYM(rgb), formal(primPen(), SYM(p), false, false));
-#line 364 "runtime.in"
+#line 367 "runtime.in"
addFunc(ve, run::gen_runtime26, primPen(), SYM(cmyk), formal(primPen(), SYM(p), false, false));
-#line 370 "runtime.in"
+#line 373 "runtime.in"
addFunc(ve, run::gen_runtime27, primPen(), SYM(interp), formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false), formal(primReal(), SYM(t), false, false));
-#line 375 "runtime.in"
+#line 378 "runtime.in"
addFunc(ve, run::gen_runtime28, primPen(), SYM(rgb), formal(primReal(), SYM(r), false, false), formal(primReal(), SYM(g), false, false), formal(primReal(), SYM(b), false, false));
-#line 380 "runtime.in"
+#line 383 "runtime.in"
addFunc(ve, run::gen_runtime29, primPen(), SYM(cmyk), formal(primReal(), SYM(c), false, false), formal(primReal(), SYM(m), false, false), formal(primReal(), SYM(y), false, false), formal(primReal(), SYM(k), false, false));
-#line 385 "runtime.in"
+#line 388 "runtime.in"
addFunc(ve, run::gen_runtime30, primPen(), SYM(gray), formal(primReal(), SYM(gray), false, false));
-#line 390 "runtime.in"
+#line 393 "runtime.in"
addFunc(ve, run::gen_runtime31, realArray(), SYM(colors), formal(primPen(), SYM(p), false, false));
-#line 418 "runtime.in"
+#line 421 "runtime.in"
addFunc(ve, run::gen_runtime32, primString() , SYM(hex), formal(primPen(), SYM(p), false, false));
-#line 423 "runtime.in"
+#line 426 "runtime.in"
addFunc(ve, run::gen_runtime33, primInt(), SYM(byte), formal(primReal(), SYM(x), false, false));
-#line 428 "runtime.in"
+#line 431 "runtime.in"
addFunc(ve, run::gen_runtime34, primString() , SYM(colorspace), formal(primPen(), SYM(p), false, false));
-#line 435 "runtime.in"
+#line 438 "runtime.in"
addFunc(ve, run::gen_runtime35, primPen(), SYM(pattern), formal(primString(), SYM(s), false, false));
-#line 440 "runtime.in"
+#line 443 "runtime.in"
addFunc(ve, run::gen_runtime36, primString() , SYM(pattern), formal(primPen(), SYM(p), false, false));
-#line 445 "runtime.in"
+#line 448 "runtime.in"
addFunc(ve, run::gen_runtime37, primPen(), SYM(fillrule), formal(primInt(), SYM(n), false, false));
-#line 450 "runtime.in"
+#line 453 "runtime.in"
addFunc(ve, run::gen_runtime38, primInt(), SYM(fillrule), formal(primPen(), SYM(p), false, false));
-#line 455 "runtime.in"
+#line 458 "runtime.in"
addFunc(ve, run::gen_runtime39, primPen(), SYM(opacity), formal(primReal(), SYM(opacity), true, false), formal(primString() , SYM(blend), true, false));
-#line 465 "runtime.in"
+#line 468 "runtime.in"
addFunc(ve, run::gen_runtime40, primReal(), SYM(opacity), formal(primPen(), SYM(p), false, false));
-#line 470 "runtime.in"
+#line 473 "runtime.in"
addFunc(ve, run::gen_runtime41, primString() , SYM(blend), formal(primPen(), SYM(p), false, false));
-#line 475 "runtime.in"
+#line 478 "runtime.in"
addFunc(ve, run::gen_runtime42, primPen(), SYM(linetype), formal(realArray(), SYM(pattern), false, false), formal(primReal(), SYM(offset), true, false), formal(primBoolean(), SYM(scale), true, false), formal(primBoolean(), SYM(adjust), true, false));
-#line 486 "runtime.in"
+#line 489 "runtime.in"
addFunc(ve, run::gen_runtime43, realArray(), SYM(linetype), formal(primPen(), SYM(p), true, false));
-#line 492 "runtime.in"
+#line 495 "runtime.in"
addFunc(ve, run::gen_runtime44, primReal(), SYM(offset), formal(primPen(), SYM(p), false, false));
-#line 497 "runtime.in"
+#line 500 "runtime.in"
addFunc(ve, run::gen_runtime45, primBoolean(), SYM(scale), formal(primPen(), SYM(p), false, false));
-#line 502 "runtime.in"
+#line 505 "runtime.in"
addFunc(ve, run::gen_runtime46, primBoolean(), SYM(adjust), formal(primPen(), SYM(p), false, false));
-#line 507 "runtime.in"
+#line 510 "runtime.in"
addFunc(ve, run::gen_runtime47, primPen(), SYM(adjust), formal(primPen(), SYM(p), false, false), formal(primReal(), SYM(arclength), false, false), formal(primBoolean(), SYM(cyclic), false, false));
-#line 512 "runtime.in"
+#line 515 "runtime.in"
addFunc(ve, run::gen_runtime48, primPen(), SYM(linecap), formal(primInt(), SYM(n), false, false));
-#line 517 "runtime.in"
+#line 520 "runtime.in"
addFunc(ve, run::gen_runtime49, primInt(), SYM(linecap), formal(primPen(), SYM(p), true, false));
-#line 522 "runtime.in"
+#line 525 "runtime.in"
addFunc(ve, run::gen_runtime50, primPen(), SYM(linejoin), formal(primInt(), SYM(n), false, false));
-#line 527 "runtime.in"
+#line 530 "runtime.in"
addFunc(ve, run::gen_runtime51, primInt(), SYM(linejoin), formal(primPen(), SYM(p), true, false));
-#line 532 "runtime.in"
+#line 535 "runtime.in"
addFunc(ve, run::gen_runtime52, primPen(), SYM(miterlimit), formal(primReal(), SYM(x), false, false));
-#line 537 "runtime.in"
+#line 540 "runtime.in"
addFunc(ve, run::gen_runtime53, primReal(), SYM(miterlimit), formal(primPen(), SYM(p), true, false));
-#line 542 "runtime.in"
+#line 545 "runtime.in"
addFunc(ve, run::gen_runtime54, primPen(), SYM(linewidth), formal(primReal(), SYM(x), false, false));
-#line 547 "runtime.in"
+#line 550 "runtime.in"
addFunc(ve, run::gen_runtime55, primReal(), SYM(linewidth), formal(primPen(), SYM(p), true, false));
-#line 552 "runtime.in"
+#line 555 "runtime.in"
addFunc(ve, run::gen_runtime56, primPen(), SYM(fontcommand), formal(primString(), SYM(s), false, false));
-#line 557 "runtime.in"
+#line 560 "runtime.in"
addFunc(ve, run::gen_runtime57, primString() , SYM(font), formal(primPen(), SYM(p), true, false));
-#line 562 "runtime.in"
+#line 565 "runtime.in"
addFunc(ve, run::gen_runtime58, primPen(), SYM(fontsize), formal(primReal(), SYM(size), false, false), formal(primReal(), SYM(lineskip), false, false));
-#line 568 "runtime.in"
+#line 571 "runtime.in"
addFunc(ve, run::gen_runtime59, primReal(), SYM(fontsize), formal(primPen(), SYM(p), true, false));
-#line 573 "runtime.in"
+#line 576 "runtime.in"
addFunc(ve, run::gen_runtime60, primReal(), SYM(lineskip), formal(primPen(), SYM(p), true, false));
-#line 578 "runtime.in"
+#line 581 "runtime.in"
addFunc(ve, run::gen_runtime61, primPen(), SYM(overwrite), formal(primInt(), SYM(n), false, false));
-#line 584 "runtime.in"
+#line 587 "runtime.in"
addFunc(ve, run::gen_runtime62, primInt(), SYM(overwrite), formal(primPen(), SYM(p), true, false));
-#line 589 "runtime.in"
+#line 592 "runtime.in"
addFunc(ve, run::gen_runtime63, primPen(), SYM(basealign), formal(primInt(), SYM(n), false, false));
-#line 594 "runtime.in"
+#line 597 "runtime.in"
addFunc(ve, run::gen_runtime64, primInt(), SYM(basealign), formal(primPen(), SYM(p), true, false));
-#line 599 "runtime.in"
+#line 602 "runtime.in"
addFunc(ve, run::gen_runtime65, primTransform(), SYM(transform), formal(primPen(), SYM(p), false, false));
-#line 604 "runtime.in"
+#line 607 "runtime.in"
addFunc(ve, run::gen_runtime66, primPath(), SYM(nib), formal(primPen(), SYM(p), false, false));
-#line 609 "runtime.in"
+#line 612 "runtime.in"
addFunc(ve, run::gen_runtime67, primPen(), SYM(makepen), formal(primPath(), SYM(p), false, false));
-#line 614 "runtime.in"
+#line 617 "runtime.in"
addFunc(ve, run::gen_runtime68, primPen(), SYM(colorless), formal(primPen(), SYM(p), false, false));
-#line 620 "runtime.in"
+#line 623 "runtime.in"
addFunc(ve, run::gen_runtime69, primBoolean(), SYM(interactive));
-#line 627 "runtime.in"
+#line 630 "runtime.in"
addFunc(ve, run::gen_runtime70, primBoolean(), SYM(uptodate));
-#line 632 "runtime.in"
+#line 635 "runtime.in"
addFunc(ve, run::gen_runtime71, primInt(), SYM(system), formal(stringArray(), SYM(s), false, false));
-#line 646 "runtime.in"
+#line 649 "runtime.in"
addFunc(ve, run::gen_runtime72, primBoolean(), SYM(view));
-#line 651 "runtime.in"
+#line 654 "runtime.in"
addFunc(ve, run::gen_runtime73, primString() , SYM(asydir));
-#line 656 "runtime.in"
+#line 659 "runtime.in"
addFunc(ve, run::gen_runtime74, primString() , SYM(locale), formal(primString() , SYM(s), true, false));
-#line 662 "runtime.in"
+#line 665 "runtime.in"
addFunc(ve, run::gen_runtime75, primVoid(), SYM(abort), formal(primString() , SYM(s), true, false));
-#line 668 "runtime.in"
+#line 671 "runtime.in"
addFunc(ve, run::gen_runtime76, primVoid(), SYM(exit));
-#line 673 "runtime.in"
+#line 676 "runtime.in"
addFunc(ve, run::gen_runtime77, primVoid(), SYM(assert), formal(primBoolean(), SYM(b), false, false), formal(primString() , SYM(s), true, false));
-#line 684 "runtime.in"
+#line 687 "runtime.in"
addFunc(ve, run::gen_runtime78, primVoid(), SYM(sleep), formal(primInt(), SYM(seconds), false, false));
-#line 690 "runtime.in"
+#line 693 "runtime.in"
addFunc(ve, run::gen_runtime79, primVoid(), SYM(usleep), formal(primInt(), SYM(microseconds), false, false));
-#line 696 "runtime.in"
+#line 699 "runtime.in"
addFunc(ve, run::gen_runtime80, primVoid(), SYM(_eval), formal(primString(), SYM(s), false, false), formal(primBoolean(), SYM(embedded), false, false), formal(primBoolean(), SYM(interactivewrite), true, false));
-#line 709 "runtime.in"
+#line 712 "runtime.in"
addFunc(ve, run::gen_runtime81, primVoid(), SYM(_eval), formal(primCode(), SYM(s), false, false), formal(primBoolean(), SYM(embedded), false, false));
-#line 725 "runtime.in"
+#line 728 "runtime.in"
addFunc(ve, run::gen_runtime82, primString() , SYM(location));
-#line 731 "runtime.in"
+#line 734 "runtime.in"
REGISTER_BLTIN(run::loadModule,"loadModule");
-#line 737 "runtime.in"
+#line 740 "runtime.in"
addFunc(ve, run::gen_runtime84, primString() , SYM(cd), formal(primString() , SYM(s), true, false));
-#line 747 "runtime.in"
+#line 750 "runtime.in"
addFunc(ve, run::gen_runtime85, primVoid(), SYM(list), formal(primString(), SYM(s), false, false), formal(primBoolean(), SYM(imports), true, false));
-#line 756 "runtime.in"
+#line 759 "runtime.in"
REGISTER_BLTIN(run::nullGuide,"nullGuide");
-#line 764 "runtime.in"
+#line 767 "runtime.in"
REGISTER_BLTIN(run::dotsGuide,"dotsGuide");
-#line 774 "runtime.in"
+#line 777 "runtime.in"
REGISTER_BLTIN(run::dashesGuide,"dashesGuide");
-#line 801 "runtime.in"
+#line 804 "runtime.in"
REGISTER_BLTIN(run::newCycleToken,"newCycleToken");
-#line 806 "runtime.in"
+#line 809 "runtime.in"
addFunc(ve, run::gen_runtime90, primGuide(), symbol::trans("operator cast"), formal(primCycleToken(), SYM(tok), false, false));
-#line 813 "runtime.in"
+#line 816 "runtime.in"
addFunc(ve, run::gen_runtime91, primGuide(), symbol::trans("operator spec"), formal(primPair(), SYM(z), false, false), formal(primInt(), SYM(p), false, false));
-#line 821 "runtime.in"
+#line 824 "runtime.in"
addFunc(ve, run::gen_runtime92, primCurlSpecifier(), SYM_CURL, formal(primReal(), SYM(gamma), false, false), formal(primInt(), SYM(p), false, false));
-#line 827 "runtime.in"
+#line 830 "runtime.in"
REGISTER_BLTIN(run::curlSpecifierValuePart,"curlSpecifierValuePart");
-#line 832 "runtime.in"
+#line 835 "runtime.in"
REGISTER_BLTIN(run::curlSpecifierSidePart,"curlSpecifierSidePart");
-#line 837 "runtime.in"
+#line 840 "runtime.in"
addFunc(ve, run::gen_runtime95, primGuide(), symbol::trans("operator cast"), formal(primCurlSpecifier(), SYM(spec), false, false));
-#line 842 "runtime.in"
+#line 845 "runtime.in"
addFunc(ve, run::gen_runtime96, primTensionSpecifier(), SYM_TENSION, formal(primReal(), SYM(tout), false, false), formal(primReal(), SYM(tin), false, false), formal(primBoolean(), SYM(atleast), false, false));
-#line 847 "runtime.in"
+#line 850 "runtime.in"
REGISTER_BLTIN(run::tensionSpecifierOutPart,"tensionSpecifierOutPart");
-#line 852 "runtime.in"
+#line 855 "runtime.in"
REGISTER_BLTIN(run::tensionSpecifierInPart,"tensionSpecifierInPart");
-#line 857 "runtime.in"
+#line 860 "runtime.in"
REGISTER_BLTIN(run::tensionSpecifierAtleastPart,"tensionSpecifierAtleastPart");
-#line 862 "runtime.in"
+#line 865 "runtime.in"
addFunc(ve, run::gen_runtime100, primGuide(), symbol::trans("operator cast"), formal(primTensionSpecifier(), SYM(t), false, false));
-#line 867 "runtime.in"
+#line 870 "runtime.in"
addFunc(ve, run::gen_runtime101, primGuide(), SYM_CONTROLS, formal(primPair(), SYM(zout), false, false), formal(primPair(), SYM(zin), false, false));
-#line 872 "runtime.in"
+#line 875 "runtime.in"
addFunc(ve, run::gen_runtime102, primInt(), SYM(size), formal(primGuide(), SYM(g), false, false));
-#line 879 "runtime.in"
+#line 882 "runtime.in"
addFunc(ve, run::gen_runtime103, primInt(), SYM(length), formal(primGuide(), SYM(g), false, false));
-#line 886 "runtime.in"
+#line 889 "runtime.in"
addFunc(ve, run::gen_runtime104, primBoolean(), SYM(cyclic), formal(primGuide(), SYM(g), false, false));
-#line 893 "runtime.in"
+#line 896 "runtime.in"
addFunc(ve, run::gen_runtime105, primPair(), SYM(point), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false));
-#line 900 "runtime.in"
+#line 903 "runtime.in"
addFunc(ve, run::gen_runtime106, pairArray(), SYM(dirSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false));
-#line 912 "runtime.in"
+#line 915 "runtime.in"
addFunc(ve, run::gen_runtime107, pairArray(), SYM(controlSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false));
-#line 929 "runtime.in"
+#line 932 "runtime.in"
addFunc(ve, run::gen_runtime108, primTensionSpecifier(), SYM(tensionSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false));
-#line 939 "runtime.in"
+#line 942 "runtime.in"
addFunc(ve, run::gen_runtime109, realArray(), SYM(curlSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false));
-#line 953 "runtime.in"
+#line 956 "runtime.in"
addFunc(ve, run::gen_runtime110, primGuide(), SYM(reverse), formal(primGuide(), SYM(g), false, false));
-#line 1008 "runtime.in"
+#line 1011 "runtime.in"
addFunc(ve, run::gen_runtime111, realArray(), SYM(_cputime));
-#line 1022 "runtime.in"
+#line 1025 "runtime.in"
addFunc(ve, run::gen_runtime112, primBoolean(), SYM_EQ, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false));
-#line 1030 "runtime.in"
+#line 1033 "runtime.in"
addFunc(ve, run::gen_runtime113, primBoolean(), SYM_NEQ, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false));
-#line 1035 "runtime.in"
+#line 1038 "runtime.in"
addFunc(ve, run::gen_runtime114, primTransform(), SYM_PLUS, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false));
-#line 1040 "runtime.in"
+#line 1043 "runtime.in"
addFunc(ve, run::gen_runtime115, primTransform(), SYM_TIMES, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false));
-#line 1045 "runtime.in"
+#line 1048 "runtime.in"
addFunc(ve, run::gen_runtime116, primPair(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPair(), SYM(z), false, false));
-#line 1050 "runtime.in"
+#line 1053 "runtime.in"
addFunc(ve, run::gen_runtime117, primPath(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPath(), SYM(g), false, false));
-#line 1055 "runtime.in"
+#line 1058 "runtime.in"
addFunc(ve, run::gen_runtime118, primPen(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPen(), SYM(p), false, false));
-#line 1060 "runtime.in"
+#line 1063 "runtime.in"
addFunc(ve, run::gen_runtime119, primPicture(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPicture(), SYM(f), false, false));
-#line 1065 "runtime.in"
+#line 1068 "runtime.in"
addFunc(ve, run::gen_runtime120, primPicture(), SYM_TIMES, formal(realArray2(), SYM(t), false, false), formal(primPicture(), SYM(f), false, false));
-#line 1070 "runtime.in"
+#line 1073 "runtime.in"
addFunc(ve, run::gen_runtime121, primTransform(), SYM_CARET, formal(primTransform(), SYM(t), false, false), formal(primInt(), SYM(n), false, false));
-#line 1081 "runtime.in"
+#line 1084 "runtime.in"
REGISTER_BLTIN(run::transformXPart,"transformXPart");
-#line 1086 "runtime.in"
+#line 1089 "runtime.in"
REGISTER_BLTIN(run::transformYPart,"transformYPart");
-#line 1091 "runtime.in"
+#line 1094 "runtime.in"
REGISTER_BLTIN(run::transformXXPart,"transformXXPart");
-#line 1096 "runtime.in"
+#line 1099 "runtime.in"
REGISTER_BLTIN(run::transformXYPart,"transformXYPart");
-#line 1101 "runtime.in"
+#line 1104 "runtime.in"
REGISTER_BLTIN(run::transformYXPart,"transformYXPart");
-#line 1106 "runtime.in"
+#line 1109 "runtime.in"
REGISTER_BLTIN(run::transformYYPart,"transformYYPart");
-#line 1111 "runtime.in"
+#line 1114 "runtime.in"
REGISTER_BLTIN(run::real6ToTransform,"real6ToTransform");
-#line 1117 "runtime.in"
+#line 1120 "runtime.in"
addFunc(ve, run::gen_runtime129, primTransform(), SYM(shift), formal(primTransform(), SYM(t), false, false));
-#line 1122 "runtime.in"
+#line 1125 "runtime.in"
addFunc(ve, run::gen_runtime130, primTransform(), SYM(shiftless), formal(primTransform(), SYM(t), false, false));
-#line 1127 "runtime.in"
+#line 1130 "runtime.in"
addFunc(ve, run::transformIdentity, primTransform(), SYM(identity));
-#line 1132 "runtime.in"
+#line 1135 "runtime.in"
addFunc(ve, run::gen_runtime132, primTransform(), SYM(inverse), formal(primTransform(), SYM(t), false, false));
-#line 1137 "runtime.in"
+#line 1140 "runtime.in"
addFunc(ve, run::gen_runtime133, primTransform(), SYM(shift), formal(primPair(), SYM(z), false, false));
-#line 1142 "runtime.in"
+#line 1145 "runtime.in"
addFunc(ve, run::gen_runtime134, primTransform(), SYM(shift), formal(primReal(), SYM(x), false, false), formal(primReal(), SYM(y), false, false));
-#line 1147 "runtime.in"
+#line 1150 "runtime.in"
addFunc(ve, run::gen_runtime135, primTransform(), SYM(xscale), formal(primReal(), SYM(x), false, false));
-#line 1152 "runtime.in"
+#line 1155 "runtime.in"
addFunc(ve, run::gen_runtime136, primTransform(), SYM(yscale), formal(primReal(), SYM(y), false, false));
-#line 1157 "runtime.in"
+#line 1160 "runtime.in"
addFunc(ve, run::gen_runtime137, primTransform(), SYM(scale), formal(primReal(), SYM(x), false, false));
-#line 1162 "runtime.in"
+#line 1165 "runtime.in"
addFunc(ve, run::gen_runtime138, primTransform(), SYM(scale), formal(primReal(), SYM(x), false, false), formal(primReal(), SYM(y), false, false));
-#line 1167 "runtime.in"
+#line 1170 "runtime.in"
addFunc(ve, run::gen_runtime139, primTransform(), SYM(slant), formal(primReal(), SYM(s), false, false));
-#line 1172 "runtime.in"
+#line 1175 "runtime.in"
addFunc(ve, run::gen_runtime140, primTransform(), SYM(rotate), formal(primReal(), SYM(angle), false, false), formal(primPair(), SYM(z), true, false));
-#line 1177 "runtime.in"
+#line 1180 "runtime.in"
addFunc(ve, run::gen_runtime141, primTransform(), SYM(reflect), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false));
}
diff --git a/Build/source/utils/asymptote/runtime.in b/Build/source/utils/asymptote/runtime.in
index 987f5151bc6..542378bbe53 100644
--- a/Build/source/utils/asymptote/runtime.in
+++ b/Build/source/utils/asymptote/runtime.in
@@ -170,6 +170,9 @@ namespace vm {
const Int DefaultValue=0x7fffffffffffffffLL;
const Int Undefined=0x7ffffffffffffffeLL;
+const Int BoolTruthValue=0xABABABABABABABACLL;
+const Int BoolFalseValue=0xABABABABABABABABLL;
+
const item Default=DefaultValue;
#else
const item Default=item(default_t());
diff --git a/Build/source/utils/asymptote/stack.cc b/Build/source/utils/asymptote/stack.cc
index cbd8b5a4998..b1651d2c424 100644
--- a/Build/source/utils/asymptote/stack.cc
+++ b/Build/source/utils/asymptote/stack.cc
@@ -156,6 +156,10 @@ void stack::run(program *code, vars_t vars)
const inst &i = *ip;
curPos = i.pos;
+#if 0
+ //printInst(cout, ip, code->begin());
+ cout << i.pos << "\n";
+#endif
#ifdef DEBUG_STACK
cerr << curPos << "\n";
printInst(cerr, ip, code->begin());
@@ -187,6 +191,20 @@ void stack::run(program *code, vars_t vars)
(*vars)[get<Int>(i)] = top();
break;
+#ifdef COMBO
+ case inst::varpop:
+ (*vars)[get<Int>(i)] = pop();
+ break;
+
+ case inst::fieldpop: {
+ vars_t frame = pop<vars_t>();
+ if (!frame)
+ error("dereference of null pointer");
+ (*frame)[get<Int>(i)] = pop();
+ break;
+ }
+#endif
+
case inst::fieldpush: {
vars_t frame = pop<vars_t>();
if (!frame)
@@ -221,6 +239,16 @@ void stack::run(program *code, vars_t vars)
if (!pop<bool>()) { ip = get<program::label>(i); continue; }
break;
+#ifdef COMBO
+ case inst::gejmp: {
+ Int y = pop<Int>();
+ Int x = pop<Int>();
+ if (x>=y)
+ { ip = get<program::label>(i); continue; }
+ break;
+ }
+#endif
+
case inst::popcall: {
/* get the function reference off of the stack */
callable* f = pop<callable*>();
diff --git a/Build/source/utils/asymptote/stm.cc b/Build/source/utils/asymptote/stm.cc
index 27424bfad6a..acc00f0082b 100644
--- a/Build/source/utils/asymptote/stm.cc
+++ b/Build/source/utils/asymptote/stm.cc
@@ -55,7 +55,7 @@ void baseExpTrans(coenv &e, exp *expr)
types::ty_kind kind = expr->trans(e)->kind;
if (kind != types::ty_void)
// Remove any value it puts on the stack.
- e.c.encode(inst::pop);
+ e.c.encodePop();
}
void expStm::trans(coenv &e) {
@@ -95,7 +95,7 @@ void storeExp(coenv &e, types::ty *t, exp *expr) {
varEntry *v = makeVarEntry(expr->getPos(), e, 0, t);
e.e.addVar(symbol::trans("operator answer"), v);
v->getLocation()->encode(WRITE, expr->getPos(), e.c);
- e.c.encode(inst::pop);
+ e.c.encodePop();
}
void storeAndWriteExp(coenv &e, types::ty *t, exp *expr) {
@@ -181,20 +181,28 @@ void ifStm::prettyprint(ostream &out, Int indent)
void ifStm::trans(coenv &e)
{
- test->transToType(e, types::primBoolean());
-
Int elseLabel = e.c.fwdLabel();
Int end = e.c.fwdLabel();
+#ifdef TRANSJUMP
+ test->transConditionalJump(e, false, elseLabel);
+#else
+ test->transToType(e, types::primBoolean());
e.c.useLabel(inst::njmp,elseLabel);
+#endif
onTrue->markTrans(e);
- e.c.useLabel(inst::jmp,end);
- e.c.defLabel(elseLabel);
- // Produces efficient code whether or not there is an else clause.
- if (onFalse)
+ if (onFalse) {
+ // Encode the jump around the 'else' clause at the end of the 'if' clause
+ e.c.useLabel(inst::jmp,end);
+
+ e.c.defLabel(elseLabel);
onFalse->markTrans(e);
+ } else {
+ e.c.defLabel(elseLabel);
+ }
+
e.c.defLabel(end);
}
@@ -216,13 +224,18 @@ void whileStm::prettyprint(ostream &out, Int indent)
void whileStm::trans(coenv &e)
{
+ Int end = e.c.fwdLabel();
+ e.c.pushBreak(end);
+
Int start = e.c.defLabel();
e.c.pushContinue(start);
- test->transToType(e, types::primBoolean());
- Int end = e.c.fwdLabel();
- e.c.pushBreak(end);
+#ifdef TRANSJUMP
+ test->transConditionalJump(e, false, end);
+#else
+ test->transToType(e, types::primBoolean());
e.c.useLabel(inst::njmp,end);
+#endif
transLoopBody(e,body);
@@ -254,8 +267,14 @@ void doStm::trans(coenv &e)
transLoopBody(e,body);
e.c.defLabel(testLabel);
+
+#ifdef TRANSJUMP
+ test->transConditionalJump(e, true, start);
+#else
test->transToType(e, types::primBoolean());
e.c.useLabel(inst::cjmp,start);
+#endif
+
e.c.defLabel(end);
e.c.popBreak();
@@ -277,7 +296,8 @@ void forStm::trans(coenv &e)
{
// Any vardec in the initializer needs its own scope.
e.e.beginScope();
- if(init) init->markTrans(e);
+ if (init)
+ init->markTrans(e);
Int ctarget = e.c.fwdLabel();
e.c.pushContinue(ctarget);
@@ -286,15 +306,20 @@ void forStm::trans(coenv &e)
Int start = e.c.defLabel();
if(test) {
+#ifdef TRANSJUMP
+ test->transConditionalJump(e, false, end);
+#else
test->transToType(e, types::primBoolean());
e.c.useLabel(inst::njmp,end);
+#endif
}
transLoopBody(e,body);
e.c.defLabel(ctarget);
- if (update) update->markTrans(e);
+ if (update)
+ update->markTrans(e);
e.c.useLabel(inst::jmp,start);
e.c.defLabel(end);
@@ -329,10 +354,20 @@ void extendedForStm::trans(coenv &e) {
symbol a=symbol::gensym("a");
symbol i=symbol::gensym("i");
- // start[] a=set;
- arrayTy at(pos, start, new dimensions(pos));
- decid dec1(pos, new decidstart(pos, a), set);
- vardec(pos, &at, &dec1).trans(e);
+ // Get the start type. Handle type inference as a special case.
+ types::ty *t = start->trans(e, true);
+ if (t->kind == types::ty_inferred) {
+ // var a=set;
+ tyEntryTy tet(pos, primInferred());
+ decid dec1(pos, new decidstart(pos, a), set);
+ vardec(pos, &tet, &dec1).trans(e);
+ }
+ else {
+ // start[] a=set;
+ arrayTy at(pos, start, new dimensions(pos));
+ decid dec1(pos, new decidstart(pos, a), set);
+ vardec(pos, &at, &dec1).trans(e);
+ }
// { start var=a[i]; body }
block b(pos);
@@ -343,7 +378,12 @@ void extendedForStm::trans(coenv &e) {
b.add(new vardec(pos, start, &dec2));
b.add(body);
-
+ // If there are errors already, just report errors in the body and don't try
+ // to translate the for loop.
+ if (em.errors()) {
+ b.trans(e);
+ return;
+ }
// for (int i=0; i < a.length; ++i)
// <block>
diff --git a/Build/source/utils/asymptote/tests/array/fields.asy b/Build/source/utils/asymptote/tests/array/fields.asy
index 8435551aceb..7845ef2de64 100644
--- a/Build/source/utils/asymptote/tests/array/fields.asy
+++ b/Build/source/utils/asymptote/tests/array/fields.asy
@@ -76,4 +76,26 @@ StartTest("fields");
// TODO: Test inserting/deleting lengths more seriously.
}
+{
+ // Test extended for.
+ int[] a = {1,4,6,2,7,4,8,9,1,3,-1};
+ int i = 0;
+ for (int x : a) {
+ assert(x == a[i]);
+ ++i;
+ }
+ assert(i == a.length);
+}
+
+{
+ // Test extended for.
+ int[] a = {1,4,6,2,7,4,8,9,1,3,-1};
+ int i = 0;
+ for (var x : a) {
+ assert(x == a[i]);
+ ++i;
+ }
+ assert(i == a.length);
+}
+
EndTest();
diff --git a/Build/source/utils/asymptote/texfile.cc b/Build/source/utils/asymptote/texfile.cc
index 5df087e8013..1682bed2866 100644
--- a/Build/source/utils/asymptote/texfile.cc
+++ b/Build/source/utils/asymptote/texfile.cc
@@ -61,7 +61,7 @@ void texfile::miniprologue()
void texfile::prologue()
{
if(inlinetex) {
- string prename=auxname(getSetting<string>("outname"),"pre");
+ string prename=auxname(settings::outname(),"pre");
std::ifstream exists(prename.c_str());
std::ofstream *outpreamble=
new std::ofstream(prename.c_str(),std::ios::app);