diff options
author | Karl Berry <karl@freefriends.org> | 2009-05-28 23:56:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-05-28 23:56:03 +0000 |
commit | e767448d0591f5dbb0cd485e4b014becdcbd1ba4 (patch) | |
tree | 83bec5bd1ee117130f3e9dcee985dcd42f5145d9 /Build | |
parent | 20751a51df382b884807d8b9ef1ff7f7cc7739a5 (diff) |
asymptote 1.74
git-svn-id: svn://tug.org/texlive/trunk@13514 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
46 files changed, 4308 insertions, 2635 deletions
diff --git a/Build/source/utils/asymptote/ChangeLog b/Build/source/utils/asymptote/ChangeLog index d684018c4f3..ac73d7c3838 100644 --- a/Build/source/utils/asymptote/ChangeLog +++ b/Build/source/utils/asymptote/ChangeLog @@ -1,4 +1,431 @@ ------------------------------------------------------------------------ +r4335 | jcbowman | 2009-05-28 00:56:30 -0600 (Thu, 28 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/latexusage.tex + +Improve appearance of cube example. + +------------------------------------------------------------------------ +r4334 | jcbowman | 2009-05-28 00:33:43 -0600 (Thu, 28 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Increase anglefactor. + +------------------------------------------------------------------------ +r4333 | jcbowman | 2009-05-28 00:14:35 -0600 (Thu, 28 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/bezulate.asy + +Fix assert; increase fuzz. + +------------------------------------------------------------------------ +r4332 | jcbowman | 2009-05-28 00:00:27 -0600 (Thu, 28 May 2009) | 3 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Disable PRC output when using ConTeXt engine (due to lack of movie15 +equivalent). + +------------------------------------------------------------------------ +r4331 | jcbowman | 2009-05-27 23:37:13 -0600 (Wed, 27 May 2009) | 4 lines +Changed paths: + M /trunk/asymptote/base/bezulate.asy + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/base/three_surface.asy + M /trunk/asymptote/doc/asymptote.texi + A /trunk/asymptote/examples/pathintersectsurface.asy + M /trunk/asymptote/path.cc + M /trunk/asymptote/path.h + M /trunk/asymptote/path3.cc + M /trunk/asymptote/path3.h + M /trunk/asymptote/runtime.in + +Fix incorrect auxiliary control point in surface bounding box routines. + +Add path/surface intersections and intersectionpoints routines. + +------------------------------------------------------------------------ +r4330 | jcbowman | 2009-05-27 10:16:32 -0600 (Wed, 27 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/asymptote.spec + +Fix packaging. + +------------------------------------------------------------------------ +r4329 | jcbowman | 2009-05-27 09:47:32 -0600 (Wed, 27 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/asymptote.spec + +Package conTeXt files. + +------------------------------------------------------------------------ +r4328 | jcbowman | 2009-05-27 09:30:15 -0600 (Wed, 27 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Revert r4303; ensure consistency of circle and arc. + +------------------------------------------------------------------------ +r4327 | jcbowman | 2009-05-27 08:44:56 -0600 (Wed, 27 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/configure.ac + +Fix RPM build. + +------------------------------------------------------------------------ +r4326 | jcbowman | 2009-05-26 23:21:51 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/bezulate.asy + M /trunk/asymptote/picture.cc + +Fix diagnostics. + +------------------------------------------------------------------------ +r4325 | jcbowman | 2009-05-26 22:56:39 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_pens.asy + M /trunk/asymptote/doc/asymptote.texi + +Remove ambiguity in font commands. + +------------------------------------------------------------------------ +r4324 | jcbowman | 2009-05-26 22:55:34 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/bezulate.asy + +Increase duplicate fuzz to work around font errors. + +------------------------------------------------------------------------ +r4323 | jcbowman | 2009-05-26 17:57:11 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/configure.ac + M /trunk/asymptote/settings.cc + +Add portability fix. + +------------------------------------------------------------------------ +r4322 | jcbowman | 2009-05-26 17:46:56 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/algebra3.h + +Remove unused enums. + +------------------------------------------------------------------------ +r4321 | jcbowman | 2009-05-26 08:23:49 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/algebra3.h + +Fix enum. + +------------------------------------------------------------------------ +r4320 | jcbowman | 2009-05-26 08:21:02 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/settings.cc + +Fix preprocessor command. + +------------------------------------------------------------------------ +r4319 | jcbowman | 2009-05-26 02:52:25 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/bezulate.asy + M /trunk/asymptote/base/embed.asy + +Enable non-PRC 3D context support. + +------------------------------------------------------------------------ +r4318 | jcbowman | 2009-05-26 02:25:39 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/picture.cc + M /trunk/asymptote/runtime.in + M /trunk/asymptote/texfile.cc + +Support context engine in _texpath; clean up files. + +------------------------------------------------------------------------ +r4317 | jcbowman | 2009-05-26 01:30:46 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/picture.cc + +Cleanup temporary context files. + +------------------------------------------------------------------------ +r4316 | jcbowman | 2009-05-26 01:12:05 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + +Normalize direction. + +------------------------------------------------------------------------ +r4315 | jcbowman | 2009-05-26 00:16:53 -0600 (Tue, 26 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/settings.cc + +Workaround possibly broken header file on i386-solaris with g++ 3.4.3. + +------------------------------------------------------------------------ +r4314 | jcbowman | 2009-05-25 23:58:24 -0600 (Mon, 25 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/pipestream.h + +Force child to exit when pipe is closed. + +------------------------------------------------------------------------ +r4313 | jcbowman | 2009-05-25 11:01:50 -0600 (Mon, 25 May 2009) | 4 lines +Changed paths: + M /trunk/asymptote/pipestream.h + M /trunk/asymptote/runtime.in + M /trunk/asymptote/settings.cc + M /trunk/asymptote/settings.h + +Prevent double waiting in pipeclose(). + +Support PDF tex engines in texpath. + +------------------------------------------------------------------------ +r4312 | jcbowman | 2009-05-25 07:18:45 -0600 (Mon, 25 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/texfile.h + +Don't issue \usemodule[pictex] in inlinetex mode. + +------------------------------------------------------------------------ +r4311 | jcbowman | 2009-05-24 22:25:12 -0600 (Sun, 24 May 2009) | 5 lines +Changed paths: + M /trunk/asymptote/pipestream.h + M /trunk/asymptote/runtime.in + M /trunk/asymptote/settings.cc + +Handle zombies in pipestream without using a wrapper, so that one can detect +whether the child process has terminated. + +Simplify, _texpath, textpath, and _strokepath. + +------------------------------------------------------------------------ +r4310 | jcbowman | 2009-05-23 22:47:30 -0600 (Sat, 23 May 2009) | 9 lines +Changed paths: + M /trunk/asymptote/base/plain_pens.asy + M /trunk/asymptote/examples/contextfonts.asy + M /trunk/asymptote/pen.h + M /trunk/asymptote/settings.cc + M /trunk/asymptote/texfile.cc + +Fix initial context pen. + +Add usetypescript convenience function. + +Protect context switchtobodyfont with gsave/grestore to prevent +misalignment if font is not found. + +Improve description of -v option. + +------------------------------------------------------------------------ +r4309 | jcbowman | 2009-05-23 22:44:43 -0600 (Sat, 23 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/examples/floor.asy + +Fix ylabel rotation. + +------------------------------------------------------------------------ +r4308 | jcbowman | 2009-05-23 21:07:40 -0600 (Sat, 23 May 2009) | 5 lines +Changed paths: + M /trunk/asymptote/picture.cc + +Implement a better workaround for lack of a context interactive mode that +does not rely on the existence of a null.tex file. + +Use context-style command-line options. + +------------------------------------------------------------------------ +r4307 | jcbowman | 2009-05-23 11:18:01 -0600 (Sat, 23 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/Makefile.in + +Fix man page generator. + +------------------------------------------------------------------------ +r4306 | jcbowman | 2009-05-23 08:11:52 -0600 (Sat, 23 May 2009) | 4 lines +Changed paths: + M /trunk/asymptote/Makefile.in + M /trunk/asymptote/configure.ac + A /trunk/asymptote/doc/colo-asy.tex + +Add colo-asy.tex file (contributed by Mojca Miklavec). + +Remove base/asy-keywords.el in favour of asy-keywords.el. + +------------------------------------------------------------------------ +r4305 | jcbowman | 2009-05-22 18:24:14 -0600 (Fri, 22 May 2009) | 2 lines +Changed paths: + A /trunk/asymptote/examples/unitoctant.asy + M /trunk/asymptote/path.cc + M /trunk/asymptote/path3.cc + +Add unitoctant example. + +------------------------------------------------------------------------ +r4304 | jcbowman | 2009-05-22 14:20:05 -0600 (Fri, 22 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/runtime.in + +Allow draw(nullpath3,linewidth(0)). + +------------------------------------------------------------------------ +r4303 | jcbowman | 2009-05-22 14:09:15 -0600 (Fri, 22 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Use only 2 nodes for arcs of no more than 90 degress. + +------------------------------------------------------------------------ +r4302 | jcbowman | 2009-05-22 09:05:16 -0600 (Fri, 22 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/texfile.cc + +Remove unneeded \bye in context support. + +------------------------------------------------------------------------ +r4301 | jcbowman | 2009-05-21 13:40:02 -0600 (Thu, 21 May 2009) | 3 lines +Changed paths: + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/examples/basealign.asy + M /trunk/asymptote/examples/threeviews.asy + +Add LeftView, RightView, FrontView, BackView, BottomView, TopView, along +with addViews function. + +------------------------------------------------------------------------ +r4300 | jcbowman | 2009-05-21 01:01:24 -0600 (Thu, 21 May 2009) | 2 lines +Changed paths: + A /trunk/asymptote/examples/basealign.asy + +Add example of baseline alignment. + +------------------------------------------------------------------------ +r4299 | jcbowman | 2009-05-21 00:32:14 -0600 (Thu, 21 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_pens.asy + M /trunk/asymptote/base/plain_strings.asy + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/drawclipbegin.h + M /trunk/asymptote/drawfill.h + M /trunk/asymptote/drawlayer.h + A /trunk/asymptote/examples/contextfonts.asy + M /trunk/asymptote/pen.h + M /trunk/asymptote/picture.cc + M /trunk/asymptote/settings.cc + M /trunk/asymptote/settings.h + M /trunk/asymptote/texfile.cc + M /trunk/asymptote/texfile.h + +Add support for ConTeXt tex engine. + +------------------------------------------------------------------------ +r4298 | jcbowman | 2009-05-20 19:24:38 -0600 (Wed, 20 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/Makefile.in + M /trunk/asymptote/configure.ac + M /trunk/asymptote/path.h + M /trunk/asymptote/path3.h + +Updates to facilitate TeXLive builds. + +------------------------------------------------------------------------ +r4297 | jcbowman | 2009-05-20 00:48:02 -0600 (Wed, 20 May 2009) | 2 lines +Changed paths: + A /trunk/asymptote/examples/threeviews.asy (from /trunk/asymptote/examples/twoviews.asy:4296) + D /trunk/asymptote/examples/twoviews.asy + +Update example. + +------------------------------------------------------------------------ +r4296 | jcbowman | 2009-05-20 00:03:34 -0600 (Wed, 20 May 2009) | 2 lines +Changed paths: + A /trunk/asymptote/examples/twoviews.asy + +Add example showing how to render multiple views of the same picture. + +------------------------------------------------------------------------ +r4295 | jcbowman | 2009-05-19 23:53:39 -0600 (Tue, 19 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + +Simplify code. + +------------------------------------------------------------------------ +r4294 | jcbowman | 2009-05-19 23:49:09 -0600 (Tue, 19 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_Label.asy + M /trunk/asymptote/base/three_surface.asy + +Remove dependence on currentprojection in label(Label, path3). + +------------------------------------------------------------------------ +r4293 | jcbowman | 2009-05-19 23:36:08 -0600 (Tue, 19 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/Makefile.in + +Fix another BUILD problem. + +------------------------------------------------------------------------ +r4292 | jcbowman | 2009-05-19 22:50:14 -0600 (Tue, 19 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/Makefile.in + M /trunk/asymptote/asymptote.spec + +Fix build problem. + +------------------------------------------------------------------------ +r4291 | jcbowman | 2009-05-19 21:29:58 -0600 (Tue, 19 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/Makefile.in + R /trunk/asymptote/doc/FAQ/install-sh + R /trunk/asymptote/doc/install-sh + M /trunk/asymptote/install-sh + +Remove symbolic links from source distribution. + +------------------------------------------------------------------------ +r4290 | jcbowman | 2009-05-18 23:08:58 -0600 (Mon, 18 May 2009) | 4 lines +Changed paths: + M /trunk/asymptote/configure.ac + +Add enable-gsl[=yes] and enable-gl[=yes] options. + +Use AS_HELP_STRING. + +------------------------------------------------------------------------ +r4289 | jcbowman | 2009-05-18 22:47:55 -0600 (Mon, 18 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/Makefile.in + M /trunk/asymptote/doc/png/Makefile.in + +Fix distclean. + +------------------------------------------------------------------------ +r4288 | jcbowman | 2009-05-18 11:08:59 -0600 (Mon, 18 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/configure.ac + +Increment version to 1.74svn. + +------------------------------------------------------------------------ +r4287 | jcbowman | 2009-05-18 11:08:23 -0600 (Mon, 18 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/configure.ac + +Revert last change. + +------------------------------------------------------------------------ +r4286 | jcbowman | 2009-05-18 11:06:44 -0600 (Mon, 18 May 2009) | 2 lines +Changed paths: + M /trunk/asymptote/configure.ac + +Fix version number. + +------------------------------------------------------------------------ r4285 | jcbowman | 2009-05-18 02:02:35 -0600 (Mon, 18 May 2009) | 2 lines Changed paths: M /trunk/asymptote/settings.cc diff --git a/Build/source/utils/asymptote/Makefile.in b/Build/source/utils/asymptote/Makefile.in index eba734e3710..94ee373ad72 100644 --- a/Build/source/utils/asymptote/Makefile.in +++ b/Build/source/utils/asymptote/Makefile.in @@ -24,15 +24,16 @@ FILES = $(CAMP) runtime env genv main stm dec errormsg \ $(PRC) glrender tr arcball algebra3 quaternion svnrevision DIST = camp.tab.h camp.tab.cc lex.yy.cc runtime.h runtime.cc keywords.cc \ - asy-keywords.el base/asy-keywords.el + asy-keywords.el NAME = asy XNAME = x$(NAME) CLEAN = camp.output asy.list svnrevision.cc doc/version.texi GUI/xasyVersion.py $(XNAME) -EXTRA = asy-mode.el asy-keywords.el asy-init.el asy.vim asymptote.py reload.js nopapersize.ps +EXTRA = asy-mode.el asy-init.el asy.vim asymptote.py reload.js nopapersize.ps EXEXTRA = piicon.eps *.views *.dat DOCEXTRA = *.asy *.csv *.dat latexusage.tex externalprc.tex pixel.pdf KEYWORDS = base $(ASYMPTOTE_SITEDIR) LATEXFILES = asymptote.sty asycolors.sty +CONTEXTFILES = colo-asy.tex ASY = ./asy -dir base -config "" -render=0 DEFS = @DEFS@ @OPTIONS@ @@ -59,6 +60,7 @@ docdir = $(DESTDIR)@docdir@ exampledir = $(docdir)/examples animationsdir = $(exampledir)/animations latexdir = $(DESTDIR)@latexdir@ +contextdir = $(DESTDIR)@contextdir@ INSTALL = @INSTALL@ REVISION = "const char *SVN_REVISION=" revision = `svn info 2>/dev/null | grep "Revision" | sed -e "s/Revision: \(.*\)/-r\1/"` @@ -109,7 +111,7 @@ $(GCLIB): $(GC).tar.gz fi cd $(GC); \ ./configure $(GCOPTIONS); \ - $(GCLIB_CHECK) + $(GCLIB_CHECK) $(GCPPLIB): $(GCLIB) @@ -140,14 +142,12 @@ keywords.cc: keywords.pl camp.l envcompleter.d: keywords.cc -asy.list: asy +asy-keywords.el: asy $(ASY) -l > asy.list - ls $(addsuffix /*.asy,$(KEYWORDS)) | grep -v plain\* | grep -v three_\* | grep -v featpost3D | xargs $(ASY) -l >> asy.list + ls $(addsuffix /*.asy,$(KEYWORDS)) | grep -v plain\* | \ + grep -v three_\* | grep -v featpost3D | xargs $(ASY) -l >> asy.list ./asy-list.pl asy.list @VERSION@ -asy-keywords.el: asy.list - ln -sf ../asy-keywords.el base/ - install: asy-keywords.el install-asy install-man install-all: asy-keywords.el install-asy install-doc @@ -156,8 +156,9 @@ install-asy: asy ${INSTALL} -d $(bindir) $(asydir) $(GUIdir) $(exampledir) \ $(animationsdir) -${INSTALL} -d $(latexdir) + -${INSTALL} -d $(contextdir) ${INSTALL} -p -m 755 $(NAME) $(bindir) - ${INSTALL} -p -m 644 base/*.asy $(addprefix base/,$(EXTRA)) $(asydir) + ${INSTALL} -p -m 644 asy-keywords.el base/*.asy $(addprefix base/,$(EXTRA)) $(asydir) ${INSTALL} -p -m 755 GUI/*.py $(GUIdir) ln -sf @datadir@/asymptote/GUI/xasy.py $(bindir)/$(XNAME) ${INSTALL} -p -m 644 examples/*.asy $(addprefix examples/,$(EXEXTRA)) \ @@ -166,6 +167,7 @@ install-asy: asy examples/animations/inlinemovie.tex \ examples/animations/inlinemovie3.tex $(animationsdir) -${INSTALL} -p -m 644 $(addprefix doc/,$(LATEXFILES)) $(latexdir) + -${INSTALL} -p -m 644 $(addprefix doc/,$(CONTEXTFILES)) $(contextdir) -if test -z "$(DESTDIR)"; then \ texhash; \ fi @@ -192,6 +194,8 @@ uninstall-asy: -rmdir $(asydir) -cd $(latexdir); rm -f $(LATEXFILES) -rmdir $(latexdir) + -cd $(contextdir); rm -f $(CONTEXTFILES) + -rmdir $(contextdir) -cd $(bindir); rm -f $(NAME) $(XNAME) uninstall-man: diff --git a/Build/source/utils/asymptote/ReleaseNotes b/Build/source/utils/asymptote/ReleaseNotes index 6a1d8e590df..2a7517059bb 100644 --- a/Build/source/utils/asymptote/ReleaseNotes +++ b/Build/source/utils/asymptote/ReleaseNotes @@ -1,3 +1,15 @@ +Release Notes for Version 1.74 + +An error in the surface bounding box routines was fixed. Path/surface +intersection routines were added. PDF tex engines are now supported for +3D labels and texpath. The new ConTeXT tex engine can be used for both 2D +and non-PRC 3D drawings. Projections LeftView, RightView, FrontView, +BackView, BottomView, and TopView, along with an addViews function, were +implemented. Portability fixes and various updates to support TeXLive +builds were made. The dependence on currentprojection in label(Label, +path3) was removed. The font command for LaTeX tex engines now requires all +four NFSS (encoding, family, series, shape) arguments. + Release Notes for Version 1.73 An alternative OpenGL background color can now be specified with the pen diff --git a/Build/source/utils/asymptote/algebra3.h b/Build/source/utils/asymptote/algebra3.h index 67b07737f3c..0e6602c3cad 100644 --- a/Build/source/utils/asymptote/algebra3.h +++ b/Build/source/utils/asymptote/algebra3.h @@ -104,10 +104,12 @@ class mat4; #define M_PI 3.141592654 #endif -enum {VX, VY, VZ, VW}; // axes -enum {PA, PB, PC, PD}; // planes -enum {RED, GREEN, BLUE, ALPHA}; // colors -enum {KA, KD, KS, ES}; // phong coefficients +enum axes {VX, VY, VZ, VW}; +/* +enum planes {PA, PB, PC, PD}; +enum colors {RED, GREEN, BLUE, ALPHA}; +enum phong {KA, KD, KS, ES}; +*/ /**************************************************************** * * diff --git a/Build/source/utils/asymptote/asy-keywords.el b/Build/source/utils/asymptote/asy-keywords.el index f699de8de8a..76f6a9abac5 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 "1.73") +(defvar asy-keywords-version "1.74") (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 )) @@ -11,7 +11,7 @@ and controls tension atleast curl if else while for do return break continue str Braid Label Legend Rmf TreeNode abscissa arc arrowhead binarytree binarytreeNode block bool bool3 bounds bqe circle conic coord coordsys cputime ellipse file filltype frame grid3 guide horner hsv hyperbola indexedTransform int inversion key line linefit marginT marker mass object pair parabola path path3 pen picture point position projection real revolution scaleT scientific segment side slice splitface string surface tensionSpecifier ticklocate ticksgridT tickvalues transform transformation tree triangle trilinear triple vector vertex void )) (defvar asy-function-name '( -AND Arc ArcArrow ArcArrows Arrow Arrows Automatic AvantGarde BBox BWRainbow BWRainbow2 Bar Bars BeginArcArrow BeginArrow BeginBar BeginDotMargin BeginMargin BeginPenMargin Blank Bookman Bottom BottomTop Bounds Break Broken BrokenLog Ceil Circle CircleBarIntervalMarker Cos Courier CrossIntervalMarker DefaultFormat DefaultLogFormat Degrees Dir DotMargin DotMargins Dotted Draw Drawline Embed EndArcArrow EndArrow EndBar EndDotMargin EndMargin EndPenMargin Fill FillDraw Floor Format Full Gaussian Gaussrand Gaussrandpair Gradient Grayscale Helvetica Hermite HookHead InOutTicks InTicks J Label Landscape Left LeftRight LeftTicks Legend Linear Link Log LogFormat Margin Margins Mark MidArcArrow MidArrow NOT NewCenturySchoolBook NoBox NoMargin NoModifier NoTicks NoTicks3 NoZero NoZeroFormat None OR OmitFormat OmitTick OutTicks Ox Oy Palatino PaletteTicks Pen PenMargin PenMargins Pentype Portrait RadialShade Rainbow Range Relative Right RightTicks Rotate Round Scale ScaleX ScaleY ScaleZ Seascape Shift Sin Slant Spline StickIntervalMarker Straight Symbol Tan TeXify Ticks Ticks3 TildeIntervalMarker TimesRoman Top TrueMargin UnFill UpsideDown Wheel X XEquals XOR XY XYEquals XYZero XYgrid XZEquals XZZero XZero XZgrid Y YEquals YXgrid YZ YZEquals YZZero YZero YZgrid Z ZX ZXgrid ZYgrid ZapfChancery ZapfDingbats _cputime _draw _eval _image _labelpath _strokepath _texpath aCos aSin aTan abort abs accel acos acosh acot acsc add addArrow addMargins addSaveFunction addnode addnodes addpenarc addpenline addseg adjust alias align all altitude angabscissa angle angpoint animate annotate anticomplementary antipedal apply approximate arc arcarrowsize arccircle arcdir arcfromcenter arcfromfocus arclength arcnodesnumber arcpoint arcsubtended arcsubtendedcenter arctime arctopath array arrow arrow2 arrowbase arrowbasepoints arrowsize asec asin asinh ask assert asy asycode asydir asyfigure asyfilecode asyinclude asywrite atan atan2 atanh atbreakpoint atexit atime attach attract atupdate autoformat autoscale autoscale3 axes axes3 axialshade axis axiscoverage azimuth babel background bangles bar barmarksize barsize basealign baseline bbox beep beginclip begingroup beginpoint between bevel bezier bezierP bezierPP bezierPPP bezulate bibliography bibliographystyle binarytree binarytreeNode binomial binput bins bisector bisectorpoint bispline blend boutput box bqe breakpoint breakpoints brick buildRestoreDefaults buildRestoreThunk buildcycle bulletcolor canonical canonicalcartesiansystem cartesiansystem case1 case2 case3 cbrt cd ceil center centerToFocus centroid cevian change2 changecoordsys checkSegment checkconditionlength checker checklengths checkposition checktriangle choose circle circlebarframe circlemarkradius circlenodesnumber circumcenter circumcircle clamped clear clip clipdraw close cmyk code colatitude collect collinear color colorless colors colorspace comma compassmark complement complementary concat concurrent cone conic conicnodesnumber conictype conj connect containmentTree contains contour contour3 controlSpecifier convert coordinates coordsys copy cos cosh cot countIntersections cputime crop cropcode cross crossframe crosshatch crossmarksize csc csv cubicroots curabscissa curlSpecifier curpoint currentarrow currentexitfunction currentmomarrow currentpolarconicroutine curve cut cutafter cutbefore cyclic cylinder debugger deconstruct defaultdir defaultformat defaultpen defaultspline defined degenerate degrees delete deletepreamble determinant diagonal diamond diffdiv dimension dir dirSpecifier dirtime display distance divisors do_overpaint dot dotframe dotsize downcase draw drawAll drawDoubleLine drawFermion drawGhost drawGluon drawMomArrow drawPhoton drawScalar drawVertex drawVertexBox drawVertexBoxO drawVertexBoxX drawVertexO drawVertexOX drawVertexTriangle drawVertexTriangleO drawVertexX drawarrow drawarrow2 drawline drawtick duplicate elle ellipse ellipsenodesnumber embed embed3 empty enclose endScript endclip endgroup endl endpoint endpoints eof eol equation equations erase erf erfc error errorbar errorbars euler eval excenter excircle exit exitXasyMode exitfunction exp expi expm1 exradius extend extension extouch fabs factorial fermat fft fhorner figure file filecode fill filldraw filloutside fillrule filltype find finite firstcut firstframe fit fixedscaling floor flush fmdefaults fmod focusToCenter font fontcommand fontsize foot format frac frequency fromCenter fromFocus fspline functionshade gamma generate_random_backtrace generateticks gergonne getc getint getpair getreal getstring gettriple gluon gouraudshade graph graphic gray grestore grid grid3 gsave halfbox hatch hdiffdiv hermite hex histogram history hline hprojection hsv hyperbola hyperbolanodesnumber hyperlink hypot identity image incenter incentral incircle increasing incrementposition indexedTransform initXasyMode initdefaults input inradius insert inside interactive interior interp interpolate intersect intersection intersectionpoint intersectionpoints intersections intouch inverse inversion invisible is3D isDuplicate isogonal isogonalconjugate isotomic isotomicconjugate isparabola italic item key kurtosis kurtosisexcess label labelaxis labelmargin labelpath labels labeltick labelx labelx3 labely labely3 labelz labelz3 lastcut latex latitude latticeshade layer layout ldexp leastsquares legend legenditem length lift limits line linear linecap linejoin linemargin lineskip linetype linewidth link list locale locate locatefile location log log10 log1p logaxiscoverage longitude lookup magnetize makeNode makedraw makepen map margin markangle markangleradius markanglespace markarc marker markinterval marknodes markrightangle markuniform mass masscenter massformat math max max3 maxbound maxcoords maxlength maxratio maxtimes mean medial median midpoint min min3 minbound minipage minratio mintimes miterlimit momArrowPath momarrowsize monotonic nativeformat natural needshipout newl newpage newslide newton newtree nextframe nextnormal nextpage nib nodabscissa none normalvideo notaknot numberpage nurb object offset onpath opacity opposite orientation orig_circlenodesnumber orig_circlenodesnumber1 orig_draw orig_ellipsenodesnumber orig_ellipsenodesnumber1 orig_hyperbolanodesnumber orig_parabolanodesnumber origin orthic orthocentercenter outformat outline outprefix output overwrite pack pairs palette parabola parabolanodesnumber parallel partialsum path path3 pattern pause pdf pedal periodic perp perpendicular perpendicularmark phantom photon piecewisestraight point polar polarconicroutine polargraph polygon postcontrol postscript pow10 ppoint prc prc0 precision precontrol prepend print_random_addresses project projection purge pwhermite quadrant quadraticroots quantize quarticroots quotient radialshade radians radicalcenter radicalline radius rand randompath rd read1 read2 read3 readline realmult realquarticroots rectangle rectangular rectify reflect relabscissa relative relativedistance reldir relpoint reltime remainder remark removeDuplicates rename replace report rescale rescale2 resetdefaultpen restore restoredefaults reverse reversevideo rf rfind rgb rgba rgbint rmf rms rotate rotateO rotation round roundbox roundedpath roundrectangle samecoordsys sameside sample save savedefaults saveline scale scale3 scaleO scaleT scaleless scientific search searchtree sec secondaryX secondaryY seconds section sector seek seekeof segment sequence setpens sgn sgnd sharpangle sharpdegrees shift shiftless shipout shipout3 show side simeq simpson sin single sinh size size3 skewness skip slant sleep slope slopefield solve sort sourceline sphere split sqrt square srand standardizecoordsys startScript startTrembling stdev step stickframe stickmarksize stickmarkspace stop straight straightness string stripdirectory stripextension stripfile strokepath subdivide subitem subpath substr sum surface symmedial symmedian system tab tableau tan tangent tangential tangents tanh tell tensionSpecifier tensorshade tex texcolor texify texpath texpreamble texreset texshipout textpath thick thin tick tickMax tickMax3 tickMin tickMin3 ticklabelshift ticklocate tildeframe tildemarksize tile tiling time times title titlepage topbox transform transformation transpose tremble trembleFuzz tremble_circlenodesnumber tremble_circlenodesnumber1 tremble_draw tremble_ellipsenodesnumber tremble_ellipsenodesnumber1 tremble_hyperbolanodesnumber tremble_marknodes tremble_markuniform tremble_parabolanodesnumber triangle triangleAbc triangleabc triangulate tricoef tridiagonal trilinear trim trueMagnetize truepoint tube uncycle unfill uniform unit unitrand unitsize unityroot unstraighten upcase updatefunction upscale uptodate usepackage usersetting usleep value variance variancebiased vbox vector vectorfield verbatim view vline vprojection windingnumber word write xaxis xaxis3 xaxis3At xaxisAt xequals xinput xlimits xoutput xpart xscale xscaleO xtick xtick3 xtrans yaxis yaxis3 yaxis3At yaxisAt yequals ylimits ypart yscale yscaleO ytick ytick3 ytrans zaxis3 zaxis3At zero zero3 zlimits zpart ztick ztick3 ztrans )) +AND Arc ArcArrow ArcArrows Arrow Arrows Automatic AvantGarde BBox BWRainbow BWRainbow2 Bar Bars BeginArcArrow BeginArrow BeginBar BeginDotMargin BeginMargin BeginPenMargin Blank Bookman Bottom BottomTop Bounds Break Broken BrokenLog Ceil Circle CircleBarIntervalMarker Cos Courier CrossIntervalMarker DefaultFormat DefaultLogFormat Degrees Dir DotMargin DotMargins Dotted Draw Drawline Embed EndArcArrow EndArrow EndBar EndDotMargin EndMargin EndPenMargin Fill FillDraw Floor Format Full Gaussian Gaussrand Gaussrandpair Gradient Grayscale Helvetica Hermite HookHead InOutTicks InTicks J Label Landscape Left LeftRight LeftTicks Legend Linear Link Log LogFormat Margin Margins Mark MidArcArrow MidArrow NOT NewCenturySchoolBook NoBox NoMargin NoModifier NoTicks NoTicks3 NoZero NoZeroFormat None OR OmitFormat OmitTick OutTicks Ox Oy Palatino PaletteTicks Pen PenMargin PenMargins Pentype Portrait RadialShade Rainbow Range Relative Right RightTicks Rotate Round Scale ScaleX ScaleY ScaleZ Seascape Shift Sin Slant Spline StickIntervalMarker Straight Symbol Tan TeXify Ticks Ticks3 TildeIntervalMarker TimesRoman Top TrueMargin UnFill UpsideDown Wheel X XEquals XOR XY XYEquals XYZero XYgrid XZEquals XZZero XZero XZgrid Y YEquals YXgrid YZ YZEquals YZZero YZero YZgrid Z ZX ZXgrid ZYgrid ZapfChancery ZapfDingbats _cputime _draw _eval _image _labelpath _strokepath _texpath aCos aSin aTan abort abs accel acos acosh acot acsc add addArrow addMargins addSaveFunction addnode addnodes addpenarc addpenline addseg adjust alias align all altitude angabscissa angle angpoint animate annotate anticomplementary antipedal apply approximate arc arcarrowsize arccircle arcdir arcfromcenter arcfromfocus arclength arcnodesnumber arcpoint arcsubtended arcsubtendedcenter arctime arctopath array arrow arrow2 arrowbase arrowbasepoints arrowsize asec asin asinh ask assert asy asycode asydir asyfigure asyfilecode asyinclude asywrite atan atan2 atanh atbreakpoint atexit atime attach attract atupdate autoformat autoscale autoscale3 axes axes3 axialshade axis axiscoverage azimuth babel background bangles bar barmarksize barsize basealign baseline bbox beep beginclip begingroup beginpoint between bevel bezier bezierP bezierPP bezierPPP bezulate bibliography bibliographystyle binarytree binarytreeNode binomial binput bins bisector bisectorpoint bispline blend boutput box bqe breakpoint breakpoints brick buildRestoreDefaults buildRestoreThunk buildcycle bulletcolor canonical canonicalcartesiansystem cartesiansystem case1 case2 case3 cbrt cd ceil center centerToFocus centroid cevian change2 changecoordsys checkSegment checkconditionlength checker checklengths checkposition checktriangle choose circle circlebarframe circlemarkradius circlenodesnumber circumcenter circumcircle clamped clear clip clipdraw close cmyk code colatitude collect collinear color colorless colors colorspace comma compassmark complement complementary concat concurrent cone conic conicnodesnumber conictype conj connect containmentTree contains contour contour3 controlSpecifier convert coordinates coordsys copy cos cosh cot countIntersections cputime crop cropcode cross crossframe crosshatch crossmarksize csc csv cubicroots curabscissa curlSpecifier curpoint currentarrow currentexitfunction currentmomarrow currentpolarconicroutine curve cut cutafter cutbefore cyclic cylinder debugger deconstruct defaultdir defaultformat defaultpen defaultspline defined degenerate degrees delete deletepreamble determinant diagonal diamond diffdiv dimension dir dirSpecifier dirtime display distance divisors do_overpaint dot dotframe dotsize downcase draw drawAll drawDoubleLine drawFermion drawGhost drawGluon drawMomArrow drawPhoton drawScalar drawVertex drawVertexBox drawVertexBoxO drawVertexBoxX drawVertexO drawVertexOX drawVertexTriangle drawVertexTriangleO drawVertexX drawarrow drawarrow2 drawline drawtick duplicate elle ellipse ellipsenodesnumber embed embed3 empty enclose endScript endclip endgroup endl endpoint endpoints eof eol equation equations erase erf erfc error errorbar errorbars euler eval excenter excircle exit exitXasyMode exitfunction exp expi expm1 exradius extend extension extouch fabs factorial fermat fft fhorner figure file filecode fill filldraw filloutside fillrule filltype find finite firstcut firstframe fit fixedscaling floor flush fmdefaults fmod focusToCenter font fontcommand fontsize foot format frac frequency fromCenter fromFocus fspline functionshade gamma generate_random_backtrace generateticks gergonne getc getint getpair getreal getstring gettriple gluon gouraudshade graph graphic gray grestore grid grid3 gsave halfbox hatch hdiffdiv hermite hex histogram history hline hprojection hsv hyperbola hyperbolanodesnumber hyperlink hypot identity image incenter incentral incircle increasing incrementposition indexedTransform initXasyMode initdefaults input inradius insert inside interactive interior interp interpolate intersect intersection intersectionpoint intersectionpoints intersections intouch inverse inversion invisible is3D isDuplicate isogonal isogonalconjugate isotomic isotomicconjugate isparabola italic item key kurtosis kurtosisexcess label labelaxis labelmargin labelpath labels labeltick labelx labelx3 labely labely3 labelz labelz3 lastcut latex latitude latticeshade layer layout ldexp leastsquares legend legenditem length lift limits line linear linecap linejoin linemargin lineskip linetype linewidth link list locale locate locatefile location log log10 log1p logaxiscoverage longitude lookup magnetize makeNode makedraw makepen map margin markangle markangleradius markanglespace markarc marker markinterval marknodes markrightangle markuniform mass masscenter massformat math max max3 maxbound maxcoords maxlength maxratio maxtimes mean medial median midpoint min min3 minbound minipage minratio mintimes miterlimit momArrowPath momarrowsize monotonic nativeformat natural needshipout newl newpage newslide newton newtree nextframe nextnormal nextpage nib nodabscissa none normalvideo notaknot numberpage nurb object offset onpath opacity opposite orientation orig_circlenodesnumber orig_circlenodesnumber1 orig_draw orig_ellipsenodesnumber orig_ellipsenodesnumber1 orig_hyperbolanodesnumber orig_parabolanodesnumber origin orthic orthocentercenter outformat outline outprefix output overwrite pack pairs palette parabola parabolanodesnumber parallel partialsum path path3 pattern pause pdf pedal periodic perp perpendicular perpendicularmark phantom photon piecewisestraight point polar polarconicroutine polargraph polygon postcontrol postscript pow10 ppoint prc prc0 precision precontrol prepend print_random_addresses project projection purge pwhermite quadrant quadraticroots quantize quarticroots quotient radialshade radians radicalcenter radicalline radius rand randompath rd read1 read2 read3 readline realmult realquarticroots rectangle rectangular rectify reflect relabscissa relative relativedistance reldir relpoint reltime remainder remark removeDuplicates rename replace report rescale rescale2 resetdefaultpen restore restoredefaults reverse reversevideo rf rfind rgb rgba rgbint rmf rms rotate rotateO rotation round roundbox roundedpath roundrectangle samecoordsys sameside sample save savedefaults saveline scale scale3 scaleO scaleT scaleless scientific search searchtree sec secondaryX secondaryY seconds section sector seek seekeof segment sequence setpens sgn sgnd sharpangle sharpdegrees shift shiftless shipout shipout3 show side simeq simpson sin single sinh size size3 skewness skip slant sleep slope slopefield solve sort sourceline sphere split sqrt square srand standardizecoordsys startScript startTrembling stdev step stickframe stickmarksize stickmarkspace stop straight straightness string stripdirectory stripextension stripfile strokepath subdivide subitem subpath substr sum surface symmedial symmedian system tab tableau tan tangent tangential tangents tanh tell tensionSpecifier tensorshade tex texcolor texify texpath texpreamble texreset texshipout textpath thick thin tick tickMax tickMax3 tickMin tickMin3 ticklabelshift ticklocate tildeframe tildemarksize tile tiling time times title titlepage topbox transform transformation transpose tremble trembleFuzz tremble_circlenodesnumber tremble_circlenodesnumber1 tremble_draw tremble_ellipsenodesnumber tremble_ellipsenodesnumber1 tremble_hyperbolanodesnumber tremble_marknodes tremble_markuniform tremble_parabolanodesnumber triangle triangleAbc triangleabc triangulate tricoef tridiagonal trilinear trim trueMagnetize truepoint tube uncycle unfill uniform unit unitrand unitsize unityroot unstraighten upcase updatefunction upscale uptodate usepackage usersetting usetypescript usleep value variance variancebiased vbox vector vectorfield verbatim view vline vprojection windingnumber word write xaxis xaxis3 xaxis3At xaxisAt xequals xinput xlimits xoutput xpart xscale xscaleO xtick xtick3 xtrans yaxis yaxis3 yaxis3At yaxisAt yequals ylimits ypart yscale yscaleO ytick ytick3 ytrans zaxis3 zaxis3At zero zero3 zlimits zpart ztick ztick3 ztrans )) (defvar asy-variable-name '( -AliceBlue Align Allow AntiqueWhite Apricot Aqua Aquamarine Aspect Azure BeginPoint Beige Bisque Bittersweet Black BlanchedAlmond Blue BlueGreen BlueViolet Both Break BrickRed Brown BurlyWood BurntOrange CCW CW CadetBlue CarnationPink Center Centered Cerulean Chartreuse Chocolate Coral CornflowerBlue Cornsilk Crimson Crop Cyan Dandelion DarkBlue DarkCyan DarkGoldenrod DarkGray DarkGreen DarkKhaki DarkMagenta DarkOliveGreen DarkOrange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkTurquoise DarkViolet DeepPink DeepSkyBlue DefaultHead DimGray DodgerBlue Dotted Draw E ENE EPS ESE Emerald EndPoint Fill FillDraw FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold Goldenrod Gray Green GreenYellow Honeydew HookHead Horizontal HotPink I IgnoreAspect IndianRed Indigo Ivory JOIN_IN JOIN_OUT JungleGreen Khaki Label Lavender LavenderBlush LawnGreen LeftJustified LeftSide LemonChiffon LightBlue LightCoral LightCyan LightGoldenrodYellow LightGreen LightGrey LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSteelBlue LightYellow Lime LimeGreen Linear Linen Log Logarithmic Magenta Mahogany Mark MarkFill Maroon Max MediumAquamarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed Melon MidPoint MidnightBlue Min MintCream MistyRose Moccasin Move MoveQuiet Mulberry N NE NNE NNW NW NavajoWhite Navy NavyBlue NoAlign NoCrop NoFill NoSide OldLace Olive OliveDrab OliveGreen Orange OrangeRed Orchid Ox Oy PaleGoldenrod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip Peach PeachPuff Periwinkle Peru PineGreen Pink Plum PowderBlue ProcessBlue Purple RawSienna Red RedOrange RedViolet Rhodamine RightJustified RightSide RosyBrown RoyalBlue RoyalPurple RubineRed S SE SSE SSW SW SaddleBrown Salmon SandyBrown SeaGreen Seashell Sepia Sienna Silver SimpleHead SkyBlue SlateBlue SlateGray Snow SpringGreen SteelBlue Suppress SuppressQuiet Tan TeXHead Teal TealBlue Thistle Ticksize Tomato Turquoise UnFill VERSION Value Vertical Violet VioletRed W WNW WSW Wheat White WhiteSmoke WildStrawberry XYAlign YAlign Yellow YellowGreen YellowOrange addpenarc addpenline align allowstepping angularsystem animationdelay appendsuffix arcarrowangle arcarrowfactor arrow2sizelimit arrowangle arrowbarb arrowdir arrowfactor arrowhookfactor arrowlength arrowsizelimit arrowtexfactor authorpen axis axiscoverage axislabelfactor background backgroundcolor backgroundpen barfactor barmarksizefactor basealign baselinetemplate beveljoin bigvertexpen bigvertexsize black blue bm bottom bp brown bullet byfoci byvertices camerafactor chartreuse circlemarkradiusfactor circlenodesnumberfactor circleprecision circlescale cm codefile codepen codeskip colorPen coloredNodes coloredSegments conditionlength conicnodesfactor count cputimeformat crossmarksizefactor currentcoordsys currentpatterns currentpen currentpicture currentposition currentprojection curvilinearsystem cuttings cyan darkblue darkbrown darkcyan darkgray darkgreen darkgrey darkmagenta darkolive darkred dashdotted dashed datepen dateskip debuggerlines debugging deepblue deepcyan deepgray deepgreen deepgrey deepmagenta deepred default defaultS defaultbackpen defaultcoordsys defaultfilename defaultformat defaultmassformat defaultpen diagnostics differentlengths dot dotfactor dotframe dotted doublelinepen doublelinespacing down ellipsenodesnumberfactor eps epsgeo epsilon evenodd extendcap fermionpen figureborder figuremattpen firstnode firststep foregroundcolor fuchsia fuzz gapfactor ghostpen gluonamplitude gluonpen gluonratio gray green grey hatchepsilon havepagenumber heavyblue heavycyan heavygray heavygreen heavygrey heavymagenta heavyred hline hwratio hyperbolanodesnumberfactor identity4 ignore inXasyMode inch inches includegraphicscommand incommensurate inf infinity institutionpen intMax intMin invert invisible itempen itemskip itemstep labelmargin landscape lastnode left legendhskip legendlinelength legendmargin legendmarkersize legendmaxrelativewidth legendvskip lightblue lightcyan lightgray lightgreen lightgrey lightmagenta lightolive lightred lightyellow linemargin longdashdotted longdashed magenta magneticPoints magneticRadius mantissaBits markangleradius markangleradiusfactor markanglespace markanglespacefactor mediumblue mediumcyan mediumgray mediumgreen mediumgrey mediummagenta mediumred mediumyellow middle minDistDefault minblockheight minblockwidth mincirclediameter minipagemargin minipagewidth minvertexangle miterjoin mm momarrowfactor momarrowlength momarrowmargin momarrowoffset momarrowpen monoPen morepoints nCircle newbulletcolor ngraph nil nmesh nobasealign nodeMarginDefault nodesystem nomarker nopoint noprimary nullpath nullpen numarray oldbulletcolor olive orange origin overpaint page pageheight pagemargin pagenumberalign pagenumberpen pagenumberposition pagewidth paleblue palecyan palegray palegreen palegrey palemagenta palered paleyellow parabolanodesnumberfactor perpfactor phi photonamplitude photonpen photonratio pi pink plain plus preamblenodes pt purple r3 r4a r4b randMax realDigits realEpsilon realMax realMin red relativesystem reverse right roundcap roundjoin royalblue salmon saveFunctions scalarpen sequencereal settings shipped signedtrailingzero solid springgreen sqrtEpsilon squarecap squarepen startposition stdin stdout stepfraction steppagenumberpen stepping stickframe stickmarksizefactor stickmarkspacefactor textpen ticksize tildeframe tildemarksizefactor tinv titlealign titlepagepen titlepageposition titlepen titleskip top trailingzero treeLevelStep treeMinNodeWidth treeNodeStep trembleAngle trembleFrequency trembleRandom tremblingMode undefined unitcircle unitsquare up urlpen urlskip version vertexpen vertexsize viewportsize vline white wye xformStack yellow ylabelwidth zerotickfuzz zerowinding )) +AliceBlue Align Allow AntiqueWhite Apricot Aqua Aquamarine Aspect Azure BeginPoint Beige Bisque Bittersweet Black BlanchedAlmond Blue BlueGreen BlueViolet Both Break BrickRed Brown BurlyWood BurntOrange CCW CW CadetBlue CarnationPink Center Centered Cerulean Chartreuse Chocolate Coral CornflowerBlue Cornsilk Crimson Crop Cyan Dandelion DarkBlue DarkCyan DarkGoldenrod DarkGray DarkGreen DarkKhaki DarkMagenta DarkOliveGreen DarkOrange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkTurquoise DarkViolet DeepPink DeepSkyBlue DefaultHead DimGray DodgerBlue Dotted Draw E ENE EPS ESE Emerald EndPoint Fill FillDraw FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold Goldenrod Gray Green GreenYellow Honeydew HookHead Horizontal HotPink I IgnoreAspect IndianRed Indigo Ivory JOIN_IN JOIN_OUT JungleGreen Khaki Label Lavender LavenderBlush LawnGreen LeftJustified LeftSide LemonChiffon LightBlue LightCoral LightCyan LightGoldenrodYellow LightGreen LightGrey LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSteelBlue LightYellow Lime LimeGreen Linear Linen Log Logarithmic Magenta Mahogany Mark MarkFill Maroon Max MediumAquamarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed Melon MidPoint MidnightBlue Min MintCream MistyRose Moccasin Move MoveQuiet Mulberry N NE NNE NNW NW NavajoWhite Navy NavyBlue NoAlign NoCrop NoFill NoSide OldLace Olive OliveDrab OliveGreen Orange OrangeRed Orchid Ox Oy PaleGoldenrod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip Peach PeachPuff Periwinkle Peru PineGreen Pink Plum PowderBlue ProcessBlue Purple RawSienna Red RedOrange RedViolet Rhodamine RightJustified RightSide RosyBrown RoyalBlue RoyalPurple RubineRed S SE SSE SSW SW SaddleBrown Salmon SandyBrown SeaGreen Seashell Sepia Sienna Silver SimpleHead SkyBlue SlateBlue SlateGray Snow SpringGreen SteelBlue Suppress SuppressQuiet Tan TeXHead Teal TealBlue Thistle Ticksize Tomato Turquoise UnFill VERSION Value Vertical Violet VioletRed W WNW WSW Wheat White WhiteSmoke WildStrawberry XYAlign YAlign Yellow YellowGreen YellowOrange addpenarc addpenline align allowstepping angularsystem animationdelay appendsuffix arcarrowangle arcarrowfactor arrow2sizelimit arrowangle arrowbarb arrowdir arrowfactor arrowhookfactor arrowlength arrowsizelimit arrowtexfactor authorpen axis axiscoverage axislabelfactor background backgroundcolor backgroundpen barfactor barmarksizefactor basealign baselinetemplate beveljoin bigvertexpen bigvertexsize black blue bm bottom bp brown bullet byfoci byvertices camerafactor chartreuse circlemarkradiusfactor circlenodesnumberfactor circleprecision circlescale cm codefile codepen codeskip colorPen coloredNodes coloredSegments conditionlength conicnodesfactor count cputimeformat crossmarksizefactor currentcoordsys currentpatterns currentpen currentpicture currentposition currentprojection curvilinearsystem cuttings cyan darkblue darkbrown darkcyan darkgray darkgreen darkgrey darkmagenta darkolive darkred dashdotted dashed datepen dateskip debuggerlines debugging deepblue deepcyan deepgray deepgreen deepgrey deepmagenta deepred default defaultS defaultbackpen defaultcoordsys defaultfilename defaultformat defaultmassformat defaultpen diagnostics differentlengths dot dotfactor dotframe dotted doublelinepen doublelinespacing down duplicateFuzz ellipsenodesnumberfactor eps epsgeo epsilon evenodd extendcap fermionpen figureborder figuremattpen firstnode firststep foregroundcolor fuchsia fuzz gapfactor ghostpen gluonamplitude gluonpen gluonratio gray green grey hatchepsilon havepagenumber heavyblue heavycyan heavygray heavygreen heavygrey heavymagenta heavyred hline hwratio hyperbolanodesnumberfactor identity4 ignore inXasyMode inch inches includegraphicscommand incommensurate inf infinity institutionpen intMax intMin invert invisible itempen itemskip itemstep labelmargin landscape lastnode left legendhskip legendlinelength legendmargin legendmarkersize legendmaxrelativewidth legendvskip lightblue lightcyan lightgray lightgreen lightgrey lightmagenta lightolive lightred lightyellow linemargin longdashdotted longdashed magenta magneticPoints magneticRadius mantissaBits markangleradius markangleradiusfactor markanglespace markanglespacefactor mediumblue mediumcyan mediumgray mediumgreen mediumgrey mediummagenta mediumred mediumyellow middle minDistDefault minblockheight minblockwidth mincirclediameter minipagemargin minipagewidth minvertexangle miterjoin mm momarrowfactor momarrowlength momarrowmargin momarrowoffset momarrowpen monoPen morepoints nCircle newbulletcolor ngraph nil nmesh nobasealign nodeMarginDefault nodesystem nomarker nopoint noprimary nullpath nullpen numarray oldbulletcolor olive orange origin overpaint page pageheight pagemargin pagenumberalign pagenumberpen pagenumberposition pagewidth paleblue palecyan palegray palegreen palegrey palemagenta palered paleyellow parabolanodesnumberfactor perpfactor phi photonamplitude photonpen photonratio pi pink plain plus preamblenodes pt purple r3 r4a r4b randMax realDigits realEpsilon realMax realMin red relativesystem reverse right roundcap roundjoin royalblue salmon saveFunctions scalarpen sequencereal settings shipped signedtrailingzero solid springgreen sqrtEpsilon squarecap squarepen startposition stdin stdout stepfraction steppagenumberpen stepping stickframe stickmarksizefactor stickmarkspacefactor textpen ticksize tildeframe tildemarksizefactor tinv titlealign titlepagepen titlepageposition titlepen titleskip top trailingzero treeLevelStep treeMinNodeWidth treeNodeStep trembleAngle trembleFrequency trembleRandom tremblingMode undefined unitcircle unitsquare up urlpen urlskip version vertexpen vertexsize viewportsize vline white wye xformStack yellow ylabelwidth zerotickfuzz zerowinding )) diff --git a/Build/source/utils/asymptote/asymptote.spec b/Build/source/utils/asymptote/asymptote.spec index 460404a4054..bc587b5256b 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: 1.73 +Version: 1.74 Release: 1%{?dist} Summary: Descriptive vector graphics language @@ -27,8 +27,6 @@ Requires: freeglut-devel >= 2.4.0 Requires(post): /usr/bin/texhash /sbin/install-info Requires(postun): /usr/bin/texhash /sbin/install-info -%define texpkgdir %{_texmf}/tex/latex/%{name} - %description Asymptote is a powerful descriptive vector graphics language for technical drawings, inspired by MetaPost but with an improved C++-like syntax. @@ -43,7 +41,7 @@ that LaTeX does for scientific text. %build CFLAGS="`echo $RPM_OPT_FLAGS | sed s/-O2/-O3/`" \ -%configure --with-latex=%{_texmf}/tex/latex/ +%configure --with-latex=%{_texmf}/tex/latex --with-context=%{_texmf}/tex/context/third make %{?_smp_mflags} @@ -75,7 +73,8 @@ fi %doc %{_defaultdocdir}/%{name}/ %{_bindir}/* %{_datadir}/%{name}/ -%{texpkgdir}/ +%{_texmf}/tex/latex/%{name} +%{_texmf}/tex/context/third/%{name} %{_mandir}/man1/*.1* %{_infodir}/*.info* diff --git a/Build/source/utils/asymptote/base/bezulate.asy b/Build/source/utils/asymptote/base/bezulate.asy index c47f3144912..2710996b322 100644 --- a/Build/source/utils/asymptote/base/bezulate.asy +++ b/Build/source/utils/asymptote/base/bezulate.asy @@ -1,6 +1,7 @@ // Bezier triangulation routines written by Orest Shardt, 2008. -private real fuzz = sqrtEpsilon; +private real fuzz=sqrtEpsilon; +real duplicateFuzz=1e-3; // Work around font errors. int countIntersections(path[] p, pair start, pair end) { @@ -46,7 +47,7 @@ path[][] containmentTree(path[] paths) bool isDuplicate(pair a, pair b, real relSize) { - return abs(a-b) <= sqrtEpsilon*relSize; + return abs(a-b) <= duplicateFuzz*relSize; } path removeDuplicates(path p) @@ -101,8 +102,7 @@ void connect(path[] paths, path[] result, path[] patch) // find first intersection of line segment with outer curve path line = start--start+d*direction; real[][] ints=intersections(line,outer,fuzz); - assert(ints.length != 0); - real endtime=ints[0][1]; // endtime is time on outer + real endtime=ints.length > 0 ? ints[0][1] : 0; // endtime is time on outer pair end = point(outer,endtime); line = start--end; path rline = reverse(line); diff --git a/Build/source/utils/asymptote/base/embed.asy b/Build/source/utils/asymptote/base/embed.asy index 3fe3d38720c..5695eadab56 100644 --- a/Build/source/utils/asymptote/base/embed.asy +++ b/Build/source/utils/asymptote/base/embed.asy @@ -1,11 +1,13 @@ -texpreamble(" +if(latex()) { + texpreamble(" \ifx\pdfhorigin\undefined% \usepackage[3D,dvipdfmx]{movie15} \else% \usepackage[3D]{movie15} \fi% "); -usepackage("hyperref","setpagesize=false,unicode"); + usepackage("hyperref","setpagesize=false,unicode"); +} // See http://www.ctan.org/tex-archive/macros/latex/contrib/movie15/README // for documentation of the options. diff --git a/Build/source/utils/asymptote/base/plain_Label.asy b/Build/source/utils/asymptote/base/plain_Label.asy index 77a04deb007..1279880ca3a 100644 --- a/Build/source/utils/asymptote/base/plain_Label.asy +++ b/Build/source/utils/asymptote/base/plain_Label.asy @@ -172,7 +172,7 @@ side operator * (real x, side s) align operator cast(pair dir) {align A; A.init(dir,false); return A;} align operator cast(triple dir) {align A; A.init(dir,false); return A;} align operator cast(side side) {align A; A.init(side.align,true); return A;} -align NoAlign; +restricted align NoAlign; void write(file file=stdout, align align, suffix suffix=endl) { diff --git a/Build/source/utils/asymptote/base/plain_pens.asy b/Build/source/utils/asymptote/base/plain_pens.asy index 88fc112f684..5dba51dbda4 100644 --- a/Build/source/utils/asymptote/base/plain_pens.asy +++ b/Build/source/utils/asymptote/base/plain_pens.asy @@ -174,17 +174,29 @@ void write(file file=stdout, string s="", pen[] p) write(file,s,p[i],endl); } -pen font(string name) +void usetypescript(string s, string encoding="") { - return fontcommand("\font\ASYfont="+name+"\ASYfont"); + texpreamble("\usetypescript["+s+"]["+encoding+"]"); } -pen font(string name, real size) +pen font(string name, string options="") { + // Protect context switchtobodyfont with gsave/grestore to prevent + // misalignment if font is not found. + return fontcommand(settings.tex == "context" ? + "\special{pdf:q}\switchtobodyfont["+name+ + (options == "" ? "" : ","+options)+"]\special{pdf:Q}%" : + "\font\ASYfont="+name+"\ASYfont"); +} + +pen font(string name, real size, string options="") +{ + if(settings.tex == "context") + return fontsize(size)+font(name+","+(string) size+"pt",options); return fontsize(size)+font(name+" at "+(string) size+"pt"); } -pen font(string encoding, string family, string series="m", string shape="n") +pen font(string encoding, string family, string series, string shape) { return fontcommand("\usefont{"+encoding+"}{"+family+"}{"+series+"}{"+shape+ "}"); diff --git a/Build/source/utils/asymptote/base/plain_strings.asy b/Build/source/utils/asymptote/base/plain_strings.asy index 2df4743171f..801e63e83cf 100644 --- a/Build/source/utils/asymptote/base/plain_strings.asy +++ b/Build/source/utils/asymptote/base/plain_strings.asy @@ -136,29 +136,38 @@ string math(string s) return s != "" ? "$"+s+"$" : s; } +private void notimplemented(string text) +{ + abort(text+" is not implemented for the '"+settings.tex+"' TeX engine"); +} + string graphic(string name, string options="") { - if(options != "") options="["+options+"]"; - return "\includegraphics"+options+"{"+name+"}"; + if(latex()) { + if(options != "") options="["+options+"]"; + return "\includegraphics"+options+"{"+name+"}"; + } + if(settings.tex != "context") + notimplemented("graphic"); + return "\externalfigure["+name+"]["+options+"]"; } string minipage(string s, real width=100bp) { if(latex()) return "\begin{minipage}{"+(string) (width*pt)+"pt}"+s+"\end{minipage}"; - write("warning: minipage requires -tex latex or -tex pdflatex"); - return ""; + if(settings.tex != "context") + notimplemented("minipage"); + return "\startframedtext[none][frame=off,width="+(string) (width*pt)+ + "pt]"+s+"\stopframedtext"; } void usepackage(string s, string options="") { - if(latex()) { - string usepackage="\usepackage"; - if(options != "") usepackage += "["+options+"]"; - texpreamble(usepackage+"{"+s+"}"); - return; - } - write("warning: usepackage requires -tex latex or -tex pdflatex"); + if(!latex()) notimplemented("usepackage"); + string usepackage="\usepackage"; + if(options != "") usepackage += "["+options+"]"; + texpreamble(usepackage+"{"+s+"}"); } void pause(string w="Hit enter to continue") diff --git a/Build/source/utils/asymptote/base/three.asy b/Build/source/utils/asymptote/base/three.asy index 7c76714518a..a5a78a77b2a 100644 --- a/Build/source/utils/asymptote/base/three.asy +++ b/Build/source/utils/asymptote/base/three.asy @@ -6,6 +6,7 @@ if(prc0()) { access embed; Embed=embed.embed; Link=embed.link; + if(settings.tex == "context") settings.prc=false; } real defaultshininess=0.25; @@ -14,9 +15,10 @@ real linegranularity=0.01; real tubegranularity=0.003; real dotgranularity=0.0001; pair viewportmargin=0; // Horizontal and vertical viewport margins. -real viewportfactor=1.02; // Factor used to expand orthographic viewport. -real anglefactor=1.02; // Factor used to expand perspective viewport. +real viewportfactor=1.005; // Factor used to expand orthographic viewport. real angleprecision=1e-3; // Precision for centering perspective projections. +real anglefactor=max(1.015,1+angleprecision); + // Factor used to expand perspective viewport. string defaultembed3Doptions; string defaultembed3Dscript; @@ -299,6 +301,13 @@ projection obliqueY(real angle=45) projection oblique=oblique(); projection obliqueX=obliqueX(), obliqueY=obliqueY(), obliqueZ=obliqueZ(); +projection LeftView=orthographic(-X,showtarget=true); +projection RightView=orthographic(X,showtarget=true); +projection FrontView=orthographic(-Y,showtarget=true); +projection BackView=orthographic(Y,showtarget=true); +projection BottomView=orthographic(-Z,showtarget=true); +projection TopView=orthographic(Z,showtarget=true); + currentprojection=perspective(5,4,2); // Map pair z to a triple by inverting the projection P onto the @@ -1790,10 +1799,8 @@ restricted path3 unitsquare3=O--X--X+Y--Y--cycle; path3 circle(triple c, real r, triple normal=Z) { - path3 p=scale3(r)*unitcircle3; - if(normal != Z) - p=align(unit(normal))*p; - return shift(c)*p; + path3 p=normal == Z ? unitcircle3 : align(unit(normal))*unitcircle3; + return shift(c)*scale3(r)*p; } // return an arc centered at c from triple v1 to v2 (assuming |v2-c|=|v1-c|), @@ -1811,10 +1818,14 @@ path3 arc(triple c, triple v1, triple v2, triple normal=O, bool direction=CCW) if(normal == O) abort("explicit normal required for these endpoints"); } - transform3 T=align(unit(normal)); - transform3 Tinv=transpose(T); - v1=Tinv*v1; - v2=Tinv*v2; + transform3 T; + bool align=normal != Z; + if(align) { + T=align(unit(normal)); + transform3 Tinv=transpose(T); + v1=Tinv*v1; + v2=Tinv*v2; + } string invalidnormal="invalid normal vector"; real fuzz=sqrtEpsilon*max(abs(v1),abs(v2)); @@ -1833,7 +1844,9 @@ path3 arc(triple c, triple v1, triple v2, triple normal=O, bool direction=CCW) if(t1 >= t2 && direction) t1 -= n; if(t2 >= t1 && !direction) t2 -= n; - return shift(c)*scale3(r)*T*subpath(unitcircle3,t1,t2); + path3 p=subpath(unitcircle3,t1,t2); + if(align) p=T*p; + return shift(c)*scale3(r)*p; } // return an arc centered at c with radius r from c+r*dir(theta1,phi1) to @@ -2469,7 +2482,7 @@ object embed(string label="", string text=label, transform3 inv=inverse(modelview); if(adjusted) write("adjusting camera to ",tinv*inv*P.camera); - target=inv*P.target; + target=inv*P.target; } P=T*P; } @@ -2590,6 +2603,23 @@ currentpicture.fitter=new frame(string prefix, picture pic, string format, return f; }; +void addViews(picture dest, picture src, bool group=true, + filltype filltype=NoFill, bool above=true) +{ + frame Front=src.fit(FrontView); + add(dest,Front,group,filltype,above); + frame Top=src.fit(TopView); + add(dest,shift(0,min(Front).y-max(Top).y)*Top,group,filltype,above); + frame Right=src.fit(RightView); + add(dest,shift(min(Front).x-max(Right).x)*Right,group,filltype,above); +} + +void addViews(picture src, bool group=true, filltype filltype=NoFill, + bool above=true) +{ + addViews(currentpicture,src,group,filltype,above); +} + // Force an array of 3D pictures to be as least as large as picture all. void rescale3(picture[] pictures, picture all, projection P=currentprojection) { diff --git a/Build/source/utils/asymptote/base/three_surface.asy b/Build/source/utils/asymptote/base/three_surface.asy index 6e540c416ff..f1303d2e973 100644 --- a/Build/source/utils/asymptote/base/three_surface.asy +++ b/Build/source/utils/asymptote/base/three_surface.asy @@ -35,14 +35,6 @@ struct patch { return new real[] {f(P[0][0]),f(P[0][3]),f(P[3][3]),f(P[3][0])}; } - triple[] controlpoints() { - return new triple[] { - P[0][0],P[0][1],P[0][2],P[0][3], - P[1][0],P[1][1],P[1][2],P[1][3], - P[2][0],P[2][1],P[2][2],P[2][3], - P[3][0],P[3][1],P[3][2],P[3][3]}; - } - triple Bu(int j, real u) {return bezier(P[0][j],P[1][j],P[2][j],P[3][j],u);} triple BuP(int j, real u) {return bezierP(P[0][j],P[1][j],P[2][j],P[3][j],u);} triple BuPP(int j, real u) { @@ -145,22 +137,6 @@ struct patch { light.color(normal10(),nocolors ? m : colors[3])}; } - triple bound(real m(real[], real), triple b) { - real x=m(new real[] {P[0][0].x,P[0][1].x,P[0][2].x,P[0][3].x, - P[1][0].x,P[1][1].x,P[1][2].x,P[1][3].x, - P[2][0].x,P[2][1].x,P[2][2].x,P[2][3].x, - P[3][0].x,P[3][1].x,P[3][2].x,P[3][3].x},b.x); - real y=m(new real[] {P[0][0].y,P[0][1].y,P[0][2].y,P[0][3].y, - P[1][0].y,P[1][1].y,P[1][2].y,P[1][3].y, - P[2][0].y,P[2][1].y,P[2][2].y,P[2][3].y, - P[3][0].y,P[3][1].y,P[3][2].y,P[3][3].y},b.y); - real z=m(new real[] {P[0][0].z,P[0][1].z,P[0][2].z,P[0][3].z, - P[1][0].z,P[1][1].z,P[1][2].z,P[1][3].z, - P[2][0].z,P[2][1].z,P[2][2].z,P[2][3].z, - P[3][0].z,P[3][1].z,P[3][2].z,P[3][3].z},b.z); - return (x,y,z); - } - triple min3,max3; bool havemin3,havemax3; @@ -172,13 +148,13 @@ struct patch { triple min(triple bound=P[0][0]) { if(havemin3) return minbound(min3,bound); havemin3=true; - return min3=bound(minbound,bound); + return min3=minbound(P,bound); } triple max(triple bound=P[0][0]) { if(havemax3) return maxbound(max3,bound); havemax3=true; - return max3=bound(maxbound,bound); + return max3=maxbound(P,bound); } triple center() { @@ -186,11 +162,11 @@ struct patch { } pair min(projection P, pair bound=project(this.P[0][0],P.t)) { - return minbound(controlpoints(),P.t,bound); + return minbound(this.P,P.t,bound); } pair max(projection P, pair bound=project(this.P[0][0],P.t)) { - return maxbound(controlpoints(),P.t,bound); + return maxbound(this.P,P.t,bound); } void operator init(triple[][] P, triple[] normals=new triple[], @@ -901,6 +877,45 @@ patch subpatch(patch s, real ua, real va, real ub, real vb) s.straight,s.planar); } +// return an array containing all intersection times of path p and patch s. +real[][] intersections(path3 p, patch s, real fuzz=-1) +{ + return sort(intersections(p,s.P,fuzz)); +} + +// return an array containing all intersection times of path p and surface s. +real[][] intersections(path3 p, surface s, real fuzz=-1) +{ + real[][] T; + if(length(p) < 0) return T; + for(int i=0; i < s.s.length; ++i) + for(real[] s: intersections(p,s.s[i].P,fuzz)) + T.push(s); + + sort(T); + + static real fuzzFactor=10.0; + static real Fuzz=1000.0*realEpsilon; + real fuzz=max(fuzzFactor*fuzz,Fuzz)*abs(max(s)-min(s)); + + // Remove intrapatch duplicate points. + for(int i=0; i < T.length; ++i) { + for(int j=i+1; j < T.length;) { + if(abs(point(p,i)-point(p,j)) < fuzz) + T.delete(j); + else ++j; + } + } + return T; +} + +// return an array containing all intersection points of path p and surface s. +triple[] intersectionpoints(path3 p, surface s, real fuzz=-1) +{ + real[][] t=intersections(p,s,fuzz); + return sequence(new triple(int i) {return point(p,t[i][0]);},t.length); +} + triple point(patch s, real u, real v) { return s.point(u,v); @@ -1152,6 +1167,12 @@ void label(picture pic=currentpicture, Label L, triple position, path[] g=texpath(L); if(g.length == 0 || (g.length == 1 && size(g[0]) == 0)) return; pic.add(new void(frame f, transform3 t, picture pic, projection P) { + // Handle relative projected 3D alignments. + Label L=L.copy(); + if(!align.is3D && L.align.relative && L.align.dir3 != O && + determinant(P.t) != 0) + L.align(L.align.dir*unit(project(L.align.dir3,P.t))); + triple v=t*position; if(L.defaulttransform3) L.T3=transform3(P); @@ -1181,20 +1202,21 @@ void label(picture pic=currentpicture, Label L, triple position, void label(picture pic=currentpicture, Label L, path3 g, align align=NoAlign, pen p=currentpen) { - Label L=Label(L,align,p); + Label L=L.copy(); + L.align(align); + L.p(p); bool relative=L.position.relative; real position=L.position.position.x; - pair Align=L.align.dir; - bool alignrelative=L.align.relative; if(L.defaultposition) {relative=true; position=0.5;} if(relative) position=reltime(g,position); if(L.align.default) { - alignrelative=true; - Align=position <= 0 ? S : position >= length(g) ? N : E; + align a; + a.init(-I*(position <= sqrtEpsilon ? S : + position >= length(g)-sqrtEpsilon ? N : E),relative=true); + a.dir3=dir(g,position); // Pass 3D direction via unused field. + L.align(a); } - label(pic,L,point(g,position), - alignrelative && determinant(currentprojection.t) != 0 ? - -Align*project(dir(g,position),currentprojection.t)*I : L.align); + label(pic,L,point(g,position)); } surface extrude(Label L, triple axis=Z) diff --git a/Build/source/utils/asymptote/base/version.asy b/Build/source/utils/asymptote/base/version.asy index 6f560eb187d..0a43cd5ee23 100644 --- a/Build/source/utils/asymptote/base/version.asy +++ b/Build/source/utils/asymptote/base/version.asy @@ -1 +1 @@ -string VERSION="1.73"; +string VERSION="1.74"; diff --git a/Build/source/utils/asymptote/config.h.in b/Build/source/utils/asymptote/config.h.in index ef1b416889a..29260eaf7d8 100644 --- a/Build/source/utils/asymptote/config.h.in +++ b/Build/source/utils/asymptote/config.h.in @@ -66,6 +66,9 @@ /* Define to 1 if you have the `readline' library (-lreadline). */ #undef HAVE_LIBREADLINE +/* Define to 1 if you have the `rt' library (-lrt). */ +#undef HAVE_LIBRT + /* Define to 1 if you have the `sigsegv' library (-lsigsegv). */ #undef HAVE_LIBSIGSEGV diff --git a/Build/source/utils/asymptote/configure b/Build/source/utils/asymptote/configure index e96dd617ddb..ce3c074e5bb 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 1.73. +# Generated by GNU Autoconf 2.63 for Asymptote 1.74. # # 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='1.73' -PACKAGE_STRING='Asymptote 1.73' +PACKAGE_VERSION='1.74' +PACKAGE_STRING='Asymptote 1.74' PACKAGE_BUGREPORT='http://sourceforge.net/projects/asymptote' # Factoring default headers for most tests. @@ -659,6 +659,7 @@ CXXFLAGS CXX LEX_OUTPUT_ROOT LEX +contextdir latexdir TEXI2DVI kpsewhich @@ -715,6 +716,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking with_latex +with_context with_docdir enable_tetex_build enable_gc @@ -1290,7 +1292,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 1.73 to adapt to many kinds of systems. +\`configure' configures Asymptote 1.74 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1351,7 +1353,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Asymptote 1.73:";; + short | recursive ) echo "Configuration of Asymptote 1.74:";; esac cat <<\_ACEOF @@ -1372,6 +1374,7 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-latex=PATH specify path to LaTeX installation + --with-context=PATH specify path to ConTeXt installation --with-docdir=PATH alternate documentation installation directory Some influential environment variables: @@ -1458,7 +1461,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Asymptote configure 1.73 +Asymptote configure 1.74 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1472,7 +1475,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 1.73, which was +It was created by Asymptote $as_me 1.74, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -3925,6 +3928,61 @@ fi fi + +# Check whether --with-context was given. +if test "${with_context+set}" = set; then + withval=$with_context; if test "x$withval" != "x" ; then + contextdir=$withval + fi + +else + +# Extract the first word of "kpsewhich", so it can be a program name with args. +set dummy kpsewhich; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_kpsewhich+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$kpsewhich"; then + ac_cv_prog_kpsewhich="$kpsewhich" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_kpsewhich="true" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +kpsewhich=$ac_cv_prog_kpsewhich +if test -n "$kpsewhich"; then + { $as_echo "$as_me:$LINENO: result: $kpsewhich" >&5 +$as_echo "$kpsewhich" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test "x$kpsewhich" = "xtrue"; then + contextdir=`kpsewhich -expand-var='$TEXMFLOCAL'/tex/context/third` +else + contextdir=$prefix/share/texmf/tex/context/third +fi + +fi + + for ac_prog in texi2dvi texi2dvi4a2ps do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -3970,9 +4028,13 @@ done latexdir=$latexdir/asymptote +contextdir=$contextdir/asymptote { $as_echo "$as_me:$LINENO: Using $latexdir for LaTeX style file" >&5 $as_echo "$as_me: Using $latexdir for LaTeX style file" >&6;} +{ $as_echo "$as_me:$LINENO: Using $contextdir for ConTeXT style file" >&5 +$as_echo "$as_me: Using $contextdir for ConTeXT style file" >&6;} + @@ -7475,6 +7537,81 @@ _ACEOF fi +{ $as_echo "$as_me:$LINENO: checking for sched_yield in -lrt" >&5 +$as_echo_n "checking for sched_yield in -lrt... " >&6; } +if test "${ac_cv_lib_rt_sched_yield+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); +int +main () +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_rt_sched_yield=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_rt_sched_yield=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_rt_sched_yield" >&5 +$as_echo "$ac_cv_lib_rt_sched_yield" >&6; } +if test "x$ac_cv_lib_rt_sched_yield" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBRT 1 +_ACEOF + + LIBS="-lrt $LIBS" + +fi + + { $as_echo "$as_me:$LINENO: checking for rl_completion_matches in -lreadline" >&5 $as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; } @@ -11338,7 +11475,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 1.73, which was +This file was extended by Asymptote $as_me 1.74, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11397,7 +11534,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -Asymptote config.status 1.73 +Asymptote config.status 1.74 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 8d69537dddc..6e602165712 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],[1.73],[http://sourceforge.net/projects/asymptote]) +AC_INIT([Asymptote],[1.74],[http://sourceforge.net/projects/asymptote]) VERSION=$PACKAGE_VERSION AC_SUBST(VERSION) @@ -20,7 +20,8 @@ test "$Datadir" = '${prefix}/share' && Datadir=$prefix/share AC_SUBST(Datadir) AC_ARG_WITH(latex, - [ --with-latex=PATH specify path to LaTeX installation ], + [AS_HELP_STRING(--with-latex=PATH, + specify path to LaTeX installation)], [if test "x$withval" != "x" ; then latexdir=$withval fi @@ -36,14 +37,32 @@ else fi ]) +AC_ARG_WITH(context, + [AS_HELP_STRING(--with-context=PATH, + specify path to ConTeXt installation)], + [if test "x$withval" != "x" ; then + contextdir=$withval + fi + ],[ +AC_CHECK_PROG(kpsewhich,kpsewhich,true) +if test "x$kpsewhich" = "xtrue"; then + contextdir=`kpsewhich -expand-var='$TEXMFLOCAL'/tex/context/third` +else + contextdir=$prefix/share/texmf/tex/context/third +fi +]) + AC_CHECK_PROGS(TEXI2DVI,[texi2dvi texi2dvi4a2ps]) AC_SUBST(TEXI2DVI) latexdir=$latexdir/asymptote +contextdir=$contextdir/asymptote AC_MSG_NOTICE([Using $latexdir for LaTeX style file]) +AC_MSG_NOTICE([Using $contextdir for ConTeXT style file]) AC_SUBST(latexdir) +AC_SUBST(contextdir) docdir=$Datadir/doc/asymptote @@ -199,6 +218,7 @@ AC_CHECK_LIB([m], [sqrt]) AC_CHECK_LIB([z], [deflate]) AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([sigsegv], [stackoverflow_install_handler]) +AC_CHECK_LIB([rt], [sched_yield]) AC_CHECK_LIB([readline], [rl_completion_matches],, AC_MSG_NOTICE(*** Could not find GNU readline 4.2 or later: will compile without readline support ***)) @@ -277,7 +297,7 @@ AC_C_CONST AC_C_INLINE AC_TYPE_SIGNAL -AC_DEFUN(AC_FUNC_STRPTIME, [ +AC_DEFUN([ac_FUNC_STRPTIME], [ AC_CHECK_FUNCS(strptime) AC_MSG_CHECKING(for strptime declaration in time.h) AC_EGREP_HEADER(strptime, time.h, [ @@ -290,7 +310,7 @@ AC_DEFUN(AC_FUNC_STRPTIME, [ AC_FUNC_FORK AC_CHECK_FUNCS([dup2 floor memset pow sqrt strchr tgamma]) AC_FUNC_STRFTIME -AC_FUNC_STRPTIME +ac_FUNC_STRPTIME AC_FUNC_ERROR_AT_LINE AC_FUNC_FSEEKO diff --git a/Build/source/utils/asymptote/doc/Makefile.in b/Build/source/utils/asymptote/doc/Makefile.in index 93aba13dfe8..bf26747579e 100644 --- a/Build/source/utils/asymptote/doc/Makefile.in +++ b/Build/source/utils/asymptote/doc/Makefile.in @@ -48,7 +48,7 @@ options: ../settings.cc $(ASY) -h 2>&1 | grep -iv Asymptote > options asy.1: options asy.1.begin asy.1.end - cat options | grep \^- | sed -e "s/-\(.*\) \([A-Z].*\)/.TP\n.B -\1\n\2\./" | sed -e "/^.B/ s/-/\\\\-/g" | cat asy.1.begin - asy.1.end > asy.1 + cat options | grep \^- | sed -e "s/-\(.*\) \([a-zA-Z].*\)/.TP\n.B -\1\n\2\./" | sed -e "/^.B/ s/-/\\\\-/g" | cat asy.1.begin - asy.1.end > asy.1 asymptote.dvi: $(SOURCE) $(ASYFILES:.asy=.eps) ln -sf asymptote.texi asymptote_.texi diff --git a/Build/source/utils/asymptote/doc/asy.1 b/Build/source/utils/asymptote/doc/asy.1 index 0e3cfed6d67..d0699897509 100644 --- a/Build/source/utils/asymptote/doc/asy.1 +++ b/Build/source/utils/asymptote/doc/asy.1 @@ -198,7 +198,9 @@ Scroll standard output n lines at a time [0]. .TP .B \-tabcompletion Interactive prompt auto-completion [true]. --tex engine latex|pdflatex|xelatex|tex|pdftex|none [latex] +.TP +.B \-tex engine +latex|pdflatex|xelatex|tex|pdftex|context|none [latex]. .TP .B \-thick Render thick 3D lines [true]. @@ -225,7 +227,7 @@ Use two-sided 3D lighting model for rendering [true]. General purpose user string. .TP .B \-v,\-verbose -Increase verbosity level [0]. +Increase verbosity level (can specify multiple times) [0]. .TP .B \-version Show version; command-line only. diff --git a/Build/source/utils/asymptote/doc/asymptote.texi b/Build/source/utils/asymptote/doc/asymptote.texi index 2c4872fd8e7..b04a940decb 100644 --- a/Build/source/utils/asymptote/doc/asymptote.texi +++ b/Build/source/utils/asymptote/doc/asymptote.texi @@ -1397,7 +1397,7 @@ and @code{rainbow.asy}. @cindex function shading @cindex @code{functionshade} More general shading possibilities are available with the @code{pdflatex}, -@code{xetex}, and @code{pdftex} @TeX{} engines: the routine +@code{context}, and @code{pdftex} @TeX{} engines: the routine @verbatim void functionshade(picture pic=currentpicture, path[] g, bool stroke=false, pen fillrule=currentpen, string shader); @@ -2324,7 +2324,7 @@ path times along @code{p} and @code{q}, in the sense of @code{point(path, real)}, for one such intersection point (as chosen by the algorithm described on page 137 of @code{The MetaFontbook}). The computations are performed to the absolute error specified by @code{fuzz}, -or, if @code{fuzz < 0}, to machine precision. If the paths do not +or if @code{fuzz < 0}, to machine precision. If the paths do not intersect, return a real array of length 0. @cindex @code{intersections} @@ -2332,7 +2332,7 @@ intersect, return a real array of length 0. Return all (unless there are infinitely many) intersection times of paths @code{p} and @code{q} as a sorted array of real arrays of length 2 (@pxref{sort}). The computations are performed to the absolute error -specified by @code{fuzz}, or, if @code{fuzz < 0}, to machine precision. +specified by @code{fuzz}, or if @code{fuzz < 0}, to machine precision. @cindex @code{intersections} @item real[] intersections(path p, explicit pair a, explicit pair b, @@ -2340,7 +2340,7 @@ specified by @code{fuzz}, or, if @code{fuzz < 0}, to machine precision. Return all (unless there are infinitely many) intersection times of path @code{p} with the (infinite) line through points @code{a} and @code{b} as a sorted array. The intersections returned are guaranteed to be -correct to within the absolute error specified by @code{fuzz}, or, if +correct to within the absolute error specified by @code{fuzz}, or if @code{fuzz < 0}, to machine precision. @cindex @code{times} @@ -2377,7 +2377,7 @@ returns an array containing all intersection points of the paths @cindex @code{extension} @item pair extension(pair P, pair Q, pair p, pair q); returns the intersection point of the extensions of the line segments -@code{P--Q} and @code{p--q}, or, if the lines are parallel, +@code{P--Q} and @code{p--q}, or if the lines are parallel, @code{(infinity,infinity)}. @cindex @code{cut} @@ -2860,7 +2860,7 @@ skip of a pen can be examined with the routines @cindex @code{font command} @item A pen using a specific @code{LaTeX} @code{NFSS} font is returned by calling the function @code{pen font(string encoding, string family, -string series="m", string shape="n")}. The default setting, +string series, string shape)}. The default setting, @code{font("OT1","cmr","m","n")}, corresponds to 12pt Computer Modern Roman; this may be changed with @code{defaultpen(pen)}. The font setting of a pen is returned by @@ -6189,7 +6189,7 @@ This module provides an interface to the @code{LaTeX} package @noindent for embedding movies, sounds, and 3D objects into a @acronym{PDF} document. @noindent -@cindex @code{XeLaTeX} +@cindex @code{xelatex} However, @code{XeLaTeX} users need to rename the modified version @code{movie15_dvipdfmx.sty} from @quotation @@ -6270,7 +6270,7 @@ To use Cyrillic fonts, you will need to change the font encoding: @verbatim import unicode; texpreamble("\usepackage{mathtext}\usepackage[russian]{babel}"); -defaultpen(font("T2A","cmr")); +defaultpen(font("T2A","cmr","m","n")); @end verbatim @noindent @cindex Chinese @@ -7704,6 +7704,31 @@ autoadjust,center)}. The default projection, @code{currentprojection}, is initially set to @code{perspective(5,4,2)}. +@cindex @code{LeftView} +@cindex @code{RightView} +@cindex @code{FrontView} +@cindex @code{BackView} +@cindex @code{BottomView} +@cindex @code{TopView} +We also define standard orthographic views used in technical drawing: +@verbatim +projection LeftView=orthographic(-X,showtarget=true); +projection RightView=orthographic(X,showtarget=true); +projection FrontView=orthographic(-Y,showtarget=true); +projection BackView=orthographic(Y,showtarget=true); +projection BottomView=orthographic(-Z,showtarget=true); +projection TopView=orthographic(Z,showtarget=true); +@end verbatim +@noindent +The function +@verbatim +void addViews(picture dest=currentpicture, picture src, bool group=true, + filltype filltype=NoFill, bool above=true); +@end verbatim +@noindent +adds picture @code{pic} as seen with @code{FrontView} aligned above the +projection @code{TopView} and to the right of the projection @code{RightView}. + A triple or path3 can be projected to a pair or path, with @code{project(triple, projection P=currentprojection)} or @code{project(path3, projection P=currentprojection)}. @@ -7829,7 +7854,24 @@ Three-dimensional versions of the path functions @code{length}, @code{arclength}, @code{arctime}, @code{reverse}, @code{subpath}, @code{intersect}, @code{intersections}, @code{intersectionpoint}, @code{intersectionpoints}, @code{min}, @code{max}, @code{cyclic}, and -@code{straight} are also defined. +@code{straight} are also defined. + +The routine +@cindex @code{intersections} +@verbatim +real[][] intersections(path3 p, surface s, real fuzz=-1); +@end verbatim +@noindent +returns the intersection times of a path @code{p} with a surface +@code{s} as a sorted array of real arrays of length 2, and +@cindex @code{intersectionpoints} +@verbatim +triple[] intersectionpoints(path3 p, surface s, real fuzz=-1); +@end verbatim +@noindent +returns the corresponding intersection points. +Here, the computations are performed to the absolute error specified by +@code{fuzz}, or if @code{fuzz < 0}, to machine precision. Here is an example showing all five guide3 connectors: @verbatiminclude join3.asy @@ -8520,10 +8562,15 @@ at the beginning of the configuration file, it can contain arbitrary @cindex @code{render} @cindex @code{antialias} @cindex @code{size} +@cindex @code{latex} +@cindex @code{tex} +@cindex @code{pdflatex} +@cindex @code{xelatex} +@cindex @code{context} @anchor{convert} The default output format is @acronym{EPS} for the (default) -@code{latex} tex engine and @acronym{PDF} for the @code{pdflatex} and -@code{xelatex} tex engines. +@code{latex} and @code{tex} tex engine and @acronym{PDF} for the +@code{pdflatex}, @code{xelatex}, and @code{context} tex engines. Alternative output formats may be produced using the @code{-f} option (or @code{outformat} setting). The optional setting @code{-render n} requests an output resolution of @code{n} pixels per @code{bp}. Antialiasing is @@ -9149,5 +9196,7 @@ Melenchuk, Martin Wiebusch, and Stefan Knorr. @c LocalWords: minblockwidth minblockheight mincirclediameter nonassociative @c LocalWords: nonintegral gettriple enablerepo hexidecimal XeLaTeX xelatex @c LocalWords: dvipdfmx autoadjust viewportsize viewportwidth viewportheight -@c LocalWords: subregions nonsimply functionshade xetex shader floatingdisk -@c LocalWords: functionshading nonselfintersecting +@c LocalWords: subregions nonsimply functionshade shader floatingdisk TopView +@c LocalWords: functionshading nonselfintersecting maxlength LeftView +@c LocalWords: vectorfieldsphere RightView FrontView BackView BottomView +@c LocalWords: addViews diff --git a/Build/source/utils/asymptote/doc/colo-asy.tex b/Build/source/utils/asymptote/doc/colo-asy.tex new file mode 100644 index 00000000000..a9f2a9b636c --- /dev/null +++ b/Build/source/utils/asymptote/doc/colo-asy.tex @@ -0,0 +1,84 @@ +%D \module +%D [ file=colo-asy, +%D version=2009.05.20, +%D title=\CONTEXT\ Color Macros, +%D subtitle=\asymptote\ Colors, +%D author=\asymptote\ developers, +%D date=\currentdate, +%D copyright={put something here}] +%C +%C any copyright notice may go here + +% call with \setupcolor[asy] + +\definecolor [cyan] [c=1.00,m=0.00,y=0.00,k=0.00] +\definecolor [magenta] [c=0.00,m=1.00,y=0.00,k=0.00] +\definecolor [yellow] [c=0.00,m=0.00,y=1.00,k=0.00] +\definecolor [black] [c=0.00,m=0.00,y=0.00,k=1.00] + +\definecolor [white] [c=0.00,m=0.00,y=0.00,k=0.00] +\definecolor [gray] [c=0.00,m=0.00,y=0.00,k=0.50] + +\definecolor [red] [c=0.00,m=1.00,y=1.00,k=0.00] +\definecolor [green] [c=1.00,m=0.00,y=1.00,k=0.00] +\definecolor [blue] [c=1.00,m=1.00,y=0.00,k=0.00] + +\definecolor [palered] [c=0.00,m=0.25,y=0.25,k=0.00] +\definecolor [palegreen] [c=0.25,m=0.00,y=0.25,k=0.00] +\definecolor [paleblue] [c=0.25,m=0.25,y=0.00,k=0.00] +\definecolor [palecyan] [c=0.25,m=0.00,y=0.00,k=0.00] +\definecolor [palemagenta] [c=0.00,m=0.25,y=0.00,k=0.00] +\definecolor [paleyellow] [c=0.00,m=0.00,y=0.25,k=0.00] +\definecolor [palegray] [c=0.00,m=0.00,y=0.00,k=0.05] +\definecolor [lightred] [c=0.00,m=0.50,y=0.50,k=0.00] +\definecolor [lightgreen] [c=0.50,m=0.00,y=0.50,k=0.00] +\definecolor [lightblue] [c=0.50,m=0.50,y=0.00,k=0.00] +\definecolor [lightcyan] [c=0.50,m=0.00,y=0.00,k=0.00] +\definecolor [lightmagenta] [c=0.00,m=0.50,y=0.00,k=0.00] +\definecolor [lightyellow] [c=0.00,m=0.00,y=0.50,k=0.00] +\definecolor [lightgray] [c=0.00,m=0.00,y=0.00,k=0.10] +\definecolor [mediumred] [c=0.00,m=0.75,y=0.75,k=0.00] +\definecolor [mediumgreen] [c=0.75,m=0.00,y=0.75,k=0.00] +\definecolor [mediumblue] [c=0.75,m=0.75,y=0.00,k=0.00] +\definecolor [mediumcyan] [c=0.75,m=0.00,y=0.00,k=0.00] +\definecolor [mediummagenta] [c=0.00,m=0.75,y=0.00,k=0.00] +\definecolor [mediumyellow] [c=0.00,m=0.00,y=0.75,k=0.00] +\definecolor [mediumgray] [c=0.00,m=0.00,y=0.00,k=0.25] +\definecolor [heavyred] [c=0.00,m=1.00,y=1.00,k=0.25] +\definecolor [heavygreen] [c=1.00,m=0.00,y=1.00,k=0.25] +\definecolor [heavyblue] [c=1.00,m=1.00,y=0.00,k=0.25] +\definecolor [heavycyan] [c=1.00,m=0.00,y=0.00,k=0.25] +\definecolor [heavymagenta] [c=0.00,m=1.00,y=0.00,k=0.25] +\definecolor [lightolive] [c=0.00,m=0.00,y=1.00,k=0.25] +\definecolor [heavygray] [c=0.00,m=0.00,y=0.00,k=0.75] +\definecolor [deepred] [c=0.00,m=1.00,y=1.00,k=0.50] +\definecolor [deepgreen] [c=1.00,m=0.00,y=1.00,k=0.50] +\definecolor [deepblue] [c=1.00,m=1.00,y=0.00,k=0.50] +\definecolor [deepcyan] [c=1.00,m=0.00,y=0.00,k=0.50] +\definecolor [deepmagenta] [c=0.00,m=1.00,y=0.00,k=0.50] +\definecolor [olive] [c=0.00,m=0.00,y=1.00,k=0.50] +\definecolor [deepgray] [c=0.00,m=0.00,y=0.00,k=0.90] +\definecolor [darkred] [c=0.00,m=1.00,y=1.00,k=0.75] +\definecolor [darkgreen] [c=1.00,m=0.00,y=1.00,k=0.75] +\definecolor [darkblue] [c=1.00,m=1.00,y=0.00,k=0.75] +\definecolor [darkcyan] [c=1.00,m=0.00,y=0.00,k=0.75] +\definecolor [darkmagenta] [c=0.00,m=1.00,y=0.00,k=0.75] +\definecolor [darkolive] [c=0.00,m=0.00,y=1.00,k=0.75] +\definecolor [darkgray] [c=0.00,m=0.00,y=0.00,k=0.95] +\definecolor [orange] [c=0.00,m=0.50,y=1.00,k=0.00] +\definecolor [fuchsia] [c=0.00,m=1.00,y=0.50,k=0.00] +\definecolor [chartreuse] [c=0.50,m=0.00,y=1.00,k=0.00] +\definecolor [springgreen] [c=1.00,m=0.00,y=0.50,k=0.00] +\definecolor [purple] [c=0.50,m=1.00,y=0.00,k=0.00] +\definecolor [royalblue] [c=1.00,m=0.50,y=0.00,k=0.00] +\definecolor [salmon] [c=0.00,m=0.50,y=0.50,k=0.00] +\definecolor [brown] [c=0.00,m=1.00,y=1.00,k=0.50] +\definecolor [darkbrown] [c=0.00,m=1.00,y=1.00,k=0.75] +\definecolor [pink] [c=0.00,m=0.25,y=0.00,k=0.00] +\definecolor [palegrey] [c=0.00,m=0.00,y=0.00,k=0.05] +\definecolor [lightgrey] [c=0.00,m=0.00,y=0.00,k=0.10] +\definecolor [mediumgrey] [c=0.00,m=0.00,y=0.00,k=0.25] +\definecolor [grey] [c=0.00,m=0.00,y=0.00,k=0.50] +\definecolor [heavygrey] [c=0.00,m=0.00,y=0.00,k=0.50] +\definecolor [deepgrey] [c=0.00,m=0.00,y=0.00,k=0.90] +\definecolor [darkgrey] [c=0.00,m=0.00,y=0.00,k=0.95] diff --git a/Build/source/utils/asymptote/doc/latexusage.tex b/Build/source/utils/asymptote/doc/latexusage.tex index 5c10c4f83d9..6cbd1cb2a75 100644 --- a/Build/source/utils/asymptote/doc/latexusage.tex +++ b/Build/source/utils/asymptote/doc/latexusage.tex @@ -81,6 +81,7 @@ the \verb+{attach=true}+ option: \begin{center} \begin{asy}[height=4cm,attach=false] import three; +currentprojection=orthographic(5,4,2); draw(unitcube,blue); label("$V-E+F=2$",(0,1,0.5),3Y,blue+fontsize(17)); \end{asy} diff --git a/Build/source/utils/asymptote/doc/options b/Build/source/utils/asymptote/doc/options index 48d821dfa40..dffc98eb199 100644 --- a/Build/source/utils/asymptote/doc/options +++ b/Build/source/utils/asymptote/doc/options @@ -58,7 +58,7 @@ Options (negate by replacing - with -no): -safe Disable system call [true] -scroll n Scroll standard output n lines at a time [0] -tabcompletion Interactive prompt auto-completion [true] --tex engine latex|pdflatex|xelatex|tex|pdftex|none [latex] +-tex engine latex|pdflatex|xelatex|tex|pdftex|context|none [latex] -thick Render thick 3D lines [true] -thin Render thin 3D lines [true] -threads Use POSIX threads for 3D rendering [true] @@ -67,7 +67,7 @@ Options (negate by replacing - with -no): -twice Run LaTeX twice (to resolve references) [false] -twosided Use two-sided 3D lighting model for rendering [true] -u,-user string General purpose user string --v,-verbose Increase verbosity level [0] +-v,-verbose Increase verbosity level (can specify multiple times) [0] -version Show version; command-line only -wait Wait for child processes to finish before exiting [false] -where Show where listed variables are declared [false] diff --git a/Build/source/utils/asymptote/drawclipbegin.h b/Build/source/utils/asymptote/drawclipbegin.h index 5bc2d1f7c37..55862b35c23 100644 --- a/Build/source/utils/asymptote/drawclipbegin.h +++ b/Build/source/utils/asymptote/drawclipbegin.h @@ -58,14 +58,16 @@ public: if(gsave) out->gsave(); if(empty()) return true; - out->verbatim(settings::beginpicture(out->texengine)); - out->verbatim("("); - double width=bpath.right-bpath.left; - double height=bpath.top-bpath.bottom; - out->write(width*ps2tex); - out->verbatim(","); - out->write(height*ps2tex); - out->verbatimline(")%"); + if(!settings::context(out->texengine)) { + out->verbatim(settings::beginpicture(out->texengine)); + out->verbatim("("); + double width=bpath.right-bpath.left; + double height=bpath.top-bpath.bottom; + out->write(width*ps2tex); + out->verbatim(","); + out->write(height*ps2tex); + out->verbatimline(")%"); + } out->beginspecial(); out->beginraw(); diff --git a/Build/source/utils/asymptote/drawfill.h b/Build/source/utils/asymptote/drawfill.h index 71e2c9042c2..14666d1df5f 100644 --- a/Build/source/utils/asymptote/drawfill.h +++ b/Build/source/utils/asymptote/drawfill.h @@ -166,8 +166,10 @@ public: drawFunctionShade(const vm::array& src, bool stroke, pen pentype, const string& shader) : drawFill(src,stroke,pentype), shader(shader) { - if(!settings::pdf(settings::getSetting<string>("tex"))) - reportError("functionshade requires -tex pdftex or -tex pdflatex"); + string texengine=settings::getSetting<string>("tex"); + if(!settings::pdf(texengine)) + reportError("functionshade is not implemented for the '"+texengine+ + "' tex engine"); } virtual ~drawFunctionShade() {} diff --git a/Build/source/utils/asymptote/drawlayer.h b/Build/source/utils/asymptote/drawlayer.h index 05876afdfd0..2c16de74500 100644 --- a/Build/source/utils/asymptote/drawlayer.h +++ b/Build/source/utils/asymptote/drawlayer.h @@ -30,7 +30,9 @@ public: bool islabel() {return true;} bool write(texfile *out, const bbox&) { - out->verbatimline("\\newpage"); + out->verbatimline(settings::latex(out->texengine) ? "\\newpage" : + settings::context(out->texengine) ? "}\\eject\\hbox{%" : + "\\eject"); return true; } }; diff --git a/Build/source/utils/asymptote/examples/basealign.asy b/Build/source/utils/asymptote/examples/basealign.asy new file mode 100644 index 00000000000..8a34bdab4b7 --- /dev/null +++ b/Build/source/utils/asymptote/examples/basealign.asy @@ -0,0 +1,41 @@ +import fontsize; +import three; +currentprojection=orthographic(Z); + +defaultpen(fontsize(100pt)); + +dot(O); + +label("acg",O,align=N,basealign); +label("ace",O,align=N,red); +label("acg",O,align=S,basealign); +label("ace",O,align=S,red); +label("acg",O,align=E,basealign); +label("ace",O,align=E,red); +label("acg",O,align=W,basealign); +label("ace",O,align=W,red); + +picture pic; +dot(pic,(labelmargin(),0,0),blue); +dot(pic,(-labelmargin(),0,0),blue); +dot(pic,(0,labelmargin(),0),blue); +dot(pic,(0,-labelmargin(),0),blue); +add(pic,O); + +dot((0,0)); + +label("acg",(0,0),align=N,basealign); +label("ace",(0,0),align=N,red); +label("acg",(0,0),align=S,basealign); +label("ace",(0,0),align=S,red); +label("acg",(0,0),align=E,basealign); +label("ace",(0,0),align=E,red); +label("acg",(0,0),align=W,basealign); +label("ace",(0,0),align=W,red); + +picture pic; +dot(pic,(labelmargin(),0),blue); +dot(pic,(-labelmargin(),0),blue); +dot(pic,(0,labelmargin()),blue); +dot(pic,(0,-labelmargin()),blue); +add(pic,(0,0)); diff --git a/Build/source/utils/asymptote/examples/contextfonts.asy b/Build/source/utils/asymptote/examples/contextfonts.asy new file mode 100644 index 00000000000..d64d4e58e57 --- /dev/null +++ b/Build/source/utils/asymptote/examples/contextfonts.asy @@ -0,0 +1,8 @@ +settings.tex="context"; + +usetypescript("iwona","ec"); +usetypescript("antykwa-torunska","t5"); + +label("$A$",0,N,font("iwona")); +label("$A$",0,S,font("antykwa")+red); + diff --git a/Build/source/utils/asymptote/examples/floor.asy b/Build/source/utils/asymptote/examples/floor.asy index 96e71812c01..02c2446abe8 100644 --- a/Build/source/utils/asymptote/examples/floor.asy +++ b/Build/source/utils/asymptote/examples/floor.asy @@ -22,7 +22,7 @@ bool3 branch(real x) { }; draw(graph(Floor,-5.5,5.5,500,branch)); -axes("$x$","$\lfloor x\rfloor$",red); +axes("$x$",rotate(0)*"$\lfloor x\rfloor$",red); dot(Close); dot(Open,UnFill); diff --git a/Build/source/utils/asymptote/examples/pathintersectsurface.asy b/Build/source/utils/asymptote/examples/pathintersectsurface.asy new file mode 100644 index 00000000000..5e9f4e54905 --- /dev/null +++ b/Build/source/utils/asymptote/examples/pathintersectsurface.asy @@ -0,0 +1,18 @@ +size(500); +import graph3; + +path3 g=randompath3(10); + +draw(g,red+thin()); + +triple[][] P={ + {(0,0,0),(1,0,0),(1,0,0),(2,0,0)}, + {(0,4/3,0),(2/3,4/3,2),(4/3,4/3,2),(2,4/3,0)}, + {(0,2/3,0),(2/3,2/3,0),(4/3,2/3,0),(2,2/3,0)}, + {(0,2,0),(2/3,2,0),(4/3,2,0),(2,2,0)}}; + +surface s=surface(patch(P)); +s.append(unitplane); + +draw(s,lightgray+opacity(0.9)); +dot(intersectionpoints(g,s),blue); diff --git a/Build/source/utils/asymptote/examples/threeviews.asy b/Build/source/utils/asymptote/examples/threeviews.asy new file mode 100644 index 00000000000..39f9ed4464e --- /dev/null +++ b/Build/source/utils/asymptote/examples/threeviews.asy @@ -0,0 +1,13 @@ +import three; + +picture pic; +size(pic,200); +currentlight.viewport=false; +settings.render=4; + +draw(pic,scale3(0.5)*unitsphere,green); +draw(pic,Label("$x$",1),O--X); +draw(pic,Label("$y$",1),O--Y); +draw(pic,Label("$z$",1),O--Z); + +addViews(pic); diff --git a/Build/source/utils/asymptote/examples/unitoctant.asy b/Build/source/utils/asymptote/examples/unitoctant.asy new file mode 100644 index 00000000000..89f851f6a23 --- /dev/null +++ b/Build/source/utils/asymptote/examples/unitoctant.asy @@ -0,0 +1,35 @@ +import graph3; + +currentprojection=orthographic(5,4,2); + +size(0,150); +patch s=octant1; +draw(surface(s),green+opacity(0.5)); +draw(s.external(),blue); + +triple[][] P=s.P; + +for(int i=0; i < 4; ++i) + dot(P[i],red); + +axes3("$x$","$y$",Label("$z$",align=Z)); +triple P00=P[0][0]; +triple P10=P[1][0]; +triple P01=P[0][1]; +triple P02=P[0][2]; +triple P11=P[1][1]; +triple P12=P[1][2]; +triple Q11=XYplane(xypart(P11)); +triple Q12=XYplane(xypart(P12)); + +draw(P11--Q11,dashed); +draw(P12--Q12,dashed); +draw(O--Q12--Q11--(Q11.x,0,0)); +draw(Q12--(Q12.x,0,0)); + +label("$(1,0,0)$",P00,-2Y); +label("$(1,a,0)$",P10,-Z); +label("$(1,0,a)$",P01,-2Y); +label("$(a,0,1)$",P02,Z+X-Y); +label("$(1,a,a)$",P11,3X); +label("$(a,a^2,1)$",P12,7X+Y); diff --git a/Build/source/utils/asymptote/install-sh b/Build/source/utils/asymptote/install-sh index 08572bfd3c9..6781b987bdb 100755 --- a/Build/source/utils/asymptote/install-sh +++ b/Build/source/utils/asymptote/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2006-10-14.15J +scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -48,7 +48,7 @@ IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" +doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else @@ -58,34 +58,49 @@ fi # Put in absolute file names if you don't have them in your path; # or use environment vars. -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' -posix_glob= posix_mkdir= # Desired mode of installed file. mode=0755 +chgrpcmd= chmodcmd=$chmodprog chowncmd= -chgrpcmd= -stripcmd= +mvcmd=$mvprog rmcmd="$rmprog -f" -mvcmd="$mvprog" +stripcmd= + src= dst= dir_arg= -dstarg= +dst_arg= + +copy_on_change=false no_target_directory= -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... @@ -95,68 +110,55 @@ In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG " while test $# -ne 0; do case $1 in - -c) shift - continue;; + -c) ;; + + -C) copy_on_change=true;; - -d) dir_arg=true - shift - continue;; + -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; + shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 - shift - shift case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac - continue;; + shift;; -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -p) shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; @@ -168,21 +170,22 @@ while test $# -ne 0; do *) break;; esac + shift done -if test $# -ne 0 && test -z "$dir_arg$dstarg"; then +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do - if test -n "$dstarg"; then + if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" + set fnord "$@" "$dst_arg" shift # fnord fi shift # arg - dstarg=$arg + dst_arg=$arg done fi @@ -227,7 +230,7 @@ for src do # Protect names starting with `-'. case $src in - -*) src=./$src ;; + -*) src=./$src;; esac if test -n "$dir_arg"; then @@ -245,22 +248,22 @@ do exit 1 fi - if test -z "$dstarg"; then + if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi - dst=$dstarg + dst=$dst_arg # Protect names starting with `-'. case $dst in - -*) dst=./$dst ;; + -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 + echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst @@ -381,26 +384,19 @@ do # directory the slow way, step by step, checking for races as we go. case $dstdir in - /*) prefix=/ ;; - -*) prefix=./ ;; - *) prefix= ;; + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; esac - case $posix_glob in - '') - if (set -f) 2>/dev/null; then - posix_glob=true - else - posix_glob=false - fi ;; - esac + eval "$initialize_posix_glob" oIFS=$IFS IFS=/ - $posix_glob && set -f + $posix_glob set -f set fnord $dstdir shift - $posix_glob && set +f + $posix_glob set +f IFS=$oIFS prefixes= @@ -462,41 +458,54 @@ do # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dst"; then - $doit $rmcmd -f "$dst" 2>/dev/null \ - || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ - && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ - || { - echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - } || exit 1 + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 trap '' 0 fi @@ -506,5 +515,6 @@ done # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff --git a/Build/source/utils/asymptote/path.cc b/Build/source/utils/asymptote/path.cc index 0ad028d5cc5..2b8fdc65911 100644 --- a/Build/source/utils/asymptote/path.cc +++ b/Build/source/utils/asymptote/path.cc @@ -23,6 +23,8 @@ const double BigFuzz=10000.0*DBL_EPSILON; const double Fuzz=1000.0*DBL_EPSILON; const double Fuzz2=Fuzz*Fuzz; const double sqrtFuzz=sqrt(Fuzz); +const double fuzzFactor=10.0; + const double third=1.0/3.0; path nullpath; @@ -867,7 +869,7 @@ void intersections(std::vector<double>& S, std::vector<double>& T, size_t n=S1.size(); for(size_t i=0; i < n; ++i) { S.push_back(S1[i]); - T.push_back(0); + T.push_back(0.0); } } else { pair factor=(q-p)/((q-p).abs2()); @@ -888,18 +890,20 @@ void intersections(std::vector<double>& S, std::vector<double>& T, void add(std::vector<double>& S, double s, const path& p, double fuzz2) { - pair P=p.point(s); - for(size_t i=0; i < S.size(); ++i) - if((p.point(S[i])-P).abs2() <= fuzz2) return; + pair z=p.point(s); + size_t n=S.size(); + for(size_t i=0; i < n; ++i) + if((p.point(S[i])-z).abs2() <= fuzz2) return; S.push_back(s); } void add(std::vector<double>& S, std::vector<double>& T, double s, double t, - const path& p, const path& q, double fuzz2) + const path& p, double fuzz2) { - pair P=p.point(s); - for(size_t i=0; i < S.size(); ++i) - if((p.point(S[i])-P).abs2() <= fuzz2) return; + pair z=p.point(s); + size_t n=S.size(); + for(size_t i=0; i < n; ++i) + if((p.point(S[i])-z).abs2() <= fuzz2) return; S.push_back(s); T.push_back(t); } @@ -907,22 +911,21 @@ void add(std::vector<double>& S, std::vector<double>& T, double s, double t, void add(double& s, double& t, std::vector<double>& S, std::vector<double>& T, std::vector<double>& S1, std::vector<double>& T1, double pscale, double qscale, double poffset, double qoffset, - const path& p, const path& q, double fuzz, bool single) + const path& p, double fuzz2, bool single) { if(single) { s=s*pscale+poffset; t=t*qscale+qoffset; } else { - double fuzz2=4.0*fuzz*fuzz; size_t n=S1.size(); for(size_t i=0; i < n; ++i) - add(S,T,pscale*S1[i]+poffset,qscale*T1[i]+qoffset,p,q,fuzz2); + add(S,T,pscale*S1[i]+poffset,qscale*T1[i]+qoffset,p,fuzz2); } } void add(double& s, double& t, std::vector<double>& S, std::vector<double>& T, std::vector<double>& S1, std::vector<double>& T1, - const path& p, const path& q, double fuzz, bool single) + const path& p, double fuzz2, bool single) { size_t n=S1.size(); if(single) { @@ -931,16 +934,16 @@ void add(double& s, double& t, std::vector<double>& S, std::vector<double>& T, t=T1[0]; } } else { - double fuzz2=4.0*fuzz*fuzz; for(size_t i=0; i < n; ++i) - add(S,T,S1[i],T1[i],p,q,fuzz2); + add(S,T,S1[i],T1[i],p,fuzz2); } } void intersections(std::vector<double>& S, path& g, const pair& p, const pair& q, double fuzz) { - double fuzz2=fuzz*fuzz; + double fuzz2=max(fuzzFactor*fuzz,Fuzz); + fuzz2=fuzz2*fuzz2; std::vector<double> S1; lineintersections(S1,g,p,q,fuzz); size_t n=S1.size(); @@ -954,11 +957,14 @@ bool intersections(double &s, double &t, std::vector<double>& S, { if(errorstream::interrupt) throw interrupted(); + double fuzz2=max(fuzzFactor*fuzz,Fuzz); + fuzz2=fuzz2*fuzz2; + Int lp=p.length(); if(((lp == 1 && p.straight(0)) || lp == 0) && exact) { std::vector<double> T1,S1; intersections(T1,S1,q,p.point((Int) 0),p.point(lp),fuzz); - add(s,t,S,T,S1,T1,p,q,fuzz,single); + add(s,t,S,T,S1,T1,p,fuzz2,single); return S1.size() > 0; } @@ -966,7 +972,7 @@ bool intersections(double &s, double &t, std::vector<double>& S, if(((lq == 1 && q.straight(0)) || lq == 0) && exact) { std::vector<double> S1,T1; intersections(S1,T1,p,q.point((Int) 0),q.point(lq),fuzz); - add(s,t,S,T,S1,T1,p,q,fuzz,single); + add(s,t,S,T,S1,T1,p,fuzz2,single); return S1.size() > 0; } @@ -984,24 +990,24 @@ bool intersections(double &s, double &t, std::vector<double>& S, --depth; if((maxp-minp).length()+(maxq-minq).length() <= fuzz || depth == 0) { if(single) { - s=0; - t=0; + s=0.5; + t=0.5; } else { - S.push_back(0.0); - T.push_back(0.0); + S.push_back(0.5); + T.push_back(0.5); } return true; } path p1,p2; double pscale,poffset; + std::vector<double> S1,T1; if(lp <= 1) { if(lp == 1) p.halve(p1,p2); if(lp == 0 || p1 == p || p2 == p) { - std::vector<double> T1,S1; intersections(T1,S1,q,p.point((Int) 0),p.point((Int) 0),fuzz); - add(s,t,S,T,S1,T1,p,q,fuzz,single); + add(s,t,S,T,S1,T1,p,fuzz2,single); return S1.size() > 0; } pscale=poffset=0.5; @@ -1019,9 +1025,8 @@ bool intersections(double &s, double &t, std::vector<double>& S, if(lq <= 1) { if(lq == 1) q.halve(q1,q2); if(lq == 0 || q1 == q || q2 == q) { - std::vector<double> S1,T1; intersections(S1,T1,p,q.point((Int) 0),q.point((Int) 0),fuzz); - add(s,t,S,T,S1,T1,p,q,fuzz,single); + add(s,t,S,T,S1,T1,p,fuzz2,single); return S1.size() > 0; } qscale=qoffset=0.5; @@ -1038,9 +1043,8 @@ bool intersections(double &s, double &t, std::vector<double>& S, static size_t maxcount=9; size_t count=0; - std::vector<double> S1,T1; if(intersections(s,t,S1,T1,p1,q1,fuzz,single,exact,depth)) { - add(s,t,S,T,S1,T1,pscale,qscale,0.0,0.0,p,q,fuzz,single); + add(s,t,S,T,S1,T1,pscale,qscale,0.0,0.0,p,fuzz2,single); if(single || depth <= mindepth) return true; count += S1.size(); @@ -1050,7 +1054,7 @@ bool intersections(double &s, double &t, std::vector<double>& S, S1.clear(); T1.clear(); if(intersections(s,t,S1,T1,p1,q2,fuzz,single,exact,depth)) { - add(s,t,S,T,S1,T1,pscale,qscale,0.0,qoffset,p,q,fuzz,single); + add(s,t,S,T,S1,T1,pscale,qscale,0.0,qoffset,p,fuzz2,single); if(single || depth <= mindepth) return true; count += S1.size(); @@ -1060,7 +1064,7 @@ bool intersections(double &s, double &t, std::vector<double>& S, S1.clear(); T1.clear(); if(intersections(s,t,S1,T1,p2,q1,fuzz,single,exact,depth)) { - add(s,t,S,T,S1,T1,pscale,qscale,poffset,0.0,p,q,fuzz,single); + add(s,t,S,T,S1,T1,pscale,qscale,poffset,0.0,p,fuzz2,single); if(single || depth <= mindepth) return true; count += S1.size(); @@ -1070,7 +1074,7 @@ bool intersections(double &s, double &t, std::vector<double>& S, S1.clear(); T1.clear(); if(intersections(s,t,S1,T1,p2,q2,fuzz,single,exact,depth)) { - add(s,t,S,T,S1,T1,pscale,qscale,poffset,qoffset,p,q,fuzz,single); + add(s,t,S,T,S1,T1,pscale,qscale,poffset,qoffset,p,fuzz2,single); if(single || depth <= mindepth) return true; count += S1.size(); diff --git a/Build/source/utils/asymptote/path.h b/Build/source/utils/asymptote/path.h index 95702bada05..b61d9c23657 100644 --- a/Build/source/utils/asymptote/path.h +++ b/Build/source/utils/asymptote/path.h @@ -72,6 +72,7 @@ extern const double BigFuzz; extern const double Fuzz; extern const double Fuzz2; extern const double sqrtFuzz; +extern const double fuzzFactor; class path : public gc { bool cycles; // If the path is closed in a loop @@ -450,9 +451,8 @@ extern const double third; } -// Do -DOMIT_SOLVEDKNOT_DECL to work around redefinition error reported by -// old (broken) compilers. #ifndef BROKEN_COMPILER +// Delete the following line to work around problems with old broken compilers. GC_DECLARE_PTRFREE(camp::solvedKnot); #endif diff --git a/Build/source/utils/asymptote/path3.cc b/Build/source/utils/asymptote/path3.cc index 7cfa16647d5..da973dc36be 100644 --- a/Build/source/utils/asymptote/path3.cc +++ b/Build/source/utils/asymptote/path3.cc @@ -24,28 +24,6 @@ void checkEmpty3(Int n) { reportError("nullpath3 has no points"); } -double bound(triple z0, triple c0, triple c1, triple z1, - double (*m)(double, double), - double (*f)(const triple&, double*), double *t, - double b, int depth) -{ - b=m(b,m(f(z0,t),f(z1,t))); - if(m(-1.0,1.0)*(b-m(f(c0,t),f(c1,t))) >= -sqrtFuzz || depth == 0) - return b; - --depth; - - triple m0=0.5*(z0+c0); - triple m1=0.5*(c0+c1); - triple m2=0.5*(c1+z1); - triple m3=0.5*(m0+m1); - triple m4=0.5*(m1+m2); - triple m5=0.5*(m3+m4); - - // Check both Bezier subpaths. - b=bound(z0,m0,m3,m5,m,f,t,b,depth); - return bound(m5,m4,m2,z1,m,f,t,b,depth); -} - triple path3::point(double t) const { checkEmpty3(n); @@ -337,6 +315,28 @@ bbox3 path3::bounds() const return box; } +double bound(triple z0, triple c0, triple c1, triple z1, + double (*m)(double, double), + double (*f)(const triple&, double*), double *t, + double b, double fuzz, int depth) +{ + b=m(b,m(f(z0,t),f(z1,t))); + if(m(-1.0,1.0)*(b-m(f(c0,t),f(c1,t))) >= -fuzz || depth == 0) + return b; + --depth; + + triple m0=0.5*(z0+c0); + triple m1=0.5*(c0+c1); + triple m2=0.5*(c1+z1); + triple m3=0.5*(m0+m1); + triple m4=0.5*(m1+m2); + triple m5=0.5*(m3+m4); + + // Check both Bezier subpaths. + b=bound(z0,m0,m3,m5,m,f,t,b,fuzz,depth); + return bound(m5,m4,m2,z1,m,f,t,b,fuzz,depth); +} + pair path3::bounds(double (*m)(double, double), double (*x)(const triple&, double*), double (*y)(const triple&, double*), double *t) const @@ -515,7 +515,7 @@ void intersections(std::vector<double>& S, std::vector<double>& T, size_t n=S1.size(); for(size_t i=0; i < n; ++i) { S.push_back(S1[i]); - T.push_back(0); + T.push_back(0.0); } } @@ -532,13 +532,12 @@ void add(std::vector<double>& S, std::vector<double>& T, double s, double t, void add(double& s, double& t, std::vector<double>& S, std::vector<double>& T, std::vector<double>& S1, std::vector<double>& T1, double pscale, double qscale, double poffset, double qoffset, - const path3& p, const path3& q, double fuzz, bool single) + const path3& p, const path3& q, double fuzz2, bool single) { if(single) { s=s*pscale+poffset; t=t*qscale+qoffset; } else { - double fuzz2=4.0*fuzz*fuzz; size_t n=S1.size(); for(size_t i=0; i < n; ++i) add(S,T,pscale*S1[i]+poffset,qscale*T1[i]+qoffset,p,q,fuzz2); @@ -547,7 +546,7 @@ void add(double& s, double& t, std::vector<double>& S, std::vector<double>& T, void add(double& s, double& t, std::vector<double>& S, std::vector<double>& T, std::vector<double>& S1, std::vector<double>& T1, - const path3& p, const path3& q, double fuzz, bool single) + const path3& p, const path3& q, double fuzz2, bool single) { size_t n=S1.size(); if(single) { @@ -556,7 +555,6 @@ void add(double& s, double& t, std::vector<double>& S, std::vector<double>& T, t=T1[0]; } } else { - double fuzz2=4.0*fuzz*fuzz; for(size_t i=0; i < n; ++i) add(S,T,S1[i],T1[i],p,q,fuzz2); } @@ -568,11 +566,14 @@ bool intersections(double &s, double &t, std::vector<double>& S, { if(errorstream::interrupt) throw interrupted(); + double fuzz2=max(fuzzFactor*fuzz,Fuzz); + fuzz2=fuzz2*fuzz2; + Int lp=p.length(); if(lp == 0 && exact) { std::vector<double> T1,S1; intersections(T1,S1,q,p.point(lp),fuzz); - add(s,t,S,T,S1,T1,p,q,fuzz,single); + add(s,t,S,T,S1,T1,p,q,fuzz2,single); return S1.size() > 0; } @@ -580,7 +581,7 @@ bool intersections(double &s, double &t, std::vector<double>& S, if(lq == 0 && exact) { std::vector<double> S1,T1; intersections(S1,T1,p,q.point(lq),fuzz); - add(s,t,S,T,S1,T1,p,q,fuzz,single); + add(s,t,S,T,S1,T1,p,q,fuzz2,single); return S1.size() > 0; } @@ -600,11 +601,11 @@ bool intersections(double &s, double &t, std::vector<double>& S, --depth; if((maxp-minp).length()+(maxq-minq).length() <= fuzz || depth == 0) { if(single) { - s=0; - t=0; + s=0.5; + t=0.5; } else { - S.push_back(0.0); - T.push_back(0.0); + S.push_back(0.5); + T.push_back(0.5); } return true; } @@ -612,12 +613,13 @@ bool intersections(double &s, double &t, std::vector<double>& S, path3 p1,p2; double pscale,poffset; + std::vector<double> S1,T1; + if(lp <= 1) { if(lp == 1) p.halve(p1,p2); if(lp == 0 || p1 == p || p2 == p) { - std::vector<double> T1,S1; intersections(T1,S1,q,p.point((Int) 0),fuzz); - add(s,t,S,T,S1,T1,p,q,fuzz,single); + add(s,t,S,T,S1,T1,p,q,fuzz2,single); return S1.size() > 0; } pscale=poffset=0.5; @@ -635,9 +637,8 @@ bool intersections(double &s, double &t, std::vector<double>& S, if(lq <= 1) { if(lq == 1) q.halve(q1,q2); if(lq == 0 || q1 == q || q2 == q) { - std::vector<double> S1,T1; intersections(S1,T1,p,q.point((Int) 0),fuzz); - add(s,t,S,T,S1,T1,p,q,fuzz,single); + add(s,t,S,T,S1,T1,p,q,fuzz2,single); return S1.size() > 0; } qscale=qoffset=0.5; @@ -654,9 +655,8 @@ bool intersections(double &s, double &t, std::vector<double>& S, static size_t maxcount=9; size_t count=0; - std::vector<double> S1,T1; if(intersections(s,t,S1,T1,p1,q1,fuzz,single,exact,depth)) { - add(s,t,S,T,S1,T1,pscale,qscale,0.0,0.0,p,q,fuzz,single); + add(s,t,S,T,S1,T1,pscale,qscale,0.0,0.0,p,q,fuzz2,single); if(single || depth <= mindepth) return true; count += S1.size(); @@ -666,7 +666,7 @@ bool intersections(double &s, double &t, std::vector<double>& S, S1.clear(); T1.clear(); if(intersections(s,t,S1,T1,p1,q2,fuzz,single,exact,depth)) { - add(s,t,S,T,S1,T1,pscale,qscale,0.0,qoffset,p,q,fuzz,single); + add(s,t,S,T,S1,T1,pscale,qscale,0.0,qoffset,p,q,fuzz2,single); if(single || depth <= mindepth) return true; count += S1.size(); @@ -676,7 +676,7 @@ bool intersections(double &s, double &t, std::vector<double>& S, S1.clear(); T1.clear(); if(intersections(s,t,S1,T1,p2,q1,fuzz,single,exact,depth)) { - add(s,t,S,T,S1,T1,pscale,qscale,poffset,0.0,p,q,fuzz,single); + add(s,t,S,T,S1,T1,pscale,qscale,poffset,0.0,p,q,fuzz2,single); if(single || depth <= mindepth) return true; count += S1.size(); @@ -686,7 +686,7 @@ bool intersections(double &s, double &t, std::vector<double>& S, S1.clear(); T1.clear(); if(intersections(s,t,S1,T1,p2,q2,fuzz,single,exact,depth)) { - add(s,t,S,T,S1,T1,pscale,qscale,poffset,qoffset,p,q,fuzz,single); + add(s,t,S,T,S1,T1,pscale,qscale,poffset,qoffset,p,q,fuzz2,single); if(single || depth <= mindepth) return true; count += S1.size(); @@ -779,9 +779,10 @@ double yratio(const triple& v, double *) return v.gety()/z; } +template<class T> struct Split { - double m0,m1,m2,m3,m4,m5; - Split(double z0, double c0, double c1, double z1) { + T m0,m1,m2,m3,m4,m5; + Split(T z0, T c0, T c1, T z1) { m0=0.5*(z0+c0); m1=0.5*(c0+c1); m2=0.5*(c1+z1); @@ -791,123 +792,383 @@ struct Split { } }; -double cornerbound(double *p, double (*m)(double, double)) +double cornerbound(double *P, double (*m)(double, double)) { - double b=m(p[0],p[3]); - b=m(b,p[12]); - return m(b,p[15]); + double b=m(P[0],P[3]); + b=m(b,P[12]); + return m(b,P[15]); } -double controlbound(double *p, double (*m)(double, double)) +double controlbound(double *P, double (*m)(double, double)) { - double b=m(p[1],p[2]); - b=m(b,p[4]); - b=m(b,p[5]); - b=m(b,p[6]); - b=m(b,p[7]); - b=m(b,p[8]); - b=m(b,p[9]); - b=m(b,p[10]); - b=m(b,p[11]); - b=m(b,p[13]); - return m(b,p[14]); + double b=m(P[1],P[2]); + b=m(b,P[4]); + b=m(b,P[5]); + b=m(b,P[6]); + b=m(b,P[7]); + b=m(b,P[8]); + b=m(b,P[9]); + b=m(b,P[10]); + b=m(b,P[11]); + b=m(b,P[13]); + return m(b,P[14]); } -double cornerbound(triple *p, double (*m)(double, double), +double cornerbound(triple *P, double (*m)(double, double), double (*f)(const triple&, double*), double *t) { - double b=m(f(p[0],t),f(p[3],t)); - b=m(b,f(p[12],t)); - return m(b,f(p[15],t)); + double b=m(f(P[0],t),f(P[3],t)); + b=m(b,f(P[12],t)); + return m(b,f(P[15],t)); } -double controlbound(triple *p, double (*m)(double, double), +double controlbound(triple *P, double (*m)(double, double), double (*f)(const triple&, double*), double *t) { - double b=m(f(p[1],t),f(p[2],t)); - b=m(b,f(p[4],t)); - b=m(b,f(p[5],t)); - b=m(b,f(p[6],t)); - b=m(b,f(p[7],t)); - b=m(b,f(p[8],t)); - b=m(b,f(p[9],t)); - b=m(b,f(p[10],t)); - b=m(b,f(p[11],t)); - b=m(b,f(p[13],t)); - return m(b,f(p[14],t)); + double b=m(f(P[1],t),f(P[2],t)); + b=m(b,f(P[4],t)); + b=m(b,f(P[5],t)); + b=m(b,f(P[6],t)); + b=m(b,f(P[7],t)); + b=m(b,f(P[8],t)); + b=m(b,f(P[9],t)); + b=m(b,f(P[10],t)); + b=m(b,f(P[11],t)); + b=m(b,f(P[13],t)); + return m(b,f(P[14],t)); } -double bound(double *p, double (*m)(double, double), double b, int depth) +double bound(double *P, double (*m)(double, double), double b, + double fuzz, int depth) { - b=m(b,cornerbound(p,m)); - if(m(-1.0,1.0)*(b-controlbound(p,m)) >= -sqrtFuzz || depth == 0) + b=m(b,cornerbound(P,m)); + if(m(-1.0,1.0)*(b-controlbound(P,m)) >= -fuzz || depth == 0) return b; --depth; - Split c0(p[0],p[1],p[2],p[3]); - Split c1(p[4],p[5],p[6],p[7]); - Split c2(p[8],p[9],p[10],p[11]); - Split c3(p[12],p[13],p[14],p[15]); + Split<double> c0(P[0],P[1],P[2],P[3]); + Split<double> c1(P[4],P[5],P[6],P[7]); + Split<double> c2(P[8],P[9],P[10],P[11]); + Split<double> c3(P[12],P[13],P[14],P[15]); - Split c4(p[12],p[8],p[4],p[0]); - Split c5(c3.m0,c2.m0,c1.m0,c0.m0); - Split c6(c3.m3,c2.m3,c1.m3,c0.m3); - Split c7(c3.m5,c2.m5,c1.m5,c0.m5); - Split c8(c3.m4,c2.m4,c1.m4,c0.m4); - Split c9(c3.m5,c2.m5,c1.m5,c0.m5); - Split c10(p[15],p[11],p[7],p[3]); + Split<double> c4(P[12],P[8],P[4],P[0]); + Split<double> c5(c3.m0,c2.m0,c1.m0,c0.m0); + Split<double> c6(c3.m3,c2.m3,c1.m3,c0.m3); + Split<double> c7(c3.m5,c2.m5,c1.m5,c0.m5); + Split<double> c8(c3.m4,c2.m4,c1.m4,c0.m4); + Split<double> c9(c3.m2,c2.m2,c1.m2,c0.m2); + Split<double> c10(P[15],P[11],P[7],P[3]); // Check all 4 Bezier subpatches. double s0[]={c4.m5,c5.m5,c6.m5,c7.m5,c4.m3,c5.m3,c6.m3,c7.m3, - c4.m0,c5.m0,c6.m0,c7.m0,p[12],c3.m0,c3.m3,c3.m5}; - b=bound(s0,m,b,depth); - double s1[]={p[0],c0.m0,c0.m3,c0.m5,c4.m2,c5.m2,c6.m2,c7.m2, + c4.m0,c5.m0,c6.m0,c7.m0,P[12],c3.m0,c3.m3,c3.m5}; + b=bound(s0,m,b,fuzz,depth); + double s1[]={P[0],c0.m0,c0.m3,c0.m5,c4.m2,c5.m2,c6.m2,c7.m2, c4.m4,c5.m4,c6.m4,c7.m4,c4.m5,c5.m5,c6.m5,c7.m5}; - b=bound(s1,m,b,depth); - double s2[]={c0.m5,c0.m4,c0.m2,p[3],c7.m2,c8.m2,c9.m2,c10.m2, + b=bound(s1,m,b,fuzz,depth); + double s2[]={c0.m5,c0.m4,c0.m2,P[3],c7.m2,c8.m2,c9.m2,c10.m2, c7.m4,c8.m4,c9.m4,c10.m4,c7.m5,c8.m5,c9.m5,c10.m5}; - b=bound(s2,m,b,depth); + b=bound(s2,m,b,fuzz,depth); double s3[]={c7.m5,c8.m5,c9.m5,c10.m5,c7.m3,c8.m3,c9.m3,c10.m3, - c7.m0,c8.m0,c9.m0,c10.m0,c3.m5,c3.m4,c3.m2,p[15]}; - return bound(s3,m,b,depth); + c7.m0,c8.m0,c9.m0,c10.m0,c3.m5,c3.m4,c3.m2,P[15]}; + return bound(s3,m,b,fuzz,depth); } -double bound(triple *p, double (*m)(double, double), +double bound(triple *P, double (*m)(double, double), double (*f)(const triple&, double*), double *t, - double b, int depth) + double b, double fuzz, int depth) { - b=m(b,cornerbound(p,m,f,t)); - if(m(-1.0,1.0)*(b-controlbound(p,m,f,t)) >= -sqrtFuzz || depth == 0) + b=m(b,cornerbound(P,m,f,t)); + if(m(-1.0,1.0)*(b-controlbound(P,m,f,t)) >= -fuzz || depth == 0) return b; --depth; - Split3 c0(p[0],p[1],p[2],p[3]); - Split3 c1(p[4],p[5],p[6],p[7]); - Split3 c2(p[8],p[9],p[10],p[11]); - Split3 c3(p[12],p[13],p[14],p[15]); + Split<triple> c0(P[0],P[1],P[2],P[3]); + Split<triple> c1(P[4],P[5],P[6],P[7]); + Split<triple> c2(P[8],P[9],P[10],P[11]); + Split<triple> c3(P[12],P[13],P[14],P[15]); - Split3 c4(p[12],p[8],p[4],p[0]); - Split3 c5(c3.m0,c2.m0,c1.m0,c0.m0); - Split3 c6(c3.m3,c2.m3,c1.m3,c0.m3); - Split3 c7(c3.m5,c2.m5,c1.m5,c0.m5); - Split3 c8(c3.m4,c2.m4,c1.m4,c0.m4); - Split3 c9(c3.m5,c2.m5,c1.m5,c0.m5); - Split3 c10(p[15],p[11],p[7],p[3]); + Split<triple> c4(P[12],P[8],P[4],P[0]); + Split<triple> c5(c3.m0,c2.m0,c1.m0,c0.m0); + Split<triple> c6(c3.m3,c2.m3,c1.m3,c0.m3); + Split<triple> c7(c3.m5,c2.m5,c1.m5,c0.m5); + Split<triple> c8(c3.m4,c2.m4,c1.m4,c0.m4); + Split<triple> c9(c3.m2,c2.m2,c1.m2,c0.m2); + Split<triple> c10(P[15],P[11],P[7],P[3]); // Check all 4 Bezier subpatches. - triple s0[]={c4.m5,c5.m5,c6.m5,c7.m5,c4.m3,c5.m3,c6.m3,c7.m3, - c4.m0,c5.m0,c6.m0,c7.m0,p[12],c3.m0,c3.m3,c3.m5}; - b=bound(s0,m,f,t,b,depth); - triple s1[]={p[0],c0.m0,c0.m3,c0.m5,c4.m2,c5.m2,c6.m2,c7.m2, + c4.m0,c5.m0,c6.m0,c7.m0,P[12],c3.m0,c3.m3,c3.m5}; + b=bound(s0,m,f,t,b,fuzz,depth); + triple s1[]={P[0],c0.m0,c0.m3,c0.m5,c4.m2,c5.m2,c6.m2,c7.m2, c4.m4,c5.m4,c6.m4,c7.m4,c4.m5,c5.m5,c6.m5,c7.m5}; - b=bound(s1,m,f,t,b,depth); - triple s2[]={c0.m5,c0.m4,c0.m2,p[3],c7.m2,c8.m2,c9.m2,c10.m2, + b=bound(s1,m,f,t,b,fuzz,depth); + triple s2[]={c0.m5,c0.m4,c0.m2,P[3],c7.m2,c8.m2,c9.m2,c10.m2, c7.m4,c8.m4,c9.m4,c10.m4,c7.m5,c8.m5,c9.m5,c10.m5}; - b=bound(s2,m,f,t,b,depth); + b=bound(s2,m,f,t,b,fuzz,depth); triple s3[]={c7.m5,c8.m5,c9.m5,c10.m5,c7.m3,c8.m3,c9.m3,c10.m3, - c7.m0,c8.m0,c9.m0,c10.m0,c3.m5,c3.m4,c3.m2,p[15]}; - return bound(s3,m,f,t,b,depth); + c7.m0,c8.m0,c9.m0,c10.m0,c3.m5,c3.m4,c3.m2,P[15]}; + return bound(s3,m,f,t,b,fuzz,depth); +} + +inline void add(std::vector<double>& T, std::vector<double>& U, + std::vector<double>& V, double t, double u, double v, + const path3& p, double fuzz2) +{ + triple z=p.point(t); + size_t n=T.size(); + for(size_t i=0; i < n; ++i) + if((p.point(T[i])-z).abs2() <= fuzz2) return; + T.push_back(t); + U.push_back(u); + V.push_back(v); +} + +void add(std::vector<double>& T, std::vector<double>& U, + std::vector<double>& V, std::vector<double>& T1, + std::vector<double>& U1, std::vector<double>& V1, + const path3& p, double tscale, double toffset, + double uoffset, double voffset, double fuzz2) +{ + size_t n=T1.size(); + for(size_t i=0; i < n; ++i) + add(T,U,V,tscale*T1[i]+toffset,0.5*U1[i]+uoffset,0.5*V1[i]+voffset,p, + fuzz2); +} + +void bounds(triple& Pmin, triple& Pmax, triple *P, double fuzz) +{ + double Px[]={P[0].getx(),P[1].getx(),P[2].getx(),P[3].getx(), + P[4].getx(),P[5].getx(),P[6].getx(),P[7].getx(), + P[8].getx(),P[9].getx(),P[10].getx(),P[11].getx(), + P[12].getx(),P[13].getx(),P[14].getx(),P[15].getx()}; + double bx=Px[0]; + double xmin=bound(Px,min,bx,fuzz); + double xmax=bound(Px,max,bx,fuzz); + + double Py[]={P[0].gety(),P[1].gety(),P[2].gety(),P[3].gety(), + P[4].gety(),P[5].gety(),P[6].gety(),P[7].gety(), + P[8].gety(),P[9].gety(),P[10].gety(),P[11].gety(), + P[12].gety(),P[13].gety(),P[14].gety(),P[15].gety()}; + double by=Py[0]; + double ymin=bound(Py,min,by,fuzz); + double ymax=bound(Py,max,by,fuzz); + + double Pz[]={P[0].getz(),P[1].getz(),P[2].getz(),P[3].getz(), + P[4].getz(),P[5].getz(),P[6].getz(),P[7].getz(), + P[8].getz(),P[9].getz(),P[10].getz(),P[11].getz(), + P[12].getz(),P[13].getz(),P[14].getz(),P[15].getz()}; + double bz=Pz[0]; + double zmin=bound(Pz,min,bz,fuzz); + double zmax=bound(Pz,max,bz,fuzz); + Pmin=triple(xmin,ymin,zmin); + Pmax=triple(xmax,ymax,zmax); +} + +bool intersections(double& U, double& V, const triple& v, triple *P, + double fuzz, unsigned depth) +{ + if(errorstream::interrupt) throw interrupted(); + + triple Pmin,Pmax; + bounds(Pmin,Pmax,P,fuzz); + + if(Pmax.getx()+fuzz >= v.getx() && + Pmax.gety()+fuzz >= v.gety() && + Pmax.getz()+fuzz >= v.getz() && + v.getx()+fuzz >= Pmin.getx() && + v.gety()+fuzz >= Pmin.gety() && + v.getz()+fuzz >= Pmin.getz()) { // Overlapping bounding boxes + + --depth; + if((Pmax-Pmin).abs2() <= fuzz*fuzz || depth == 0) { + U=0.5; + V=0.5; + return true; + } + +// Compute the control points of the four subpatches obtained by splitting +// the patch with control points P at u=v=1/2. + Split<triple> c0(P[0],P[1],P[2],P[3]); + Split<triple> c1(P[4],P[5],P[6],P[7]); + Split<triple> c2(P[8],P[9],P[10],P[11]); + Split<triple> c3(P[12],P[13],P[14],P[15]); + + Split<triple> c4(P[12],P[8],P[4],P[0]); + Split<triple> c5(c3.m0,c2.m0,c1.m0,c0.m0); + Split<triple> c6(c3.m3,c2.m3,c1.m3,c0.m3); + Split<triple> c7(c3.m5,c2.m5,c1.m5,c0.m5); + Split<triple> c8(c3.m4,c2.m4,c1.m4,c0.m4); + Split<triple> c9(c3.m2,c2.m2,c1.m2,c0.m2); + Split<triple> c10(P[15],P[11],P[7],P[3]); + + // Check all 4 Bezier subpatches. + + double U1,V1; + triple Q0[]={P[0],c0.m0,c0.m3,c0.m5,c4.m2,c5.m2,c6.m2,c7.m2, + c4.m4,c5.m4,c6.m4,c7.m4,c4.m5,c5.m5,c6.m5,c7.m5}; + if(intersections(U1,V1,v,Q0,fuzz,depth)) { + U=0.5*U1; + V=0.5*V1; + return true; + } + + triple Q1[]={c0.m5,c0.m4,c0.m2,P[3],c7.m2,c8.m2,c9.m2,c10.m2, + c7.m4,c8.m4,c9.m4,c10.m4,c7.m5,c8.m5,c9.m5,c10.m5}; + if(intersections(U1,V1,v,Q1,fuzz,depth)) { + U=0.5*U1; + V=0.5*V1+0.5; + return true; + } + + triple Q2[]={c7.m5,c8.m5,c9.m5,c10.m5,c7.m3,c8.m3,c9.m3,c10.m3, + c7.m0,c8.m0,c9.m0,c10.m0,c3.m5,c3.m4,c3.m2,P[15]}; + if(intersections(U1,V1,v,Q2,fuzz,depth)) { + U=0.5*U1+0.5; + V=0.5*V1+0.5; + return true; + } + + triple Q3[]={c4.m5,c5.m5,c6.m5,c7.m5,c4.m3,c5.m3,c6.m3,c7.m3, + c4.m0,c5.m0,c6.m0,c7.m0,P[12],c3.m0,c3.m3,c3.m5}; + if(intersections(U1,V1,v,Q3,fuzz,depth)) { + U=0.5*U1+0.5; + V=0.5*V1; + return true; + } + } + return false; +} + +void intersections(std::vector<double>& T, std::vector<double>& U, + std::vector<double>& V, path3& p, triple *P, + double fuzz, unsigned depth) +{ + if(errorstream::interrupt) throw interrupted(); + + triple pmin=p.min(); + triple pmax=p.max(); + + triple Pmin,Pmax; + bounds(Pmin,Pmax,P,fuzz); + + if(Pmax.getx()+fuzz >= pmin.getx() && + Pmax.gety()+fuzz >= pmin.gety() && + Pmax.getz()+fuzz >= pmin.getz() && + pmax.getx()+fuzz >= Pmin.getx() && + pmax.gety()+fuzz >= Pmin.gety() && + pmax.getz()+fuzz >= Pmin.getz()) { // Overlapping bounding boxes + + --depth; + + if(((pmax-pmin).length()+(Pmax-Pmin).length() <= fuzz) || depth == 0) { + T.push_back(0.5); + U.push_back(0.5); + V.push_back(0.5); + return; + } + + Int lp=p.length(); + + path3 p0,p1; + p.halve(p0,p1); + + std::vector<double> T1,U1,V1; + double tscale,toffset; + + double fuzz2=max(fuzzFactor*fuzz,Fuzz); + fuzz2=fuzz2*fuzz2; + + if(lp <= 1) { + if(lp == 1) p.halve(p0,p1); + if(lp == 0 || p0 == p || p1 == p) { + double u,v; + if(intersections(u,v,p.point((Int) 0),P,fuzz,depth)) { + T1.push_back(0.0); + U1.push_back(u); + V1.push_back(v); + add(T,U,V,T1,U1,V1,p,1.0,0.0,0.0,0.0,fuzz2); + } + return; + } + tscale=toffset=0.5; + } else { + Int tp=lp/2; + p0=p.subpath(0,tp); + p1=p.subpath(tp,lp); + toffset=tp; + tscale=1.0; + } + + Split<triple> c0(P[0],P[1],P[2],P[3]); + Split<triple> c1(P[4],P[5],P[6],P[7]); + Split<triple> c2(P[8],P[9],P[10],P[11]); + Split<triple> c3(P[12],P[13],P[14],P[15]); + + Split<triple> c4(P[12],P[8],P[4],P[0]); + Split<triple> c5(c3.m0,c2.m0,c1.m0,c0.m0); + Split<triple> c6(c3.m3,c2.m3,c1.m3,c0.m3); + Split<triple> c7(c3.m5,c2.m5,c1.m5,c0.m5); + Split<triple> c8(c3.m4,c2.m4,c1.m4,c0.m4); + Split<triple> c9(c3.m2,c2.m2,c1.m2,c0.m2); + Split<triple> c10(P[15],P[11],P[7],P[3]); + + // Check all 4 Bezier subpatches against p0. + triple Q0[]={P[0],c0.m0,c0.m3,c0.m5,c4.m2,c5.m2,c6.m2,c7.m2, + c4.m4,c5.m4,c6.m4,c7.m4,c4.m5,c5.m5,c6.m5,c7.m5}; + intersections(T1,U1,V1,p0,Q0,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,0.0,0.0,0.0,fuzz2); + + T1.clear(); + U1.clear(); + V1.clear(); + triple Q1[]={c0.m5,c0.m4,c0.m2,P[3],c7.m2,c8.m2,c9.m2,c10.m2, + c7.m4,c8.m4,c9.m4,c10.m4,c7.m5,c8.m5,c9.m5,c10.m5}; + intersections(T1,U1,V1,p0,Q1,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,0.0,0.0,0.5,fuzz2); + + T1.clear(); + U1.clear(); + V1.clear(); + triple Q2[]={c7.m5,c8.m5,c9.m5,c10.m5,c7.m3,c8.m3,c9.m3,c10.m3, + c7.m0,c8.m0,c9.m0,c10.m0,c3.m5,c3.m4,c3.m2,P[15]}; + intersections(T1,U1,V1,p0,Q2,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,0.0,0.5,0.5,fuzz2); + + T1.clear(); + U1.clear(); + V1.clear(); + triple Q3[]={c4.m5,c5.m5,c6.m5,c7.m5,c4.m3,c5.m3,c6.m3,c7.m3, + c4.m0,c5.m0,c6.m0,c7.m0,P[12],c3.m0,c3.m3,c3.m5}; + intersections(T1,U1,V1,p0,Q3,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,0.0,0.5,0.0,fuzz2); + + // Check all 4 Bezier subpatches against p1. + T1.clear(); + U1.clear(); + V1.clear(); + intersections(T1,U1,V1,p1,Q0,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,toffset,0.0,0.0,fuzz2); + + T1.clear(); + U1.clear(); + V1.clear(); + intersections(T1,U1,V1,p1,Q1,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,toffset,0.0,0.5,fuzz2); + + T1.clear(); + U1.clear(); + V1.clear(); + intersections(T1,U1,V1,p1,Q2,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,toffset,0.5,0.5,fuzz2); + + T1.clear(); + U1.clear(); + V1.clear(); + intersections(T1,U1,V1,p1,Q3,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,toffset,0.5,0.0,fuzz2); + } + } } //namespace camp diff --git a/Build/source/utils/asymptote/path3.h b/Build/source/utils/asymptote/path3.h index 872e19d72bd..208c9ab2688 100644 --- a/Build/source/utils/asymptote/path3.h +++ b/Build/source/utils/asymptote/path3.h @@ -339,6 +339,12 @@ bool intersections(double& s, double& t, std::vector<double>& S, void intersections(std::vector<double>& S, path3& g, const triple& p, const triple& q, double fuzz); +void intersections(std::vector<double>& T, std::vector<double>& U, + std::vector<double>& V, path3& p, triple *P, + double fuzz, unsigned depth=maxdepth); +bool intersections(double& U, double& V, const triple& v, triple *P, + double fuzz, unsigned depth=maxdepth); + // Concatenates two path3s into a new one. path3 concat(const path3& p1, const path3& p2); @@ -351,18 +357,6 @@ inline triple displacement(const triple& z, const triple& p, const triple& q) return Z-dot(Z,Q)*Q; } -struct Split3 { - triple m0,m1,m2,m3,m4,m5; - Split3(triple z0, triple c0, triple c1, triple z1) { - m0=0.5*(z0+c0); - m1=0.5*(c0+c1); - m2=0.5*(c1+z1); - m3=0.5*(m0+m1); - m4=0.5*(m1+m2); - m5=0.5*(m3+m4); - } -}; - double xproject(const triple& v, double *t); double yproject(const triple& v, double *t); @@ -372,18 +366,17 @@ double yratio(const triple& v, double *t); double bound(triple z0, triple c0, triple c1, triple z1, double (*m)(double, double), double (*f)(const triple&, double*), double *t, - double b, int depth=maxdepth); -double bound(double *p, double (*m)(double, double), double b, - int depth=maxdepth); + double b, double fuzz=sqrtFuzz, int depth=maxdepth); +double bound(double *p, double (*m)(double, double), + double b, double fuzz=sqrtFuzz, int depth=maxdepth); double bound(triple *p, double (*m)(double, double), - double (*f)(const triple&, double*), double* t, double b, - int depth=maxdepth); + double (*f)(const triple&, double*), double* t, + double b, double fuzz=sqrtFuzz, int depth=maxdepth); } -// Do -DOMIT_SOLVEDKNOT_DECL to work around redefinition error reported by -// old (broken) compilers. #ifndef BROKEN_COMPILER -GC_DECLARE_PTRFREE(camp::solvedKnot); +// Delete the following line to work around problems with old broken compilers. +GC_DECLARE_PTRFREE(camp::solvedKnot3); #endif #endif diff --git a/Build/source/utils/asymptote/pen.h b/Build/source/utils/asymptote/pen.h index 623a57f09ba..755d7262be6 100644 --- a/Build/source/utils/asymptote/pen.h +++ b/Build/source/utils/asymptote/pen.h @@ -17,6 +17,7 @@ namespace camp { static const string DEFPAT="<default>"; static const string DEFLATEXFONT="\\usefont{\\ASYencoding}{\\ASYfamily}{\\ASYseries}{\\ASYshape}"; +static const string DEFCONTEXTFONT="modern"; static const string DEFTEXFONT="cmr12"; static const double DEFWIDTH=-1; static const Int DEFCAP=-1; @@ -395,8 +396,15 @@ public: return settings::getSetting<string>("textinitialfont"); else { ostringstream buf; - buf << "\\font\\ASYfont=" << DEFTEXFONT << " at " << size() - << "pt\\ASYfont"; + // Protect context switchtobodyfont with gsave/grestore to prevent + // misalignment if font is not found. + if(texengine == "context") + buf << "\\special{pdf:q}\\switchtobodyfont[" + << DEFCONTEXTFONT << "," << size() << "pt]\\special{pdf:Q}%" + << newl; + else + buf << "\\font\\ASYfont=" << DEFTEXFONT + << " at " << size() << "pt\\ASYfont"; return buf.str(); } } diff --git a/Build/source/utils/asymptote/picture.cc b/Build/source/utils/asymptote/picture.cc index 26023157229..7b41fd7b530 100644 --- a/Build/source/utils/asymptote/picture.cc +++ b/Build/source/utils/asymptote/picture.cc @@ -24,8 +24,15 @@ texstream::~texstream() { unlink((name+"aux").c_str()); unlink((name+"log").c_str()); unlink((name+"out").c_str()); - if(settings::pdf(getSetting<string>("tex"))) + string texengine=getSetting<string>("tex"); + if(settings::pdf(texengine)) unlink((name+"pdf").c_str()); + if(settings::context(texengine)) { + unlink((name+"tex").c_str()); + unlink((name+"top").c_str()); + unlink((name+"tua").c_str()); + unlink((name+"tui").c_str()); + } } namespace camp { @@ -216,7 +223,16 @@ void picture::texinit() unlink(cname); ostringstream cmd; - cmd << texprogram() << " \\scrollmode"; + bool context=settings::context(getSetting<string>("tex")); + if(context) { + // Create a null texput.tex file as a portable way of tricking context + // to enter interactive mode (pending the implementation of --pipe). + string texput=stripFile(outname())+"texput.tex"; + ofstream(texput.c_str()); + cmd << texprogram() << " --scrollmode --purgeall " << texput; + } else + cmd << texprogram() << " \\scrollmode"; + pd.tex.open(cmd.str().c_str(),"texpath",texpathmessage()); pd.tex.wait("\n*"); pd.tex << "\n"; @@ -239,15 +255,18 @@ bool picture::texprocess(const string& texname, const string& outname, unlink(aux.c_str()); string program=texprogram(); ostringstream cmd; - cmd << program << " \\nonstopmode\\input '" << texname << "'"; + bool context=settings::context(getSetting<string>("tex")); + cmd << program << (context ? " --nonstopmode --purgeall '" : + " \\nonstopmode\\input '") << texname << "'"; bool quiet=verbose <= 1; - status=System(cmd,quiet ? 1 : 0,"texpath",texpathmessage()); + status=System(cmd,quiet ? 1 : 0,true,"texpath",texpathmessage()); if(!status && getSetting<bool>("twice")) - status=System(cmd,quiet ? 1 : 0,"texpath",texpathmessage()); + status=System(cmd,quiet ? 1 : 0,true,"texpath",texpathmessage()); if(status) { if(quiet) { ostringstream cmd; - cmd << program << " \\scrollmode\\input '" << texname << "'"; + cmd << program << (context ? " --scrollmode --purgeall '" : + " \\scrollmode\\input '") << texname << "'"; System(cmd,0); } return false; @@ -326,6 +345,13 @@ bool picture::texprocess(const string& texname, const string& outname, unlink(aux.c_str()); unlink(auxname(prefix,"log").c_str()); unlink(auxname(prefix,"out").c_str()); + if(context) { + unlink(auxname(prefix,"top").c_str()); + unlink(auxname(prefix,"tua").c_str()); + unlink(auxname(prefix,"tuc").c_str()); + unlink(auxname(prefix,"tui").c_str()); + unlink(auxname(prefix,"tuo").c_str()); + } } if(status == 0) return true; } diff --git a/Build/source/utils/asymptote/pipestream.h b/Build/source/utils/asymptote/pipestream.h index ee8193635c3..191dfcffe85 100644 --- a/Build/source/utils/asymptote/pipestream.h +++ b/Build/source/utils/asymptote/pipestream.h @@ -1,5 +1,5 @@ /* Pipestream: A simple C++ interface to UNIX pipes - Version 0.03 + Version 0.04 Copyright (C) 2005-2009 John C. Bowman This program is free software; you can redistribute it and/or modify @@ -26,6 +26,7 @@ #include <sstream> #include <unistd.h> #include <signal.h> +#include <fcntl.h> #include "common.h" #include "errormsg.h" @@ -41,7 +42,9 @@ protected: static const int BUFSIZE=SHRT_MAX; char buffer[BUFSIZE]; int pid; + bool Running; bool pipeopen; + bool pipein; ostringstream transcript; public: @@ -73,44 +76,43 @@ public: } cout.flush(); // Flush stdout to avoid duplicate output. - int wrapperpid; - - // Portable way of forking that avoids zombie child processes - if((wrapperpid=fork()) < 0) { - cerr << "fork failed: " << command << endl; - exit(-1); + if((pid=fork()) < 0) { + ostringstream buf; + buf << "fork failed: " << command << endl; + camp::reportError(buf); } - if(wrapperpid == 0) { - if((pid=fork()) < 0) { - ostringstream buf; - buf << "fork failed: " << command << endl; - camp::reportError(buf); - } - - if(pid == 0) { - if(interact::interactive) signal(SIGINT,SIG_IGN); - close(in[1]); - close(out[0]); - close(STDIN_FILENO); - close(out_fileno); - dup2(in[0],STDIN_FILENO); - dup2(out[1],out_fileno); - close(in[0]); - close(out[1]); - char **argv=args(command); - if(argv) execvp(argv[0],argv); - execError(command,hint,application); - kill(0,SIGTERM); - _exit(-1); - } - _exit(0); - } else { - close(out[1]); + if(pid == 0) { + if(interact::interactive) signal(SIGINT,SIG_IGN); + close(in[1]); + close(out[0]); + close(STDIN_FILENO); + close(out_fileno); + dup2(in[0],STDIN_FILENO); + dup2(out[1],out_fileno); close(in[0]); - *buffer=0; - pipeopen=true; - waitpid(wrapperpid,NULL,0); + close(out[1]); + char **argv=args(command); + if(argv) execvp(argv[0],argv); + execError(command,hint,application); + kill(0,SIGTERM); + _exit(-1); + } + close(out[1]); + close(in[0]); + *buffer=0; + pipeopen=true; + pipein=true; + Running=true; + } + + void block(bool block=true) { + if(pipeopen) { + int flags=fcntl(out[0],F_GETFL); + if(block) + fcntl(out[0],F_SETFL,flags & ~O_NONBLOCK); + else + fcntl(out[0],F_SETFL,flags | O_NONBLOCK); } } @@ -124,11 +126,21 @@ public: open(command,hint,application,out_fileno); } + void eof() { + if(pipeopen && pipein) { + close(in[1]); + pipein=false; + } + } + virtual void pipeclose() { if(pipeopen) { - close(in[1]); + eof(); close(out[0]); + Running=false; pipeopen=false; + kill(pid,SIGQUIT); + waitpid(pid,NULL,0); // Avoid zombies. } } @@ -141,10 +153,16 @@ public: char *p=buffer; ssize_t size=BUFSIZE-1; for(;;) { - if((nc=read(out[0],p,size)) < 0) - camp::reportError("read from pipe failed"); + if((nc=read(out[0],p,size)) < 0) { + if(errno == EAGAIN) {p[0]=0; break;} + else camp::reportError("read from pipe failed"); + } p[nc]=0; - if(nc == 0) break; + if(nc == 0) { + if(waitpid(pid, NULL, WNOHANG) == pid) + Running=false; + break; + } if(nc > 0) { if(settings::verbose > 2) cerr << p; if(strchr(p,'\n')) break; @@ -155,6 +173,8 @@ public: return p+nc-buffer; } + bool running() {return Running;} + typedef iopipestream& (*imanip)(iopipestream&); iopipestream& operator << (imanip func) { return (*func)(*this); } diff --git a/Build/source/utils/asymptote/runtime.cc b/Build/source/utils/asymptote/runtime.cc index 4881fd8368e..909d1d2605f 100644 --- a/Build/source/utils/asymptote/runtime.cc +++ b/Build/source/utils/asymptote/runtime.cc @@ -369,6 +369,81 @@ double *copyArray2C(array *a, bool square=true, size_t dim2=0) return c; } +triple *copyTripleArray2C(array *a, bool square=true, size_t dim2=0) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2 << endl; + error(buf); + } + + triple *c=new triple[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + triple *ci=c+i*m; + for(size_t j=0; j < m; j++) + ci[j]=read<triple>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } + return c; +} + +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2 << endl; + error(buf); + } + + size_t nm=n*m; + double *cx=new double[3*nm]; + double *cy=cx+nm; + double *cz=cx+2*nm; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + double *xi=cx+i*m; + double *yi=cy+i*m; + double *zi=cz+i*m; + for(size_t j=0; j < m; j++) { + triple v=read<triple>(ai,j); + xi[j]=v.getx(); + yi[j]=v.gety(); + zi[j]=v.getz(); + } + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } + return cx; +} + +double norm(double *a, size_t n) +{ + if(n == 0) return 0.0; + double M=fabs(a[0]); + for(size_t i=1; i < n; ++i) + M=::max(M,fabs(a[i])); + return M; +} + +double norm(triple *a, size_t n) +{ + if(n == 0) return 0.0; + double M=a[0].abs2(); + for(size_t i=1; i < n; ++i) + M=::max(M,a[i].abs2()); + return sqrt(M); +} + static const char *incommensurate="Incommensurate matrices"; static const char *singular="Singular matrix"; static size_t *pivot,*Row,*Col; @@ -871,9 +946,8 @@ array *readpath(const string& psname, bool keep, while(true) { string out; gs >> out; + if(out.empty() && !gs.running()) break; buf << out; - string s=buf.str(); - if(gs.tailequals(s.c_str(),s.size(),"E",1)) break; } if(verbose > 2) cout << endl; @@ -1005,45 +1079,45 @@ void cannotwrite(const string& s) namespace run { // Initializers -#line 1045 "runtime.in" +#line 1119 "runtime.in" void IntZero(stack *Stack) { -#line 1046 "runtime.in" +#line 1120 "runtime.in" {Stack->push<Int>(0); return;} } -#line 1051 "runtime.in" +#line 1125 "runtime.in" void realZero(stack *Stack) { -#line 1052 "runtime.in" +#line 1126 "runtime.in" {Stack->push<real>(0.0); return;} } -#line 1056 "runtime.in" +#line 1130 "runtime.in" void boolFalse(stack *Stack) { -#line 1057 "runtime.in" +#line 1131 "runtime.in" {Stack->push<bool>(false); return;} } -#line 1061 "runtime.in" +#line 1135 "runtime.in" void pushNullArray(stack *Stack) { -#line 1062 "runtime.in" +#line 1136 "runtime.in" {Stack->push<array*>(0); return;} } -#line 1066 "runtime.in" +#line 1140 "runtime.in" void pushNullRecord(stack *Stack) { -#line 1067 "runtime.in" +#line 1141 "runtime.in" {Stack->push<frame*>(0); return;} } -#line 1071 "runtime.in" +#line 1145 "runtime.in" void pushNullFunction(stack *Stack) { -#line 1072 "runtime.in" +#line 1146 "runtime.in" {Stack->push(nullfunc::instance()); return;} } @@ -1052,183 +1126,183 @@ void pushNullFunction(stack *Stack) // Put the default value token on the stack (in place of an argument when // making a function call). -#line 1081 "runtime.in" +#line 1155 "runtime.in" void pushDefault(stack *Stack) { -#line 1082 "runtime.in" +#line 1156 "runtime.in" {Stack->push(def); return;} } // Test if the value on the stack is the default value token. -#line 1088 "runtime.in" +#line 1162 "runtime.in" void isDefault(stack *Stack) { item i=vm::pop(Stack); -#line 1089 "runtime.in" +#line 1163 "runtime.in" {Stack->push<bool>(isdefault(i)); return;} } // Logical operations -#line 1095 "runtime.in" +#line 1169 "runtime.in" // bool !(bool b); void gen8(stack *Stack) { bool b=vm::pop<bool>(Stack); -#line 1096 "runtime.in" +#line 1170 "runtime.in" {Stack->push<bool>(!b); return;} } -#line 1101 "runtime.in" +#line 1175 "runtime.in" void boolMemEq(stack *Stack) { frame * b=vm::pop<frame *>(Stack); frame * a=vm::pop<frame *>(Stack); -#line 1102 "runtime.in" +#line 1176 "runtime.in" {Stack->push<bool>(a == b); return;} } -#line 1106 "runtime.in" +#line 1180 "runtime.in" void boolMemNeq(stack *Stack) { frame * b=vm::pop<frame *>(Stack); frame * a=vm::pop<frame *>(Stack); -#line 1107 "runtime.in" +#line 1181 "runtime.in" {Stack->push<bool>(a != b); return;} } -#line 1111 "runtime.in" +#line 1185 "runtime.in" void boolFuncEq(stack *Stack) { callable * b=vm::pop<callable *>(Stack); callable * a=vm::pop<callable *>(Stack); -#line 1112 "runtime.in" +#line 1186 "runtime.in" {Stack->push<bool>(a->compare(b)); return;} } -#line 1116 "runtime.in" +#line 1190 "runtime.in" void boolFuncNeq(stack *Stack) { callable * b=vm::pop<callable *>(Stack); callable * a=vm::pop<callable *>(Stack); -#line 1117 "runtime.in" +#line 1191 "runtime.in" {Stack->push<bool>(!(a->compare(b))); return;} } // Bit operations -#line 1123 "runtime.in" +#line 1197 "runtime.in" // Int AND(Int a, Int b); void gen13(stack *Stack) { Int b=vm::pop<Int>(Stack); Int a=vm::pop<Int>(Stack); -#line 1124 "runtime.in" +#line 1198 "runtime.in" {Stack->push<Int>(a & b); return;} } -#line 1129 "runtime.in" +#line 1203 "runtime.in" // Int OR(Int a, Int b); void gen14(stack *Stack) { Int b=vm::pop<Int>(Stack); Int a=vm::pop<Int>(Stack); -#line 1130 "runtime.in" +#line 1204 "runtime.in" {Stack->push<Int>(a | b); return;} } -#line 1134 "runtime.in" +#line 1208 "runtime.in" // Int XOR(Int a, Int b); void gen15(stack *Stack) { Int b=vm::pop<Int>(Stack); Int a=vm::pop<Int>(Stack); -#line 1135 "runtime.in" +#line 1209 "runtime.in" {Stack->push<Int>(a ^ b); return;} } -#line 1139 "runtime.in" +#line 1213 "runtime.in" // Int NOT(Int a); void gen16(stack *Stack) { Int a=vm::pop<Int>(Stack); -#line 1140 "runtime.in" +#line 1214 "runtime.in" {Stack->push<Int>(~a); return;} } // Casts -#line 1146 "runtime.in" +#line 1220 "runtime.in" void pairToGuide(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 1147 "runtime.in" +#line 1221 "runtime.in" {Stack->push<guide*>(new pairguide(z)); return;} } -#line 1152 "runtime.in" +#line 1226 "runtime.in" void pathToGuide(stack *Stack) { path p=vm::pop<path>(Stack); -#line 1153 "runtime.in" +#line 1227 "runtime.in" {Stack->push<guide*>(new pathguide(p)); return;} } -#line 1157 "runtime.in" +#line 1231 "runtime.in" void guideToPath(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 1158 "runtime.in" +#line 1232 "runtime.in" {Stack->push<path>(g->solve()); return;} } // Picture operations -#line 1164 "runtime.in" +#line 1238 "runtime.in" void newPicture(stack *Stack) { -#line 1165 "runtime.in" +#line 1239 "runtime.in" {Stack->push<picture*>(new picture()); return;} } -#line 1170 "runtime.in" +#line 1244 "runtime.in" // bool empty(picture *f); void gen21(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1171 "runtime.in" +#line 1245 "runtime.in" {Stack->push<bool>(f->null()); return;} } -#line 1175 "runtime.in" +#line 1249 "runtime.in" // void erase(picture *f); void gen22(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1176 "runtime.in" +#line 1250 "runtime.in" f->nodes.clear(); } -#line 1180 "runtime.in" +#line 1254 "runtime.in" // pair min(picture *f); void gen23(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1181 "runtime.in" +#line 1255 "runtime.in" {Stack->push<pair>(f->bounds().Min()); return;} } -#line 1185 "runtime.in" +#line 1259 "runtime.in" // pair max(picture *f); void gen24(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1186 "runtime.in" +#line 1260 "runtime.in" {Stack->push<pair>(f->bounds().Max()); return;} } -#line 1190 "runtime.in" +#line 1264 "runtime.in" // void label(picture *f, string *s, string *size, transform t, pair position, pair align, pen p); void gen25(stack *Stack) { @@ -1239,75 +1313,114 @@ void gen25(stack *Stack) string * size=vm::pop<string *>(Stack); string * s=vm::pop<string *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1192 "runtime.in" +#line 1266 "runtime.in" f->append(new drawLabel(*s,*size,t,position,align,p)); } -#line 1196 "runtime.in" +#line 1270 "runtime.in" // bool labels(picture *f); void gen26(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1197 "runtime.in" +#line 1271 "runtime.in" {Stack->push<bool>(f->havelabels()); return;} } -#line 1201 "runtime.in" +#line 1275 "runtime.in" // patharray* _texpath(string *s, pen p=CURRENTPEN); void gen27(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); string * s=vm::pop<string *>(Stack); -#line 1202 "runtime.in" +#line 1276 "runtime.in" array *P=new array(0); if(s->empty()) {Stack->push<patharray*>(P); return;} string prefix=outname(); spaceToUnderscore(prefix); string psname=auxname(prefix,"ps"); - string texname=auxname(prefix,"tex"); string dviname=auxname(prefix,"dvi"); bbox b; - texfile tex(texname,b,true); + bool pdf=settings::pdf(getSetting<string>("tex")); + texfile tex(texname,b); tex.miniprologue(); - tex.setfont(p); - tex.verbatimline("\\special{ps:"); - tex.verbatimline(ASYo); - tex.verbatimline("/ASY1 true def"); - tex.verbatimline("/v {neg exch 4 copy 4 2 roll 2 copy 6 2 roll 2 copy (M) print ASYo ASYo (L) print ASYo add ASYo (L) print add ASYo add ASYo (L) print add ASYo ASYo (c) print} bind def"); - tex.verbatimline("/show {ASY1 {(Z) "+currentpoint+ - "/ASY1 false def} if currentpoint newpath moveto false charpath "+ - pathforall+"} bind def}"); - tex.verbatim(*s); - tex.verbatimline("\\special{ps: (E) print}"); + + if(!pdf) { + tex.verbatimline("\\special{ps:"); + tex.verbatimline(ASYo); + tex.verbatimline("/ASY1 true def"); + tex.verbatimline("/v {neg exch 4 copy 4 2 roll 2 copy 6 2 roll 2 copy (M) print ASYo ASYo (L) print ASYo add ASYo (L) print add ASYo add ASYo (L) print add ASYo ASYo (c) print} bind def"); + tex.verbatimline("/show {ASY1 {(Z) "+currentpoint+ + "/ASY1 false def} if currentpoint newpath moveto false charpath "+ + pathforall+"} bind def}"); + } + tex.verbatimline(*s); tex.epilogue(true); tex.close(); - ostringstream cmd; + // TODO: Put in common subproutine (cf. teprocess). string aux=auxname(prefix,"aux"); unlink(aux.c_str()); - cmd << texprogram(true) << " \\nonstopmode\\input '" << texname << "'"; + string program=texprogram(); + ostringstream cmd; + bool context=settings::context(getSetting<string>("tex")); + cmd << program << (context ? " --nonstopmode '" : + " \\nonstopmode\\input '") << texname << "'"; bool quiet=verbose <= 2; - int status=System(cmd,quiet ? 1 : 0,"texpath",texpathmessage()); + int status=System(cmd,quiet ? 1 : 0,true,"texpath",texpathmessage()); if(!status && getSetting<bool>("twice")) - status=System(cmd,quiet ? 1 : 0,"texpath",texpathmessage()); + status=System(cmd,quiet ? 1 : 0,true,"texpath",texpathmessage()); if(status) { if(quiet) { ostringstream cmd; - cmd << texprogram(true) << " \\scrollmode\\input '" << texname << "'"; + cmd << program << (context ? " --scrollmode '" : + " \\scrollmode\\input '") << texname << "'"; System(cmd,0); } } - if(!status) { - ostringstream cmd; - cmd << "'" << getSetting<string>("dvips") << "' -R -Pdownload35 -D600 " - << getSetting<string>("dvipsOptions"); - if(verbose <= 2) cmd << " -q"; - cmd << " -o '" << psname << "' '" << dviname << "'"; - status=System(cmd,0,true,"dvips"); + string pdfname; + if(!status) { + if(pdf) { + pdfname=auxname(prefix,"pdf"); + std::ofstream ps(psname.c_str()); + if(!ps) cannotwrite(psname); + + ps << ASYo << newl + << "/ASY1 true def" << newl + << "/fill {ASY1 {(Z) " << currentpoint << "/ASY1 false def} if " + << pathforall << " (M) " << currentpoint + << "currentpoint newpath moveto } bind def" << newl + << "/stroke {ASY1 {(Z) " << currentpoint + << "/ASY1 false def} if strokepath " + << pathforall << " (M) " << currentpoint + << "currentpoint newpath moveto } bind def" << newl; + + ostringstream cmd; + cmd << "'" << getSetting<string>("gs") + << "' -q -dNOCACHE -dNOPAUSE -dBATCH"; + if(safe) cmd << " -dSAFER"; + cmd << " -sDEVICE=epswrite -sOutputFile=- '" << pdfname << "'"; + iopipestream gs(cmd.str().c_str(),"gs","Ghostscript"); + + gs.block(false); + while(true) { + string line; + gs >> line; + if(line.empty() && !gs.running()) break; + ps << line; + } + ps.close(); + } else { + ostringstream cmd; + cmd << "'" << getSetting<string>("dvips") << "' -R -Pdownload35 -D600 " + << getSetting<string>("dvipsOptions"); + if(verbose <= 2) cmd << " -q"; + cmd << " -o '" << psname << "' '" << dviname << "'"; + status=System(cmd,0,true,"dvips"); + } } if(status != 0) @@ -1319,22 +1432,30 @@ void gen27(stack *Stack) if(!getSetting<bool>("keepaux")) unlink(aux.c_str()); unlink(auxname(prefix,"log").c_str()); - unlink(dviname.c_str()); + if(pdf) + unlink(pdfname.c_str()); + else + unlink(dviname.c_str()); + if(context) { + unlink(auxname(prefix,"top").c_str()); + unlink(auxname(prefix,"tua").c_str()); + unlink(auxname(prefix,"tui").c_str()); + } } - {Stack->push<patharray*>(readpath(psname,keep,twelvepercent,-twelvepercent)); return;} + {Stack->push<patharray*>(readpath(psname,keep,twelvepercent, + pdf ? twelvepercent : -twelvepercent)); return;} } -#line 1268 "runtime.in" +#line 1390 "runtime.in" // patharray* textpath(string *s, pen p=CURRENTPEN); void gen28(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); string * s=vm::pop<string *>(Stack); -#line 1269 "runtime.in" +#line 1391 "runtime.in" array *P=new array(0); if(s->empty()) {Stack->push<patharray*>(P); return;} - int status=0; string prefix=outname(); spaceToUnderscore(prefix); string outputname=auxname(prefix,getSetting<string>("textoutputtype")); @@ -1344,73 +1465,71 @@ void gen28(stack *Stack) if(!text) cannotwrite(textname); - text << getSetting<string>("textprologue"); - text << p.Font() << endl; - text << *s; - text << getSetting<string>("textepilogue"); + text << getSetting<string>("textprologue") << newl + << p.Font() << newl + << *s << newl + << getSetting<string>("textepilogue") << endl; text.close(); - ostringstream cmd; - string textcommand=getSetting<string>("textcommand"); - cmd << textcommand << " '" << textname << "' '" - << outputname << "'"; - bool quiet=verbose <= 2; - status=System(cmd,quiet ? 1 : 0); - - string epsname=auxname(prefix,"eps"); - - if(status == 0) { - ostringstream cmd; - cmd << "'" << getSetting<string>("gs") - << "' -q -dNOCACHE -dNOPAUSE -dBATCH"; - if(safe) cmd << " -dSAFER"; - cmd << " -sDEVICE=epswrite -sOutputFile='" << epsname << "' '" - << outputname << "'"; - status=System(cmd,0,true,"gs"); - } - - if(status != 0) - error("textpath failed"); - - string psname=auxname(prefix+"_","ps"); - std::ifstream eps(epsname.c_str()); + string psname=auxname(prefix,"ps"); std::ofstream ps(psname.c_str()); - - if(!eps) cannotread(epsname); if(!ps) cannotwrite(psname); - ps << ASYo << endl - << "/ASY1 true def" << endl + ps << ASYo << newl + << "/ASY1 true def" << newl << "/fill {ASY1 {(Z) " << currentpoint << "/ASY1 false def} if " << pathforall << " (M) " << currentpoint - << "currentpoint newpath moveto } bind def" << endl + << "currentpoint newpath moveto } bind def" << newl << "/stroke {ASY1 {(Z) " << currentpoint << "/ASY1 false def} if strokepath " << pathforall << " (M) " << currentpoint << "currentpoint newpath moveto } bind def" << endl; - string line; - while(getline(eps,line)) - ps << line << endl; - ps << "(E) print" << endl; - eps.close(); + + ostringstream pipe; + pipe << getSetting<string>("textcommand") << " '" << textname << "'"; + iopipestream typesetter(pipe.str().c_str()); + + ostringstream pipe2; + pipe2 << "'" << getSetting<string>("gs") + << "' -q -dNOCACHE -dNOPAUSE -dBATCH"; + if(safe) pipe2 << " -dSAFER"; + pipe2 << " -sDEVICE=epswrite -sOutputFile=- -"; + iopipestream gs(pipe2.str().c_str(),"gs","Ghostscript"); + gs.block(false); + + // TODO: Simplify by connecting the pipes directly. + while(true) { + string out; + if(typesetter.isopen()) { + typesetter >> out; + if(!out.empty()) gs << out; + else if(!typesetter.running()) { + typesetter.pipeclose(); + gs.eof(); + } + } + string out2; + gs >> out2; + if(out2.empty() && !gs.running()) break; + ps << out2; + } ps.close(); - + + if(verbose > 2) cout << endl; + bool keep=getSetting<bool>("keep"); - if(!keep) { // Delete temporary files. + if(!keep) // Delete temporary files. unlink(textname.c_str()); - unlink(outputname.c_str()); - unlink(epsname.c_str()); - } {Stack->push<patharray*>(readpath(psname,keep,tenpercent,tenpercent)); return;} } -#line 1343 "runtime.in" +#line 1462 "runtime.in" // patharray* _strokepath(path g, pen p=CURRENTPEN); void gen29(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); path g=vm::pop<path>(Stack); -#line 1344 "runtime.in" +#line 1463 "runtime.in" array *P=new array(0); if(g.size() == 0) {Stack->push<patharray*>(P); return;} @@ -1427,24 +1546,24 @@ void gen29(stack *Stack) ps.write(g); ps.strokepath(); ps.stroke(); - ps.verbatimline("(M) "+currentpoint+"(E) print"); + ps.verbatimline("(M) "+currentpoint); ps.epilogue(); ps.close(); {Stack->push<patharray*>(readpath(psname,getSetting<bool>("keep"))); return;} } -#line 1367 "runtime.in" +#line 1486 "runtime.in" // void _draw(picture *f, path g, pen p); void gen30(stack *Stack) { pen p=vm::pop<pen>(Stack); path g=vm::pop<path>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1368 "runtime.in" +#line 1487 "runtime.in" f->append(new drawPath(g,p)); } -#line 1372 "runtime.in" +#line 1491 "runtime.in" // void fill(picture *f, patharray *g, pen p=CURRENTPEN, bool copy=true); void gen31(stack *Stack) { @@ -1452,12 +1571,12 @@ void gen31(stack *Stack) pen p=vm::pop<pen>(Stack,CURRENTPEN); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1373 "runtime.in" +#line 1492 "runtime.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawFill(*copyarray(g),false,p)); } -#line 1378 "runtime.in" +#line 1497 "runtime.in" // void latticeshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray2 *p, bool copy=true); void gen32(stack *Stack) { @@ -1467,12 +1586,12 @@ void gen32(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1380 "runtime.in" +#line 1499 "runtime.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawLatticeShade(*copyarray(g),stroke,fillrule,*copyarray(p))); } -#line 1385 "runtime.in" +#line 1504 "runtime.in" // void axialshade(picture *f, patharray *g, bool stroke=false, pen pena, pair a, pen penb, pair b, bool copy=true); void gen33(stack *Stack) { @@ -1484,12 +1603,12 @@ void gen33(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1387 "runtime.in" +#line 1506 "runtime.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawAxialShade(*copyarray(g),stroke,pena,a,penb,b)); } -#line 1392 "runtime.in" +#line 1511 "runtime.in" // void radialshade(picture *f, patharray *g, bool stroke=false, pen pena, pair a, real ra, pen penb, pair b, real rb, bool copy=true); void gen34(stack *Stack) { @@ -1503,12 +1622,12 @@ void gen34(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1394 "runtime.in" +#line 1513 "runtime.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawRadialShade(*copyarray(g),stroke,pena,a,ra,penb,b,rb)); } -#line 1399 "runtime.in" +#line 1518 "runtime.in" // void gouraudshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray *p, pairarray *z, Intarray *edges, bool copy=true); void gen35(stack *Stack) { @@ -1520,7 +1639,7 @@ void gen35(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1402 "runtime.in" +#line 1521 "runtime.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; checkArrays(p,z); checkArrays(z,edges); @@ -1528,7 +1647,7 @@ void gen35(stack *Stack) *copyarray(z),*copyarray(edges))); } -#line 1410 "runtime.in" +#line 1529 "runtime.in" // void gouraudshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray *p, Intarray *edges, bool copy=true); void gen36(stack *Stack) { @@ -1539,7 +1658,7 @@ void gen36(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1413 "runtime.in" +#line 1532 "runtime.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; size_t n=checkArrays(p,edges); size_t m=checkArray(g); @@ -1560,7 +1679,7 @@ void gen36(stack *Stack) *z,*copyarray(edges))); } -#line 1434 "runtime.in" +#line 1553 "runtime.in" // void tensorshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray2 *p, patharray *b=NULL, pairarray2 *z=emptyarray, bool copy=true); void gen37(stack *Stack) { @@ -1572,7 +1691,7 @@ void gen37(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1437 "runtime.in" +#line 1556 "runtime.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; array *(*copyarray2)(array *a)=copy ? copyArray2: nop; if(b == NULL) b=g; @@ -1584,7 +1703,7 @@ void gen37(stack *Stack) *copyarray(b),*copyarray2(z))); } -#line 1449 "runtime.in" +#line 1568 "runtime.in" // void functionshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, string shader=emptystring, bool copy=true); void gen38(stack *Stack) { @@ -1594,14 +1713,14 @@ void gen38(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1452 "runtime.in" +#line 1571 "runtime.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawFunctionShade(*copyarray(g),stroke,fillrule,shader)); } // Clip a picture to a superpath using the given fill rule. // Subsequent additions to the picture will not be affected by the clipping. -#line 1459 "runtime.in" +#line 1578 "runtime.in" // void clip(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, bool copy=true); void gen39(stack *Stack) { @@ -1610,13 +1729,13 @@ void gen39(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1461 "runtime.in" +#line 1580 "runtime.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; drawClipBegin *begin=new drawClipBegin(*copyarray(g),stroke,fillrule,true); f->enclose(begin,new drawClipEnd(true,begin)); } -#line 1467 "runtime.in" +#line 1586 "runtime.in" // void beginclip(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, bool copy=true); void gen40(stack *Stack) { @@ -1625,97 +1744,97 @@ void gen40(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1469 "runtime.in" +#line 1588 "runtime.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawClipBegin(*copyarray(g),stroke,fillrule,false)); } -#line 1474 "runtime.in" +#line 1593 "runtime.in" // void endclip(picture *f); void gen41(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1475 "runtime.in" +#line 1594 "runtime.in" f->append(new drawClipEnd(false)); } -#line 1479 "runtime.in" +#line 1598 "runtime.in" // void gsave(picture *f); void gen42(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1480 "runtime.in" +#line 1599 "runtime.in" f->append(new drawGsave()); } -#line 1484 "runtime.in" +#line 1603 "runtime.in" // void grestore(picture *f); void gen43(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1485 "runtime.in" +#line 1604 "runtime.in" f->append(new drawGrestore()); } -#line 1489 "runtime.in" +#line 1608 "runtime.in" // void begingroup(picture *f); void gen44(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1490 "runtime.in" +#line 1609 "runtime.in" f->append(new drawBegin()); } -#line 1494 "runtime.in" +#line 1613 "runtime.in" // void endgroup(picture *f); void gen45(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1495 "runtime.in" +#line 1614 "runtime.in" f->append(new drawEnd()); } -#line 1499 "runtime.in" +#line 1618 "runtime.in" // void add(picture *dest, picture *src); void gen46(stack *Stack) { picture * src=vm::pop<picture *>(Stack); picture * dest=vm::pop<picture *>(Stack); -#line 1500 "runtime.in" +#line 1619 "runtime.in" dest->add(*src); } -#line 1504 "runtime.in" +#line 1623 "runtime.in" // void prepend(picture *dest, picture *src); void gen47(stack *Stack) { picture * src=vm::pop<picture *>(Stack); picture * dest=vm::pop<picture *>(Stack); -#line 1505 "runtime.in" +#line 1624 "runtime.in" dest->prepend(*src); } -#line 1509 "runtime.in" +#line 1628 "runtime.in" // void postscript(picture *f, string s); void gen48(stack *Stack) { string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1510 "runtime.in" +#line 1629 "runtime.in" f->append(new drawVerbatim(PostScript,s)); } -#line 1514 "runtime.in" +#line 1633 "runtime.in" // void tex(picture *f, string s); void gen49(stack *Stack) { string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1515 "runtime.in" +#line 1634 "runtime.in" f->append(new drawVerbatim(TeX,s)); } -#line 1519 "runtime.in" +#line 1638 "runtime.in" // void postscript(picture *f, string s, pair min, pair max); void gen50(stack *Stack) { @@ -1723,11 +1842,11 @@ void gen50(stack *Stack) pair min=vm::pop<pair>(Stack); string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1520 "runtime.in" +#line 1639 "runtime.in" f->append(new drawVerbatim(PostScript,s,min,max)); } -#line 1524 "runtime.in" +#line 1643 "runtime.in" // void tex(picture *f, string s, pair min, pair max); void gen51(stack *Stack) { @@ -1735,33 +1854,33 @@ void gen51(stack *Stack) pair min=vm::pop<pair>(Stack); string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1525 "runtime.in" +#line 1644 "runtime.in" f->append(new drawVerbatim(TeX,s,min,max)); } -#line 1529 "runtime.in" +#line 1648 "runtime.in" // void texpreamble(string s); void gen52(stack *Stack) { string s=vm::pop<string>(Stack); -#line 1530 "runtime.in" +#line 1649 "runtime.in" string t=s+"\n"; processDataStruct &pd=processData(); pd.TeXpipepreamble.push_back(t); pd.TeXpreamble.push_back(t); } -#line 1537 "runtime.in" +#line 1656 "runtime.in" // void deletepreamble(); void gen53(stack *) { -#line 1538 "runtime.in" +#line 1657 "runtime.in" if(getSetting<bool>("inlinetex")) { unlink(auxname(outname(),"pre").c_str()); } } -#line 1544 "runtime.in" +#line 1663 "runtime.in" // void _labelpath(picture *f, string s, string size, path g, string justify, pair offset, pen p); void gen54(stack *Stack) { @@ -1772,40 +1891,40 @@ void gen54(stack *Stack) string size=vm::pop<string>(Stack); string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1546 "runtime.in" +#line 1665 "runtime.in" f->append(new drawLabelPath(s,size,g,justify,offset,p)); } -#line 1550 "runtime.in" +#line 1669 "runtime.in" // void texreset(); void gen55(stack *) { -#line 1551 "runtime.in" +#line 1670 "runtime.in" processDataStruct &pd=processData(); pd.TeXpipepreamble.clear(); pd.TeXpreamble.clear(); pd.tex.pipeclose(); } -#line 1558 "runtime.in" +#line 1677 "runtime.in" // void layer(picture *f); void gen56(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1559 "runtime.in" +#line 1678 "runtime.in" f->append(new drawLayer()); } -#line 1563 "runtime.in" +#line 1682 "runtime.in" // void newpage(picture *f); void gen57(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 1564 "runtime.in" +#line 1683 "runtime.in" f->append(new drawNewPage()); } -#line 1568 "runtime.in" +#line 1687 "runtime.in" // void _image(picture *f, realarray2 *data, pair initial, pair final, penarray *palette=NULL, transform t=identity, bool copy=true, bool antialias=false); void gen58(stack *Stack) { @@ -1817,14 +1936,14 @@ void gen58(stack *Stack) pair initial=vm::pop<pair>(Stack); realarray2 * data=vm::pop<realarray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1571 "runtime.in" +#line 1690 "runtime.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; array *(*copyarray2)(array *a)=copy ? copyArray2: nop; f->append(new drawImage(*copyarray2(data),*copyarray(palette), t*matrix(initial,final),antialias)); } -#line 1578 "runtime.in" +#line 1697 "runtime.in" // void _image(picture *f, penarray2 *data, pair initial, pair final, transform t=identity, bool copy=true, bool antialias=false); void gen59(stack *Stack) { @@ -1835,36 +1954,36 @@ void gen59(stack *Stack) pair initial=vm::pop<pair>(Stack); penarray2 * data=vm::pop<penarray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 1580 "runtime.in" +#line 1699 "runtime.in" array *(*copyarray2)(array *a)=copy ? copyArray2: nop; f->append(new drawImage(*copyarray2(data),t*matrix(initial,final),antialias)); } -#line 1585 "runtime.in" +#line 1704 "runtime.in" // string nativeformat(); void gen60(stack *Stack) { -#line 1586 "runtime.in" +#line 1705 "runtime.in" {Stack->push<string>(nativeformat()); return;} } -#line 1590 "runtime.in" +#line 1709 "runtime.in" // bool latex(); void gen61(stack *Stack) { -#line 1591 "runtime.in" +#line 1710 "runtime.in" {Stack->push<bool>(latex(getSetting<string>("tex"))); return;} } -#line 1595 "runtime.in" +#line 1714 "runtime.in" // bool pdf(); void gen62(stack *Stack) { -#line 1596 "runtime.in" +#line 1715 "runtime.in" {Stack->push<bool>(pdf(getSetting<string>("tex"))); return;} } -#line 1600 "runtime.in" +#line 1719 "runtime.in" // void shipout(string prefix=emptystring, picture *f, picture *preamble=NULL, string format=emptystring, bool wait=false, bool view=true, callableTransform *xform); void gen63(stack *Stack) { @@ -1875,7 +1994,7 @@ void gen63(stack *Stack) picture * preamble=vm::pop<picture *>(Stack,NULL); picture * f=vm::pop<picture *>(Stack); string prefix=vm::pop<string>(Stack,emptystring); -#line 1603 "runtime.in" +#line 1722 "runtime.in" if(prefix.empty()) prefix=outname(); picture *result=new picture; @@ -1918,7 +2037,7 @@ void gen63(stack *Stack) result->shipout(preamble,prefix,format,0.0,wait,view); } -#line 1646 "runtime.in" +#line 1765 "runtime.in" // void shipout3(string prefix, picture *f, string format=emptystring, real width, real height, real angle, triple m, triple M, realarray2 *t, realarray *background, triplearray *lights, realarray2 *diffuse, realarray2 *ambient, realarray2 *specular, bool viewportlighting, bool view=true); void gen64(stack *Stack) { @@ -1938,7 +2057,7 @@ void gen64(stack *Stack) string format=vm::pop<string>(Stack,emptystring); picture * f=vm::pop<picture *>(Stack); string prefix=vm::pop<string>(Stack); -#line 1651 "runtime.in" +#line 1770 "runtime.in" size_t n=checkArrays(lights,diffuse); checkEqual(n,checkArray(ambient)); checkEqual(n,checkArray(specular)); @@ -1949,17 +2068,17 @@ void gen64(stack *Stack) copyArray2C(specular,false,4),viewportlighting,view); } -#line 1662 "runtime.in" +#line 1781 "runtime.in" // void shipout3(string prefix, picture *f); void gen65(stack *Stack) { picture * f=vm::pop<picture *>(Stack); string prefix=vm::pop<string>(Stack); -#line 1663 "runtime.in" +#line 1782 "runtime.in" f->shipout3(prefix); } -#line 1667 "runtime.in" +#line 1786 "runtime.in" // void deconstruct(picture *f, picture *preamble=NULL, real magnification=1, callableTransform *xform); void gen66(stack *Stack) { @@ -1967,7 +2086,7 @@ void gen66(stack *Stack) real magnification=vm::pop<real>(Stack,1); picture * preamble=vm::pop<picture *>(Stack,NULL); picture * f=vm::pop<picture *>(Stack); -#line 1669 "runtime.in" +#line 1788 "runtime.in" unsigned level=0; unsigned n=0; @@ -2098,188 +2217,188 @@ void gen66(stack *Stack) } } -#line 1800 "runtime.in" +#line 1919 "runtime.in" // void purge(Int divisor=0); void gen67(stack *Stack) { Int divisor=vm::pop<Int>(Stack,0); -#line 1801 "runtime.in" +#line 1920 "runtime.in" purge(divisor); } // Pen operations -#line 1807 "runtime.in" +#line 1926 "runtime.in" void newPen(stack *Stack) { -#line 1808 "runtime.in" +#line 1927 "runtime.in" {Stack->push<pen>(pen()); return;} } -#line 1813 "runtime.in" +#line 1932 "runtime.in" // bool ==(pen a, pen b); void gen69(stack *Stack) { pen b=vm::pop<pen>(Stack); pen a=vm::pop<pen>(Stack); -#line 1814 "runtime.in" +#line 1933 "runtime.in" {Stack->push<bool>(a == b); return;} } -#line 1818 "runtime.in" +#line 1937 "runtime.in" // bool !=(pen a, pen b); void gen70(stack *Stack) { pen b=vm::pop<pen>(Stack); pen a=vm::pop<pen>(Stack); -#line 1819 "runtime.in" +#line 1938 "runtime.in" {Stack->push<bool>(a != b); return;} } -#line 1823 "runtime.in" +#line 1942 "runtime.in" // pen +(pen a, pen b); void gen71(stack *Stack) { pen b=vm::pop<pen>(Stack); pen a=vm::pop<pen>(Stack); -#line 1824 "runtime.in" +#line 1943 "runtime.in" {Stack->push<pen>(a+b); return;} } -#line 1828 "runtime.in" +#line 1947 "runtime.in" // pen *(real a, pen b); void gen72(stack *Stack) { pen b=vm::pop<pen>(Stack); real a=vm::pop<real>(Stack); -#line 1829 "runtime.in" +#line 1948 "runtime.in" {Stack->push<pen>(a*b); return;} } -#line 1833 "runtime.in" +#line 1952 "runtime.in" // pen *(pen a, real b); void gen73(stack *Stack) { real b=vm::pop<real>(Stack); pen a=vm::pop<pen>(Stack); -#line 1834 "runtime.in" +#line 1953 "runtime.in" {Stack->push<pen>(b*a); return;} } -#line 1838 "runtime.in" +#line 1957 "runtime.in" // pair max(pen p); void gen74(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1839 "runtime.in" +#line 1958 "runtime.in" {Stack->push<pair>(p.bounds().Max()); return;} } -#line 1843 "runtime.in" +#line 1962 "runtime.in" // pair min(pen p); void gen75(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1844 "runtime.in" +#line 1963 "runtime.in" {Stack->push<pair>(p.bounds().Min()); return;} } // Reset the meaning of pen default attributes. -#line 1849 "runtime.in" +#line 1968 "runtime.in" // void resetdefaultpen(); void gen76(stack *) { -#line 1850 "runtime.in" +#line 1969 "runtime.in" processData().defaultpen=camp::pen::initialpen(); } -#line 1854 "runtime.in" +#line 1973 "runtime.in" // void defaultpen(pen p); void gen77(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1855 "runtime.in" +#line 1974 "runtime.in" processData().defaultpen=pen(resolvepen,p); } -#line 1859 "runtime.in" +#line 1978 "runtime.in" // pen defaultpen(); void gen78(stack *Stack) { -#line 1860 "runtime.in" +#line 1979 "runtime.in" {Stack->push<pen>(processData().defaultpen); return;} } -#line 1864 "runtime.in" +#line 1983 "runtime.in" // bool invisible(pen p); void gen79(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1865 "runtime.in" +#line 1984 "runtime.in" {Stack->push<bool>(p.invisible()); return;} } -#line 1869 "runtime.in" +#line 1988 "runtime.in" // pen invisible(); void gen80(stack *Stack) { -#line 1870 "runtime.in" +#line 1989 "runtime.in" {Stack->push<pen>(pen(invisiblepen)); return;} } -#line 1874 "runtime.in" +#line 1993 "runtime.in" // pen gray(pen p); void gen81(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1875 "runtime.in" +#line 1994 "runtime.in" p.togrey(); {Stack->push<pen>(p); return;} } -#line 1880 "runtime.in" +#line 1999 "runtime.in" // pen rgb(pen p); void gen82(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1881 "runtime.in" +#line 2000 "runtime.in" p.torgb(); {Stack->push<pen>(p); return;} } -#line 1886 "runtime.in" +#line 2005 "runtime.in" // pen cmyk(pen p); void gen83(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1887 "runtime.in" +#line 2006 "runtime.in" p.tocmyk(); {Stack->push<pen>(p); return;} } -#line 1892 "runtime.in" +#line 2011 "runtime.in" // pen interp(pen a, pen b, real t); void gen84(stack *Stack) { real t=vm::pop<real>(Stack); pen b=vm::pop<pen>(Stack); pen a=vm::pop<pen>(Stack); -#line 1893 "runtime.in" +#line 2012 "runtime.in" {Stack->push<pen>(interpolate(a,b,t)); return;} } -#line 1897 "runtime.in" +#line 2016 "runtime.in" // pen rgb(real r, real g, real b); void gen85(stack *Stack) { real b=vm::pop<real>(Stack); real g=vm::pop<real>(Stack); real r=vm::pop<real>(Stack); -#line 1898 "runtime.in" +#line 2017 "runtime.in" {Stack->push<pen>(pen(r,g,b)); return;} } -#line 1902 "runtime.in" +#line 2021 "runtime.in" // pen cmyk(real c, real m, real y, real k); void gen86(stack *Stack) { @@ -2287,25 +2406,25 @@ void gen86(stack *Stack) real y=vm::pop<real>(Stack); real m=vm::pop<real>(Stack); real c=vm::pop<real>(Stack); -#line 1903 "runtime.in" +#line 2022 "runtime.in" {Stack->push<pen>(pen(c,m,y,k)); return;} } -#line 1907 "runtime.in" +#line 2026 "runtime.in" // pen gray(real gray); void gen87(stack *Stack) { real gray=vm::pop<real>(Stack); -#line 1908 "runtime.in" +#line 2027 "runtime.in" {Stack->push<pen>(pen(gray)); return;} } -#line 1912 "runtime.in" +#line 2031 "runtime.in" // realarray* colors(pen p); void gen88(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1913 "runtime.in" +#line 2032 "runtime.in" size_t n=ColorComponents[p.colorspace()]; array *a=new array(n); @@ -2332,60 +2451,60 @@ void gen88(stack *Stack) {Stack->push<realarray*>(a); return;} } -#line 1940 "runtime.in" +#line 2059 "runtime.in" // string colorspace(pen p); void gen89(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1941 "runtime.in" +#line 2060 "runtime.in" string s=ColorDeviceSuffix[p.colorspace()]; std::transform(s.begin(),s.end(),s.begin(),tolower); {Stack->push<string>(s); return;} } -#line 1947 "runtime.in" +#line 2066 "runtime.in" // pen pattern(string *s); void gen90(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 1948 "runtime.in" +#line 2067 "runtime.in" {Stack->push<pen>(pen(setpattern,*s)); return;} } -#line 1952 "runtime.in" +#line 2071 "runtime.in" // string pattern(pen p); void gen91(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1953 "runtime.in" +#line 2072 "runtime.in" {Stack->push<string>(p.fillpattern()); return;} } -#line 1957 "runtime.in" +#line 2076 "runtime.in" // pen fillrule(Int n); void gen92(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 1958 "runtime.in" +#line 2077 "runtime.in" {Stack->push<pen>(pen(n >= 0 && n < nFill ? (FillRule) n : DEFFILL)); return;} } -#line 1962 "runtime.in" +#line 2081 "runtime.in" // Int fillrule(pen p); void gen93(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1963 "runtime.in" +#line 2082 "runtime.in" {Stack->push<Int>(p.Fillrule()); return;} } -#line 1967 "runtime.in" +#line 2086 "runtime.in" // pen opacity(real opacity=1.0, string blend=defaulttransparency); void gen94(stack *Stack) { string blend=vm::pop<string>(Stack,defaulttransparency); real opacity=vm::pop<real>(Stack,1.0); -#line 1968 "runtime.in" +#line 2087 "runtime.in" for(Int i=0; i < nBlendMode; ++i) if(blend == BlendMode[i]) {Stack->push<pen>(pen(Transparency(blend,opacity))); return;} @@ -2394,25 +2513,25 @@ void gen94(stack *Stack) error(buf); } -#line 1977 "runtime.in" +#line 2096 "runtime.in" // real opacity(pen p); void gen95(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1978 "runtime.in" +#line 2097 "runtime.in" {Stack->push<real>(p.opacity()); return;} } -#line 1982 "runtime.in" +#line 2101 "runtime.in" // string blend(pen p); void gen96(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1983 "runtime.in" +#line 2102 "runtime.in" {Stack->push<string>(p.blend()); return;} } -#line 1987 "runtime.in" +#line 2106 "runtime.in" // pen linetype(string *s, real offset=0, bool scale=true, bool adjust=true); void gen97(stack *Stack) { @@ -2420,331 +2539,331 @@ void gen97(stack *Stack) bool scale=vm::pop<bool>(Stack,true); real offset=vm::pop<real>(Stack,0); string * s=vm::pop<string *>(Stack); -#line 1988 "runtime.in" +#line 2107 "runtime.in" {Stack->push<pen>(pen(LineType(*s,offset,scale,adjust))); return;} } -#line 1992 "runtime.in" +#line 2111 "runtime.in" // string linetype(pen p=CURRENTPEN); void gen98(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 1993 "runtime.in" +#line 2112 "runtime.in" {Stack->push<string>(p.stroke()); return;} } -#line 1997 "runtime.in" +#line 2116 "runtime.in" // real offset(pen p); void gen99(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 1998 "runtime.in" +#line 2117 "runtime.in" {Stack->push<real>(p.linetype().offset); return;} } -#line 2002 "runtime.in" +#line 2121 "runtime.in" // bool scale(pen p); void gen100(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 2003 "runtime.in" +#line 2122 "runtime.in" {Stack->push<bool>(p.linetype().scale); return;} } -#line 2007 "runtime.in" +#line 2126 "runtime.in" // bool adjust(pen p); void gen101(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 2008 "runtime.in" +#line 2127 "runtime.in" {Stack->push<bool>(p.linetype().adjust); return;} } -#line 2012 "runtime.in" +#line 2131 "runtime.in" // pen adjust(pen p, real arclength, bool cyclic); void gen102(stack *Stack) { bool cyclic=vm::pop<bool>(Stack); real arclength=vm::pop<real>(Stack); pen p=vm::pop<pen>(Stack); -#line 2013 "runtime.in" +#line 2132 "runtime.in" {Stack->push<pen>(adjustdash(p,arclength,cyclic)); return;} } -#line 2017 "runtime.in" +#line 2136 "runtime.in" // pen linecap(Int n); void gen103(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 2018 "runtime.in" +#line 2137 "runtime.in" {Stack->push<pen>(pen(setlinecap,n >= 0 && n < nCap ? n : DEFCAP)); return;} } -#line 2022 "runtime.in" +#line 2141 "runtime.in" // Int linecap(pen p=CURRENTPEN); void gen104(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 2023 "runtime.in" +#line 2142 "runtime.in" {Stack->push<Int>(p.cap()); return;} } -#line 2027 "runtime.in" +#line 2146 "runtime.in" // pen linejoin(Int n); void gen105(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 2028 "runtime.in" +#line 2147 "runtime.in" {Stack->push<pen>(pen(setlinejoin,n >= 0 && n < nJoin ? n : DEFJOIN)); return;} } -#line 2032 "runtime.in" +#line 2151 "runtime.in" // Int linejoin(pen p=CURRENTPEN); void gen106(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 2033 "runtime.in" +#line 2152 "runtime.in" {Stack->push<Int>(p.join()); return;} } -#line 2037 "runtime.in" +#line 2156 "runtime.in" // pen miterlimit(real x); void gen107(stack *Stack) { real x=vm::pop<real>(Stack); -#line 2038 "runtime.in" +#line 2157 "runtime.in" {Stack->push<pen>(pen(setmiterlimit,x >= 1.0 ? x : DEFJOIN)); return;} } -#line 2042 "runtime.in" +#line 2161 "runtime.in" // real miterlimit(pen p=CURRENTPEN); void gen108(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 2043 "runtime.in" +#line 2162 "runtime.in" {Stack->push<real>(p.miter()); return;} } -#line 2047 "runtime.in" +#line 2166 "runtime.in" // pen linewidth(real x); void gen109(stack *Stack) { real x=vm::pop<real>(Stack); -#line 2048 "runtime.in" +#line 2167 "runtime.in" {Stack->push<pen>(pen(setlinewidth,x >= 0.0 ? x : DEFWIDTH)); return;} } -#line 2052 "runtime.in" +#line 2171 "runtime.in" // real linewidth(pen p=CURRENTPEN); void gen110(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 2053 "runtime.in" +#line 2172 "runtime.in" {Stack->push<real>(p.width()); return;} } -#line 2057 "runtime.in" +#line 2176 "runtime.in" // pen fontcommand(string *s); void gen111(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 2058 "runtime.in" +#line 2177 "runtime.in" {Stack->push<pen>(pen(setfont,*s)); return;} } -#line 2062 "runtime.in" +#line 2181 "runtime.in" // string font(pen p=CURRENTPEN); void gen112(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 2063 "runtime.in" +#line 2182 "runtime.in" {Stack->push<string>(p.Font()); return;} } -#line 2067 "runtime.in" +#line 2186 "runtime.in" // pen fontsize(real size, real lineskip); void gen113(stack *Stack) { real lineskip=vm::pop<real>(Stack); real size=vm::pop<real>(Stack); -#line 2068 "runtime.in" +#line 2187 "runtime.in" {Stack->push<pen>(pen(setfontsize,size > 0.0 ? size : 0.0, lineskip > 0.0 ? lineskip : 0.0)); return;} } -#line 2073 "runtime.in" +#line 2192 "runtime.in" // real fontsize(pen p=CURRENTPEN); void gen114(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 2074 "runtime.in" +#line 2193 "runtime.in" {Stack->push<real>(p.size()); return;} } -#line 2078 "runtime.in" +#line 2197 "runtime.in" // real lineskip(pen p=CURRENTPEN); void gen115(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 2079 "runtime.in" +#line 2198 "runtime.in" {Stack->push<real>(p.Lineskip()); return;} } -#line 2083 "runtime.in" +#line 2202 "runtime.in" // pen overwrite(Int n); void gen116(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 2084 "runtime.in" +#line 2203 "runtime.in" {Stack->push<pen>(pen(setoverwrite,n >= 0 && n < nOverwrite ? (overwrite_t) n : DEFWRITE)); return;} } -#line 2089 "runtime.in" +#line 2208 "runtime.in" // Int overwrite(pen p=CURRENTPEN); void gen117(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 2090 "runtime.in" +#line 2209 "runtime.in" {Stack->push<Int>(p.Overwrite()); return;} } -#line 2094 "runtime.in" +#line 2213 "runtime.in" // pen basealign(Int n); void gen118(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 2095 "runtime.in" +#line 2214 "runtime.in" {Stack->push<pen>(pen(n >= 0 && n < nBaseLine ? (BaseLine) n : DEFBASE)); return;} } -#line 2099 "runtime.in" +#line 2218 "runtime.in" // Int basealign(pen p=CURRENTPEN); void gen119(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 2100 "runtime.in" +#line 2219 "runtime.in" {Stack->push<Int>(p.Baseline()); return;} } -#line 2104 "runtime.in" +#line 2223 "runtime.in" // transform transform(pen p); void gen120(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 2105 "runtime.in" +#line 2224 "runtime.in" {Stack->push<transform>(p.getTransform()); return;} } -#line 2109 "runtime.in" +#line 2228 "runtime.in" // path nib(pen p); void gen121(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 2110 "runtime.in" +#line 2229 "runtime.in" {Stack->push<path>(p.Path()); return;} } -#line 2114 "runtime.in" +#line 2233 "runtime.in" // pen makepen(path p); void gen122(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2115 "runtime.in" +#line 2234 "runtime.in" {Stack->push<pen>(pen(p)); return;} } -#line 2119 "runtime.in" +#line 2238 "runtime.in" // pen colorless(pen p); void gen123(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 2120 "runtime.in" +#line 2239 "runtime.in" p.colorless(); {Stack->push<pen>(p); return;} } // Interactive mode -#line 2126 "runtime.in" +#line 2245 "runtime.in" // bool interactive(); void gen124(stack *Stack) { -#line 2127 "runtime.in" +#line 2246 "runtime.in" {Stack->push<bool>(interact::interactive); return;} } -#line 2132 "runtime.in" +#line 2251 "runtime.in" // bool uptodate(); void gen125(stack *Stack) { -#line 2133 "runtime.in" +#line 2252 "runtime.in" {Stack->push<bool>(interact::uptodate); return;} } // System commands -#line 2139 "runtime.in" +#line 2258 "runtime.in" // Int system(string s); void gen126(stack *Stack) { string s=vm::pop<string>(Stack); -#line 2140 "runtime.in" +#line 2259 "runtime.in" if(safe) error("system() call disabled; override with option -nosafe"); if(s.empty()) {Stack->push<Int>(0); return;} else {Stack->push<Int>(System(s.c_str())); return;} } -#line 2147 "runtime.in" +#line 2266 "runtime.in" // bool view(); void gen127(stack *Stack) { -#line 2148 "runtime.in" +#line 2267 "runtime.in" {Stack->push<bool>(view()); return;} } -#line 2152 "runtime.in" +#line 2271 "runtime.in" // string asydir(); void gen128(stack *Stack) { -#line 2153 "runtime.in" +#line 2272 "runtime.in" {Stack->push<string>(systemDir); return;} } -#line 2157 "runtime.in" +#line 2276 "runtime.in" // string locale(string s=emptystring); void gen129(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); -#line 2158 "runtime.in" +#line 2277 "runtime.in" char *L=setlocale(LC_ALL,s.empty() ? NULL : s.c_str()); {Stack->push<string>(L != NULL ? string(L) : ""); return;} } -#line 2163 "runtime.in" +#line 2282 "runtime.in" // void abort(string s=emptystring); void gen130(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); -#line 2164 "runtime.in" +#line 2283 "runtime.in" if(s.empty()) throw handled_error(); error(s.c_str()); } -#line 2169 "runtime.in" +#line 2288 "runtime.in" // void exit(); void gen131(stack *) { -#line 2170 "runtime.in" +#line 2289 "runtime.in" throw quit(); } -#line 2174 "runtime.in" +#line 2293 "runtime.in" // void assert(bool b, string s=emptystring); void gen132(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); bool b=vm::pop<bool>(Stack); -#line 2175 "runtime.in" +#line 2294 "runtime.in" flush(cout); if(!b) { ostringstream buf; @@ -2754,34 +2873,34 @@ void gen132(stack *Stack) } } -#line 2185 "runtime.in" +#line 2304 "runtime.in" // void sleep(Int seconds); void gen133(stack *Stack) { Int seconds=vm::pop<Int>(Stack); -#line 2186 "runtime.in" +#line 2305 "runtime.in" if(seconds <= 0) return; sleep(seconds); } -#line 2191 "runtime.in" +#line 2310 "runtime.in" // void usleep(Int microseconds); void gen134(stack *Stack) { Int microseconds=vm::pop<Int>(Stack); -#line 2192 "runtime.in" +#line 2311 "runtime.in" if(microseconds <= 0) return; usleep((unsigned long) microseconds); } -#line 2197 "runtime.in" +#line 2316 "runtime.in" // void _eval(string *s, bool embedded, bool interactiveWrite=false); void gen135(stack *Stack) { bool interactiveWrite=vm::pop<bool>(Stack,false); bool embedded=vm::pop<bool>(Stack); string * s=vm::pop<string *>(Stack); -#line 2198 "runtime.in" +#line 2317 "runtime.in" if (embedded) { trans::coenv *e=Stack->getEnvironment(); vm::interactiveStack *is=dynamic_cast<vm::interactiveStack *>(Stack); @@ -2795,13 +2914,13 @@ void gen135(stack *Stack) } } -#line 2212 "runtime.in" +#line 2331 "runtime.in" // void _eval(runnable *s, bool embedded); void gen136(stack *Stack) { bool embedded=vm::pop<bool>(Stack); runnable * s=vm::pop<runnable *>(Stack); -#line 2213 "runtime.in" +#line 2332 "runtime.in" absyntax::block *ast=new absyntax::block(s->getPos(), false); ast->add(s); @@ -2818,42 +2937,42 @@ void gen136(stack *Stack) } } -#line 2230 "runtime.in" +#line 2349 "runtime.in" // string location(); void gen137(stack *Stack) { -#line 2231 "runtime.in" +#line 2350 "runtime.in" ostringstream buf; buf << getPos(); {Stack->push<string>(buf.str()); return;} } // Wrapper for the stack::load() method. -#line 2237 "runtime.in" +#line 2356 "runtime.in" void loadModule(stack *Stack) { string * index=vm::pop<string *>(Stack); -#line 2238 "runtime.in" +#line 2357 "runtime.in" Stack->load(*index); } -#line 2242 "runtime.in" +#line 2361 "runtime.in" // string cd(string s=emptystring); void gen139(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); -#line 2243 "runtime.in" +#line 2362 "runtime.in" if(!s.empty() && !globalwrite()) writeDisabled(); {Stack->push<string>(setPath(s.c_str())); return;} } -#line 2248 "runtime.in" +#line 2367 "runtime.in" // void list(string *s, bool imports=false); void gen140(stack *Stack) { bool imports=vm::pop<bool>(Stack,false); string * s=vm::pop<string *>(Stack); -#line 2249 "runtime.in" +#line 2368 "runtime.in" if(*s == "-") return; trans::genv ge; symbol *name=symbol::trans(*s); @@ -2863,94 +2982,94 @@ void gen140(stack *Stack) // Path operations -#line 2259 "runtime.in" +#line 2378 "runtime.in" void nullPath(stack *Stack) { -#line 2260 "runtime.in" +#line 2379 "runtime.in" {Stack->push<path>(nullpath); return;} } -#line 2265 "runtime.in" +#line 2384 "runtime.in" // bool ==(path a, path b); void gen142(stack *Stack) { path b=vm::pop<path>(Stack); path a=vm::pop<path>(Stack); -#line 2266 "runtime.in" +#line 2385 "runtime.in" {Stack->push<bool>(a == b); return;} } -#line 2270 "runtime.in" +#line 2389 "runtime.in" // bool !=(path a, path b); void gen143(stack *Stack) { path b=vm::pop<path>(Stack); path a=vm::pop<path>(Stack); -#line 2271 "runtime.in" +#line 2390 "runtime.in" {Stack->push<bool>(!(a == b)); return;} } -#line 2275 "runtime.in" +#line 2394 "runtime.in" // pair point(path p, Int t); void gen144(stack *Stack) { Int t=vm::pop<Int>(Stack); path p=vm::pop<path>(Stack); -#line 2276 "runtime.in" +#line 2395 "runtime.in" {Stack->push<pair>(p.point((Int) t)); return;} } -#line 2280 "runtime.in" +#line 2399 "runtime.in" // pair point(path p, real t); void gen145(stack *Stack) { real t=vm::pop<real>(Stack); path p=vm::pop<path>(Stack); -#line 2281 "runtime.in" +#line 2400 "runtime.in" {Stack->push<pair>(p.point(t)); return;} } -#line 2285 "runtime.in" +#line 2404 "runtime.in" // pair precontrol(path p, Int t); void gen146(stack *Stack) { Int t=vm::pop<Int>(Stack); path p=vm::pop<path>(Stack); -#line 2286 "runtime.in" +#line 2405 "runtime.in" {Stack->push<pair>(p.precontrol((Int) t)); return;} } -#line 2290 "runtime.in" +#line 2409 "runtime.in" // pair precontrol(path p, real t); void gen147(stack *Stack) { real t=vm::pop<real>(Stack); path p=vm::pop<path>(Stack); -#line 2291 "runtime.in" +#line 2410 "runtime.in" {Stack->push<pair>(p.precontrol(t)); return;} } -#line 2295 "runtime.in" +#line 2414 "runtime.in" // pair postcontrol(path p, Int t); void gen148(stack *Stack) { Int t=vm::pop<Int>(Stack); path p=vm::pop<path>(Stack); -#line 2296 "runtime.in" +#line 2415 "runtime.in" {Stack->push<pair>(p.postcontrol((Int) t)); return;} } -#line 2300 "runtime.in" +#line 2419 "runtime.in" // pair postcontrol(path p, real t); void gen149(stack *Stack) { real t=vm::pop<real>(Stack); path p=vm::pop<path>(Stack); -#line 2301 "runtime.in" +#line 2420 "runtime.in" {Stack->push<pair>(p.postcontrol(t)); return;} } -#line 2305 "runtime.in" +#line 2424 "runtime.in" // pair dir(path p, Int t, Int sign=0, bool normalize=true); void gen150(stack *Stack) { @@ -2958,49 +3077,49 @@ void gen150(stack *Stack) Int sign=vm::pop<Int>(Stack,0); Int t=vm::pop<Int>(Stack); path p=vm::pop<path>(Stack); -#line 2306 "runtime.in" +#line 2425 "runtime.in" {Stack->push<pair>(p.dir(t,sign,normalize)); return;} } -#line 2310 "runtime.in" +#line 2429 "runtime.in" // pair dir(path p, real t, bool normalize=true); void gen151(stack *Stack) { bool normalize=vm::pop<bool>(Stack,true); real t=vm::pop<real>(Stack); path p=vm::pop<path>(Stack); -#line 2311 "runtime.in" +#line 2430 "runtime.in" {Stack->push<pair>(p.dir(t,normalize)); return;} } -#line 2315 "runtime.in" +#line 2434 "runtime.in" // pair accel(path p, Int t, Int sign=0); void gen152(stack *Stack) { Int sign=vm::pop<Int>(Stack,0); Int t=vm::pop<Int>(Stack); path p=vm::pop<path>(Stack); -#line 2316 "runtime.in" +#line 2435 "runtime.in" {Stack->push<pair>(p.accel(t,sign)); return;} } -#line 2320 "runtime.in" +#line 2439 "runtime.in" // pair accel(path p, real t); void gen153(stack *Stack) { real t=vm::pop<real>(Stack); path p=vm::pop<path>(Stack); -#line 2321 "runtime.in" +#line 2440 "runtime.in" {Stack->push<pair>(p.accel(t)); return;} } -#line 2325 "runtime.in" +#line 2444 "runtime.in" // real radius(path p, real t); void gen154(stack *Stack) { real t=vm::pop<real>(Stack); path p=vm::pop<path>(Stack); -#line 2326 "runtime.in" +#line 2445 "runtime.in" pair v=p.dir(t,false); pair a=p.accel(t); real d=dot(a,v); @@ -3011,38 +3130,38 @@ void gen154(stack *Stack) {Stack->push<real>(denom > 0 ? r/sqrt(denom) : 0.0); return;} } -#line 2337 "runtime.in" +#line 2456 "runtime.in" // path reverse(path p); void gen155(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2338 "runtime.in" +#line 2457 "runtime.in" {Stack->push<path>(p.reverse()); return;} } -#line 2342 "runtime.in" +#line 2461 "runtime.in" // path subpath(path p, Int a, Int b); void gen156(stack *Stack) { Int b=vm::pop<Int>(Stack); Int a=vm::pop<Int>(Stack); path p=vm::pop<path>(Stack); -#line 2343 "runtime.in" +#line 2462 "runtime.in" {Stack->push<path>(p.subpath((Int) a, (Int) b)); return;} } -#line 2347 "runtime.in" +#line 2466 "runtime.in" // path subpath(path p, real a, real b); void gen157(stack *Stack) { real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); path p=vm::pop<path>(Stack); -#line 2348 "runtime.in" +#line 2467 "runtime.in" {Stack->push<path>(p.subpath(a,b)); return;} } -#line 2352 "runtime.in" +#line 2471 "runtime.in" // path nurb(pair z0, pair z1, pair z2, pair z3, real w0, real w1, real w2, real w3, Int m); void gen158(stack *Stack) { @@ -3055,93 +3174,93 @@ void gen158(stack *Stack) pair z2=vm::pop<pair>(Stack); pair z1=vm::pop<pair>(Stack); pair z0=vm::pop<pair>(Stack); -#line 2354 "runtime.in" +#line 2473 "runtime.in" {Stack->push<path>(nurb(z0,z1,z2,z3,w0,w1,w2,w3,m)); return;} } -#line 2358 "runtime.in" +#line 2477 "runtime.in" // Int length(path p); void gen159(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2359 "runtime.in" +#line 2478 "runtime.in" {Stack->push<Int>(p.length()); return;} } -#line 2363 "runtime.in" +#line 2482 "runtime.in" // bool cyclic(path p); void gen160(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2364 "runtime.in" +#line 2483 "runtime.in" {Stack->push<bool>(p.cyclic()); return;} } -#line 2368 "runtime.in" +#line 2487 "runtime.in" // bool straight(path p, Int t); void gen161(stack *Stack) { Int t=vm::pop<Int>(Stack); path p=vm::pop<path>(Stack); -#line 2369 "runtime.in" +#line 2488 "runtime.in" {Stack->push<bool>(p.straight(t)); return;} } -#line 2373 "runtime.in" +#line 2492 "runtime.in" // path unstraighten(path p); void gen162(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2374 "runtime.in" +#line 2493 "runtime.in" {Stack->push<path>(p.unstraighten()); return;} } -#line 2378 "runtime.in" +#line 2497 "runtime.in" // bool piecewisestraight(path p); void gen163(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2379 "runtime.in" +#line 2498 "runtime.in" {Stack->push<bool>(p.piecewisestraight()); return;} } -#line 2383 "runtime.in" +#line 2502 "runtime.in" // real arclength(path p); void gen164(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2384 "runtime.in" +#line 2503 "runtime.in" {Stack->push<real>(p.arclength()); return;} } -#line 2388 "runtime.in" +#line 2507 "runtime.in" // real arctime(path p, real dval); void gen165(stack *Stack) { real dval=vm::pop<real>(Stack); path p=vm::pop<path>(Stack); -#line 2389 "runtime.in" +#line 2508 "runtime.in" {Stack->push<real>(p.arctime(dval)); return;} } -#line 2393 "runtime.in" +#line 2512 "runtime.in" // real dirtime(path p, pair z); void gen166(stack *Stack) { pair z=vm::pop<pair>(Stack); path p=vm::pop<path>(Stack); -#line 2394 "runtime.in" +#line 2513 "runtime.in" {Stack->push<real>(p.directiontime(z)); return;} } -#line 2398 "runtime.in" +#line 2517 "runtime.in" // realarray* intersect(path p, path q, real fuzz=-1); void gen167(stack *Stack) { real fuzz=vm::pop<real>(Stack,-1); path q=vm::pop<path>(Stack); path p=vm::pop<path>(Stack); -#line 2399 "runtime.in" +#line 2518 "runtime.in" bool exact=fuzz <= 0.0; if(fuzz < 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), @@ -3153,18 +3272,18 @@ void gen167(stack *Stack) (*V)[0]=s; (*V)[1]=t; {Stack->push<realarray*>(V); return;} - } else - {Stack->push<realarray*>(new array(0)); return;} + } + {Stack->push<realarray*>(new array(0)); return;} } -#line 2415 "runtime.in" +#line 2534 "runtime.in" // realarray2* intersections(path p, path q, real fuzz=-1); void gen168(stack *Stack) { real fuzz=vm::pop<real>(Stack,-1); path q=vm::pop<path>(Stack); path p=vm::pop<path>(Stack); -#line 2416 "runtime.in" +#line 2535 "runtime.in" bool exact=fuzz <= 0.0; if(fuzz < 0.0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), @@ -3194,7 +3313,7 @@ void gen168(stack *Stack) {Stack->push<realarray2*>(V); return;} } -#line 2446 "runtime.in" +#line 2565 "runtime.in" // realarray* intersections(path p, explicit pair a, explicit pair b, real fuzz=-1); void gen169(stack *Stack) { @@ -3202,7 +3321,7 @@ void gen169(stack *Stack) pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); path p=vm::pop<path>(Stack); -#line 2447 "runtime.in" +#line 2566 "runtime.in" if(fuzz < 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), ::max(length(a),length(b))); @@ -3218,7 +3337,7 @@ void gen169(stack *Stack) // Return the intersection point of the extensions of the line segments // PQ and pq. -#line 2463 "runtime.in" +#line 2582 "runtime.in" // pair extension(pair P, pair Q, pair p, pair q); void gen170(stack *Stack) { @@ -3226,7 +3345,7 @@ void gen170(stack *Stack) pair p=vm::pop<pair>(Stack); pair Q=vm::pop<pair>(Stack); pair P=vm::pop<pair>(Stack); -#line 2464 "runtime.in" +#line 2583 "runtime.in" pair ac=P-Q; pair bd=q-p; real det=ac.getx()*bd.gety()-ac.gety()*bd.getx(); @@ -3234,49 +3353,49 @@ void gen170(stack *Stack) {Stack->push<pair>(P+((p.getx()-P.getx())*bd.gety()-(p.gety()-P.gety())*bd.getx())*ac/det); return;} } -#line 2472 "runtime.in" +#line 2591 "runtime.in" // Int size(path p); void gen171(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2473 "runtime.in" +#line 2592 "runtime.in" {Stack->push<Int>(p.size()); return;} } -#line 2477 "runtime.in" +#line 2596 "runtime.in" // path &(path p, path q); void gen172(stack *Stack) { path q=vm::pop<path>(Stack); path p=vm::pop<path>(Stack); -#line 2478 "runtime.in" +#line 2597 "runtime.in" {Stack->push<path>(camp::concat(p,q)); return;} } -#line 2482 "runtime.in" +#line 2601 "runtime.in" // pair min(path p); void gen173(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2483 "runtime.in" +#line 2602 "runtime.in" {Stack->push<pair>(p.min()); return;} } -#line 2487 "runtime.in" +#line 2606 "runtime.in" // pair max(path p); void gen174(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2488 "runtime.in" +#line 2607 "runtime.in" {Stack->push<pair>(p.max()); return;} } -#line 2492 "runtime.in" +#line 2611 "runtime.in" // realarray* mintimes(path p); void gen175(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2493 "runtime.in" +#line 2612 "runtime.in" array *V=new array(2); pair z=p.mintimes(); (*V)[0]=z.getx(); @@ -3284,12 +3403,12 @@ void gen175(stack *Stack) {Stack->push<realarray*>(V); return;} } -#line 2501 "runtime.in" +#line 2620 "runtime.in" // realarray* maxtimes(path p); void gen176(stack *Stack) { path p=vm::pop<path>(Stack); -#line 2502 "runtime.in" +#line 2621 "runtime.in" array *V=new array(2); pair z=p.maxtimes(); (*V)[0]=z.getx(); @@ -3297,7 +3416,7 @@ void gen176(stack *Stack) {Stack->push<realarray*>(V); return;} } -#line 2510 "runtime.in" +#line 2629 "runtime.in" // real relativedistance(real theta, real phi, real t, bool atleast); void gen177(stack *Stack) { @@ -3305,58 +3424,58 @@ void gen177(stack *Stack) real t=vm::pop<real>(Stack); real phi=vm::pop<real>(Stack); real theta=vm::pop<real>(Stack); -#line 2511 "runtime.in" +#line 2630 "runtime.in" {Stack->push<real>(camp::velocity(theta,phi,tension(t,atleast))); return;} } -#line 2515 "runtime.in" +#line 2634 "runtime.in" // Int windingnumber(patharray *p, pair z); void gen178(stack *Stack) { pair z=vm::pop<pair>(Stack); patharray * p=vm::pop<patharray *>(Stack); -#line 2516 "runtime.in" +#line 2635 "runtime.in" {Stack->push<Int>(windingnumber(p,z)); return;} } -#line 2520 "runtime.in" +#line 2639 "runtime.in" // bool inside(explicit patharray *g, pair z, pen fillrule=CURRENTPEN); void gen179(stack *Stack) { pen fillrule=vm::pop<pen>(Stack,CURRENTPEN); pair z=vm::pop<pair>(Stack); patharray * g=vm::pop<patharray *>(Stack); -#line 2521 "runtime.in" +#line 2640 "runtime.in" {Stack->push<bool>(fillrule.inside(windingnumber(g,z))); return;} } -#line 2525 "runtime.in" +#line 2644 "runtime.in" // bool inside(path g, pair z, pen fillrule=CURRENTPEN); void gen180(stack *Stack) { pen fillrule=vm::pop<pen>(Stack,CURRENTPEN); pair z=vm::pop<pair>(Stack); path g=vm::pop<path>(Stack); -#line 2526 "runtime.in" +#line 2645 "runtime.in" {Stack->push<bool>(fillrule.inside(g.windingnumber(z))); return;} } // Determine the side of a--b that c lies on // (negative=left, zero=on line, positive=right). -#line 2532 "runtime.in" +#line 2651 "runtime.in" // real side(pair a, pair b, pair c); void gen181(stack *Stack) { pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 2533 "runtime.in" +#line 2652 "runtime.in" {Stack->push<real>(orient2d(a,b,c)); return;} } // Determine the side of the counterclockwise circle through a,b,c that d // lies on (negative=inside, 0=on circle, positive=right). -#line 2539 "runtime.in" +#line 2658 "runtime.in" // real incircle(pair a, pair b, pair c, pair d); void gen182(stack *Stack) { @@ -3364,14 +3483,14 @@ void gen182(stack *Stack) pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 2540 "runtime.in" +#line 2659 "runtime.in" {Stack->push<real>(incircle(a.getx(),a.gety(),b.getx(),b.gety(),c.getx(),c.gety(), d.getx(),d.gety())); return;} } // Path3 operations -#line 2547 "runtime.in" +#line 2666 "runtime.in" // path3 path3(triplearray *pre, triplearray *point, triplearray *post, boolarray *straight, bool cyclic); void gen183(stack *Stack) { @@ -3380,7 +3499,7 @@ void gen183(stack *Stack) triplearray * post=vm::pop<triplearray *>(Stack); triplearray * point=vm::pop<triplearray *>(Stack); triplearray * pre=vm::pop<triplearray *>(Stack); -#line 2549 "runtime.in" +#line 2668 "runtime.in" size_t n=checkArrays(pre,point); checkEqual(n,checkArray(post)); checkEqual(n,checkArray(straight)); @@ -3395,94 +3514,94 @@ void gen183(stack *Stack) {Stack->push<path3>(path3(nodes,(Int) n,cyclic)); return;} } -#line 2565 "runtime.in" +#line 2684 "runtime.in" void nullPath3(stack *Stack) { -#line 2566 "runtime.in" +#line 2685 "runtime.in" {Stack->push<path3>(nullpath3); return;} } -#line 2570 "runtime.in" +#line 2689 "runtime.in" // bool ==(path3 a, path3 b); void gen185(stack *Stack) { path3 b=vm::pop<path3>(Stack); path3 a=vm::pop<path3>(Stack); -#line 2571 "runtime.in" +#line 2690 "runtime.in" {Stack->push<bool>(a == b); return;} } -#line 2575 "runtime.in" +#line 2694 "runtime.in" // bool !=(path3 a, path3 b); void gen186(stack *Stack) { path3 b=vm::pop<path3>(Stack); path3 a=vm::pop<path3>(Stack); -#line 2576 "runtime.in" +#line 2695 "runtime.in" {Stack->push<bool>(!(a == b)); return;} } -#line 2580 "runtime.in" +#line 2699 "runtime.in" // triple point(path3 p, Int t); void gen187(stack *Stack) { Int t=vm::pop<Int>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2581 "runtime.in" +#line 2700 "runtime.in" {Stack->push<triple>(p.point((Int) t)); return;} } -#line 2585 "runtime.in" +#line 2704 "runtime.in" // triple point(path3 p, real t); void gen188(stack *Stack) { real t=vm::pop<real>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2586 "runtime.in" +#line 2705 "runtime.in" {Stack->push<triple>(p.point(t)); return;} } -#line 2590 "runtime.in" +#line 2709 "runtime.in" // triple precontrol(path3 p, Int t); void gen189(stack *Stack) { Int t=vm::pop<Int>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2591 "runtime.in" +#line 2710 "runtime.in" {Stack->push<triple>(p.precontrol((Int) t)); return;} } -#line 2595 "runtime.in" +#line 2714 "runtime.in" // triple precontrol(path3 p, real t); void gen190(stack *Stack) { real t=vm::pop<real>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2596 "runtime.in" +#line 2715 "runtime.in" {Stack->push<triple>(p.precontrol(t)); return;} } -#line 2600 "runtime.in" +#line 2719 "runtime.in" // triple postcontrol(path3 p, Int t); void gen191(stack *Stack) { Int t=vm::pop<Int>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2601 "runtime.in" +#line 2720 "runtime.in" {Stack->push<triple>(p.postcontrol((Int) t)); return;} } -#line 2605 "runtime.in" +#line 2724 "runtime.in" // triple postcontrol(path3 p, real t); void gen192(stack *Stack) { real t=vm::pop<real>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2606 "runtime.in" +#line 2725 "runtime.in" {Stack->push<triple>(p.postcontrol(t)); return;} } -#line 2610 "runtime.in" +#line 2729 "runtime.in" // triple dir(path3 p, Int t, Int sign=0, bool normalize=true); void gen193(stack *Stack) { @@ -3490,49 +3609,49 @@ void gen193(stack *Stack) Int sign=vm::pop<Int>(Stack,0); Int t=vm::pop<Int>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2611 "runtime.in" +#line 2730 "runtime.in" {Stack->push<triple>(p.dir(t,sign,normalize)); return;} } -#line 2615 "runtime.in" +#line 2734 "runtime.in" // triple dir(path3 p, real t, bool normalize=true); void gen194(stack *Stack) { bool normalize=vm::pop<bool>(Stack,true); real t=vm::pop<real>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2616 "runtime.in" +#line 2735 "runtime.in" {Stack->push<triple>(p.dir(t,normalize)); return;} } -#line 2620 "runtime.in" +#line 2739 "runtime.in" // triple accel(path3 p, Int t, Int sign=0); void gen195(stack *Stack) { Int sign=vm::pop<Int>(Stack,0); Int t=vm::pop<Int>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2621 "runtime.in" +#line 2740 "runtime.in" {Stack->push<triple>(p.accel(t,sign)); return;} } -#line 2625 "runtime.in" +#line 2744 "runtime.in" // triple accel(path3 p, real t); void gen196(stack *Stack) { real t=vm::pop<real>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2626 "runtime.in" +#line 2745 "runtime.in" {Stack->push<triple>(p.accel(t)); return;} } -#line 2630 "runtime.in" +#line 2749 "runtime.in" // real radius(path3 p, real t); void gen197(stack *Stack) { real t=vm::pop<real>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2631 "runtime.in" +#line 2750 "runtime.in" triple v=p.dir(t,false); triple a=p.accel(t); real d=dot(a,v); @@ -3543,7 +3662,7 @@ void gen197(stack *Stack) {Stack->push<real>(denom > 0 ? r/sqrt(denom) : 0.0); return;} } -#line 2642 "runtime.in" +#line 2761 "runtime.in" // real radius(triple z0, triple c0, triple c1, triple z1, real t); void gen198(stack *Stack) { @@ -3552,7 +3671,7 @@ void gen198(stack *Stack) triple c1=vm::pop<triple>(Stack); triple c0=vm::pop<triple>(Stack); triple z0=vm::pop<triple>(Stack); -#line 2643 "runtime.in" +#line 2762 "runtime.in" triple v=(3.0*(z1-z0)+9.0*(c0-c1))*t*t+(6.0*(z0+c1)-12.0*c0)*t+3.0*(c0-z0); triple a=6.0*(z1-z0+3.0*(c0-c1))*t+6.0*(z0+c1)-12.0*c0; real d=dot(a,v); @@ -3563,85 +3682,85 @@ void gen198(stack *Stack) {Stack->push<real>(denom > 0 ? r/sqrt(denom) : 0.0); return;} } -#line 2654 "runtime.in" +#line 2773 "runtime.in" // path3 reverse(path3 p); void gen199(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 2655 "runtime.in" +#line 2774 "runtime.in" {Stack->push<path3>(p.reverse()); return;} } -#line 2659 "runtime.in" +#line 2778 "runtime.in" // path3 subpath(path3 p, Int a, Int b); void gen200(stack *Stack) { Int b=vm::pop<Int>(Stack); Int a=vm::pop<Int>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2660 "runtime.in" +#line 2779 "runtime.in" {Stack->push<path3>(p.subpath((Int) a, (Int) b)); return;} } -#line 2664 "runtime.in" +#line 2783 "runtime.in" // path3 subpath(path3 p, real a, real b); void gen201(stack *Stack) { real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2665 "runtime.in" +#line 2784 "runtime.in" {Stack->push<path3>(p.subpath(a,b)); return;} } -#line 2669 "runtime.in" +#line 2788 "runtime.in" // Int length(path3 p); void gen202(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 2670 "runtime.in" +#line 2789 "runtime.in" {Stack->push<Int>(p.length()); return;} } -#line 2674 "runtime.in" +#line 2793 "runtime.in" // bool cyclic(path3 p); void gen203(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 2675 "runtime.in" +#line 2794 "runtime.in" {Stack->push<bool>(p.cyclic()); return;} } -#line 2679 "runtime.in" +#line 2798 "runtime.in" // bool straight(path3 p, Int t); void gen204(stack *Stack) { Int t=vm::pop<Int>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2680 "runtime.in" +#line 2799 "runtime.in" {Stack->push<bool>(p.straight(t)); return;} } // Return the component of vector v perpendicular to a unit vector u. -#line 2685 "runtime.in" +#line 2804 "runtime.in" // triple perp(triple v, triple u); void gen205(stack *Stack) { triple u=vm::pop<triple>(Stack); triple v=vm::pop<triple>(Stack); -#line 2686 "runtime.in" +#line 2805 "runtime.in" {Stack->push<triple>(v-dot(v,u)*u); return;} } // Return the maximum perpendicular deviation of segment i of path3 g // from a straight line. -#line 2692 "runtime.in" +#line 2811 "runtime.in" // real straightness(path3 p, Int t); void gen206(stack *Stack) { Int t=vm::pop<Int>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2693 "runtime.in" +#line 2812 "runtime.in" if(p.straight(t)) {Stack->push<real>(0); return;} triple z0=p.point(t); triple u=unit(p.point(t+1)-z0); @@ -3651,7 +3770,7 @@ void gen206(stack *Stack) // Return the maximum perpendicular deviation of z0..controls c0 and c1..z1 // from a straight line. -#line 2703 "runtime.in" +#line 2822 "runtime.in" // real straightness(triple z0, triple c0, triple c1, triple z1); void gen207(stack *Stack) { @@ -3659,47 +3778,47 @@ void gen207(stack *Stack) triple c1=vm::pop<triple>(Stack); triple c0=vm::pop<triple>(Stack); triple z0=vm::pop<triple>(Stack); -#line 2704 "runtime.in" +#line 2823 "runtime.in" triple u=unit(z1-z0); {Stack->push<real>(::max(length(perp(c0-z0,u)),length(perp(c1-z0,u)))); return;} } -#line 2709 "runtime.in" +#line 2828 "runtime.in" // bool piecewisestraight(path3 p); void gen208(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 2710 "runtime.in" +#line 2829 "runtime.in" {Stack->push<bool>(p.piecewisestraight()); return;} } -#line 2714 "runtime.in" +#line 2833 "runtime.in" // real arclength(path3 p); void gen209(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 2715 "runtime.in" +#line 2834 "runtime.in" {Stack->push<real>(p.arclength()); return;} } -#line 2719 "runtime.in" +#line 2838 "runtime.in" // real arctime(path3 p, real dval); void gen210(stack *Stack) { real dval=vm::pop<real>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2720 "runtime.in" +#line 2839 "runtime.in" {Stack->push<real>(p.arctime(dval)); return;} } -#line 2724 "runtime.in" +#line 2843 "runtime.in" // realarray* intersect(path3 p, path3 q, real fuzz=-1); void gen211(stack *Stack) { real fuzz=vm::pop<real>(Stack,-1); path3 q=vm::pop<path3>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2725 "runtime.in" +#line 2844 "runtime.in" bool exact=fuzz <= 0.0; if(fuzz < 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), @@ -3716,14 +3835,14 @@ void gen211(stack *Stack) {Stack->push<realarray*>(new array(0)); return;} } -#line 2742 "runtime.in" +#line 2861 "runtime.in" // realarray2* intersections(path3 p, path3 q, real fuzz=-1); void gen212(stack *Stack) { real fuzz=vm::pop<real>(Stack,-1); path3 q=vm::pop<path3>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2743 "runtime.in" +#line 2862 "runtime.in" bool exact=fuzz <= 0.0; if(fuzz < 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), @@ -3755,49 +3874,95 @@ void gen212(stack *Stack) {Stack->push<realarray2*>(V); return;} } -#line 2775 "runtime.in" -// Int size(path3 p); +#line 2894 "runtime.in" +// realarray2* intersections(path3 p, triplearray2 *P, real fuzz=-1); void gen213(stack *Stack) { + real fuzz=vm::pop<real>(Stack,-1); + triplearray2 * P=vm::pop<triplearray2 *>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2776 "runtime.in" +#line 2895 "runtime.in" + triple *A=copyTripleArray2C(P,true,4); + if(fuzz <= 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), + norm(A,16)); + std::vector<real> T,U,V; + intersections(T,U,V,p,A,fuzz); + delete[] A; + size_t n=T.size(); + array *W=new array(n); + for(size_t i=0; i < n; ++i) { + array *Wi=new array(3); + (*W)[i]=Wi; + (*Wi)[0]=T[i]; + (*Wi)[1]=U[i]; + (*Wi)[2]=V[i]; + } + {Stack->push<realarray2*>(W); return;} // Sorting will done in asy. +} + +#line 2914 "runtime.in" +// realarray* intersections(triple v, triplearray2 *P, real fuzz=-1); +void gen214(stack *Stack) +{ + real fuzz=vm::pop<real>(Stack,-1); + triplearray2 * P=vm::pop<triplearray2 *>(Stack); + triple v=vm::pop<triple>(Stack); +#line 2915 "runtime.in" + triple *A=copyTripleArray2C(P,true,4); + if(fuzz <= 0) fuzz=BigFuzz*::max(length(v),norm(A,16)); + real U,V; + if(intersections(U,V,v,A,fuzz)) { + array *W=new array(2); + (*W)[0]=U; + (*W)[1]=V; + {Stack->push<realarray*>(W); return;} + } + {Stack->push<realarray*>(new array(0)); return;} +} + +#line 2928 "runtime.in" +// Int size(path3 p); +void gen215(stack *Stack) +{ + path3 p=vm::pop<path3>(Stack); +#line 2929 "runtime.in" {Stack->push<Int>(p.size()); return;} } -#line 2780 "runtime.in" +#line 2933 "runtime.in" // path3 &(path3 p, path3 q); -void gen214(stack *Stack) +void gen216(stack *Stack) { path3 q=vm::pop<path3>(Stack); path3 p=vm::pop<path3>(Stack); -#line 2781 "runtime.in" +#line 2934 "runtime.in" {Stack->push<path3>(camp::concat(p,q)); return;} } -#line 2785 "runtime.in" +#line 2938 "runtime.in" // triple min(path3 p); -void gen215(stack *Stack) +void gen217(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 2786 "runtime.in" +#line 2939 "runtime.in" {Stack->push<triple>(p.min()); return;} } -#line 2790 "runtime.in" +#line 2943 "runtime.in" // triple max(path3 p); -void gen216(stack *Stack) +void gen218(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 2791 "runtime.in" +#line 2944 "runtime.in" {Stack->push<triple>(p.max()); return;} } -#line 2795 "runtime.in" +#line 2948 "runtime.in" // realarray* mintimes(path3 p); -void gen217(stack *Stack) +void gen219(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 2796 "runtime.in" +#line 2949 "runtime.in" array *V=new array(3); triple v=p.mintimes(); (*V)[0]=v.getx(); @@ -3806,12 +3971,12 @@ void gen217(stack *Stack) {Stack->push<realarray*>(V); return;} } -#line 2805 "runtime.in" +#line 2958 "runtime.in" // realarray* maxtimes(path3 p); -void gen218(stack *Stack) +void gen220(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 2806 "runtime.in" +#line 2959 "runtime.in" array *V=new array(3); triple v=p.maxtimes(); (*V)[0]=v.getx(); @@ -3820,30 +3985,30 @@ void gen218(stack *Stack) {Stack->push<realarray*>(V); return;} } -#line 2815 "runtime.in" +#line 2968 "runtime.in" // path3 *(realarray2 *t, path3 g); -void gen219(stack *Stack) +void gen221(stack *Stack) { path3 g=vm::pop<path3>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); -#line 2816 "runtime.in" +#line 2969 "runtime.in" {Stack->push<path3>(transformed(*t,g)); return;} } // Guide operations -#line 2822 "runtime.in" +#line 2975 "runtime.in" void nullGuide(stack *Stack) { -#line 2823 "runtime.in" +#line 2976 "runtime.in" {Stack->push<guide*>(new pathguide(path())); return;} } -#line 2828 "runtime.in" +#line 2981 "runtime.in" void dotsGuide(stack *Stack) { guidearray * a=vm::pop<guidearray *>(Stack); -#line 2829 "runtime.in" +#line 2982 "runtime.in" guidevector v; size_t size=checkArray(a); for (size_t i=0; i < size; ++i) @@ -3852,11 +4017,11 @@ void dotsGuide(stack *Stack) {Stack->push<guide*>(new multiguide(v)); return;} } -#line 2838 "runtime.in" +#line 2991 "runtime.in" void dashesGuide(stack *Stack) { guidearray * a=vm::pop<guidearray *>(Stack); -#line 2839 "runtime.in" +#line 2992 "runtime.in" static camp::curlSpec curly; static specguide curlout(&curly, camp::OUT); static specguide curlin(&curly, camp::IN); @@ -3882,179 +4047,179 @@ void dashesGuide(stack *Stack) {Stack->push<guide*>(new multiguide(v)); return;} } -#line 2865 "runtime.in" +#line 3018 "runtime.in" void newCycleToken(stack *Stack) { -#line 2866 "runtime.in" +#line 3019 "runtime.in" {Stack->push<cycleToken>(cycleToken()); return;} } -#line 2870 "runtime.in" +#line 3023 "runtime.in" // guide* operator cast(cycleToken tok); -void gen224(stack *Stack) +void gen226(stack *Stack) { cycleToken tok=vm::pop<cycleToken>(Stack); -#line 2871 "runtime.in" +#line 3024 "runtime.in" // Avoid unused variable warning messages. unused(&tok); {Stack->push<guide*>(new cycletokguide()); return;} } -#line 2877 "runtime.in" +#line 3030 "runtime.in" // guide* operator spec(pair z, Int p); -void gen225(stack *Stack) +void gen227(stack *Stack) { Int p=vm::pop<Int>(Stack); pair z=vm::pop<pair>(Stack); -#line 2878 "runtime.in" +#line 3031 "runtime.in" camp::side d=(camp::side) p; camp::dirSpec *sp=new camp::dirSpec(z); {Stack->push<guide*>(new specguide(sp,d)); return;} } -#line 2885 "runtime.in" +#line 3038 "runtime.in" // curlSpecifier operator curl(real gamma, Int p); -void gen226(stack *Stack) +void gen228(stack *Stack) { Int p=vm::pop<Int>(Stack); real gamma=vm::pop<real>(Stack); -#line 2886 "runtime.in" +#line 3039 "runtime.in" camp::side s=(camp::side) p; {Stack->push<curlSpecifier>(curlSpecifier(gamma,s)); return;} } -#line 2891 "runtime.in" +#line 3044 "runtime.in" void curlSpecifierValuePart(stack *Stack) { curlSpecifier spec=vm::pop<curlSpecifier>(Stack); -#line 2892 "runtime.in" +#line 3045 "runtime.in" {Stack->push<real>(spec.getValue()); return;} } -#line 2896 "runtime.in" +#line 3049 "runtime.in" void curlSpecifierSidePart(stack *Stack) { curlSpecifier spec=vm::pop<curlSpecifier>(Stack); -#line 2897 "runtime.in" +#line 3050 "runtime.in" {Stack->push<Int>(spec.getSide()); return;} } -#line 2901 "runtime.in" +#line 3054 "runtime.in" // guide* operator cast(curlSpecifier spec); -void gen229(stack *Stack) +void gen231(stack *Stack) { curlSpecifier spec=vm::pop<curlSpecifier>(Stack); -#line 2902 "runtime.in" +#line 3055 "runtime.in" {Stack->push<guide*>(new specguide(spec)); return;} } -#line 2906 "runtime.in" +#line 3059 "runtime.in" // tensionSpecifier operator tension(real tout, real tin, bool atleast); -void gen230(stack *Stack) +void gen232(stack *Stack) { bool atleast=vm::pop<bool>(Stack); real tin=vm::pop<real>(Stack); real tout=vm::pop<real>(Stack); -#line 2907 "runtime.in" +#line 3060 "runtime.in" {Stack->push<tensionSpecifier>(tensionSpecifier(tout, tin, atleast)); return;} } -#line 2911 "runtime.in" +#line 3064 "runtime.in" void tensionSpecifierOutPart(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 2912 "runtime.in" +#line 3065 "runtime.in" {Stack->push<real>(t.getOut()); return;} } -#line 2916 "runtime.in" +#line 3069 "runtime.in" void tensionSpecifierInPart(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 2917 "runtime.in" +#line 3070 "runtime.in" {Stack->push<real>(t.getIn()); return;} } -#line 2921 "runtime.in" +#line 3074 "runtime.in" void tensionSpecifierAtleastPart(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 2922 "runtime.in" +#line 3075 "runtime.in" {Stack->push<bool>(t.getAtleast()); return;} } -#line 2926 "runtime.in" +#line 3079 "runtime.in" // guide* operator cast(tensionSpecifier t); -void gen234(stack *Stack) +void gen236(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 2927 "runtime.in" +#line 3080 "runtime.in" {Stack->push<guide*>(new tensionguide(t)); return;} } -#line 2931 "runtime.in" +#line 3084 "runtime.in" // guide* operator controls(pair zout, pair zin); -void gen235(stack *Stack) +void gen237(stack *Stack) { pair zin=vm::pop<pair>(Stack); pair zout=vm::pop<pair>(Stack); -#line 2932 "runtime.in" +#line 3085 "runtime.in" {Stack->push<guide*>(new controlguide(zout, zin)); return;} } -#line 2936 "runtime.in" +#line 3089 "runtime.in" // Int size(guide *g); -void gen236(stack *Stack) +void gen238(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 2937 "runtime.in" +#line 3090 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<Int>(f.size()); return;} } -#line 2943 "runtime.in" +#line 3096 "runtime.in" // Int length(guide *g); -void gen237(stack *Stack) +void gen239(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 2944 "runtime.in" +#line 3097 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<Int>(g->cyclic() ? f.size() : f.size()-1); return;} } -#line 2950 "runtime.in" +#line 3103 "runtime.in" // bool cyclic(guide *g); -void gen238(stack *Stack) +void gen240(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 2951 "runtime.in" +#line 3104 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<bool>(g->cyclic()); return;} } -#line 2957 "runtime.in" +#line 3110 "runtime.in" // pair point(guide *g, Int t); -void gen239(stack *Stack) +void gen241(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 2958 "runtime.in" +#line 3111 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<pair>(f.Nodes(adjustedIndex(t,f.size(),g->cyclic())).z); return;} } -#line 2964 "runtime.in" +#line 3117 "runtime.in" // pairarray* dirSpecifier(guide *g, Int t); -void gen240(stack *Stack) +void gen242(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 2965 "runtime.in" +#line 3118 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -4065,13 +4230,13 @@ void gen240(stack *Stack) {Stack->push<pairarray*>(c); return;} } -#line 2976 "runtime.in" +#line 3129 "runtime.in" // pairarray* controlSpecifier(guide *g, Int t); -void gen241(stack *Stack) +void gen243(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 2977 "runtime.in" +#line 3130 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -4087,13 +4252,13 @@ void gen241(stack *Stack) } else {Stack->push<pairarray*>(new array(0)); return;} } -#line 2993 "runtime.in" +#line 3146 "runtime.in" // tensionSpecifier tensionSpecifier(guide *g, Int t); -void gen242(stack *Stack) +void gen244(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 2994 "runtime.in" +#line 3147 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -4102,13 +4267,13 @@ void gen242(stack *Stack) {Stack->push<tensionSpecifier>(tensionSpecifier(curr.tout.val,f.Nodes(t+1).tin.val,curr.tout.atleast)); return;} } -#line 3003 "runtime.in" +#line 3156 "runtime.in" // realarray* curlSpecifier(guide *g, Int t); -void gen243(stack *Stack) +void gen245(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 3004 "runtime.in" +#line 3157 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -4121,12 +4286,12 @@ void gen243(stack *Stack) {Stack->push<realarray*>(c); return;} } -#line 3017 "runtime.in" +#line 3170 "runtime.in" // guide* reverse(guide *g); -void gen244(stack *Stack) +void gen246(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 3018 "runtime.in" +#line 3171 "runtime.in" flatguide f; g->flatten(f,false); if(f.precyclic()) @@ -4181,20 +4346,21 @@ void gen244(stack *Stack) // Three-dimensional picture and surface operations -#line 3073 "runtime.in" +#line 3226 "runtime.in" // void _draw(picture *f, path3 g, pen p); -void gen245(stack *Stack) +void gen247(stack *Stack) { pen p=vm::pop<pen>(Stack); path3 g=vm::pop<path3>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 3074 "runtime.in" - f->append(new drawPath3(g,p)); +#line 3227 "runtime.in" + if(g.size() > 0) + f->append(new drawPath3(g,p)); } -#line 3079 "runtime.in" +#line 3233 "runtime.in" // void draw(picture *f, triplearray2 *g, bool straight, penarray *p, real opacity, real shininess, real granularity, triple normal, bool lighton, penarray *colors); -void gen246(stack *Stack) +void gen248(stack *Stack) { penarray * colors=vm::pop<penarray *>(Stack); bool lighton=vm::pop<bool>(Stack); @@ -4206,165 +4372,171 @@ void gen246(stack *Stack) bool straight=vm::pop<bool>(Stack); triplearray2 * g=vm::pop<triplearray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 3082 "runtime.in" +#line 3236 "runtime.in" f->append(new drawSurface(*g,straight,*p,opacity,shininess,granularity, normal,lighton,*colors)); } -#line 3087 "runtime.in" +#line 3241 "runtime.in" // triple min3(picture *f); -void gen247(stack *Stack) +void gen249(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 3088 "runtime.in" +#line 3242 "runtime.in" {Stack->push<triple>(f->bounds3().Min()); return;} } -#line 3092 "runtime.in" +#line 3246 "runtime.in" // triple max3(picture *f); -void gen248(stack *Stack) +void gen250(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 3093 "runtime.in" +#line 3247 "runtime.in" {Stack->push<triple>(f->bounds3().Max()); return;} } -#line 3097 "runtime.in" +#line 3251 "runtime.in" // pair min(picture *f, realarray2 *t); -void gen249(stack *Stack) +void gen251(stack *Stack) { realarray2 * t=vm::pop<realarray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 3098 "runtime.in" +#line 3252 "runtime.in" real *T=copyArray2C(t,4); pair m=f->bounds(::min,xproject,yproject,T); delete[] T; {Stack->push<pair>(m); return;} } -#line 3105 "runtime.in" +#line 3259 "runtime.in" // pair max(picture *f, realarray2 *t); -void gen250(stack *Stack) +void gen252(stack *Stack) { realarray2 * t=vm::pop<realarray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 3106 "runtime.in" +#line 3260 "runtime.in" real *T=copyArray2C(t,4); pair M=f->bounds(::max,xproject,yproject,T); delete[] T; {Stack->push<pair>(M); return;} } -#line 3113 "runtime.in" +#line 3267 "runtime.in" // pair minratio(picture *f); -void gen251(stack *Stack) +void gen253(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 3114 "runtime.in" +#line 3268 "runtime.in" {Stack->push<pair>(f->bounds(::min,xratio,yratio)); return;} } -#line 3118 "runtime.in" +#line 3272 "runtime.in" // pair maxratio(picture *f); -void gen252(stack *Stack) +void gen254(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 3119 "runtime.in" +#line 3273 "runtime.in" {Stack->push<pair>(f->bounds(::max,xratio,yratio)); return;} } -#line 3123 "runtime.in" -// real minbound(realarray *a, real b); -void gen253(stack *Stack) +#line 3277 "runtime.in" +// triple minbound(triplearray2 *P, triple b); +void gen255(stack *Stack) { - real b=vm::pop<real>(Stack); - realarray * a=vm::pop<realarray *>(Stack); -#line 3124 "runtime.in" - real *A=copyArrayC(a,16); - b=bound(A,::min,b); + triple b=vm::pop<triple>(Stack); + triplearray2 * P=vm::pop<triplearray2 *>(Stack); +#line 3278 "runtime.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)), + bound(A+32,::min,b.getz(),sqrtFuzz*norm(A+32,16))); delete[] A; - {Stack->push<real>(b); return;} + {Stack->push<triple>(b); return;} } -#line 3131 "runtime.in" -// real maxbound(realarray *a, real b); -void gen254(stack *Stack) +#line 3287 "runtime.in" +// triple maxbound(triplearray2 *P, triple b); +void gen256(stack *Stack) { - real b=vm::pop<real>(Stack); - realarray * a=vm::pop<realarray *>(Stack); -#line 3132 "runtime.in" - real *A=copyArrayC(a,16); - b=bound(A,::max,b); + triple b=vm::pop<triple>(Stack); + triplearray2 * P=vm::pop<triplearray2 *>(Stack); +#line 3288 "runtime.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)), + bound(A+32,::max,b.getz(),sqrtFuzz*norm(A+32,16))); delete[] A; - {Stack->push<real>(b); return;} + {Stack->push<triple>(b); return;} } -#line 3139 "runtime.in" -// pair minbound(triplearray *a, realarray2 *t, pair b); -void gen255(stack *Stack) +#line 3297 "runtime.in" +// pair minbound(triplearray2 *P, realarray2 *t, pair b); +void gen257(stack *Stack) { pair b=vm::pop<pair>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); - triplearray * a=vm::pop<triplearray *>(Stack); -#line 3140 "runtime.in" - triple *A=copyTripleArrayC(a,16); + triplearray2 * P=vm::pop<triplearray2 *>(Stack); +#line 3298 "runtime.in" + triple *A=copyTripleArray2C(P,true,4); real *T=copyArray2C(t,4); - b=pair(bound(A,::min,xproject,T,b.getx()), - bound(A,::min,yproject,T,b.gety())); + real fuzz=sqrtFuzz*norm(A,16); + b=pair(bound(A,::min,xproject,T,b.getx(),fuzz), + bound(A,::min,yproject,T,b.gety(),fuzz)); delete[] T; delete[] A; {Stack->push<pair>(b); return;} } -#line 3150 "runtime.in" -// pair maxbound(triplearray *a, realarray2 *t, pair b); -void gen256(stack *Stack) +#line 3309 "runtime.in" +// pair maxbound(triplearray2 *P, realarray2 *t, pair b); +void gen258(stack *Stack) { pair b=vm::pop<pair>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); - triplearray * a=vm::pop<triplearray *>(Stack); -#line 3151 "runtime.in" - triple *A=copyTripleArrayC(a,16); + triplearray2 * P=vm::pop<triplearray2 *>(Stack); +#line 3310 "runtime.in" + triple *A=copyTripleArray2C(P,true,4); real *T=copyArray2C(t,4); - b=pair(bound(A,::max,xproject,T,b.getx()), - bound(A,::max,yproject,T,b.gety())); + real fuzz=sqrtFuzz*norm(A,16); + b=pair(bound(A,::max,xproject,T,b.getx(),fuzz), + bound(A,::max,yproject,T,b.gety(),fuzz)); delete[] T; delete[] A; {Stack->push<pair>(b); return;} } -#line 3161 "runtime.in" +#line 3321 "runtime.in" // pair max(path3 g, realarray2 *t); -void gen257(stack *Stack) +void gen259(stack *Stack) { realarray2 * t=vm::pop<realarray2 *>(Stack); path3 g=vm::pop<path3>(Stack); -#line 3162 "runtime.in" +#line 3322 "runtime.in" real *T=copyArray2C(t,4); pair b=g.bounds(::max,xproject,yproject,T); delete[] T; {Stack->push<pair>(b); return;} } -#line 3169 "runtime.in" +#line 3329 "runtime.in" // pair min(path3 g, realarray2 *t); -void gen258(stack *Stack) +void gen260(stack *Stack) { realarray2 * t=vm::pop<realarray2 *>(Stack); path3 g=vm::pop<path3>(Stack); -#line 3170 "runtime.in" +#line 3330 "runtime.in" real *T=copyArray2C(t,4); pair b=g.bounds(::min,xproject,yproject,T); delete[] T; {Stack->push<pair>(b); return;} } -#line 3177 "runtime.in" +#line 3337 "runtime.in" // real change2(triplearray2 *a); -void gen259(stack *Stack) +void gen261(stack *Stack) { triplearray2 * a=vm::pop<triplearray2 *>(Stack); -#line 3178 "runtime.in" +#line 3338 "runtime.in" size_t n=checkArray(a); if(n == 0) {Stack->push<real>(0.0); return;} @@ -4385,241 +4557,241 @@ void gen259(stack *Stack) {Stack->push<real>(M); return;} } -#line 3199 "runtime.in" +#line 3359 "runtime.in" // bool is3D(picture *f); -void gen260(stack *Stack) +void gen262(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 3200 "runtime.in" +#line 3360 "runtime.in" {Stack->push<bool>(f->have3D()); return;} } -#line 3204 "runtime.in" +#line 3364 "runtime.in" // pair bezier(pair a, pair b, pair c, pair d, real t); -void gen261(stack *Stack) +void gen263(stack *Stack) { real t=vm::pop<real>(Stack); pair d=vm::pop<pair>(Stack); pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 3205 "runtime.in" +#line 3365 "runtime.in" real onemt=1-t; real onemt2=onemt*onemt; {Stack->push<pair>(onemt2*onemt*a+t*(3.0*(onemt2*b+t*onemt*c)+t*t*d)); return;} } -#line 3211 "runtime.in" +#line 3371 "runtime.in" // pair bezierP(pair a, pair b, pair c, pair d, real t); -void gen262(stack *Stack) +void gen264(stack *Stack) { real t=vm::pop<real>(Stack); pair d=vm::pop<pair>(Stack); pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 3212 "runtime.in" +#line 3372 "runtime.in" {Stack->push<pair>(3.0*(t*t*(d-a+3.0*(b-c))+t*(2.0*(a+c)-4.0*b)+b-a)); return;} } -#line 3216 "runtime.in" +#line 3376 "runtime.in" // pair bezierPP(pair a, pair b, pair c, pair d, real t); -void gen263(stack *Stack) +void gen265(stack *Stack) { real t=vm::pop<real>(Stack); pair d=vm::pop<pair>(Stack); pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 3217 "runtime.in" +#line 3377 "runtime.in" {Stack->push<pair>(6.0*(t*(d-a+3.0*(b-c))+a+c-2.0*b)); return;} } -#line 3221 "runtime.in" +#line 3381 "runtime.in" // pair bezierPPP(pair a, pair b, pair c, pair d); -void gen264(stack *Stack) +void gen266(stack *Stack) { pair d=vm::pop<pair>(Stack); pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 3222 "runtime.in" +#line 3382 "runtime.in" {Stack->push<pair>(6.0*(d-a+3.0*(b-c))); return;} } -#line 3226 "runtime.in" +#line 3386 "runtime.in" // triple bezier(triple a, triple b, triple c, triple d, real t); -void gen265(stack *Stack) +void gen267(stack *Stack) { real t=vm::pop<real>(Stack); triple d=vm::pop<triple>(Stack); triple c=vm::pop<triple>(Stack); triple b=vm::pop<triple>(Stack); triple a=vm::pop<triple>(Stack); -#line 3227 "runtime.in" +#line 3387 "runtime.in" real onemt=1-t; real onemt2=onemt*onemt; {Stack->push<triple>(onemt2*onemt*a+t*(3.0*(onemt2*b+t*onemt*c)+t*t*d)); return;} } -#line 3233 "runtime.in" +#line 3393 "runtime.in" // triple bezierP(triple a, triple b, triple c, triple d, real t); -void gen266(stack *Stack) +void gen268(stack *Stack) { real t=vm::pop<real>(Stack); triple d=vm::pop<triple>(Stack); triple c=vm::pop<triple>(Stack); triple b=vm::pop<triple>(Stack); triple a=vm::pop<triple>(Stack); -#line 3234 "runtime.in" +#line 3394 "runtime.in" {Stack->push<triple>(3.0*(t*t*(d-a+3.0*(b-c))+t*(2.0*(a+c)-4.0*b)+b-a)); return;} } -#line 3238 "runtime.in" +#line 3398 "runtime.in" // triple bezierPP(triple a, triple b, triple c, triple d, real t); -void gen267(stack *Stack) +void gen269(stack *Stack) { real t=vm::pop<real>(Stack); triple d=vm::pop<triple>(Stack); triple c=vm::pop<triple>(Stack); triple b=vm::pop<triple>(Stack); triple a=vm::pop<triple>(Stack); -#line 3239 "runtime.in" +#line 3399 "runtime.in" {Stack->push<triple>(6.0*(t*(d-a+3.0*(b-c))+a+c-2.0*b)); return;} } -#line 3243 "runtime.in" +#line 3403 "runtime.in" // triple bezierPPP(triple a, triple b, triple c, triple d); -void gen268(stack *Stack) +void gen270(stack *Stack) { triple d=vm::pop<triple>(Stack); triple c=vm::pop<triple>(Stack); triple b=vm::pop<triple>(Stack); triple a=vm::pop<triple>(Stack); -#line 3244 "runtime.in" +#line 3404 "runtime.in" {Stack->push<triple>(6.0*(d-a+3.0*(b-c))); return;} } // String operations -#line 3250 "runtime.in" +#line 3410 "runtime.in" void emptyString(stack *Stack) { -#line 3251 "runtime.in" +#line 3411 "runtime.in" {Stack->push<string>(emptystring); return;} } -#line 3256 "runtime.in" +#line 3416 "runtime.in" // Int length(string *s); -void gen270(stack *Stack) +void gen272(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 3257 "runtime.in" +#line 3417 "runtime.in" {Stack->push<Int>((Int) s->length()); return;} } -#line 3261 "runtime.in" +#line 3421 "runtime.in" // Int find(string *s, string t, Int pos=0); -void gen271(stack *Stack) +void gen273(stack *Stack) { Int pos=vm::pop<Int>(Stack,0); string t=vm::pop<string>(Stack); string * s=vm::pop<string *>(Stack); -#line 3262 "runtime.in" +#line 3422 "runtime.in" size_t n=s->find(t,pos); {Stack->push<Int>(n == string::npos ? (Int) -1 : (Int) n); return;} } -#line 3267 "runtime.in" +#line 3427 "runtime.in" // Int rfind(string *s, string t, Int pos=-1); -void gen272(stack *Stack) +void gen274(stack *Stack) { Int pos=vm::pop<Int>(Stack,-1); string t=vm::pop<string>(Stack); string * s=vm::pop<string *>(Stack); -#line 3268 "runtime.in" +#line 3428 "runtime.in" size_t n=s->rfind(t,pos); {Stack->push<Int>(n == string::npos ? (Int) -1 : (Int) n); return;} } -#line 3273 "runtime.in" +#line 3433 "runtime.in" // string reverse(string s); -void gen273(stack *Stack) +void gen275(stack *Stack) { string s=vm::pop<string>(Stack); -#line 3274 "runtime.in" +#line 3434 "runtime.in" reverse(s.begin(),s.end()); {Stack->push<string>(s); return;} } -#line 3279 "runtime.in" +#line 3439 "runtime.in" // string insert(string s, Int pos, string t); -void gen274(stack *Stack) +void gen276(stack *Stack) { string t=vm::pop<string>(Stack); Int pos=vm::pop<Int>(Stack); string s=vm::pop<string>(Stack); -#line 3280 "runtime.in" +#line 3440 "runtime.in" if ((size_t) pos < s.length()) {Stack->push<string>(s.insert(pos,t)); return;} {Stack->push<string>(s); return;} } -#line 3286 "runtime.in" +#line 3446 "runtime.in" // string substr(string* s, Int pos, Int n=-1); -void gen275(stack *Stack) +void gen277(stack *Stack) { Int n=vm::pop<Int>(Stack,-1); Int pos=vm::pop<Int>(Stack); string* s=vm::pop<string*>(Stack); -#line 3287 "runtime.in" +#line 3447 "runtime.in" if ((size_t) pos < s->length()) {Stack->push<string>(s->substr(pos,n)); return;} {Stack->push<string>(emptystring); return;} } -#line 3293 "runtime.in" +#line 3453 "runtime.in" // string erase(string s, Int pos, Int n); -void gen276(stack *Stack) +void gen278(stack *Stack) { Int n=vm::pop<Int>(Stack); Int pos=vm::pop<Int>(Stack); string s=vm::pop<string>(Stack); -#line 3294 "runtime.in" +#line 3454 "runtime.in" if ((size_t) pos < s.length()) {Stack->push<string>(s.erase(pos,n)); return;} {Stack->push<string>(s); return;} } -#line 3300 "runtime.in" +#line 3460 "runtime.in" // string downcase(string s); -void gen277(stack *Stack) +void gen279(stack *Stack) { string s=vm::pop<string>(Stack); -#line 3301 "runtime.in" +#line 3461 "runtime.in" std::transform(s.begin(),s.end(),s.begin(),tolower); {Stack->push<string>(s); return;} } -#line 3306 "runtime.in" +#line 3466 "runtime.in" // string upcase(string s); -void gen278(stack *Stack) +void gen280(stack *Stack) { string s=vm::pop<string>(Stack); -#line 3307 "runtime.in" +#line 3467 "runtime.in" std::transform(s.begin(),s.end(),s.begin(),toupper); {Stack->push<string>(s); return;} } // returns a string constructed by translating all occurrences of the string // from in an array of string pairs {from,to} to the string to in string s. -#line 3314 "runtime.in" +#line 3474 "runtime.in" // string replace(string *S, stringarray2 *translate); -void gen279(stack *Stack) +void gen281(stack *Stack) { stringarray2 * translate=vm::pop<stringarray2 *>(Stack); string * S=vm::pop<string *>(Stack); -#line 3315 "runtime.in" +#line 3475 "runtime.in" size_t size=checkArray(translate); for(size_t i=0; i < size; i++) { array *a=read<array*>(translate,i); @@ -4643,13 +4815,13 @@ void gen279(stack *Stack) {Stack->push<string>(buf.str()); return;} } -#line 3339 "runtime.in" +#line 3499 "runtime.in" // string format(string *format, Int x); -void gen280(stack *Stack) +void gen282(stack *Stack) { Int x=vm::pop<Int>(Stack); string * format=vm::pop<string *>(Stack); -#line 3340 "runtime.in" +#line 3500 "runtime.in" const char *f=format->c_str(); checkformat(f,true); @@ -4663,14 +4835,14 @@ void gen280(stack *Stack) {Stack->push<string>(s); return;} } -#line 3354 "runtime.in" +#line 3514 "runtime.in" // string format(string *format, real x, string locale=emptystring); -void gen281(stack *Stack) +void gen283(stack *Stack) { string locale=vm::pop<string>(Stack,emptystring); real x=vm::pop<real>(Stack); string * format=vm::pop<string *>(Stack); -#line 3355 "runtime.in" +#line 3515 "runtime.in" ostringstream out; checkformat(format->c_str(),false); @@ -4787,12 +4959,12 @@ void gen281(stack *Stack) {Stack->push<string>(out.str()); return;} } -#line 3472 "runtime.in" +#line 3632 "runtime.in" // Int hex(string s); -void gen282(stack *Stack) +void gen284(stack *Stack) { string s=vm::pop<string>(Stack); -#line 3473 "runtime.in" +#line 3633 "runtime.in" istringstream is(s); is.setf(std::ios::hex,std::ios::basefield); Int value; @@ -4802,36 +4974,36 @@ void gen282(stack *Stack) error(buf); } -#line 3483 "runtime.in" +#line 3643 "runtime.in" // string string(Int x); -void gen283(stack *Stack) +void gen285(stack *Stack) { Int x=vm::pop<Int>(Stack); -#line 3484 "runtime.in" +#line 3644 "runtime.in" ostringstream buf; buf << x; {Stack->push<string>(buf.str()); return;} } -#line 3490 "runtime.in" +#line 3650 "runtime.in" // string string(real x, Int digits=DBL_DIG); -void gen284(stack *Stack) +void gen286(stack *Stack) { Int digits=vm::pop<Int>(Stack,DBL_DIG); real x=vm::pop<real>(Stack); -#line 3491 "runtime.in" +#line 3651 "runtime.in" ostringstream buf; buf.precision(digits); buf << x; {Stack->push<string>(buf.str()); return;} } -#line 3498 "runtime.in" +#line 3658 "runtime.in" // string time(string format=defaulttimeformat); -void gen285(stack *Stack) +void gen287(stack *Stack) { string format=vm::pop<string>(Stack,defaulttimeformat); -#line 3499 "runtime.in" +#line 3659 "runtime.in" #ifdef HAVE_STRFTIME const time_t bintime=time(NULL); if(!strftime(Time,nTime,format.c_str(),localtime(&bintime))) {Stack->push<string>(""); return;} @@ -4841,13 +5013,13 @@ void gen285(stack *Stack) #endif } -#line 3509 "runtime.in" +#line 3669 "runtime.in" // string time(Int seconds, string format=defaulttimeformat); -void gen286(stack *Stack) +void gen288(stack *Stack) { string format=vm::pop<string>(Stack,defaulttimeformat); Int seconds=vm::pop<Int>(Stack); -#line 3510 "runtime.in" +#line 3670 "runtime.in" #ifdef HAVE_STRFTIME const time_t bintime=seconds; if(!strftime(Time,nTime,format.c_str(),localtime(&bintime))) {Stack->push<string>(""); return;} @@ -4859,13 +5031,13 @@ void gen286(stack *Stack) #endif } -#line 3522 "runtime.in" +#line 3682 "runtime.in" // Int seconds(string t=emptystring, string format=emptystring); -void gen287(stack *Stack) +void gen289(stack *Stack) { string format=vm::pop<string>(Stack,emptystring); string t=vm::pop<string>(Stack,emptystring); -#line 3523 "runtime.in" +#line 3683 "runtime.in" #if defined(HAVE_STRPTIME) const time_t bintime=time(NULL); tm tm=*localtime(&bintime); @@ -4876,11 +5048,11 @@ void gen287(stack *Stack) #endif } -#line 3534 "runtime.in" +#line 3694 "runtime.in" // realarray* _cputime(); -void gen288(stack *Stack) +void gen290(stack *Stack) { -#line 3535 "runtime.in" +#line 3695 "runtime.in" static const real ticktime=1.0/sysconf(_SC_CLK_TCK); struct tms buf; @@ -4895,234 +5067,234 @@ void gen288(stack *Stack) // Math -#line 3550 "runtime.in" +#line 3710 "runtime.in" // real ^(real x, Int y); -void gen289(stack *Stack) +void gen291(stack *Stack) { Int y=vm::pop<Int>(Stack); real x=vm::pop<real>(Stack); -#line 3551 "runtime.in" +#line 3711 "runtime.in" {Stack->push<real>(pow(x,y)); return;} } -#line 3556 "runtime.in" +#line 3716 "runtime.in" // pair ^(pair z, Int y); -void gen290(stack *Stack) +void gen292(stack *Stack) { Int y=vm::pop<Int>(Stack); pair z=vm::pop<pair>(Stack); -#line 3557 "runtime.in" +#line 3717 "runtime.in" {Stack->push<pair>(pow(z,y)); return;} } -#line 3561 "runtime.in" +#line 3721 "runtime.in" // Int quotient(Int x, Int y); -void gen291(stack *Stack) +void gen293(stack *Stack) { Int y=vm::pop<Int>(Stack); Int x=vm::pop<Int>(Stack); -#line 3562 "runtime.in" +#line 3722 "runtime.in" if(y == 0) dividebyzero(); if(y == -1) {Stack->push<Int>(Negate(x)); return;} // Implementation-independent definition of integer division: round down {Stack->push<Int>((x-portableMod(x,y))/y); return;} } -#line 3569 "runtime.in" +#line 3729 "runtime.in" // Int abs(Int x); -void gen292(stack *Stack) +void gen294(stack *Stack) { Int x=vm::pop<Int>(Stack); -#line 3570 "runtime.in" +#line 3730 "runtime.in" {Stack->push<Int>(Abs(x)); return;} } -#line 3574 "runtime.in" +#line 3734 "runtime.in" // Int sgn(real x); -void gen293(stack *Stack) +void gen295(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3575 "runtime.in" +#line 3735 "runtime.in" {Stack->push<Int>(sgn(x)); return;} } -#line 3579 "runtime.in" +#line 3739 "runtime.in" // Int rand(); -void gen294(stack *Stack) +void gen296(stack *Stack) { -#line 3580 "runtime.in" +#line 3740 "runtime.in" {Stack->push<Int>(rand()); return;} } -#line 3584 "runtime.in" +#line 3744 "runtime.in" // void srand(Int seed); -void gen295(stack *Stack) +void gen297(stack *Stack) { Int seed=vm::pop<Int>(Stack); -#line 3585 "runtime.in" +#line 3745 "runtime.in" srand(intcast(seed)); } // a random number uniformly distributed in the interval [0,1] -#line 3590 "runtime.in" +#line 3750 "runtime.in" // real unitrand(); -void gen296(stack *Stack) +void gen298(stack *Stack) { -#line 3591 "runtime.in" +#line 3751 "runtime.in" {Stack->push<real>(((real) rand())/RAND_MAX); return;} } -#line 3595 "runtime.in" +#line 3755 "runtime.in" // Int ceil(real x); -void gen297(stack *Stack) +void gen299(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3596 "runtime.in" +#line 3756 "runtime.in" {Stack->push<Int>(Intcast(ceil(x))); return;} } -#line 3600 "runtime.in" +#line 3760 "runtime.in" // Int floor(real x); -void gen298(stack *Stack) +void gen300(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3601 "runtime.in" +#line 3761 "runtime.in" {Stack->push<Int>(Intcast(floor(x))); return;} } -#line 3605 "runtime.in" +#line 3765 "runtime.in" // Int round(real x); -void gen299(stack *Stack) +void gen301(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3606 "runtime.in" +#line 3766 "runtime.in" if(validInt(x)) {Stack->push<Int>(Round(x)); return;} integeroverflow(0); } -#line 3611 "runtime.in" +#line 3771 "runtime.in" // Int Ceil(real x); -void gen300(stack *Stack) +void gen302(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3612 "runtime.in" +#line 3772 "runtime.in" {Stack->push<Int>(Ceil(x)); return;} } -#line 3616 "runtime.in" +#line 3776 "runtime.in" // Int Floor(real x); -void gen301(stack *Stack) +void gen303(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3617 "runtime.in" +#line 3777 "runtime.in" {Stack->push<Int>(Floor(x)); return;} } -#line 3621 "runtime.in" +#line 3781 "runtime.in" // Int Round(real x); -void gen302(stack *Stack) +void gen304(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3622 "runtime.in" +#line 3782 "runtime.in" {Stack->push<Int>(Round(Intcap(x))); return;} } -#line 3626 "runtime.in" +#line 3786 "runtime.in" // real fmod(real x, real y); -void gen303(stack *Stack) +void gen305(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 3627 "runtime.in" +#line 3787 "runtime.in" if (y == 0.0) dividebyzero(); {Stack->push<real>(fmod(x,y)); return;} } -#line 3632 "runtime.in" +#line 3792 "runtime.in" // real atan2(real y, real x); -void gen304(stack *Stack) +void gen306(stack *Stack) { real x=vm::pop<real>(Stack); real y=vm::pop<real>(Stack); -#line 3633 "runtime.in" +#line 3793 "runtime.in" {Stack->push<real>(atan2(y,x)); return;} } -#line 3637 "runtime.in" +#line 3797 "runtime.in" // real hypot(real x, real y); -void gen305(stack *Stack) +void gen307(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 3638 "runtime.in" +#line 3798 "runtime.in" {Stack->push<real>(hypot(x,y)); return;} } -#line 3642 "runtime.in" +#line 3802 "runtime.in" // real remainder(real x, real y); -void gen306(stack *Stack) +void gen308(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 3643 "runtime.in" +#line 3803 "runtime.in" {Stack->push<real>(remainder(x,y)); return;} } -#line 3647 "runtime.in" +#line 3807 "runtime.in" // real J(Int n, real x); -void gen307(stack *Stack) +void gen309(stack *Stack) { real x=vm::pop<real>(Stack); Int n=vm::pop<Int>(Stack); -#line 3648 "runtime.in" +#line 3808 "runtime.in" {Stack->push<real>(jn(n,x)); return;} } -#line 3652 "runtime.in" +#line 3812 "runtime.in" // real Y(Int n, real x); -void gen308(stack *Stack) +void gen310(stack *Stack) { real x=vm::pop<real>(Stack); Int n=vm::pop<Int>(Stack); -#line 3653 "runtime.in" +#line 3813 "runtime.in" {Stack->push<real>(yn(n,x)); return;} } -#line 3657 "runtime.in" +#line 3817 "runtime.in" // real erf(real x); -void gen309(stack *Stack) +void gen311(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3658 "runtime.in" +#line 3818 "runtime.in" {Stack->push<real>(erf(x)); return;} } -#line 3662 "runtime.in" +#line 3822 "runtime.in" // real erfc(real x); -void gen310(stack *Stack) +void gen312(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3663 "runtime.in" +#line 3823 "runtime.in" {Stack->push<real>(erfc(x)); return;} } -#line 3667 "runtime.in" +#line 3827 "runtime.in" // Int factorial(Int n); -void gen311(stack *Stack) +void gen313(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 3668 "runtime.in" +#line 3828 "runtime.in" if(n < 0) error(invalidargument); {Stack->push<Int>(factorial(n)); return;} } -#line 3672 "runtime.in" +#line 3832 "runtime.in" // Int choose(Int n, Int k); -void gen312(stack *Stack) +void gen314(stack *Stack) { Int k=vm::pop<Int>(Stack); Int n=vm::pop<Int>(Stack); -#line 3673 "runtime.in" +#line 3833 "runtime.in" if(n < 0 || k < 0 || k > n) error(invalidargument); Int f=1; Int r=n-k; @@ -5133,12 +5305,12 @@ void gen312(stack *Stack) {Stack->push<Int>(f); return;} } -#line 3683 "runtime.in" +#line 3843 "runtime.in" // real gamma(real x); -void gen313(stack *Stack) +void gen315(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3684 "runtime.in" +#line 3844 "runtime.in" #ifdef HAVE_TGAMMA {Stack->push<real>(tgamma(x)); return;} #else @@ -5148,23 +5320,23 @@ void gen313(stack *Stack) } // Complex Gamma function -#line 3694 "runtime.in" +#line 3854 "runtime.in" // pair gamma(explicit pair z); -void gen314(stack *Stack) +void gen316(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 3695 "runtime.in" +#line 3855 "runtime.in" {Stack->push<pair>(gamma(z)); return;} } -#line 3699 "runtime.in" +#line 3859 "runtime.in" // realarray* quadraticroots(real a, real b, real c); -void gen315(stack *Stack) +void gen317(stack *Stack) { real c=vm::pop<real>(Stack); real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); -#line 3700 "runtime.in" +#line 3860 "runtime.in" quadraticroots q(a,b,c); array *roots=new array(q.roots); if(q.roots >= 1) (*roots)[0]=q.t1; @@ -5172,14 +5344,14 @@ void gen315(stack *Stack) {Stack->push<realarray*>(roots); return;} } -#line 3708 "runtime.in" +#line 3868 "runtime.in" // pairarray* quadraticroots(explicit pair a, explicit pair b, explicit pair c); -void gen316(stack *Stack) +void gen318(stack *Stack) { pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 3709 "runtime.in" +#line 3869 "runtime.in" Quadraticroots q(a,b,c); array *roots=new array(q.roots); if(q.roots >= 1) (*roots)[0]=q.z1; @@ -5187,15 +5359,15 @@ void gen316(stack *Stack) {Stack->push<pairarray*>(roots); return;} } -#line 3717 "runtime.in" +#line 3877 "runtime.in" // realarray* cubicroots(real a, real b, real c, real d); -void gen317(stack *Stack) +void gen319(stack *Stack) { real d=vm::pop<real>(Stack); real c=vm::pop<real>(Stack); real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); -#line 3718 "runtime.in" +#line 3878 "runtime.in" cubicroots q(a,b,c,d); array *roots=new array(q.roots); if(q.roots >= 1) (*roots)[0]=q.t1; @@ -5206,103 +5378,103 @@ void gen317(stack *Stack) // Transforms -#line 3729 "runtime.in" +#line 3889 "runtime.in" // bool ==(transform a, transform b); -void gen318(stack *Stack) +void gen320(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 3730 "runtime.in" +#line 3890 "runtime.in" {Stack->push<bool>(a == b); return;} } -#line 3735 "runtime.in" +#line 3895 "runtime.in" // bool !=(transform a, transform b); -void gen319(stack *Stack) +void gen321(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 3736 "runtime.in" +#line 3896 "runtime.in" {Stack->push<bool>(a != b); return;} } -#line 3740 "runtime.in" +#line 3900 "runtime.in" // transform +(transform a, transform b); -void gen320(stack *Stack) +void gen322(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 3741 "runtime.in" +#line 3901 "runtime.in" {Stack->push<transform>(a+b); return;} } -#line 3745 "runtime.in" +#line 3905 "runtime.in" // transform *(transform a, transform b); -void gen321(stack *Stack) +void gen323(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 3746 "runtime.in" +#line 3906 "runtime.in" {Stack->push<transform>(a*b); return;} } -#line 3750 "runtime.in" +#line 3910 "runtime.in" // pair *(transform t, pair z); -void gen322(stack *Stack) +void gen324(stack *Stack) { pair z=vm::pop<pair>(Stack); transform t=vm::pop<transform>(Stack); -#line 3751 "runtime.in" +#line 3911 "runtime.in" {Stack->push<pair>(t*z); return;} } -#line 3755 "runtime.in" +#line 3915 "runtime.in" // path *(transform t, path g); -void gen323(stack *Stack) +void gen325(stack *Stack) { path g=vm::pop<path>(Stack); transform t=vm::pop<transform>(Stack); -#line 3756 "runtime.in" +#line 3916 "runtime.in" {Stack->push<path>(transformed(t,g)); return;} } -#line 3760 "runtime.in" +#line 3920 "runtime.in" // pen *(transform t, pen p); -void gen324(stack *Stack) +void gen326(stack *Stack) { pen p=vm::pop<pen>(Stack); transform t=vm::pop<transform>(Stack); -#line 3761 "runtime.in" +#line 3921 "runtime.in" {Stack->push<pen>(transformed(t,p)); return;} } -#line 3765 "runtime.in" +#line 3925 "runtime.in" // picture* *(transform t, picture *f); -void gen325(stack *Stack) +void gen327(stack *Stack) { picture * f=vm::pop<picture *>(Stack); transform t=vm::pop<transform>(Stack); -#line 3766 "runtime.in" +#line 3926 "runtime.in" {Stack->push<picture*>(transformed(t,f)); return;} } -#line 3770 "runtime.in" +#line 3930 "runtime.in" // picture* *(realarray2 *t, picture *f); -void gen326(stack *Stack) +void gen328(stack *Stack) { picture * f=vm::pop<picture *>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); -#line 3771 "runtime.in" +#line 3931 "runtime.in" {Stack->push<picture*>(transformed(*t,f)); return;} } -#line 3775 "runtime.in" +#line 3935 "runtime.in" // transform ^(transform t, Int n); -void gen327(stack *Stack) +void gen329(stack *Stack) { Int n=vm::pop<Int>(Stack); transform t=vm::pop<transform>(Stack); -#line 3776 "runtime.in" +#line 3936 "runtime.in" transform T; if(n < 0) { n=-n; @@ -5312,55 +5484,55 @@ void gen327(stack *Stack) {Stack->push<transform>(T); return;} } -#line 3786 "runtime.in" +#line 3946 "runtime.in" void transformXPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 3787 "runtime.in" +#line 3947 "runtime.in" {Stack->push<real>(t.getx()); return;} } -#line 3791 "runtime.in" +#line 3951 "runtime.in" void transformYPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 3792 "runtime.in" +#line 3952 "runtime.in" {Stack->push<real>(t.gety()); return;} } -#line 3796 "runtime.in" +#line 3956 "runtime.in" void transformXXPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 3797 "runtime.in" +#line 3957 "runtime.in" {Stack->push<real>(t.getxx()); return;} } -#line 3801 "runtime.in" +#line 3961 "runtime.in" void transformXYPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 3802 "runtime.in" +#line 3962 "runtime.in" {Stack->push<real>(t.getxy()); return;} } -#line 3806 "runtime.in" +#line 3966 "runtime.in" void transformYXPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 3807 "runtime.in" +#line 3967 "runtime.in" {Stack->push<real>(t.getyx()); return;} } -#line 3811 "runtime.in" +#line 3971 "runtime.in" void transformYYPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 3812 "runtime.in" +#line 3972 "runtime.in" {Stack->push<real>(t.getyy()); return;} } -#line 3816 "runtime.in" +#line 3976 "runtime.in" void real6ToTransform(stack *Stack) { real yy=vm::pop<real>(Stack); @@ -5369,765 +5541,765 @@ void real6ToTransform(stack *Stack) real xx=vm::pop<real>(Stack); real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 3818 "runtime.in" +#line 3978 "runtime.in" {Stack->push<transform>(transform(x,y,xx,xy,yx,yy)); return;} } -#line 3822 "runtime.in" +#line 3982 "runtime.in" // transform shift(transform t); -void gen335(stack *Stack) +void gen337(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 3823 "runtime.in" +#line 3983 "runtime.in" {Stack->push<transform>(transform(t.getx(),t.gety(),0,0,0,0)); return;} } -#line 3827 "runtime.in" +#line 3987 "runtime.in" // transform shiftless(transform t); -void gen336(stack *Stack) +void gen338(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 3828 "runtime.in" +#line 3988 "runtime.in" {Stack->push<transform>(transform(0,0,t.getxx(),t.getxy(),t.getyx(),t.getyy())); return;} } -#line 3832 "runtime.in" +#line 3992 "runtime.in" // transform identity(); void transformIdentity(stack *Stack) { -#line 3833 "runtime.in" +#line 3993 "runtime.in" {Stack->push<transform>(identity); return;} } -#line 3837 "runtime.in" +#line 3997 "runtime.in" // transform inverse(transform t); -void gen338(stack *Stack) +void gen340(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 3838 "runtime.in" +#line 3998 "runtime.in" {Stack->push<transform>(inverse(t)); return;} } -#line 3842 "runtime.in" +#line 4002 "runtime.in" // transform shift(pair z); -void gen339(stack *Stack) +void gen341(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 3843 "runtime.in" +#line 4003 "runtime.in" {Stack->push<transform>(shift(z)); return;} } -#line 3847 "runtime.in" +#line 4007 "runtime.in" // transform shift(real x, real y); -void gen340(stack *Stack) +void gen342(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 3848 "runtime.in" +#line 4008 "runtime.in" {Stack->push<transform>(shift(pair(x,y))); return;} } -#line 3852 "runtime.in" +#line 4012 "runtime.in" // transform xscale(real x); -void gen341(stack *Stack) +void gen343(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3853 "runtime.in" +#line 4013 "runtime.in" {Stack->push<transform>(xscale(x)); return;} } -#line 3857 "runtime.in" +#line 4017 "runtime.in" // transform yscale(real y); -void gen342(stack *Stack) +void gen344(stack *Stack) { real y=vm::pop<real>(Stack); -#line 3858 "runtime.in" +#line 4018 "runtime.in" {Stack->push<transform>(yscale(y)); return;} } -#line 3862 "runtime.in" +#line 4022 "runtime.in" // transform scale(real x); -void gen343(stack *Stack) +void gen345(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3863 "runtime.in" +#line 4023 "runtime.in" {Stack->push<transform>(scale(x)); return;} } -#line 3867 "runtime.in" +#line 4027 "runtime.in" // transform scale(real x, real y); -void gen344(stack *Stack) +void gen346(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 3868 "runtime.in" +#line 4028 "runtime.in" {Stack->push<transform>(xscale(x)*yscale(y)); return;} } -#line 3872 "runtime.in" +#line 4032 "runtime.in" // transform slant(real s); -void gen345(stack *Stack) +void gen347(stack *Stack) { real s=vm::pop<real>(Stack); -#line 3873 "runtime.in" +#line 4033 "runtime.in" {Stack->push<transform>(slant(s)); return;} } -#line 3877 "runtime.in" +#line 4037 "runtime.in" // transform rotate(real angle, pair z=0); -void gen346(stack *Stack) +void gen348(stack *Stack) { pair z=vm::pop<pair>(Stack,0); real angle=vm::pop<real>(Stack); -#line 3878 "runtime.in" +#line 4038 "runtime.in" {Stack->push<transform>(rotatearound(z,radians(angle))); return;} } -#line 3882 "runtime.in" +#line 4042 "runtime.in" // transform reflect(pair a, pair b); -void gen347(stack *Stack) +void gen349(stack *Stack) { pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 3883 "runtime.in" +#line 4043 "runtime.in" {Stack->push<transform>(reflectabout(a,b)); return;} } // Pair operations -#line 3889 "runtime.in" +#line 4049 "runtime.in" void pairZero(stack *Stack) { -#line 3890 "runtime.in" +#line 4050 "runtime.in" {Stack->push<pair>(zero); return;} } -#line 3895 "runtime.in" +#line 4055 "runtime.in" void realRealToPair(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 3896 "runtime.in" +#line 4056 "runtime.in" {Stack->push<pair>(pair(x,y)); return;} } -#line 3900 "runtime.in" +#line 4060 "runtime.in" void pairNegate(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 3901 "runtime.in" +#line 4061 "runtime.in" {Stack->push<pair>(-z); return;} } -#line 3905 "runtime.in" +#line 4065 "runtime.in" // real xpart(pair z); void pairXPart(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 3906 "runtime.in" +#line 4066 "runtime.in" {Stack->push<real>(z.getx()); return;} } -#line 3910 "runtime.in" +#line 4070 "runtime.in" // real ypart(pair z); void pairYPart(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 3911 "runtime.in" +#line 4071 "runtime.in" {Stack->push<real>(z.gety()); return;} } -#line 3915 "runtime.in" +#line 4075 "runtime.in" // real length(pair z); -void gen353(stack *Stack) +void gen355(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 3916 "runtime.in" +#line 4076 "runtime.in" {Stack->push<real>(z.length()); return;} } -#line 3920 "runtime.in" +#line 4080 "runtime.in" // real abs(pair z); -void gen354(stack *Stack) +void gen356(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 3921 "runtime.in" +#line 4081 "runtime.in" {Stack->push<real>(z.length()); return;} } -#line 3925 "runtime.in" +#line 4085 "runtime.in" // pair sqrt(explicit pair z); -void gen355(stack *Stack) +void gen357(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 3926 "runtime.in" +#line 4086 "runtime.in" {Stack->push<pair>(Sqrt(z)); return;} } // Return the angle of z in radians. -#line 3931 "runtime.in" +#line 4091 "runtime.in" // real angle(pair z, bool warn=true); -void gen356(stack *Stack) +void gen358(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); pair z=vm::pop<pair>(Stack); -#line 3932 "runtime.in" +#line 4092 "runtime.in" if(!warn && z.getx() == 0.0 && z.gety() == 0.0) {Stack->push<real>(0.0); return;} {Stack->push<real>(z.angle()); return;} } // Return the angle of z in degrees in the interval [0,360). -#line 3938 "runtime.in" +#line 4098 "runtime.in" // real degrees(pair z, bool warn=true); -void gen357(stack *Stack) +void gen359(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); pair z=vm::pop<pair>(Stack); -#line 3939 "runtime.in" +#line 4099 "runtime.in" if(!warn && z.getx() == 0.0 && z.gety() == 0.0) {Stack->push<real>(0.0); return;} {Stack->push<real>(principalBranch(degrees(z.angle()))); return;} } // Convert degrees to radians. -#line 3945 "runtime.in" +#line 4105 "runtime.in" // real radians(real degrees); -void gen358(stack *Stack) +void gen360(stack *Stack) { real degrees=vm::pop<real>(Stack); -#line 3946 "runtime.in" +#line 4106 "runtime.in" {Stack->push<real>(radians(degrees)); return;} } // Convert radians to degrees. -#line 3951 "runtime.in" +#line 4111 "runtime.in" // real degrees(real radians); -void gen359(stack *Stack) +void gen361(stack *Stack) { real radians=vm::pop<real>(Stack); -#line 3952 "runtime.in" +#line 4112 "runtime.in" {Stack->push<real>(degrees(radians)); return;} } // Convert radians to degrees in [0,360). -#line 3957 "runtime.in" +#line 4117 "runtime.in" // real Degrees(real radians); -void gen360(stack *Stack) +void gen362(stack *Stack) { real radians=vm::pop<real>(Stack); -#line 3958 "runtime.in" +#line 4118 "runtime.in" {Stack->push<real>(principalBranch(degrees(radians))); return;} } -#line 3962 "runtime.in" +#line 4122 "runtime.in" // real Sin(real deg); -void gen361(stack *Stack) +void gen363(stack *Stack) { real deg=vm::pop<real>(Stack); -#line 3963 "runtime.in" +#line 4123 "runtime.in" {Stack->push<real>(sin(radians(deg))); return;} } -#line 3967 "runtime.in" +#line 4127 "runtime.in" // real Cos(real deg); -void gen362(stack *Stack) +void gen364(stack *Stack) { real deg=vm::pop<real>(Stack); -#line 3968 "runtime.in" +#line 4128 "runtime.in" {Stack->push<real>(cos(radians(deg))); return;} } -#line 3972 "runtime.in" +#line 4132 "runtime.in" // real Tan(real deg); -void gen363(stack *Stack) +void gen365(stack *Stack) { real deg=vm::pop<real>(Stack); -#line 3973 "runtime.in" +#line 4133 "runtime.in" {Stack->push<real>(tan(radians(deg))); return;} } -#line 3977 "runtime.in" +#line 4137 "runtime.in" // real aSin(real x); -void gen364(stack *Stack) +void gen366(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3978 "runtime.in" +#line 4138 "runtime.in" {Stack->push<real>(degrees(asin(x))); return;} } -#line 3982 "runtime.in" +#line 4142 "runtime.in" // real aCos(real x); -void gen365(stack *Stack) +void gen367(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3983 "runtime.in" +#line 4143 "runtime.in" {Stack->push<real>(degrees(acos(x))); return;} } -#line 3987 "runtime.in" +#line 4147 "runtime.in" // real aTan(real x); -void gen366(stack *Stack) +void gen368(stack *Stack) { real x=vm::pop<real>(Stack); -#line 3988 "runtime.in" +#line 4148 "runtime.in" {Stack->push<real>(degrees(atan(x))); return;} } -#line 3992 "runtime.in" +#line 4152 "runtime.in" // pair unit(pair z); -void gen367(stack *Stack) +void gen369(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 3993 "runtime.in" +#line 4153 "runtime.in" {Stack->push<pair>(unit(z)); return;} } -#line 3997 "runtime.in" +#line 4157 "runtime.in" // pair dir(real degrees); -void gen368(stack *Stack) +void gen370(stack *Stack) { real degrees=vm::pop<real>(Stack); -#line 3998 "runtime.in" +#line 4158 "runtime.in" {Stack->push<pair>(expi(radians(degrees))); return;} } -#line 4002 "runtime.in" +#line 4162 "runtime.in" // pair dir(explicit pair z); -void gen369(stack *Stack) +void gen371(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 4003 "runtime.in" +#line 4163 "runtime.in" {Stack->push<pair>(unit(z)); return;} } -#line 4007 "runtime.in" +#line 4167 "runtime.in" // pair expi(real angle); -void gen370(stack *Stack) +void gen372(stack *Stack) { real angle=vm::pop<real>(Stack); -#line 4008 "runtime.in" +#line 4168 "runtime.in" {Stack->push<pair>(expi(angle)); return;} } -#line 4012 "runtime.in" +#line 4172 "runtime.in" // pair exp(explicit pair z); -void gen371(stack *Stack) +void gen373(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 4013 "runtime.in" +#line 4173 "runtime.in" {Stack->push<pair>(exp(z)); return;} } -#line 4017 "runtime.in" +#line 4177 "runtime.in" // pair log(explicit pair z); -void gen372(stack *Stack) +void gen374(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 4018 "runtime.in" +#line 4178 "runtime.in" {Stack->push<pair>(pair(log(z.length()),z.angle())); return;} } -#line 4022 "runtime.in" +#line 4182 "runtime.in" // pair sin(explicit pair z); -void gen373(stack *Stack) +void gen375(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 4023 "runtime.in" +#line 4183 "runtime.in" {Stack->push<pair>(sin(z)); return;} } -#line 4027 "runtime.in" +#line 4187 "runtime.in" // pair cos(explicit pair z); -void gen374(stack *Stack) +void gen376(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 4028 "runtime.in" +#line 4188 "runtime.in" {Stack->push<pair>(pair(cos(z.getx())*cosh(z.gety()),-sin(z.getx())*sinh(z.gety()))); return;} } -#line 4032 "runtime.in" +#line 4192 "runtime.in" // pair conj(pair z); -void gen375(stack *Stack) +void gen377(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 4033 "runtime.in" +#line 4193 "runtime.in" {Stack->push<pair>(conj(z)); return;} } -#line 4037 "runtime.in" +#line 4197 "runtime.in" // pair realmult(pair z, pair w); -void gen376(stack *Stack) +void gen378(stack *Stack) { pair w=vm::pop<pair>(Stack); pair z=vm::pop<pair>(Stack); -#line 4038 "runtime.in" +#line 4198 "runtime.in" {Stack->push<pair>(pair (z.getx()*w.getx(),z.gety()*w.gety())); return;} } -#line 4042 "runtime.in" +#line 4202 "runtime.in" // triple realmult(triple u, triple v); -void gen377(stack *Stack) +void gen379(stack *Stack) { triple v=vm::pop<triple>(Stack); triple u=vm::pop<triple>(Stack); -#line 4043 "runtime.in" +#line 4203 "runtime.in" {Stack->push<triple>(triple (u.getx()*v.getx(),u.gety()*v.gety(),u.getz()*v.getz())); return;} } // To avoid confusion, a dot product requires explicit pair arguments. -#line 4048 "runtime.in" +#line 4208 "runtime.in" // real dot(explicit pair z, explicit pair w); -void gen378(stack *Stack) +void gen380(stack *Stack) { pair w=vm::pop<pair>(Stack); pair z=vm::pop<pair>(Stack); -#line 4049 "runtime.in" +#line 4209 "runtime.in" {Stack->push<real>(dot(z,w)); return;} } // Triple operations -#line 4055 "runtime.in" +#line 4215 "runtime.in" void tripleZero(stack *Stack) { -#line 4056 "runtime.in" +#line 4216 "runtime.in" static triple zero; {Stack->push<triple>(zero); return;} } -#line 4062 "runtime.in" +#line 4222 "runtime.in" void realRealRealToTriple(stack *Stack) { real z=vm::pop<real>(Stack); real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 4063 "runtime.in" +#line 4223 "runtime.in" {Stack->push<triple>(triple(x,y,z)); return;} } -#line 4067 "runtime.in" +#line 4227 "runtime.in" // real xpart(triple v); void tripleXPart(stack *Stack) { triple v=vm::pop<triple>(Stack); -#line 4068 "runtime.in" +#line 4228 "runtime.in" {Stack->push<real>(v.getx()); return;} } -#line 4072 "runtime.in" +#line 4232 "runtime.in" // real ypart(triple v); void tripleYPart(stack *Stack) { triple v=vm::pop<triple>(Stack); -#line 4073 "runtime.in" +#line 4233 "runtime.in" {Stack->push<real>(v.gety()); return;} } -#line 4077 "runtime.in" +#line 4237 "runtime.in" // real zpart(triple v); void tripleZPart(stack *Stack) { triple v=vm::pop<triple>(Stack); -#line 4078 "runtime.in" +#line 4238 "runtime.in" {Stack->push<real>(v.getz()); return;} } -#line 4082 "runtime.in" +#line 4242 "runtime.in" // triple *(real x, triple v); -void gen384(stack *Stack) +void gen386(stack *Stack) { triple v=vm::pop<triple>(Stack); real x=vm::pop<real>(Stack); -#line 4083 "runtime.in" +#line 4243 "runtime.in" {Stack->push<triple>(x*v); return;} } -#line 4087 "runtime.in" +#line 4247 "runtime.in" // triple *(triple v, real x); -void gen385(stack *Stack) +void gen387(stack *Stack) { real x=vm::pop<real>(Stack); triple v=vm::pop<triple>(Stack); -#line 4088 "runtime.in" +#line 4248 "runtime.in" {Stack->push<triple>(v*x); return;} } -#line 4092 "runtime.in" +#line 4252 "runtime.in" // triple /(triple v, real x); -void gen386(stack *Stack) +void gen388(stack *Stack) { real x=vm::pop<real>(Stack); triple v=vm::pop<triple>(Stack); -#line 4093 "runtime.in" +#line 4253 "runtime.in" {Stack->push<triple>(v/x); return;} } -#line 4097 "runtime.in" +#line 4257 "runtime.in" // real length(triple v); -void gen387(stack *Stack) +void gen389(stack *Stack) { triple v=vm::pop<triple>(Stack); -#line 4098 "runtime.in" +#line 4258 "runtime.in" {Stack->push<real>(v.length()); return;} } -#line 4102 "runtime.in" +#line 4262 "runtime.in" // real abs(triple v); -void gen388(stack *Stack) +void gen390(stack *Stack) { triple v=vm::pop<triple>(Stack); -#line 4103 "runtime.in" +#line 4263 "runtime.in" {Stack->push<real>(v.length()); return;} } -#line 4107 "runtime.in" +#line 4267 "runtime.in" // real polar(triple v, bool warn=true); -void gen389(stack *Stack) +void gen391(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); triple v=vm::pop<triple>(Stack); -#line 4108 "runtime.in" +#line 4268 "runtime.in" if(!warn && v.getx() == 0.0 && v.gety() == 0.0 && v.getz() == 0.0) {Stack->push<real>(0.0); return;} {Stack->push<real>(v.polar()); return;} } -#line 4113 "runtime.in" +#line 4273 "runtime.in" // real azimuth(triple v, bool warn=true); -void gen390(stack *Stack) +void gen392(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); triple v=vm::pop<triple>(Stack); -#line 4114 "runtime.in" +#line 4274 "runtime.in" if(!warn && v.getx() == 0.0 && v.gety() == 0.0) {Stack->push<real>(0.0); return;} {Stack->push<real>(v.azimuth()); return;} } -#line 4119 "runtime.in" +#line 4279 "runtime.in" // real colatitude(triple v, bool warn=true); -void gen391(stack *Stack) +void gen393(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); triple v=vm::pop<triple>(Stack); -#line 4120 "runtime.in" +#line 4280 "runtime.in" if(!warn && v.getx() == 0.0 && v.gety() == 0.0 && v.getz() == 0.0) {Stack->push<real>(0.0); return;} {Stack->push<real>(degrees(v.polar())); return;} } -#line 4125 "runtime.in" +#line 4285 "runtime.in" // real latitude(triple v, bool warn=true); -void gen392(stack *Stack) +void gen394(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); triple v=vm::pop<triple>(Stack); -#line 4126 "runtime.in" +#line 4286 "runtime.in" if(!warn && v.getx() == 0.0 && v.gety() == 0.0 && v.getz() == 0.0) {Stack->push<real>(0.0); return;} {Stack->push<real>(90.0-degrees(v.polar())); return;} } // Return the longitude of v in [0,360). -#line 4132 "runtime.in" +#line 4292 "runtime.in" // real longitude(triple v, bool warn=true); -void gen393(stack *Stack) +void gen395(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); triple v=vm::pop<triple>(Stack); -#line 4133 "runtime.in" +#line 4293 "runtime.in" if(!warn && v.getx() == 0.0 && v.gety() == 0.0) {Stack->push<real>(0.0); return;} {Stack->push<real>(principalBranch(degrees(v.azimuth()))); return;} } -#line 4138 "runtime.in" +#line 4298 "runtime.in" // triple unit(triple v); -void gen394(stack *Stack) +void gen396(stack *Stack) { triple v=vm::pop<triple>(Stack); -#line 4139 "runtime.in" +#line 4299 "runtime.in" {Stack->push<triple>(unit(v)); return;} } -#line 4143 "runtime.in" +#line 4303 "runtime.in" // real dot(triple u, triple v); -void gen395(stack *Stack) +void gen397(stack *Stack) { triple v=vm::pop<triple>(Stack); triple u=vm::pop<triple>(Stack); -#line 4144 "runtime.in" +#line 4304 "runtime.in" {Stack->push<real>(dot(u,v)); return;} } -#line 4148 "runtime.in" +#line 4308 "runtime.in" // triple cross(triple u, triple v); -void gen396(stack *Stack) +void gen398(stack *Stack) { triple v=vm::pop<triple>(Stack); triple u=vm::pop<triple>(Stack); -#line 4149 "runtime.in" +#line 4309 "runtime.in" {Stack->push<triple>(cross(u,v)); return;} } -#line 4153 "runtime.in" +#line 4313 "runtime.in" // triple expi(real polar, real azimuth); -void gen397(stack *Stack) +void gen399(stack *Stack) { real azimuth=vm::pop<real>(Stack); real polar=vm::pop<real>(Stack); -#line 4154 "runtime.in" +#line 4314 "runtime.in" {Stack->push<triple>(expi(polar,azimuth)); return;} } -#line 4158 "runtime.in" +#line 4318 "runtime.in" // triple dir(real colatitude, real longitude); -void gen398(stack *Stack) +void gen400(stack *Stack) { real longitude=vm::pop<real>(Stack); real colatitude=vm::pop<real>(Stack); -#line 4159 "runtime.in" +#line 4319 "runtime.in" {Stack->push<triple>(expi(radians(colatitude),radians(longitude))); return;} } // System routines -#line 4165 "runtime.in" +#line 4325 "runtime.in" // void atupdate(callable *f); -void gen399(stack *Stack) +void gen401(stack *Stack) { callable * f=vm::pop<callable *>(Stack); -#line 4166 "runtime.in" +#line 4326 "runtime.in" processData().atUpdateFunction=f; } -#line 4171 "runtime.in" +#line 4331 "runtime.in" // callable* atupdate(); -void gen400(stack *Stack) +void gen402(stack *Stack) { -#line 4172 "runtime.in" +#line 4332 "runtime.in" {Stack->push<callable*>(processData().atUpdateFunction); return;} } -#line 4176 "runtime.in" +#line 4336 "runtime.in" // void atexit(callable *f); -void gen401(stack *Stack) +void gen403(stack *Stack) { callable * f=vm::pop<callable *>(Stack); -#line 4177 "runtime.in" +#line 4337 "runtime.in" processData().atExitFunction=f; } -#line 4181 "runtime.in" +#line 4341 "runtime.in" // callable* atexit(); -void gen402(stack *Stack) +void gen404(stack *Stack) { -#line 4182 "runtime.in" +#line 4342 "runtime.in" {Stack->push<callable*>(processData().atExitFunction); return;} } -#line 4186 "runtime.in" +#line 4346 "runtime.in" // void atbreakpoint(callableBp *f); -void gen403(stack *Stack) +void gen405(stack *Stack) { callableBp * f=vm::pop<callableBp *>(Stack); -#line 4187 "runtime.in" +#line 4347 "runtime.in" processData().atBreakpointFunction=f; } -#line 4191 "runtime.in" +#line 4351 "runtime.in" // void breakpoint(runnable *s=NULL); -void gen404(stack *Stack) +void gen406(stack *Stack) { runnable * s=vm::pop<runnable *>(Stack,NULL); -#line 4192 "runtime.in" +#line 4352 "runtime.in" breakpoint(Stack,s); } -#line 4196 "runtime.in" +#line 4356 "runtime.in" // string locatefile(string file); -void gen405(stack *Stack) +void gen407(stack *Stack) { string file=vm::pop<string>(Stack); -#line 4197 "runtime.in" +#line 4357 "runtime.in" {Stack->push<string>(locateFile(file)); return;} } -#line 4201 "runtime.in" +#line 4361 "runtime.in" // void stop(string file, Int line, runnable *s=NULL); -void gen406(stack *Stack) +void gen408(stack *Stack) { runnable * s=vm::pop<runnable *>(Stack,NULL); Int line=vm::pop<Int>(Stack); string file=vm::pop<string>(Stack); -#line 4202 "runtime.in" +#line 4362 "runtime.in" file=locateFile(file); clear(file,line); cout << "setting breakpoint at " << file << ": " << line << endl; bplist.push_back(bpinfo(file,line,s)); } -#line 4209 "runtime.in" +#line 4369 "runtime.in" // void breakpoints(); -void gen407(stack *) +void gen409(stack *) { -#line 4210 "runtime.in" +#line 4370 "runtime.in" for(mem::list<bpinfo>::iterator p=bplist.begin(); p != bplist.end(); ++p) cout << p->f.name() << ": " << p->f.line() << endl; } -#line 4215 "runtime.in" +#line 4375 "runtime.in" // void clear(string file, Int line); -void gen408(stack *Stack) +void gen410(stack *Stack) { Int line=vm::pop<Int>(Stack); string file=vm::pop<string>(Stack); -#line 4216 "runtime.in" +#line 4376 "runtime.in" file=locateFile(file); clear(file,line,true); } -#line 4221 "runtime.in" +#line 4381 "runtime.in" // void clear(); -void gen409(stack *) +void gen411(stack *) { -#line 4222 "runtime.in" +#line 4382 "runtime.in" bplist.clear(); } // Strip directory from string -#line 4227 "runtime.in" +#line 4387 "runtime.in" // string stripdirectory(string *s); -void gen410(stack *Stack) +void gen412(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 4228 "runtime.in" +#line 4388 "runtime.in" {Stack->push<string>(stripDir(*s)); return;} } // Strip directory from string -#line 4233 "runtime.in" +#line 4393 "runtime.in" // string stripfile(string *s); -void gen411(stack *Stack) +void gen413(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 4234 "runtime.in" +#line 4394 "runtime.in" {Stack->push<string>(stripFile(*s)); return;} } // Strip file extension from string -#line 4239 "runtime.in" +#line 4399 "runtime.in" // string stripextension(string *s); -void gen412(stack *Stack) +void gen414(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 4240 "runtime.in" +#line 4400 "runtime.in" {Stack->push<string>(stripExt(*s)); return;} } // Call ImageMagick convert. -#line 4245 "runtime.in" +#line 4405 "runtime.in" // Int convert(string args=emptystring, string file=emptystring, string format=emptystring); -void gen413(stack *Stack) +void gen415(stack *Stack) { string format=vm::pop<string>(Stack,emptystring); string file=vm::pop<string>(Stack,emptystring); string args=vm::pop<string>(Stack,emptystring); -#line 4247 "runtime.in" +#line 4407 "runtime.in" ostringstream cmd; string name=convertname(file,format); @@ -6143,14 +6315,14 @@ void gen413(stack *Stack) } // Call ImageMagick animate. -#line 4263 "runtime.in" +#line 4423 "runtime.in" // Int animate(string args=emptystring, string file=emptystring, string format=emptystring); -void gen414(stack *Stack) +void gen416(stack *Stack) { string format=vm::pop<string>(Stack,emptystring); string file=vm::pop<string>(Stack,emptystring); string args=vm::pop<string>(Stack,emptystring); -#line 4265 "runtime.in" +#line 4425 "runtime.in" #ifndef __CYGWIN__ string name=convertname(file,format,false); if(view()) { @@ -6164,12 +6336,12 @@ void gen414(stack *Stack) } // Delete file named s. -#line 4279 "runtime.in" +#line 4439 "runtime.in" // Int delete(string *s); -void gen415(stack *Stack) +void gen417(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 4280 "runtime.in" +#line 4440 "runtime.in" checkLocal(*s); Int rc=unlink(s->c_str()); if(rc == 0 && verbose > 0) @@ -6178,13 +6350,13 @@ void gen415(stack *Stack) } // Rename file "from" to file "to". -#line 4289 "runtime.in" +#line 4449 "runtime.in" // Int rename(string *from, string *to); -void gen416(stack *Stack) +void gen418(stack *Stack) { string * to=vm::pop<string *>(Stack); string * from=vm::pop<string *>(Stack); -#line 4290 "runtime.in" +#line 4450 "runtime.in" checkLocal(*from); checkLocal(*to); Int rc=rename(from->c_str(),to->c_str()); @@ -6197,10 +6369,10 @@ void gen416(stack *Stack) // Array operations // Create an empty array. -#line 4303 "runtime.in" +#line 4463 "runtime.in" void emptyArray(stack *Stack) { -#line 4304 "runtime.in" +#line 4464 "runtime.in" {Stack->push<array*>(new array(0)); return;} } @@ -6209,11 +6381,11 @@ void emptyArray(stack *Stack) // is popped off the stack, followed by each dimension in reverse order. // The array itself is technically a one dimensional array of one // dimension arrays and so on. -#line 4313 "runtime.in" +#line 4473 "runtime.in" void newDeepArray(stack *Stack) { Int depth=vm::pop<Int>(Stack); -#line 4314 "runtime.in" +#line 4474 "runtime.in" assert(depth > 0); Int *dims = new Int[depth]; @@ -6232,11 +6404,11 @@ void newDeepArray(stack *Stack) // Creates an array with elements already specified. First, the number // of elements is popped off the stack, followed by each element in // reverse order. -#line 4333 "runtime.in" +#line 4493 "runtime.in" void newInitializedArray(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 4334 "runtime.in" +#line 4494 "runtime.in" assert(n >= 0); array *a = new array(n); @@ -6249,12 +6421,12 @@ void newInitializedArray(stack *Stack) // Similar to newInitializedArray, but after the n elements, append another // array to it. -#line 4347 "runtime.in" +#line 4507 "runtime.in" void newAppendedArray(stack *Stack) { Int n=vm::pop<Int>(Stack); array* tail=vm::pop<array*>(Stack); -#line 4348 "runtime.in" +#line 4508 "runtime.in" assert(n >= 0); array *a = new array(n); @@ -6269,13 +6441,13 @@ void newAppendedArray(stack *Stack) // The function T[] array(int n, T value, int depth=0) produces a array of n // copies of x, where each copy is copied up to depth. -#line 4363 "runtime.in" +#line 4523 "runtime.in" void newDuplicateArray(stack *Stack) { Int depth=vm::pop<Int>(Stack,Int_MAX); item value=vm::pop(Stack); Int n=vm::pop<Int>(Stack); -#line 4364 "runtime.in" +#line 4524 "runtime.in" if(n < 0) error("cannot create a negative length array"); if(depth < 0) error("cannot copy to a negative depth"); @@ -6283,12 +6455,12 @@ void newDuplicateArray(stack *Stack) } // Read an element from an array. Checks for initialization & bounds. -#line 4372 "runtime.in" +#line 4532 "runtime.in" void arrayRead(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 4373 "runtime.in" +#line 4533 "runtime.in" item& i=arrayRead(a,n); if (i.empty()) { ostringstream buf; @@ -6299,50 +6471,50 @@ void arrayRead(stack *Stack) } // Slice a substring from an array. -#line 4384 "runtime.in" +#line 4544 "runtime.in" void arraySliceRead(stack *Stack) { Int right=vm::pop<Int>(Stack); Int left=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 4385 "runtime.in" +#line 4545 "runtime.in" checkArray(a); {Stack->push(a->slice(left, right)); return;} } // Slice a substring from an array. This implements the cases a[i:] and a[:] // where the endpoint is not given, and assumed to be the length of the array. -#line 4392 "runtime.in" +#line 4552 "runtime.in" void arraySliceReadToEnd(stack *Stack) { Int left=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 4393 "runtime.in" +#line 4553 "runtime.in" size_t len=checkArray(a); {Stack->push(a->slice(left, (Int)len)); return;} } // Read an element from an array of arrays. Check bounds and initialize // as necessary. -#line 4400 "runtime.in" +#line 4560 "runtime.in" void arrayArrayRead(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 4401 "runtime.in" +#line 4561 "runtime.in" item& i=arrayRead(a,n); if (i.empty()) i=new array(0); {Stack->push(i); return;} } // Write an element to an array. Increase size if necessary. -#line 4408 "runtime.in" +#line 4568 "runtime.in" void arrayWrite(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); item value=vm::pop(Stack); -#line 4409 "runtime.in" +#line 4569 "runtime.in" size_t len=checkArray(a); bool cyclic=a->cyclic(); if(cyclic && len > 0) n=imod(n,len); @@ -6356,27 +6528,27 @@ void arrayWrite(stack *Stack) {Stack->push(value); return;} } -#line 4423 "runtime.in" +#line 4583 "runtime.in" void arraySliceWrite(stack *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 4424 "runtime.in" +#line 4584 "runtime.in" checkArray(src); checkArray(dest); dest->setSlice(left, right, src); {Stack->push<array*>(src); return;} } -#line 4431 "runtime.in" +#line 4591 "runtime.in" void arraySliceWriteToEnd(stack *Stack) { Int left=vm::pop<Int>(Stack); array * dest=vm::pop<array *>(Stack); array * src=vm::pop<array *>(Stack); -#line 4432 "runtime.in" +#line 4592 "runtime.in" checkArray(src); size_t len=checkArray(dest); dest->setSlice(left, (Int) len, src); @@ -6384,20 +6556,20 @@ void arraySliceWriteToEnd(stack *Stack) } // Returns the length of an array. -#line 4440 "runtime.in" +#line 4600 "runtime.in" void arrayLength(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4441 "runtime.in" +#line 4601 "runtime.in" {Stack->push<Int>((Int) checkArray(a)); return;} } // Returns an array of integers representing the keys of the array. -#line 4446 "runtime.in" +#line 4606 "runtime.in" void arrayKeys(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4447 "runtime.in" +#line 4607 "runtime.in" size_t size=checkArray(a); array *keys=new array(); @@ -6411,22 +6583,22 @@ void arrayKeys(stack *Stack) } // Return the cyclic flag for an array. -#line 4461 "runtime.in" +#line 4621 "runtime.in" void arrayCyclicFlag(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4462 "runtime.in" +#line 4622 "runtime.in" checkArray(a); {Stack->push<bool>(a->cyclic()); return;} } // Check to see if an array element is initialized. -#line 4468 "runtime.in" +#line 4628 "runtime.in" void arrayInitializedHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); Int n=vm::pop<Int>(Stack); -#line 4469 "runtime.in" +#line 4629 "runtime.in" size_t len=checkArray(a); bool cyclic=a->cyclic(); if(cyclic && len > 0) n=imod(n,len); @@ -6436,62 +6608,62 @@ void arrayInitializedHelper(stack *Stack) } // Returns the initialize method for an array. -#line 4479 "runtime.in" +#line 4639 "runtime.in" void arrayInitialized(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4480 "runtime.in" +#line 4640 "runtime.in" {Stack->push<callable*>(new thunk(new bfunc(arrayInitializedHelper),a)); return;} } // The helper function for the cyclic method that sets the cyclic flag. -#line 4485 "runtime.in" +#line 4645 "runtime.in" void arrayCyclicHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); bool b=vm::pop<bool>(Stack); -#line 4486 "runtime.in" +#line 4646 "runtime.in" checkArray(a); a->cyclic(b); } // Set the cyclic flag for an array. -#line 4492 "runtime.in" +#line 4652 "runtime.in" void arrayCyclic(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4493 "runtime.in" +#line 4653 "runtime.in" {Stack->push<callable*>(new thunk(new bfunc(arrayCyclicHelper),a)); return;} } // The helper function for the push method that does the actual operation. -#line 4498 "runtime.in" +#line 4658 "runtime.in" void arrayPushHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); item x=vm::pop(Stack); -#line 4499 "runtime.in" +#line 4659 "runtime.in" checkArray(a); a->push(x); {Stack->push(x); return;} } // Returns the push method for an array. -#line 4506 "runtime.in" +#line 4666 "runtime.in" void arrayPush(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4507 "runtime.in" +#line 4667 "runtime.in" {Stack->push<callable*>(new thunk(new bfunc(arrayPushHelper),a)); return;} } // The helper function for the append method that appends b to a. -#line 4512 "runtime.in" +#line 4672 "runtime.in" void arrayAppendHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); array * b=vm::pop<array *>(Stack); -#line 4513 "runtime.in" +#line 4673 "runtime.in" checkArray(a); size_t size=checkArray(b); for(size_t i=0; i < size; i++) @@ -6499,20 +6671,20 @@ void arrayAppendHelper(stack *Stack) } // Returns the append method for an array. -#line 4521 "runtime.in" +#line 4681 "runtime.in" void arrayAppend(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4522 "runtime.in" +#line 4682 "runtime.in" {Stack->push<callable*>(new thunk(new bfunc(arrayAppendHelper),a)); return;} } // The helper function for the pop method. -#line 4527 "runtime.in" +#line 4687 "runtime.in" void arrayPopHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4528 "runtime.in" +#line 4688 "runtime.in" size_t asize=checkArray(a); if(asize == 0) error("cannot pop element from empty array"); @@ -6520,22 +6692,22 @@ void arrayPopHelper(stack *Stack) } // Returns the pop method for an array. -#line 4536 "runtime.in" +#line 4696 "runtime.in" void arrayPop(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4537 "runtime.in" +#line 4697 "runtime.in" {Stack->push<callable*>(new thunk(new bfunc(arrayPopHelper),a)); return;} } // The helper function for the insert method. -#line 4542 "runtime.in" +#line 4702 "runtime.in" void arrayInsertHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); array * x=vm::pop<array *>(Stack); Int i=vm::pop<Int>(Stack); -#line 4543 "runtime.in" +#line 4703 "runtime.in" size_t asize=checkArray(a); checkArray(x); if(a->cyclic() && asize > 0) i=imod(i,asize); @@ -6545,39 +6717,39 @@ void arrayInsertHelper(stack *Stack) } // Returns the insert method for an array. -#line 4553 "runtime.in" +#line 4713 "runtime.in" void arrayInsert(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4554 "runtime.in" +#line 4714 "runtime.in" {Stack->push<callable*>(new thunk(new bfunc(arrayInsertHelper),a)); return;} } // Returns the delete method for an array. -#line 4559 "runtime.in" +#line 4719 "runtime.in" void arrayDelete(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4560 "runtime.in" +#line 4720 "runtime.in" {Stack->push<callable*>(new thunk(new bfunc(arrayDeleteHelper),a)); return;} } -#line 4564 "runtime.in" +#line 4724 "runtime.in" void arrayAlias(stack *Stack) { array * b=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 4565 "runtime.in" +#line 4725 "runtime.in" {Stack->push<bool>(a==b); return;} } // Return array formed by indexing array a with elements of integer array b -#line 4570 "runtime.in" +#line 4730 "runtime.in" void arrayIntArray(stack *Stack) { array * b=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 4571 "runtime.in" +#line 4731 "runtime.in" size_t asize=checkArray(a); size_t bsize=checkArray(b); array *r=new array(bsize); @@ -6595,13 +6767,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 4589 "runtime.in" +#line 4749 "runtime.in" // Intarray* complement(Intarray *a, Int n); -void gen447(stack *Stack) +void gen449(stack *Stack) { Int n=vm::pop<Int>(Stack); Intarray * a=vm::pop<Intarray *>(Stack); -#line 4590 "runtime.in" +#line 4750 "runtime.in" size_t asize=checkArray(a); array *r=new array(0); bool *keep=new bool[n]; @@ -6618,12 +6790,12 @@ void gen447(stack *Stack) } // Generate the sequence {f(i) : i=0,1,...n-1} given a function f and integer n -#line 4607 "runtime.in" +#line 4767 "runtime.in" void arraySequence(stack *Stack) { Int n=vm::pop<Int>(Stack); callable * f=vm::pop<callable *>(Stack); -#line 4608 "runtime.in" +#line 4768 "runtime.in" if(n < 0) n=0; array *a=new array(n); for(Int i=0; i < n; ++i) { @@ -6635,12 +6807,12 @@ void arraySequence(stack *Stack) } // Return the array {0,1,...n-1} -#line 4620 "runtime.in" +#line 4780 "runtime.in" // Intarray* sequence(Int n); -void gen449(stack *Stack) +void gen451(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 4621 "runtime.in" +#line 4781 "runtime.in" if(n < 0) n=0; array *a=new array(n); for(Int i=0; i < n; ++i) { @@ -6650,12 +6822,12 @@ void gen449(stack *Stack) } // Apply a function to each element of an array -#line 4631 "runtime.in" +#line 4791 "runtime.in" void arrayFunction(stack *Stack) { array * a=vm::pop<array *>(Stack); callable * f=vm::pop<callable *>(Stack); -#line 4632 "runtime.in" +#line 4792 "runtime.in" size_t size=checkArray(a); array *b=new array(size); for(size_t i=0; i < size; ++i) { @@ -6666,12 +6838,12 @@ void arrayFunction(stack *Stack) {Stack->push<array*>(b); return;} } -#line 4643 "runtime.in" +#line 4803 "runtime.in" void arraySort(stack *Stack) { callable * f=vm::pop<callable *>(Stack); array * a=vm::pop<array *>(Stack); -#line 4644 "runtime.in" +#line 4804 "runtime.in" array *c=copyArray(a); compareFunc=f; FuncStack=Stack; @@ -6679,12 +6851,12 @@ void arraySort(stack *Stack) {Stack->push<array*>(c); return;} } -#line 4652 "runtime.in" +#line 4812 "runtime.in" // bool all(boolarray *a); -void gen452(stack *Stack) +void gen454(stack *Stack) { boolarray * a=vm::pop<boolarray *>(Stack); -#line 4653 "runtime.in" +#line 4813 "runtime.in" size_t size=checkArray(a); bool c=true; for(size_t i=0; i < size; i++) @@ -6692,12 +6864,12 @@ void gen452(stack *Stack) {Stack->push<bool>(c); return;} } -#line 4661 "runtime.in" +#line 4821 "runtime.in" // boolarray* !(boolarray* a); -void gen453(stack *Stack) +void gen455(stack *Stack) { boolarray* a=vm::pop<boolarray*>(Stack); -#line 4662 "runtime.in" +#line 4822 "runtime.in" size_t size=checkArray(a); array *c=new array(size); for(size_t i=0; i < size; i++) @@ -6705,12 +6877,12 @@ void gen453(stack *Stack) {Stack->push<boolarray*>(c); return;} } -#line 4670 "runtime.in" +#line 4830 "runtime.in" // Int sum(boolarray *a); -void gen454(stack *Stack) +void gen456(stack *Stack) { boolarray * a=vm::pop<boolarray *>(Stack); -#line 4671 "runtime.in" +#line 4831 "runtime.in" size_t size=checkArray(a); Int sum=0; for(size_t i=0; i < size; i++) @@ -6718,19 +6890,19 @@ void gen454(stack *Stack) {Stack->push<Int>(sum); return;} } -#line 4679 "runtime.in" +#line 4839 "runtime.in" void arrayCopy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4680 "runtime.in" +#line 4840 "runtime.in" {Stack->push<array*>(copyArray(a)); return;} } -#line 4684 "runtime.in" +#line 4844 "runtime.in" void arrayConcat(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4685 "runtime.in" +#line 4845 "runtime.in" // a is an array of arrays to be concatenated together. // The signature is // T[] concat(... T[][] a); @@ -6757,27 +6929,27 @@ void arrayConcat(stack *Stack) {Stack->push<array*>(result); return;} } -#line 4712 "runtime.in" +#line 4872 "runtime.in" void array2Copy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4713 "runtime.in" +#line 4873 "runtime.in" {Stack->push<array*>(copyArray2(a)); return;} } -#line 4717 "runtime.in" +#line 4877 "runtime.in" void array3Copy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4718 "runtime.in" +#line 4878 "runtime.in" {Stack->push<array*>(copyArray3(a)); return;} } -#line 4722 "runtime.in" +#line 4882 "runtime.in" void array2Transpose(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 4723 "runtime.in" +#line 4883 "runtime.in" size_t asize=checkArray(a); array *c=new array(0); for(size_t i=0; i < asize; i++) { @@ -6804,12 +6976,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 4750 "runtime.in" +#line 4910 "runtime.in" void array3Transpose(stack *Stack) { array * perm=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 4751 "runtime.in" +#line 4911 "runtime.in" const size_t DIM=3; if(checkArray(perm) != DIM) { @@ -6893,13 +7065,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 4835 "runtime.in" +#line 4995 "runtime.in" // Int find(boolarray *a, Int n=1); -void gen461(stack *Stack) +void gen463(stack *Stack) { Int n=vm::pop<Int>(Stack,1); boolarray * a=vm::pop<boolarray *>(Stack); -#line 4836 "runtime.in" +#line 4996 "runtime.in" size_t size=checkArray(a); Int j=-1; @@ -6916,13 +7088,13 @@ void gen461(stack *Stack) {Stack->push<Int>(j); return;} } -#line 4853 "runtime.in" +#line 5013 "runtime.in" // bool ==(realarray2 *a, realarray2 *b); -void gen462(stack *Stack) +void gen464(stack *Stack) { realarray2 * b=vm::pop<realarray2 *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 4854 "runtime.in" +#line 5014 "runtime.in" size_t n=checkArray(a); if(n != checkArray(b)) {Stack->push<bool>(false); return;} @@ -6942,13 +7114,13 @@ void gen462(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 4874 "runtime.in" +#line 5034 "runtime.in" void arrayConditional(stack *Stack) { array * c=vm::pop<array *>(Stack); array * b=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 4875 "runtime.in" +#line 5035 "runtime.in" size_t size=checkArray(a); array *r=new array(size); if(b && c) { @@ -6972,21 +7144,21 @@ void arrayConditional(stack *Stack) } // Return an n x n identity matrix. -#line 4899 "runtime.in" +#line 5059 "runtime.in" // realarray2* identity(Int n); -void gen464(stack *Stack) +void gen466(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 4900 "runtime.in" +#line 5060 "runtime.in" {Stack->push<realarray2*>(Identity(n)); return;} } // Return the diagonal matrix with diagonal entries given by a. -#line 4905 "runtime.in" +#line 5065 "runtime.in" void diagonal(stack *Stack) { realarray * a=vm::pop<realarray *>(Stack); -#line 4906 "runtime.in" +#line 5066 "runtime.in" size_t n=checkArray(a); array *c=new array(n); for(size_t i=0; i < n; ++i) { @@ -7002,12 +7174,12 @@ void diagonal(stack *Stack) } // Return the inverse of an n x n matrix a using Gauss-Jordan elimination. -#line 4922 "runtime.in" +#line 5082 "runtime.in" // realarray2* inverse(realarray2 *a); -void gen466(stack *Stack) +void gen468(stack *Stack) { realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 4923 "runtime.in" +#line 5083 "runtime.in" a=copyArray2(a); size_t n=checkArray(a); checkSquare(a); @@ -7100,14 +7272,14 @@ void gen466(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 5016 "runtime.in" +#line 5176 "runtime.in" // realarray* solve(realarray2 *a, realarray *b, bool warn=true); -void gen467(stack *Stack) +void gen469(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); realarray * b=vm::pop<realarray *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 5017 "runtime.in" +#line 5177 "runtime.in" size_t n=checkArray(a); if(n == 0) {Stack->push<realarray*>(new array(0)); return;} @@ -7157,14 +7329,14 @@ void gen467(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 5067 "runtime.in" +#line 5227 "runtime.in" // realarray2* solve(realarray2 *a, realarray2 *b, bool warn=true); -void gen468(stack *Stack) +void gen470(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); realarray2 * b=vm::pop<realarray2 *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 5068 "runtime.in" +#line 5228 "runtime.in" size_t n=checkArray(a); if(n == 0) {Stack->push<realarray2*>(new array(0)); return;} @@ -7225,12 +7397,12 @@ void gen468(stack *Stack) } // Compute the determinant of an n x n matrix. -#line 5129 "runtime.in" +#line 5289 "runtime.in" // real determinant(realarray2 *a); -void gen469(stack *Stack) +void gen471(stack *Stack) { realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 5130 "runtime.in" +#line 5290 "runtime.in" real *A=copyArray2C(a); size_t n=checkArray(a); @@ -7244,13 +7416,13 @@ void gen469(stack *Stack) {Stack->push<real>(det); return;} } -#line 5144 "runtime.in" +#line 5304 "runtime.in" // realarray* *(realarray2 *a, realarray *b); -void gen470(stack *Stack) +void gen472(stack *Stack) { realarray * b=vm::pop<realarray *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 5145 "runtime.in" +#line 5305 "runtime.in" size_t n=checkArray(a); size_t m=checkArray(b); array *c=new array(n); @@ -7267,13 +7439,13 @@ void gen470(stack *Stack) {Stack->push<realarray*>(c); return;} } -#line 5162 "runtime.in" +#line 5322 "runtime.in" // realarray2* *(realarray2 *a, realarray2 *b); -void gen471(stack *Stack) +void gen473(stack *Stack) { realarray2 * b=vm::pop<realarray2 *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 5163 "runtime.in" +#line 5323 "runtime.in" size_t n=checkArray(a); size_t nb=checkArray(b); @@ -7307,23 +7479,23 @@ void gen471(stack *Stack) {Stack->push<realarray2*>(c); return;} } -#line 5197 "runtime.in" +#line 5357 "runtime.in" // triple *(realarray2 *t, triple v); -void gen472(stack *Stack) +void gen474(stack *Stack) { triple v=vm::pop<triple>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); -#line 5198 "runtime.in" +#line 5358 "runtime.in" {Stack->push<triple>(*t*v); return;} } -#line 5202 "runtime.in" +#line 5362 "runtime.in" // pair project(triple v, realarray2 *t); -void gen473(stack *Stack) +void gen475(stack *Stack) { realarray2 * t=vm::pop<realarray2 *>(Stack); triple v=vm::pop<triple>(Stack); -#line 5203 "runtime.in" +#line 5363 "runtime.in" size_t n=checkArray(t); if(n != 4) error(incommensurate); array *t0=read<array*>(t,0); @@ -7348,13 +7520,13 @@ void gen473(stack *Stack) } // Compute the dot product of vectors a and b. -#line 5228 "runtime.in" +#line 5388 "runtime.in" // real dot(realarray *a, realarray *b); -void gen474(stack *Stack) +void gen476(stack *Stack) { realarray * b=vm::pop<realarray *>(Stack); realarray * a=vm::pop<realarray *>(Stack); -#line 5229 "runtime.in" +#line 5389 "runtime.in" size_t n=checkArrays(a,b); real sum=0.0; for(size_t i=0; i < n; ++i) @@ -7369,15 +7541,15 @@ void gen474(stack *Stack) // [ a[2] b[2] c[2] ] // [ ... ] // [ c[n-1] a[n-1] b[n-1] ] -#line 5244 "runtime.in" +#line 5404 "runtime.in" // realarray* tridiagonal(realarray *a, realarray *b, realarray *c, realarray *f); -void gen475(stack *Stack) +void gen477(stack *Stack) { realarray * f=vm::pop<realarray *>(Stack); realarray * c=vm::pop<realarray *>(Stack); realarray * b=vm::pop<realarray *>(Stack); realarray * a=vm::pop<realarray *>(Stack); -#line 5245 "runtime.in" +#line 5405 "runtime.in" size_t n=checkArrays(a,b); checkEqual(n,checkArray(c)); checkEqual(n,checkArray(f)); @@ -7474,16 +7646,16 @@ void gen475(stack *Stack) } // Root solve by Newton-Raphson -#line 5342 "runtime.in" +#line 5502 "runtime.in" // real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x, bool verbose=false); -void gen476(stack *Stack) +void gen478(stack *Stack) { bool verbose=vm::pop<bool>(Stack,false); real x=vm::pop<real>(Stack); callableReal * fprime=vm::pop<callableReal *>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); Int iterations=vm::pop<Int>(Stack,100); -#line 5344 "runtime.in" +#line 5504 "runtime.in" static const real fuzz=1000.0*DBL_EPSILON; Int i=0; size_t oldPrec=0; @@ -7529,9 +7701,9 @@ void gen476(stack *Stack) // Root solve by Newton-Raphson bisection // cf. routine rtsafe (Press et al., Numerical Recipes, 1991). -#line 5390 "runtime.in" +#line 5550 "runtime.in" // real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x1, real x2, bool verbose=false); -void gen477(stack *Stack) +void gen479(stack *Stack) { bool verbose=vm::pop<bool>(Stack,false); real x2=vm::pop<real>(Stack); @@ -7539,7 +7711,7 @@ void gen477(stack *Stack) callableReal * fprime=vm::pop<callableReal *>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); Int iterations=vm::pop<Int>(Stack,100); -#line 5392 "runtime.in" +#line 5552 "runtime.in" static const real fuzz=1000.0*DBL_EPSILON; size_t oldPrec=0; if(verbose) @@ -7617,16 +7789,16 @@ void gen477(stack *Stack) {Stack->push<real>((j == iterations) ? DBL_MAX : x); return;} } -#line 5470 "runtime.in" +#line 5630 "runtime.in" // real simpson(callableReal *f, real a, real b, real acc=DBL_EPSILON, real dxmax=0); -void gen478(stack *Stack) +void gen480(stack *Stack) { real dxmax=vm::pop<real>(Stack,0); real acc=vm::pop<real>(Stack,DBL_EPSILON); real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); -#line 5472 "runtime.in" +#line 5632 "runtime.in" real integral; if(dxmax == 0) dxmax=b-a; Func=f; @@ -7637,12 +7809,12 @@ void gen478(stack *Stack) } // Compute the fast Fourier transform of a pair array -#line 5483 "runtime.in" +#line 5643 "runtime.in" void pairArrayFFT(stack *Stack) { Int sign=vm::pop<Int>(Stack,1); pairarray * a=vm::pop<pairarray *>(Stack); -#line 5484 "runtime.in" +#line 5644 "runtime.in" unsigned n=(unsigned) checkArray(a); #ifdef HAVE_LIBFFTW3 array *c=new array(n); @@ -7670,12 +7842,12 @@ void pairArrayFFT(stack *Stack) {Stack->push<pairarray*>(c); return;} } -#line 5512 "runtime.in" +#line 5672 "runtime.in" // Intarray2* triangulate(pairarray *z); -void gen480(stack *Stack) +void gen482(stack *Stack) { pairarray * z=vm::pop<pairarray *>(Stack); -#line 5513 "runtime.in" +#line 5673 "runtime.in" size_t nv=checkArray(z); // Call robust version of Gilles Dumoulin's port of Paul Bourke's // triangulation code. @@ -7711,55 +7883,55 @@ void gen480(stack *Stack) // File operations -#line 5549 "runtime.in" +#line 5709 "runtime.in" // bool ==(file *a, file *b); -void gen481(stack *Stack) +void gen483(stack *Stack) { file * b=vm::pop<file *>(Stack); file * a=vm::pop<file *>(Stack); -#line 5550 "runtime.in" +#line 5710 "runtime.in" {Stack->push<bool>(a == b); return;} } -#line 5555 "runtime.in" +#line 5715 "runtime.in" // bool !=(file *a, file *b); -void gen482(stack *Stack) +void gen484(stack *Stack) { file * b=vm::pop<file *>(Stack); file * a=vm::pop<file *>(Stack); -#line 5556 "runtime.in" +#line 5716 "runtime.in" {Stack->push<bool>(a != b); return;} } -#line 5560 "runtime.in" +#line 5720 "runtime.in" void nullFile(stack *Stack) { -#line 5561 "runtime.in" +#line 5721 "runtime.in" {Stack->push<file*>(&camp::nullfile); return;} } -#line 5565 "runtime.in" +#line 5725 "runtime.in" // file* input(string name, bool check=true, string comment=commentchar); -void gen484(stack *Stack) +void gen486(stack *Stack) { string comment=vm::pop<string>(Stack,commentchar); bool check=vm::pop<bool>(Stack,true); string name=vm::pop<string>(Stack); -#line 5566 "runtime.in" +#line 5726 "runtime.in" char c=comment.empty() ? (char) 0 : comment[0]; file *f=new ifile(name,c,check); f->open(); {Stack->push<file*>(f); return;} } -#line 5573 "runtime.in" +#line 5733 "runtime.in" // file* output(string name, bool update=false, string comment=commentchar); -void gen485(stack *Stack) +void gen487(stack *Stack) { string comment=vm::pop<string>(Stack,commentchar); bool update=vm::pop<bool>(Stack,false); string name=vm::pop<string>(Stack); -#line 5574 "runtime.in" +#line 5734 "runtime.in" file *f; if(update) { char c=comment.empty() ? (char) 0 : comment[0]; @@ -7770,13 +7942,13 @@ void gen485(stack *Stack) {Stack->push<file*>(f); return;} } -#line 5585 "runtime.in" +#line 5745 "runtime.in" // file* xinput(string name, bool check=true); -void gen486(stack *Stack) +void gen488(stack *Stack) { bool check=vm::pop<bool>(Stack,true); string name=vm::pop<string>(Stack); -#line 5586 "runtime.in" +#line 5746 "runtime.in" #ifdef HAVE_RPC_RPC_H file *f=new ixfile(name,check); f->open(); @@ -7789,13 +7961,13 @@ void gen486(stack *Stack) #endif } -#line 5599 "runtime.in" +#line 5759 "runtime.in" // file* xoutput(string name, bool update=false); -void gen487(stack *Stack) +void gen489(stack *Stack) { bool update=vm::pop<bool>(Stack,false); string name=vm::pop<string>(Stack); -#line 5600 "runtime.in" +#line 5760 "runtime.in" #ifdef HAVE_RPC_RPC_H file *f; if(update) @@ -7812,25 +7984,25 @@ void gen487(stack *Stack) #endif } -#line 5617 "runtime.in" +#line 5777 "runtime.in" // file* binput(string name, bool check=true); -void gen488(stack *Stack) +void gen490(stack *Stack) { bool check=vm::pop<bool>(Stack,true); string name=vm::pop<string>(Stack); -#line 5618 "runtime.in" +#line 5778 "runtime.in" file *f=new ibfile(name,check); f->open(); {Stack->push<file*>(f); return;} } -#line 5624 "runtime.in" +#line 5784 "runtime.in" // file* boutput(string name, bool update=false); -void gen489(stack *Stack) +void gen491(stack *Stack) { bool update=vm::pop<bool>(Stack,false); string name=vm::pop<string>(Stack); -#line 5625 "runtime.in" +#line 5785 "runtime.in" file *f; if(update) f=new iobfile(name); else f=new obfile(name); @@ -7839,77 +8011,77 @@ void gen489(stack *Stack) {Stack->push<file*>(f); return;} } -#line 5634 "runtime.in" +#line 5794 "runtime.in" // bool eof(file *File); -void gen490(stack *Stack) +void gen492(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5635 "runtime.in" +#line 5795 "runtime.in" {Stack->push<bool>(File->eof()); return;} } -#line 5639 "runtime.in" +#line 5799 "runtime.in" // bool eol(file *File); -void gen491(stack *Stack) +void gen493(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5640 "runtime.in" +#line 5800 "runtime.in" {Stack->push<bool>(File->eol()); return;} } -#line 5644 "runtime.in" +#line 5804 "runtime.in" // bool error(file *File); -void gen492(stack *Stack) +void gen494(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5645 "runtime.in" +#line 5805 "runtime.in" {Stack->push<bool>(File->error()); return;} } -#line 5649 "runtime.in" +#line 5809 "runtime.in" // void clear(file *File); -void gen493(stack *Stack) +void gen495(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5650 "runtime.in" +#line 5810 "runtime.in" File->clear(); } -#line 5654 "runtime.in" +#line 5814 "runtime.in" // void close(file *File); -void gen494(stack *Stack) +void gen496(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5655 "runtime.in" +#line 5815 "runtime.in" File->close(); } -#line 5659 "runtime.in" +#line 5819 "runtime.in" // Int precision(file *File=NULL, Int digits=0); -void gen495(stack *Stack) +void gen497(stack *Stack) { Int digits=vm::pop<Int>(Stack,0); file * File=vm::pop<file *>(Stack,NULL); -#line 5660 "runtime.in" +#line 5820 "runtime.in" if(File == 0) File=&camp::Stdout; {Stack->push<Int>(File->precision(digits)); return;} } -#line 5665 "runtime.in" +#line 5825 "runtime.in" // void flush(file *File); -void gen496(stack *Stack) +void gen498(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5666 "runtime.in" +#line 5826 "runtime.in" File->flush(); } -#line 5670 "runtime.in" +#line 5830 "runtime.in" // string getc(file *File); -void gen497(stack *Stack) +void gen499(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5671 "runtime.in" +#line 5831 "runtime.in" char c=0; if(File->isOpen()) File->read(c); static char str[1]; @@ -7917,189 +8089,189 @@ void gen497(stack *Stack) {Stack->push<string>(string(str)); return;} } -#line 5679 "runtime.in" +#line 5839 "runtime.in" // Int tell(file *File); -void gen498(stack *Stack) +void gen500(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5680 "runtime.in" +#line 5840 "runtime.in" {Stack->push<Int>(File->tell()); return;} } -#line 5684 "runtime.in" +#line 5844 "runtime.in" // void seek(file *File, Int pos); -void gen499(stack *Stack) +void gen501(stack *Stack) { Int pos=vm::pop<Int>(Stack); file * File=vm::pop<file *>(Stack); -#line 5685 "runtime.in" +#line 5845 "runtime.in" File->seek(pos,pos >= 0); } -#line 5689 "runtime.in" +#line 5849 "runtime.in" // void seekeof(file *File); -void gen500(stack *Stack) +void gen502(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5690 "runtime.in" +#line 5850 "runtime.in" File->seek(0,false); } // Set file dimensions -#line 5695 "runtime.in" +#line 5855 "runtime.in" // file* dimension(file *File, Int nx); -void gen501(stack *Stack) +void gen503(stack *Stack) { Int nx=vm::pop<Int>(Stack); file * File=vm::pop<file *>(Stack); -#line 5696 "runtime.in" +#line 5856 "runtime.in" File->dimension(nx); {Stack->push<file*>(File); return;} } -#line 5701 "runtime.in" +#line 5861 "runtime.in" // file* dimension(file *File, Int nx, Int ny); -void gen502(stack *Stack) +void gen504(stack *Stack) { Int ny=vm::pop<Int>(Stack); Int nx=vm::pop<Int>(Stack); file * File=vm::pop<file *>(Stack); -#line 5702 "runtime.in" +#line 5862 "runtime.in" File->dimension(nx,ny); {Stack->push<file*>(File); return;} } -#line 5707 "runtime.in" +#line 5867 "runtime.in" // file* dimension(file *File, Int nx, Int ny, Int nz); -void gen503(stack *Stack) +void gen505(stack *Stack) { Int nz=vm::pop<Int>(Stack); Int ny=vm::pop<Int>(Stack); Int nx=vm::pop<Int>(Stack); file * File=vm::pop<file *>(Stack); -#line 5708 "runtime.in" +#line 5868 "runtime.in" File->dimension(nx,ny,nz); {Stack->push<file*>(File); return;} } // Set file to read comma-separated values -#line 5714 "runtime.in" +#line 5874 "runtime.in" // file* csv(file *File, bool b=true); -void gen504(stack *Stack) +void gen506(stack *Stack) { bool b=vm::pop<bool>(Stack,true); file * File=vm::pop<file *>(Stack); -#line 5715 "runtime.in" +#line 5875 "runtime.in" File->CSVMode(b); {Stack->push<file*>(File); return;} } // Set file to read whitespace-separated values -#line 5721 "runtime.in" +#line 5881 "runtime.in" // file* word(file *File, bool b=true); -void gen505(stack *Stack) +void gen507(stack *Stack) { bool b=vm::pop<bool>(Stack,true); file * File=vm::pop<file *>(Stack); -#line 5722 "runtime.in" +#line 5882 "runtime.in" File->WordMode(b); {Stack->push<file*>(File); return;} } // Set file to read arrays in line-at-a-time mode -#line 5728 "runtime.in" +#line 5888 "runtime.in" // file* line(file *File, bool b=true); -void gen506(stack *Stack) +void gen508(stack *Stack) { bool b=vm::pop<bool>(Stack,true); file * File=vm::pop<file *>(Stack); -#line 5729 "runtime.in" +#line 5889 "runtime.in" File->LineMode(b); {Stack->push<file*>(File); return;} } // Set file to read/write single-precision XDR values. -#line 5735 "runtime.in" +#line 5895 "runtime.in" // file* single(file *File, bool b=true); -void gen507(stack *Stack) +void gen509(stack *Stack) { bool b=vm::pop<bool>(Stack,true); file * File=vm::pop<file *>(Stack); -#line 5736 "runtime.in" +#line 5896 "runtime.in" File->SingleReal(b); File->SingleInt(b); {Stack->push<file*>(File); return;} } // Set file to read/write single-precision real XDR values. -#line 5743 "runtime.in" +#line 5903 "runtime.in" // file* single(file *File, real x, bool b=true); -void gen508(stack *Stack) +void gen510(stack *Stack) { bool b=vm::pop<bool>(Stack,true); real x=vm::pop<real>(Stack); file * File=vm::pop<file *>(Stack); -#line 5744 "runtime.in" +#line 5904 "runtime.in" File->SingleReal(b); unused(&x); {Stack->push<file*>(File); return;} } // Set file to read/write single-precision int XDR values. -#line 5751 "runtime.in" +#line 5911 "runtime.in" // file* single(file *File, Int x, bool b=true); -void gen509(stack *Stack) +void gen511(stack *Stack) { bool b=vm::pop<bool>(Stack,true); Int x=vm::pop<Int>(Stack); file * File=vm::pop<file *>(Stack); -#line 5752 "runtime.in" +#line 5912 "runtime.in" File->SingleInt(b); unused(&x); {Stack->push<file*>(File); return;} } // Set file to read an array1 (1 Int size followed by a 1d array) -#line 5759 "runtime.in" +#line 5919 "runtime.in" // file* read1(file *File); -void gen510(stack *Stack) +void gen512(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5760 "runtime.in" +#line 5920 "runtime.in" File->dimension(-2); {Stack->push<file*>(File); return;} } // Set file to read an array2 (2 Int sizes followed by a 2d array) -#line 5766 "runtime.in" +#line 5926 "runtime.in" // file* read2(file *File); -void gen511(stack *Stack) +void gen513(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5767 "runtime.in" +#line 5927 "runtime.in" File->dimension(-2,-2); {Stack->push<file*>(File); return;} } // Set file to read an array3 (3 Int sizes followed by a 3d array) -#line 5773 "runtime.in" +#line 5933 "runtime.in" // file* read3(file *File); -void gen512(stack *Stack) +void gen514(stack *Stack) { file * File=vm::pop<file *>(Stack); -#line 5774 "runtime.in" +#line 5934 "runtime.in" File->dimension(-2,-2,-2); {Stack->push<file*>(File); return;} } // Return the last n lines of the history named name. -#line 5780 "runtime.in" +#line 5940 "runtime.in" // stringarray* history(string name, Int n=1); -void gen513(stack *Stack) +void gen515(stack *Stack) { Int n=vm::pop<Int>(Stack,1); string name=vm::pop<string>(Stack); -#line 5781 "runtime.in" +#line 5941 "runtime.in" #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) bool newhistory=historyMap.find(name) == historyMap.end(); @@ -8131,12 +8303,12 @@ void gen513(stack *Stack) } // Return the last n lines of the interactive history. -#line 5813 "runtime.in" +#line 5973 "runtime.in" // stringarray* history(Int n=0); -void gen514(stack *Stack) +void gen516(stack *Stack) { Int n=vm::pop<Int>(Stack,0); -#line 5814 "runtime.in" +#line 5974 "runtime.in" #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) {Stack->push<stringarray*>(get_history(n)); return;} #else @@ -8147,14 +8319,14 @@ void gen514(stack *Stack) // Prompt for a string using prompt, the GNU readline library, and a // local history named name. -#line 5825 "runtime.in" +#line 5985 "runtime.in" // string readline(string prompt=emptystring, string name=emptystring, bool tabcompletion=false); -void gen515(stack *Stack) +void gen517(stack *Stack) { bool tabcompletion=vm::pop<bool>(Stack,false); string name=vm::pop<string>(Stack,emptystring); string prompt=vm::pop<string>(Stack,emptystring); -#line 5827 "runtime.in" +#line 5987 "runtime.in" if(!isatty(STDIN_FILENO)) {Stack->push<string>(emptystring); return;} #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) @@ -8196,14 +8368,14 @@ void gen515(stack *Stack) // Save a string in a local history named name. // If store=true, store the local history in the file historyfilename(name). -#line 5869 "runtime.in" +#line 6029 "runtime.in" // void saveline(string name, string value, bool store=true); -void gen516(stack *Stack) +void gen518(stack *Stack) { bool store=vm::pop<bool>(Stack,true); string value=vm::pop<string>(Stack); string name=vm::pop<string>(Stack); -#line 5870 "runtime.in" +#line 6030 "runtime.in" #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) store_history(&history_save); bool newhistory=historyMap.find(name) == historyMap.end(); @@ -8230,11 +8402,11 @@ void gen516(stack *Stack) #endif } -#line 5897 "runtime.in" +#line 6057 "runtime.in" // void generate_random_backtrace(); -void gen517(stack *) +void gen519(stack *) { -#line 5898 "runtime.in" +#line 6058 "runtime.in" #if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE) GC_generate_random_backtrace(); #else @@ -8242,12 +8414,12 @@ void gen517(stack *) #endif } -#line 5906 "runtime.in" +#line 6066 "runtime.in" // void print_random_addresses(Int n=1); -void gen518(stack *Stack) +void gen520(stack *Stack) { Int n=vm::pop<Int>(Stack,1); -#line 5907 "runtime.in" +#line 6067 "runtime.in" #if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE) GC_gcollect(); for (Int i=0; i < n; ++i) @@ -8264,874 +8436,878 @@ namespace trans { void gen_base_venv(venv &ve) { -#line 1093 "runtime.in" +#line 1167 "runtime.in" addFunc(ve, run::gen8, primBoolean(), "!", formal(primBoolean(), "b", false, false)); -#line 1121 "runtime.in" +#line 1195 "runtime.in" addFunc(ve, run::gen13, primInt(), "AND", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false)); -#line 1129 "runtime.in" +#line 1203 "runtime.in" addFunc(ve, run::gen14, primInt(), "OR", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false)); -#line 1134 "runtime.in" +#line 1208 "runtime.in" addFunc(ve, run::gen15, primInt(), "XOR", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false)); -#line 1139 "runtime.in" +#line 1213 "runtime.in" addFunc(ve, run::gen16, primInt(), "NOT", formal(primInt(), "a", false, false)); -#line 1170 "runtime.in" +#line 1244 "runtime.in" addFunc(ve, run::gen21, primBoolean(), "empty", formal(primPicture(), "f", false, false)); -#line 1175 "runtime.in" +#line 1249 "runtime.in" addFunc(ve, run::gen22, primVoid(), "erase", formal(primPicture(), "f", false, false)); -#line 1180 "runtime.in" +#line 1254 "runtime.in" addFunc(ve, run::gen23, primPair(), "min", formal(primPicture(), "f", false, false)); -#line 1185 "runtime.in" +#line 1259 "runtime.in" addFunc(ve, run::gen24, primPair(), "max", formal(primPicture(), "f", false, false)); -#line 1190 "runtime.in" +#line 1264 "runtime.in" addFunc(ve, run::gen25, primVoid(), "label", formal(primPicture(), "f", false, false), formal(primString(), "s", false, false), formal(primString(), "size", false, false), formal(primTransform(), "t", false, false), formal(primPair(), "position", false, false), formal(primPair(), "align", false, false), formal(primPen(), "p", false, false)); -#line 1196 "runtime.in" +#line 1270 "runtime.in" addFunc(ve, run::gen26, primBoolean(), "labels", formal(primPicture(), "f", false, false)); -#line 1201 "runtime.in" +#line 1275 "runtime.in" addFunc(ve, run::gen27, pathArray() , "_texpath", formal(primString(), "s", false, false), formal(primPen(), "p", true, false)); -#line 1268 "runtime.in" +#line 1390 "runtime.in" addFunc(ve, run::gen28, pathArray() , "textpath", formal(primString(), "s", false, false), formal(primPen(), "p", true, false)); -#line 1343 "runtime.in" +#line 1462 "runtime.in" addFunc(ve, run::gen29, pathArray() , "_strokepath", formal(primPath(), "g", false, false), formal(primPen(), "p", true, false)); -#line 1367 "runtime.in" +#line 1486 "runtime.in" addFunc(ve, run::gen30, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath(), "g", false, false), formal(primPen(), "p", false, false)); -#line 1372 "runtime.in" +#line 1491 "runtime.in" addFunc(ve, run::gen31, primVoid(), "fill", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primPen(), "p", true, false), formal(primBoolean(), "copy", true, false)); -#line 1378 "runtime.in" +#line 1497 "runtime.in" addFunc(ve, run::gen32, primVoid(), "latticeshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray2() , "p", false, false), formal(primBoolean(), "copy", true, false)); -#line 1385 "runtime.in" +#line 1504 "runtime.in" addFunc(ve, run::gen33, primVoid(), "axialshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "pena", false, false), formal(primPair(), "a", false, false), formal(primPen(), "penb", false, false), formal(primPair(), "b", false, false), formal(primBoolean(), "copy", true, false)); -#line 1392 "runtime.in" +#line 1511 "runtime.in" addFunc(ve, run::gen34, primVoid(), "radialshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "pena", false, false), formal(primPair(), "a", false, false), formal(primReal(), "ra", false, false), formal(primPen(), "penb", false, false), formal(primPair(), "b", false, false), formal(primReal(), "rb", false, false), formal(primBoolean(), "copy", true, false)); -#line 1399 "runtime.in" +#line 1518 "runtime.in" addFunc(ve, run::gen35, primVoid(), "gouraudshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray() , "p", false, false), formal(pairArray(), "z", false, false), formal(IntArray(), "edges", false, false), formal(primBoolean(), "copy", true, false)); -#line 1410 "runtime.in" +#line 1529 "runtime.in" addFunc(ve, run::gen36, primVoid(), "gouraudshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray() , "p", false, false), formal(IntArray(), "edges", false, false), formal(primBoolean(), "copy", true, false)); -#line 1434 "runtime.in" +#line 1553 "runtime.in" addFunc(ve, run::gen37, primVoid(), "tensorshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray2() , "p", false, false), formal(pathArray() , "b", true, false), formal(pairArray2(), "z", true, false), formal(primBoolean(), "copy", true, false)); -#line 1449 "runtime.in" +#line 1568 "runtime.in" addFunc(ve, run::gen38, primVoid(), "functionshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(primString() , "shader", true, false), formal(primBoolean(), "copy", true, false)); -#line 1457 "runtime.in" +#line 1576 "runtime.in" addFunc(ve, run::gen39, primVoid(), "clip", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(primBoolean(), "copy", true, false)); -#line 1467 "runtime.in" +#line 1586 "runtime.in" addFunc(ve, run::gen40, primVoid(), "beginclip", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(primBoolean(), "copy", true, false)); -#line 1474 "runtime.in" +#line 1593 "runtime.in" addFunc(ve, run::gen41, primVoid(), "endclip", formal(primPicture(), "f", false, false)); -#line 1479 "runtime.in" +#line 1598 "runtime.in" addFunc(ve, run::gen42, primVoid(), "gsave", formal(primPicture(), "f", false, false)); -#line 1484 "runtime.in" +#line 1603 "runtime.in" addFunc(ve, run::gen43, primVoid(), "grestore", formal(primPicture(), "f", false, false)); -#line 1489 "runtime.in" +#line 1608 "runtime.in" addFunc(ve, run::gen44, primVoid(), "begingroup", formal(primPicture(), "f", false, false)); -#line 1494 "runtime.in" +#line 1613 "runtime.in" addFunc(ve, run::gen45, primVoid(), "endgroup", formal(primPicture(), "f", false, false)); -#line 1499 "runtime.in" +#line 1618 "runtime.in" addFunc(ve, run::gen46, primVoid(), "add", formal(primPicture(), "dest", false, false), formal(primPicture(), "src", false, false)); -#line 1504 "runtime.in" +#line 1623 "runtime.in" addFunc(ve, run::gen47, primVoid(), "prepend", formal(primPicture(), "dest", false, false), formal(primPicture(), "src", false, false)); -#line 1509 "runtime.in" +#line 1628 "runtime.in" addFunc(ve, run::gen48, primVoid(), "postscript", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false)); -#line 1514 "runtime.in" +#line 1633 "runtime.in" addFunc(ve, run::gen49, primVoid(), "tex", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false)); -#line 1519 "runtime.in" +#line 1638 "runtime.in" addFunc(ve, run::gen50, primVoid(), "postscript", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primPair(), "min", false, false), formal(primPair(), "max", false, false)); -#line 1524 "runtime.in" +#line 1643 "runtime.in" addFunc(ve, run::gen51, primVoid(), "tex", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primPair(), "min", false, false), formal(primPair(), "max", false, false)); -#line 1529 "runtime.in" +#line 1648 "runtime.in" addFunc(ve, run::gen52, primVoid(), "texpreamble", formal(primString() , "s", false, false)); -#line 1537 "runtime.in" +#line 1656 "runtime.in" addFunc(ve, run::gen53, primVoid(), "deletepreamble"); -#line 1544 "runtime.in" +#line 1663 "runtime.in" addFunc(ve, run::gen54, primVoid(), "_labelpath", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primString() , "size", false, false), formal(primPath(), "g", false, false), formal(primString() , "justify", false, false), formal(primPair(), "offset", false, false), formal(primPen(), "p", false, false)); -#line 1550 "runtime.in" +#line 1669 "runtime.in" addFunc(ve, run::gen55, primVoid(), "texreset"); -#line 1558 "runtime.in" +#line 1677 "runtime.in" addFunc(ve, run::gen56, primVoid(), "layer", formal(primPicture(), "f", false, false)); -#line 1563 "runtime.in" +#line 1682 "runtime.in" addFunc(ve, run::gen57, primVoid(), "newpage", formal(primPicture(), "f", false, false)); -#line 1568 "runtime.in" +#line 1687 "runtime.in" addFunc(ve, run::gen58, primVoid(), "_image", formal(primPicture(), "f", false, false), formal(realArray2(), "data", false, false), formal(primPair(), "initial", false, false), formal(primPair(), "final", false, false), formal(penArray() , "palette", true, false), formal(primTransform(), "t", true, false), formal(primBoolean(), "copy", true, false), formal(primBoolean(), "antialias", true, false)); -#line 1578 "runtime.in" +#line 1697 "runtime.in" addFunc(ve, run::gen59, primVoid(), "_image", formal(primPicture(), "f", false, false), formal(penArray2() , "data", false, false), formal(primPair(), "initial", false, false), formal(primPair(), "final", false, false), formal(primTransform(), "t", true, false), formal(primBoolean(), "copy", true, false), formal(primBoolean(), "antialias", true, false)); -#line 1585 "runtime.in" +#line 1704 "runtime.in" addFunc(ve, run::gen60, primString() , "nativeformat"); -#line 1590 "runtime.in" +#line 1709 "runtime.in" addFunc(ve, run::gen61, primBoolean(), "latex"); -#line 1595 "runtime.in" +#line 1714 "runtime.in" addFunc(ve, run::gen62, primBoolean(), "pdf"); -#line 1600 "runtime.in" +#line 1719 "runtime.in" addFunc(ve, run::gen63, primVoid(), "shipout", formal(primString() , "prefix", true, false), formal(primPicture(), "f", false, false), formal(primPicture(), "preamble", true, false), formal(primString() , "format", true, false), formal(primBoolean(), "wait", true, false), formal(primBoolean(), "view", true, false), formal(transformFunction(), "xform", false, false)); -#line 1646 "runtime.in" +#line 1765 "runtime.in" addFunc(ve, run::gen64, primVoid(), "shipout3", formal(primString() , "prefix", false, false), formal(primPicture(), "f", false, false), formal(primString() , "format", true, false), formal(primReal(), "width", false, false), formal(primReal(), "height", false, false), formal(primReal(), "angle", false, false), formal(primTriple(), "m", false, false), formal(primTriple(), "m", false, false), formal(realArray2(), "t", false, false), formal(realArray(), "background", false, false), formal(tripleArray(), "lights", false, false), formal(realArray2(), "diffuse", false, false), formal(realArray2(), "ambient", false, false), formal(realArray2(), "specular", false, false), formal(primBoolean(), "viewportlighting", false, false), formal(primBoolean(), "view", true, false)); -#line 1662 "runtime.in" +#line 1781 "runtime.in" addFunc(ve, run::gen65, primVoid(), "shipout3", formal(primString() , "prefix", false, false), formal(primPicture(), "f", false, false)); -#line 1667 "runtime.in" +#line 1786 "runtime.in" addFunc(ve, run::gen66, primVoid(), "deconstruct", formal(primPicture(), "f", false, false), formal(primPicture(), "preamble", true, false), formal(primReal(), "magnification", true, false), formal(transformFunction(), "xform", false, false)); -#line 1800 "runtime.in" +#line 1919 "runtime.in" addFunc(ve, run::gen67, primVoid(), "purge", formal(primInt(), "divisor", true, false)); -#line 1813 "runtime.in" +#line 1932 "runtime.in" addFunc(ve, run::gen69, primBoolean(), "==", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false)); -#line 1818 "runtime.in" +#line 1937 "runtime.in" addFunc(ve, run::gen70, primBoolean(), "!=", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false)); -#line 1823 "runtime.in" +#line 1942 "runtime.in" addFunc(ve, run::gen71, primPen(), "+", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false)); -#line 1828 "runtime.in" +#line 1947 "runtime.in" addFunc(ve, run::gen72, primPen(), "*", formal(primReal(), "a", false, false), formal(primPen(), "b", false, false)); -#line 1833 "runtime.in" +#line 1952 "runtime.in" addFunc(ve, run::gen73, primPen(), "*", formal(primPen(), "a", false, false), formal(primReal(), "b", false, false)); -#line 1838 "runtime.in" +#line 1957 "runtime.in" addFunc(ve, run::gen74, primPair(), "max", formal(primPen(), "p", false, false)); -#line 1843 "runtime.in" +#line 1962 "runtime.in" addFunc(ve, run::gen75, primPair(), "min", formal(primPen(), "p", false, false)); -#line 1848 "runtime.in" +#line 1967 "runtime.in" addFunc(ve, run::gen76, primVoid(), "resetdefaultpen"); -#line 1854 "runtime.in" +#line 1973 "runtime.in" addFunc(ve, run::gen77, primVoid(), "defaultpen", formal(primPen(), "p", false, false)); -#line 1859 "runtime.in" +#line 1978 "runtime.in" addFunc(ve, run::gen78, primPen(), "defaultpen"); -#line 1864 "runtime.in" +#line 1983 "runtime.in" addFunc(ve, run::gen79, primBoolean(), "invisible", formal(primPen(), "p", false, false)); -#line 1869 "runtime.in" +#line 1988 "runtime.in" addFunc(ve, run::gen80, primPen(), "invisible"); -#line 1874 "runtime.in" +#line 1993 "runtime.in" addFunc(ve, run::gen81, primPen(), "gray", formal(primPen(), "p", false, false)); -#line 1880 "runtime.in" +#line 1999 "runtime.in" addFunc(ve, run::gen82, primPen(), "rgb", formal(primPen(), "p", false, false)); -#line 1886 "runtime.in" +#line 2005 "runtime.in" addFunc(ve, run::gen83, primPen(), "cmyk", formal(primPen(), "p", false, false)); -#line 1892 "runtime.in" +#line 2011 "runtime.in" addFunc(ve, run::gen84, primPen(), "interp", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false), formal(primReal(), "t", false, false)); -#line 1897 "runtime.in" +#line 2016 "runtime.in" addFunc(ve, run::gen85, primPen(), "rgb", formal(primReal(), "r", false, false), formal(primReal(), "g", false, false), formal(primReal(), "b", false, false)); -#line 1902 "runtime.in" +#line 2021 "runtime.in" addFunc(ve, run::gen86, primPen(), "cmyk", formal(primReal(), "c", false, false), formal(primReal(), "m", false, false), formal(primReal(), "y", false, false), formal(primReal(), "k", false, false)); -#line 1907 "runtime.in" +#line 2026 "runtime.in" addFunc(ve, run::gen87, primPen(), "gray", formal(primReal(), "gray", false, false)); -#line 1912 "runtime.in" +#line 2031 "runtime.in" addFunc(ve, run::gen88, realArray(), "colors", formal(primPen(), "p", false, false)); -#line 1940 "runtime.in" +#line 2059 "runtime.in" addFunc(ve, run::gen89, primString() , "colorspace", formal(primPen(), "p", false, false)); -#line 1947 "runtime.in" +#line 2066 "runtime.in" addFunc(ve, run::gen90, primPen(), "pattern", formal(primString(), "s", false, false)); -#line 1952 "runtime.in" +#line 2071 "runtime.in" addFunc(ve, run::gen91, primString() , "pattern", formal(primPen(), "p", false, false)); -#line 1957 "runtime.in" +#line 2076 "runtime.in" addFunc(ve, run::gen92, primPen(), "fillrule", formal(primInt(), "n", false, false)); -#line 1962 "runtime.in" +#line 2081 "runtime.in" addFunc(ve, run::gen93, primInt(), "fillrule", formal(primPen(), "p", false, false)); -#line 1967 "runtime.in" +#line 2086 "runtime.in" addFunc(ve, run::gen94, primPen(), "opacity", formal(primReal(), "opacity", true, false), formal(primString() , "blend", true, false)); -#line 1977 "runtime.in" +#line 2096 "runtime.in" addFunc(ve, run::gen95, primReal(), "opacity", formal(primPen(), "p", false, false)); -#line 1982 "runtime.in" +#line 2101 "runtime.in" addFunc(ve, run::gen96, primString() , "blend", formal(primPen(), "p", false, false)); -#line 1987 "runtime.in" +#line 2106 "runtime.in" addFunc(ve, run::gen97, primPen(), "linetype", formal(primString(), "s", false, false), formal(primReal(), "offset", true, false), formal(primBoolean(), "scale", true, false), formal(primBoolean(), "adjust", true, false)); -#line 1992 "runtime.in" +#line 2111 "runtime.in" addFunc(ve, run::gen98, primString() , "linetype", formal(primPen(), "p", true, false)); -#line 1997 "runtime.in" +#line 2116 "runtime.in" addFunc(ve, run::gen99, primReal(), "offset", formal(primPen(), "p", false, false)); -#line 2002 "runtime.in" +#line 2121 "runtime.in" addFunc(ve, run::gen100, primBoolean(), "scale", formal(primPen(), "p", false, false)); -#line 2007 "runtime.in" +#line 2126 "runtime.in" addFunc(ve, run::gen101, primBoolean(), "adjust", formal(primPen(), "p", false, false)); -#line 2012 "runtime.in" +#line 2131 "runtime.in" addFunc(ve, run::gen102, primPen(), "adjust", formal(primPen(), "p", false, false), formal(primReal(), "arclength", false, false), formal(primBoolean(), "cyclic", false, false)); -#line 2017 "runtime.in" +#line 2136 "runtime.in" addFunc(ve, run::gen103, primPen(), "linecap", formal(primInt(), "n", false, false)); -#line 2022 "runtime.in" +#line 2141 "runtime.in" addFunc(ve, run::gen104, primInt(), "linecap", formal(primPen(), "p", true, false)); -#line 2027 "runtime.in" +#line 2146 "runtime.in" addFunc(ve, run::gen105, primPen(), "linejoin", formal(primInt(), "n", false, false)); -#line 2032 "runtime.in" +#line 2151 "runtime.in" addFunc(ve, run::gen106, primInt(), "linejoin", formal(primPen(), "p", true, false)); -#line 2037 "runtime.in" +#line 2156 "runtime.in" addFunc(ve, run::gen107, primPen(), "miterlimit", formal(primReal(), "x", false, false)); -#line 2042 "runtime.in" +#line 2161 "runtime.in" addFunc(ve, run::gen108, primReal(), "miterlimit", formal(primPen(), "p", true, false)); -#line 2047 "runtime.in" +#line 2166 "runtime.in" addFunc(ve, run::gen109, primPen(), "linewidth", formal(primReal(), "x", false, false)); -#line 2052 "runtime.in" +#line 2171 "runtime.in" addFunc(ve, run::gen110, primReal(), "linewidth", formal(primPen(), "p", true, false)); -#line 2057 "runtime.in" +#line 2176 "runtime.in" addFunc(ve, run::gen111, primPen(), "fontcommand", formal(primString(), "s", false, false)); -#line 2062 "runtime.in" +#line 2181 "runtime.in" addFunc(ve, run::gen112, primString() , "font", formal(primPen(), "p", true, false)); -#line 2067 "runtime.in" +#line 2186 "runtime.in" addFunc(ve, run::gen113, primPen(), "fontsize", formal(primReal(), "size", false, false), formal(primReal(), "lineskip", false, false)); -#line 2073 "runtime.in" +#line 2192 "runtime.in" addFunc(ve, run::gen114, primReal(), "fontsize", formal(primPen(), "p", true, false)); -#line 2078 "runtime.in" +#line 2197 "runtime.in" addFunc(ve, run::gen115, primReal(), "lineskip", formal(primPen(), "p", true, false)); -#line 2083 "runtime.in" +#line 2202 "runtime.in" addFunc(ve, run::gen116, primPen(), "overwrite", formal(primInt(), "n", false, false)); -#line 2089 "runtime.in" +#line 2208 "runtime.in" addFunc(ve, run::gen117, primInt(), "overwrite", formal(primPen(), "p", true, false)); -#line 2094 "runtime.in" +#line 2213 "runtime.in" addFunc(ve, run::gen118, primPen(), "basealign", formal(primInt(), "n", false, false)); -#line 2099 "runtime.in" +#line 2218 "runtime.in" addFunc(ve, run::gen119, primInt(), "basealign", formal(primPen(), "p", true, false)); -#line 2104 "runtime.in" +#line 2223 "runtime.in" addFunc(ve, run::gen120, primTransform(), "transform", formal(primPen(), "p", false, false)); -#line 2109 "runtime.in" +#line 2228 "runtime.in" addFunc(ve, run::gen121, primPath(), "nib", formal(primPen(), "p", false, false)); -#line 2114 "runtime.in" +#line 2233 "runtime.in" addFunc(ve, run::gen122, primPen(), "makepen", formal(primPath(), "p", false, false)); -#line 2119 "runtime.in" +#line 2238 "runtime.in" addFunc(ve, run::gen123, primPen(), "colorless", formal(primPen(), "p", false, false)); -#line 2125 "runtime.in" +#line 2244 "runtime.in" addFunc(ve, run::gen124, primBoolean(), "interactive"); -#line 2132 "runtime.in" +#line 2251 "runtime.in" addFunc(ve, run::gen125, primBoolean(), "uptodate"); -#line 2137 "runtime.in" +#line 2256 "runtime.in" addFunc(ve, run::gen126, primInt(), "system", formal(primString() , "s", false, false)); -#line 2147 "runtime.in" +#line 2266 "runtime.in" addFunc(ve, run::gen127, primBoolean(), "view"); -#line 2152 "runtime.in" +#line 2271 "runtime.in" addFunc(ve, run::gen128, primString() , "asydir"); -#line 2157 "runtime.in" +#line 2276 "runtime.in" addFunc(ve, run::gen129, primString() , "locale", formal(primString() , "s", true, false)); -#line 2163 "runtime.in" +#line 2282 "runtime.in" addFunc(ve, run::gen130, primVoid(), "abort", formal(primString() , "s", true, false)); -#line 2169 "runtime.in" +#line 2288 "runtime.in" addFunc(ve, run::gen131, primVoid(), "exit"); -#line 2174 "runtime.in" +#line 2293 "runtime.in" addFunc(ve, run::gen132, primVoid(), "assert", formal(primBoolean(), "b", false, false), formal(primString() , "s", true, false)); -#line 2185 "runtime.in" +#line 2304 "runtime.in" addFunc(ve, run::gen133, primVoid(), "sleep", formal(primInt(), "seconds", false, false)); -#line 2191 "runtime.in" +#line 2310 "runtime.in" addFunc(ve, run::gen134, primVoid(), "usleep", formal(primInt(), "microseconds", false, false)); -#line 2197 "runtime.in" +#line 2316 "runtime.in" addFunc(ve, run::gen135, primVoid(), "_eval", formal(primString(), "s", false, false), formal(primBoolean(), "embedded", false, false), formal(primBoolean(), "interactivewrite", true, false)); -#line 2212 "runtime.in" +#line 2331 "runtime.in" addFunc(ve, run::gen136, primVoid(), "_eval", formal(primCode(), "s", false, false), formal(primBoolean(), "embedded", false, false)); -#line 2230 "runtime.in" +#line 2349 "runtime.in" addFunc(ve, run::gen137, primString() , "location"); -#line 2242 "runtime.in" +#line 2361 "runtime.in" addFunc(ve, run::gen139, primString() , "cd", formal(primString() , "s", true, false)); -#line 2248 "runtime.in" +#line 2367 "runtime.in" addFunc(ve, run::gen140, primVoid(), "list", formal(primString(), "s", false, false), formal(primBoolean(), "imports", true, false)); -#line 2265 "runtime.in" +#line 2384 "runtime.in" addFunc(ve, run::gen142, primBoolean(), "==", formal(primPath(), "a", false, false), formal(primPath(), "b", false, false)); -#line 2270 "runtime.in" +#line 2389 "runtime.in" addFunc(ve, run::gen143, primBoolean(), "!=", formal(primPath(), "a", false, false), formal(primPath(), "b", false, false)); -#line 2275 "runtime.in" +#line 2394 "runtime.in" addFunc(ve, run::gen144, primPair(), "point", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false)); -#line 2280 "runtime.in" +#line 2399 "runtime.in" addFunc(ve, run::gen145, primPair(), "point", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false)); -#line 2285 "runtime.in" +#line 2404 "runtime.in" addFunc(ve, run::gen146, primPair(), "precontrol", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false)); -#line 2290 "runtime.in" +#line 2409 "runtime.in" addFunc(ve, run::gen147, primPair(), "precontrol", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false)); -#line 2295 "runtime.in" +#line 2414 "runtime.in" addFunc(ve, run::gen148, primPair(), "postcontrol", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false)); -#line 2300 "runtime.in" +#line 2419 "runtime.in" addFunc(ve, run::gen149, primPair(), "postcontrol", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false)); -#line 2305 "runtime.in" +#line 2424 "runtime.in" addFunc(ve, run::gen150, primPair(), "dir", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false), formal(primBoolean(), "normalize", true, false)); -#line 2310 "runtime.in" +#line 2429 "runtime.in" addFunc(ve, run::gen151, primPair(), "dir", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false), formal(primBoolean(), "normalize", true, false)); -#line 2315 "runtime.in" +#line 2434 "runtime.in" addFunc(ve, run::gen152, primPair(), "accel", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false)); -#line 2320 "runtime.in" +#line 2439 "runtime.in" addFunc(ve, run::gen153, primPair(), "accel", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false)); -#line 2325 "runtime.in" +#line 2444 "runtime.in" addFunc(ve, run::gen154, primReal(), "radius", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false)); -#line 2337 "runtime.in" +#line 2456 "runtime.in" addFunc(ve, run::gen155, primPath(), "reverse", formal(primPath(), "p", false, false)); -#line 2342 "runtime.in" +#line 2461 "runtime.in" addFunc(ve, run::gen156, primPath(), "subpath", formal(primPath(), "p", false, false), formal(primInt(), "a", false, false), formal(primInt(), "b", false, false)); -#line 2347 "runtime.in" +#line 2466 "runtime.in" addFunc(ve, run::gen157, primPath(), "subpath", formal(primPath(), "p", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false)); -#line 2352 "runtime.in" +#line 2471 "runtime.in" addFunc(ve, run::gen158, primPath(), "nurb", formal(primPair(), "z0", false, false), formal(primPair(), "z1", false, false), formal(primPair(), "z2", false, false), formal(primPair(), "z3", false, false), formal(primReal(), "w0", false, false), formal(primReal(), "w1", false, false), formal(primReal(), "w2", false, false), formal(primReal(), "w3", false, false), formal(primInt(), "m", false, false)); -#line 2358 "runtime.in" +#line 2477 "runtime.in" addFunc(ve, run::gen159, primInt(), "length", formal(primPath(), "p", false, false)); -#line 2363 "runtime.in" +#line 2482 "runtime.in" addFunc(ve, run::gen160, primBoolean(), "cyclic", formal(primPath(), "p", false, false)); -#line 2368 "runtime.in" +#line 2487 "runtime.in" addFunc(ve, run::gen161, primBoolean(), "straight", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false)); -#line 2373 "runtime.in" +#line 2492 "runtime.in" addFunc(ve, run::gen162, primPath(), "unstraighten", formal(primPath(), "p", false, false)); -#line 2378 "runtime.in" +#line 2497 "runtime.in" addFunc(ve, run::gen163, primBoolean(), "piecewisestraight", formal(primPath(), "p", false, false)); -#line 2383 "runtime.in" +#line 2502 "runtime.in" addFunc(ve, run::gen164, primReal(), "arclength", formal(primPath(), "p", false, false)); -#line 2388 "runtime.in" +#line 2507 "runtime.in" addFunc(ve, run::gen165, primReal(), "arctime", formal(primPath(), "p", false, false), formal(primReal(), "dval", false, false)); -#line 2393 "runtime.in" +#line 2512 "runtime.in" addFunc(ve, run::gen166, primReal(), "dirtime", formal(primPath(), "p", false, false), formal(primPair(), "z", false, false)); -#line 2398 "runtime.in" +#line 2517 "runtime.in" addFunc(ve, run::gen167, realArray(), "intersect", formal(primPath(), "p", false, false), formal(primPath(), "q", false, false), formal(primReal(), "fuzz", true, false)); -#line 2415 "runtime.in" +#line 2534 "runtime.in" addFunc(ve, run::gen168, realArray2(), "intersections", formal(primPath(), "p", false, false), formal(primPath(), "q", false, false), formal(primReal(), "fuzz", true, false)); -#line 2446 "runtime.in" +#line 2565 "runtime.in" addFunc(ve, run::gen169, realArray(), "intersections", formal(primPath(), "p", false, false), formal(primPair(), "a", false, true), formal(primPair(), "b", false, true), formal(primReal(), "fuzz", true, false)); -#line 2461 "runtime.in" +#line 2580 "runtime.in" addFunc(ve, run::gen170, primPair(), "extension", formal(primPair(), "p", false, false), formal(primPair(), "q", false, false), formal(primPair(), "p", false, false), formal(primPair(), "q", false, false)); -#line 2472 "runtime.in" +#line 2591 "runtime.in" addFunc(ve, run::gen171, primInt(), "size", formal(primPath(), "p", false, false)); -#line 2477 "runtime.in" +#line 2596 "runtime.in" addFunc(ve, run::gen172, primPath(), "&", formal(primPath(), "p", false, false), formal(primPath(), "q", false, false)); -#line 2482 "runtime.in" +#line 2601 "runtime.in" addFunc(ve, run::gen173, primPair(), "min", formal(primPath(), "p", false, false)); -#line 2487 "runtime.in" +#line 2606 "runtime.in" addFunc(ve, run::gen174, primPair(), "max", formal(primPath(), "p", false, false)); -#line 2492 "runtime.in" +#line 2611 "runtime.in" addFunc(ve, run::gen175, realArray(), "mintimes", formal(primPath(), "p", false, false)); -#line 2501 "runtime.in" +#line 2620 "runtime.in" addFunc(ve, run::gen176, realArray(), "maxtimes", formal(primPath(), "p", false, false)); -#line 2510 "runtime.in" +#line 2629 "runtime.in" addFunc(ve, run::gen177, primReal(), "relativedistance", formal(primReal(), "theta", false, false), formal(primReal(), "phi", false, false), formal(primReal(), "t", false, false), formal(primBoolean(), "atleast", false, false)); -#line 2515 "runtime.in" +#line 2634 "runtime.in" addFunc(ve, run::gen178, primInt(), "windingnumber", formal(pathArray() , "p", false, false), formal(primPair(), "z", false, false)); -#line 2520 "runtime.in" +#line 2639 "runtime.in" addFunc(ve, run::gen179, primBoolean(), "inside", formal(pathArray() , "g", false, true), formal(primPair(), "z", false, false), formal(primPen(), "fillrule", true, false)); -#line 2525 "runtime.in" +#line 2644 "runtime.in" addFunc(ve, run::gen180, primBoolean(), "inside", formal(primPath(), "g", false, false), formal(primPair(), "z", false, false), formal(primPen(), "fillrule", true, false)); -#line 2530 "runtime.in" +#line 2649 "runtime.in" addFunc(ve, run::gen181, primReal(), "side", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false)); -#line 2537 "runtime.in" +#line 2656 "runtime.in" addFunc(ve, run::gen182, primReal(), "incircle", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false)); -#line 2545 "runtime.in" +#line 2664 "runtime.in" addFunc(ve, run::gen183, primPath3(), "path3", formal(tripleArray(), "pre", false, false), formal(tripleArray(), "point", false, false), formal(tripleArray(), "post", false, false), formal(boolArray(), "straight", false, false), formal(primBoolean(), "cyclic", false, false)); -#line 2570 "runtime.in" +#line 2689 "runtime.in" addFunc(ve, run::gen185, primBoolean(), "==", formal(primPath3(), "a", false, false), formal(primPath3(), "b", false, false)); -#line 2575 "runtime.in" +#line 2694 "runtime.in" addFunc(ve, run::gen186, primBoolean(), "!=", formal(primPath3(), "a", false, false), formal(primPath3(), "b", false, false)); -#line 2580 "runtime.in" +#line 2699 "runtime.in" addFunc(ve, run::gen187, primTriple(), "point", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false)); -#line 2585 "runtime.in" +#line 2704 "runtime.in" addFunc(ve, run::gen188, primTriple(), "point", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false)); -#line 2590 "runtime.in" +#line 2709 "runtime.in" addFunc(ve, run::gen189, primTriple(), "precontrol", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false)); -#line 2595 "runtime.in" +#line 2714 "runtime.in" addFunc(ve, run::gen190, primTriple(), "precontrol", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false)); -#line 2600 "runtime.in" +#line 2719 "runtime.in" addFunc(ve, run::gen191, primTriple(), "postcontrol", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false)); -#line 2605 "runtime.in" +#line 2724 "runtime.in" addFunc(ve, run::gen192, primTriple(), "postcontrol", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false)); -#line 2610 "runtime.in" +#line 2729 "runtime.in" addFunc(ve, run::gen193, primTriple(), "dir", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false), formal(primBoolean(), "normalize", true, false)); -#line 2615 "runtime.in" +#line 2734 "runtime.in" addFunc(ve, run::gen194, primTriple(), "dir", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false), formal(primBoolean(), "normalize", true, false)); -#line 2620 "runtime.in" +#line 2739 "runtime.in" addFunc(ve, run::gen195, primTriple(), "accel", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false)); -#line 2625 "runtime.in" +#line 2744 "runtime.in" addFunc(ve, run::gen196, primTriple(), "accel", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false)); -#line 2630 "runtime.in" +#line 2749 "runtime.in" addFunc(ve, run::gen197, primReal(), "radius", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false)); -#line 2642 "runtime.in" +#line 2761 "runtime.in" addFunc(ve, run::gen198, primReal(), "radius", formal(primTriple(), "z0", false, false), formal(primTriple(), "c0", false, false), formal(primTriple(), "c1", false, false), formal(primTriple(), "z1", false, false), formal(primReal(), "t", false, false)); -#line 2654 "runtime.in" +#line 2773 "runtime.in" addFunc(ve, run::gen199, primPath3(), "reverse", formal(primPath3(), "p", false, false)); -#line 2659 "runtime.in" +#line 2778 "runtime.in" addFunc(ve, run::gen200, primPath3(), "subpath", formal(primPath3(), "p", false, false), formal(primInt(), "a", false, false), formal(primInt(), "b", false, false)); -#line 2664 "runtime.in" +#line 2783 "runtime.in" addFunc(ve, run::gen201, primPath3(), "subpath", formal(primPath3(), "p", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false)); -#line 2669 "runtime.in" +#line 2788 "runtime.in" addFunc(ve, run::gen202, primInt(), "length", formal(primPath3(), "p", false, false)); -#line 2674 "runtime.in" +#line 2793 "runtime.in" addFunc(ve, run::gen203, primBoolean(), "cyclic", formal(primPath3(), "p", false, false)); -#line 2679 "runtime.in" +#line 2798 "runtime.in" addFunc(ve, run::gen204, primBoolean(), "straight", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false)); -#line 2684 "runtime.in" +#line 2803 "runtime.in" addFunc(ve, run::gen205, primTriple(), "perp", formal(primTriple(), "v", false, false), formal(primTriple(), "u", false, false)); -#line 2690 "runtime.in" +#line 2809 "runtime.in" addFunc(ve, run::gen206, primReal(), "straightness", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false)); -#line 2701 "runtime.in" +#line 2820 "runtime.in" addFunc(ve, run::gen207, primReal(), "straightness", formal(primTriple(), "z0", false, false), formal(primTriple(), "c0", false, false), formal(primTriple(), "c1", false, false), formal(primTriple(), "z1", false, false)); -#line 2709 "runtime.in" +#line 2828 "runtime.in" addFunc(ve, run::gen208, primBoolean(), "piecewisestraight", formal(primPath3(), "p", false, false)); -#line 2714 "runtime.in" +#line 2833 "runtime.in" addFunc(ve, run::gen209, primReal(), "arclength", formal(primPath3(), "p", false, false)); -#line 2719 "runtime.in" +#line 2838 "runtime.in" addFunc(ve, run::gen210, primReal(), "arctime", formal(primPath3(), "p", false, false), formal(primReal(), "dval", false, false)); -#line 2724 "runtime.in" +#line 2843 "runtime.in" addFunc(ve, run::gen211, realArray(), "intersect", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false), formal(primReal(), "fuzz", true, false)); -#line 2742 "runtime.in" +#line 2861 "runtime.in" addFunc(ve, run::gen212, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false), formal(primReal(), "fuzz", true, false)); -#line 2775 "runtime.in" - addFunc(ve, run::gen213, primInt(), "size", formal(primPath3(), "p", false, false)); -#line 2780 "runtime.in" - addFunc(ve, run::gen214, primPath3(), "&", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false)); -#line 2785 "runtime.in" - addFunc(ve, run::gen215, primTriple(), "min", formal(primPath3(), "p", false, false)); -#line 2790 "runtime.in" - addFunc(ve, run::gen216, primTriple(), "max", formal(primPath3(), "p", false, false)); -#line 2795 "runtime.in" - addFunc(ve, run::gen217, realArray(), "mintimes", formal(primPath3(), "p", false, false)); -#line 2805 "runtime.in" - addFunc(ve, run::gen218, realArray(), "maxtimes", formal(primPath3(), "p", false, false)); -#line 2815 "runtime.in" - addFunc(ve, run::gen219, primPath3(), "*", formal(realArray2(), "t", false, false), formal(primPath3(), "g", false, false)); -#line 2870 "runtime.in" - addFunc(ve, run::gen224, primGuide(), "operator cast", formal(primCycleToken(), "tok", false, false)); -#line 2877 "runtime.in" - addFunc(ve, run::gen225, primGuide(), "operator spec", formal(primPair(), "z", false, false), formal(primInt(), "p", false, false)); -#line 2885 "runtime.in" - addFunc(ve, run::gen226, primCurlSpecifier(), "operator curl", formal(primReal(), "gamma", false, false), formal(primInt(), "p", false, false)); -#line 2901 "runtime.in" - addFunc(ve, run::gen229, primGuide(), "operator cast", formal(primCurlSpecifier(), "spec", false, false)); -#line 2906 "runtime.in" - addFunc(ve, run::gen230, primTensionSpecifier(), "operator tension", formal(primReal(), "tout", false, false), formal(primReal(), "tin", false, false), formal(primBoolean(), "atleast", false, false)); -#line 2926 "runtime.in" - addFunc(ve, run::gen234, primGuide(), "operator cast", formal(primTensionSpecifier(), "t", false, false)); -#line 2931 "runtime.in" - addFunc(ve, run::gen235, primGuide(), "operator controls", formal(primPair(), "zout", false, false), formal(primPair(), "zin", false, false)); -#line 2936 "runtime.in" - addFunc(ve, run::gen236, primInt(), "size", formal(primGuide(), "g", false, false)); +#line 2894 "runtime.in" + addFunc(ve, run::gen213, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(tripleArray2(), "p", false, false), formal(primReal(), "fuzz", true, false)); +#line 2914 "runtime.in" + addFunc(ve, run::gen214, realArray(), "intersections", formal(primTriple(), "v", false, false), formal(tripleArray2(), "p", false, false), formal(primReal(), "fuzz", true, false)); +#line 2928 "runtime.in" + addFunc(ve, run::gen215, primInt(), "size", formal(primPath3(), "p", false, false)); +#line 2933 "runtime.in" + addFunc(ve, run::gen216, primPath3(), "&", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false)); +#line 2938 "runtime.in" + addFunc(ve, run::gen217, primTriple(), "min", formal(primPath3(), "p", false, false)); #line 2943 "runtime.in" - addFunc(ve, run::gen237, primInt(), "length", formal(primGuide(), "g", false, false)); -#line 2950 "runtime.in" - addFunc(ve, run::gen238, primBoolean(), "cyclic", formal(primGuide(), "g", false, false)); -#line 2957 "runtime.in" - addFunc(ve, run::gen239, primPair(), "point", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); -#line 2964 "runtime.in" - addFunc(ve, run::gen240, pairArray(), "dirSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); -#line 2976 "runtime.in" - addFunc(ve, run::gen241, pairArray(), "controlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); -#line 2993 "runtime.in" - addFunc(ve, run::gen242, primTensionSpecifier(), "tensionSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); -#line 3003 "runtime.in" - addFunc(ve, run::gen243, realArray(), "curlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); -#line 3017 "runtime.in" - addFunc(ve, run::gen244, primGuide(), "reverse", formal(primGuide(), "g", false, false)); -#line 3071 "runtime.in" - addFunc(ve, run::gen245, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath3(), "g", false, false), formal(primPen(), "p", false, false)); + addFunc(ve, run::gen218, primTriple(), "max", formal(primPath3(), "p", false, false)); +#line 2948 "runtime.in" + addFunc(ve, run::gen219, realArray(), "mintimes", formal(primPath3(), "p", false, false)); +#line 2958 "runtime.in" + addFunc(ve, run::gen220, realArray(), "maxtimes", formal(primPath3(), "p", false, false)); +#line 2968 "runtime.in" + addFunc(ve, run::gen221, primPath3(), "*", formal(realArray2(), "t", false, false), formal(primPath3(), "g", false, false)); +#line 3023 "runtime.in" + addFunc(ve, run::gen226, primGuide(), "operator cast", formal(primCycleToken(), "tok", false, false)); +#line 3030 "runtime.in" + addFunc(ve, run::gen227, primGuide(), "operator spec", formal(primPair(), "z", false, false), formal(primInt(), "p", false, false)); +#line 3038 "runtime.in" + addFunc(ve, run::gen228, primCurlSpecifier(), "operator curl", formal(primReal(), "gamma", false, false), formal(primInt(), "p", false, false)); +#line 3054 "runtime.in" + addFunc(ve, run::gen231, primGuide(), "operator cast", formal(primCurlSpecifier(), "spec", false, false)); +#line 3059 "runtime.in" + addFunc(ve, run::gen232, primTensionSpecifier(), "operator tension", formal(primReal(), "tout", false, false), formal(primReal(), "tin", false, false), formal(primBoolean(), "atleast", false, false)); #line 3079 "runtime.in" - addFunc(ve, run::gen246, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray2(), "g", false, false), formal(primBoolean(), "straight", false, false), formal(penArray() , "p", false, false), formal(primReal(), "opacity", false, false), formal(primReal(), "shininess", false, false), formal(primReal(), "granularity", false, false), formal(primTriple(), "normal", false, false), formal(primBoolean(), "lighton", false, false), formal(penArray() , "colors", false, false)); -#line 3087 "runtime.in" - addFunc(ve, run::gen247, primTriple(), "min3", formal(primPicture(), "f", false, false)); -#line 3092 "runtime.in" - addFunc(ve, run::gen248, primTriple(), "max3", formal(primPicture(), "f", false, false)); -#line 3097 "runtime.in" - addFunc(ve, run::gen249, primPair(), "min", formal(primPicture(), "f", false, false), formal(realArray2(), "t", false, false)); -#line 3105 "runtime.in" - addFunc(ve, run::gen250, primPair(), "max", formal(primPicture(), "f", false, false), formal(realArray2(), "t", false, false)); -#line 3113 "runtime.in" - addFunc(ve, run::gen251, primPair(), "minratio", formal(primPicture(), "f", false, false)); -#line 3118 "runtime.in" - addFunc(ve, run::gen252, primPair(), "maxratio", formal(primPicture(), "f", false, false)); -#line 3123 "runtime.in" - addFunc(ve, run::gen253, primReal(), "minbound", formal(realArray(), "a", false, false), formal(primReal(), "b", false, false)); -#line 3131 "runtime.in" - addFunc(ve, run::gen254, primReal(), "maxbound", formal(realArray(), "a", false, false), formal(primReal(), "b", false, false)); -#line 3139 "runtime.in" - addFunc(ve, run::gen255, primPair(), "minbound", formal(tripleArray(), "a", false, false), formal(realArray2(), "t", false, false), formal(primPair(), "b", false, false)); -#line 3150 "runtime.in" - addFunc(ve, run::gen256, primPair(), "maxbound", formal(tripleArray(), "a", false, false), formal(realArray2(), "t", false, false), formal(primPair(), "b", false, false)); -#line 3161 "runtime.in" - addFunc(ve, run::gen257, primPair(), "max", formal(primPath3(), "g", false, false), formal(realArray2(), "t", false, false)); -#line 3169 "runtime.in" - addFunc(ve, run::gen258, primPair(), "min", formal(primPath3(), "g", false, false), formal(realArray2(), "t", false, false)); -#line 3177 "runtime.in" - addFunc(ve, run::gen259, primReal(), "change2", formal(tripleArray2(), "a", false, false)); -#line 3199 "runtime.in" - addFunc(ve, run::gen260, primBoolean(), "is3D", formal(primPicture(), "f", false, false)); -#line 3204 "runtime.in" - addFunc(ve, run::gen261, primPair(), "bezier", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false)); -#line 3211 "runtime.in" - addFunc(ve, run::gen262, primPair(), "bezierP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false)); -#line 3216 "runtime.in" - addFunc(ve, run::gen263, primPair(), "bezierPP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false)); -#line 3221 "runtime.in" - addFunc(ve, run::gen264, primPair(), "bezierPPP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false)); -#line 3226 "runtime.in" - addFunc(ve, run::gen265, primTriple(), "bezier", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false)); + addFunc(ve, run::gen236, primGuide(), "operator cast", formal(primTensionSpecifier(), "t", false, false)); +#line 3084 "runtime.in" + addFunc(ve, run::gen237, primGuide(), "operator controls", formal(primPair(), "zout", false, false), formal(primPair(), "zin", false, false)); +#line 3089 "runtime.in" + addFunc(ve, run::gen238, primInt(), "size", formal(primGuide(), "g", false, false)); +#line 3096 "runtime.in" + addFunc(ve, run::gen239, primInt(), "length", formal(primGuide(), "g", false, false)); +#line 3103 "runtime.in" + addFunc(ve, run::gen240, primBoolean(), "cyclic", formal(primGuide(), "g", false, false)); +#line 3110 "runtime.in" + addFunc(ve, run::gen241, primPair(), "point", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); +#line 3117 "runtime.in" + addFunc(ve, run::gen242, pairArray(), "dirSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); +#line 3129 "runtime.in" + addFunc(ve, run::gen243, pairArray(), "controlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); +#line 3146 "runtime.in" + addFunc(ve, run::gen244, primTensionSpecifier(), "tensionSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); +#line 3156 "runtime.in" + addFunc(ve, run::gen245, realArray(), "curlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); +#line 3170 "runtime.in" + addFunc(ve, run::gen246, primGuide(), "reverse", formal(primGuide(), "g", false, false)); +#line 3224 "runtime.in" + addFunc(ve, run::gen247, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath3(), "g", false, false), formal(primPen(), "p", false, false)); #line 3233 "runtime.in" - addFunc(ve, run::gen266, primTriple(), "bezierP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false)); -#line 3238 "runtime.in" - addFunc(ve, run::gen267, primTriple(), "bezierPP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false)); -#line 3243 "runtime.in" - addFunc(ve, run::gen268, primTriple(), "bezierPPP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false)); -#line 3256 "runtime.in" - addFunc(ve, run::gen270, primInt(), "length", formal(primString(), "s", false, false)); -#line 3261 "runtime.in" - addFunc(ve, run::gen271, primInt(), "find", formal(primString(), "s", false, false), formal(primString() , "t", false, false), formal(primInt(), "pos", true, false)); + addFunc(ve, run::gen248, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray2(), "g", false, false), formal(primBoolean(), "straight", false, false), formal(penArray() , "p", false, false), formal(primReal(), "opacity", false, false), formal(primReal(), "shininess", false, false), formal(primReal(), "granularity", false, false), formal(primTriple(), "normal", false, false), formal(primBoolean(), "lighton", false, false), formal(penArray() , "colors", false, false)); +#line 3241 "runtime.in" + addFunc(ve, run::gen249, primTriple(), "min3", formal(primPicture(), "f", false, false)); +#line 3246 "runtime.in" + addFunc(ve, run::gen250, primTriple(), "max3", formal(primPicture(), "f", false, false)); +#line 3251 "runtime.in" + addFunc(ve, run::gen251, primPair(), "min", formal(primPicture(), "f", false, false), formal(realArray2(), "t", false, false)); +#line 3259 "runtime.in" + addFunc(ve, run::gen252, primPair(), "max", formal(primPicture(), "f", false, false), formal(realArray2(), "t", false, false)); #line 3267 "runtime.in" - addFunc(ve, run::gen272, primInt(), "rfind", formal(primString(), "s", false, false), formal(primString() , "t", false, false), formal(primInt(), "pos", true, false)); -#line 3273 "runtime.in" - addFunc(ve, run::gen273, primString() , "reverse", formal(primString() , "s", false, false)); -#line 3279 "runtime.in" - addFunc(ve, run::gen274, primString() , "insert", formal(primString() , "s", false, false), formal(primInt(), "pos", false, false), formal(primString() , "t", false, false)); -#line 3286 "runtime.in" - addFunc(ve, run::gen275, primString() , "substr", formal(primString(), "s", false, false), formal(primInt(), "pos", false, false), formal(primInt(), "n", true, false)); -#line 3293 "runtime.in" - addFunc(ve, run::gen276, primString() , "erase", formal(primString() , "s", false, false), formal(primInt(), "pos", false, false), formal(primInt(), "n", false, false)); -#line 3300 "runtime.in" - addFunc(ve, run::gen277, primString() , "downcase", formal(primString() , "s", false, false)); -#line 3306 "runtime.in" - addFunc(ve, run::gen278, primString() , "upcase", formal(primString() , "s", false, false)); -#line 3312 "runtime.in" - addFunc(ve, run::gen279, primString() , "replace", formal(primString(), "s", false, false), formal(stringArray2(), "translate", false, false)); -#line 3339 "runtime.in" - addFunc(ve, run::gen280, primString() , "format", formal(primString(), "format", false, false), formal(primInt(), "x", false, false)); -#line 3354 "runtime.in" - addFunc(ve, run::gen281, primString() , "format", formal(primString(), "format", false, false), formal(primReal(), "x", false, false), formal(primString() , "locale", true, false)); + addFunc(ve, run::gen253, primPair(), "minratio", formal(primPicture(), "f", false, false)); +#line 3272 "runtime.in" + addFunc(ve, run::gen254, primPair(), "maxratio", formal(primPicture(), "f", false, false)); +#line 3277 "runtime.in" + addFunc(ve, run::gen255, primTriple(), "minbound", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false)); +#line 3287 "runtime.in" + addFunc(ve, run::gen256, primTriple(), "maxbound", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false)); +#line 3297 "runtime.in" + addFunc(ve, run::gen257, primPair(), "minbound", formal(tripleArray2(), "p", false, false), formal(realArray2(), "t", false, false), formal(primPair(), "b", false, false)); +#line 3309 "runtime.in" + addFunc(ve, run::gen258, primPair(), "maxbound", formal(tripleArray2(), "p", false, false), formal(realArray2(), "t", false, false), formal(primPair(), "b", false, false)); +#line 3321 "runtime.in" + addFunc(ve, run::gen259, primPair(), "max", formal(primPath3(), "g", false, false), formal(realArray2(), "t", false, false)); +#line 3329 "runtime.in" + addFunc(ve, run::gen260, primPair(), "min", formal(primPath3(), "g", false, false), formal(realArray2(), "t", false, false)); +#line 3337 "runtime.in" + addFunc(ve, run::gen261, primReal(), "change2", formal(tripleArray2(), "a", false, false)); +#line 3359 "runtime.in" + addFunc(ve, run::gen262, primBoolean(), "is3D", formal(primPicture(), "f", false, false)); +#line 3364 "runtime.in" + addFunc(ve, run::gen263, primPair(), "bezier", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false)); +#line 3371 "runtime.in" + addFunc(ve, run::gen264, primPair(), "bezierP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false)); +#line 3376 "runtime.in" + addFunc(ve, run::gen265, primPair(), "bezierPP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false)); +#line 3381 "runtime.in" + addFunc(ve, run::gen266, primPair(), "bezierPPP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false)); +#line 3386 "runtime.in" + addFunc(ve, run::gen267, primTriple(), "bezier", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false)); +#line 3393 "runtime.in" + addFunc(ve, run::gen268, primTriple(), "bezierP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false)); +#line 3398 "runtime.in" + addFunc(ve, run::gen269, primTriple(), "bezierPP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false)); +#line 3403 "runtime.in" + addFunc(ve, run::gen270, primTriple(), "bezierPPP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false)); +#line 3416 "runtime.in" + addFunc(ve, run::gen272, primInt(), "length", formal(primString(), "s", false, false)); +#line 3421 "runtime.in" + addFunc(ve, run::gen273, primInt(), "find", formal(primString(), "s", false, false), formal(primString() , "t", false, false), formal(primInt(), "pos", true, false)); +#line 3427 "runtime.in" + addFunc(ve, run::gen274, primInt(), "rfind", formal(primString(), "s", false, false), formal(primString() , "t", false, false), formal(primInt(), "pos", true, false)); +#line 3433 "runtime.in" + addFunc(ve, run::gen275, primString() , "reverse", formal(primString() , "s", false, false)); +#line 3439 "runtime.in" + addFunc(ve, run::gen276, primString() , "insert", formal(primString() , "s", false, false), formal(primInt(), "pos", false, false), formal(primString() , "t", false, false)); +#line 3446 "runtime.in" + addFunc(ve, run::gen277, primString() , "substr", formal(primString(), "s", false, false), formal(primInt(), "pos", false, false), formal(primInt(), "n", true, false)); +#line 3453 "runtime.in" + addFunc(ve, run::gen278, primString() , "erase", formal(primString() , "s", false, false), formal(primInt(), "pos", false, false), formal(primInt(), "n", false, false)); +#line 3460 "runtime.in" + addFunc(ve, run::gen279, primString() , "downcase", formal(primString() , "s", false, false)); +#line 3466 "runtime.in" + addFunc(ve, run::gen280, primString() , "upcase", formal(primString() , "s", false, false)); #line 3472 "runtime.in" - addFunc(ve, run::gen282, primInt(), "hex", formal(primString() , "s", false, false)); -#line 3483 "runtime.in" - addFunc(ve, run::gen283, primString() , "string", formal(primInt(), "x", false, false)); -#line 3490 "runtime.in" - addFunc(ve, run::gen284, primString() , "string", formal(primReal(), "x", false, false), formal(primInt(), "digits", true, false)); -#line 3498 "runtime.in" - addFunc(ve, run::gen285, primString() , "time", formal(primString() , "format", true, false)); -#line 3509 "runtime.in" - addFunc(ve, run::gen286, primString() , "time", formal(primInt(), "seconds", false, false), formal(primString() , "format", true, false)); -#line 3522 "runtime.in" - addFunc(ve, run::gen287, primInt(), "seconds", formal(primString() , "t", true, false), formal(primString() , "format", true, false)); -#line 3534 "runtime.in" - addFunc(ve, run::gen288, realArray(), "_cputime"); -#line 3548 "runtime.in" - addFunc(ve, run::gen289, primReal(), "^", formal(primReal(), "x", false, false), formal(primInt(), "y", false, false)); -#line 3556 "runtime.in" - addFunc(ve, run::gen290, primPair(), "^", formal(primPair(), "z", false, false), formal(primInt(), "y", false, false)); -#line 3561 "runtime.in" - addFunc(ve, run::gen291, primInt(), "quotient", formal(primInt(), "x", false, false), formal(primInt(), "y", false, false)); -#line 3569 "runtime.in" - addFunc(ve, run::gen292, primInt(), "abs", formal(primInt(), "x", false, false)); -#line 3574 "runtime.in" - addFunc(ve, run::gen293, primInt(), "sgn", formal(primReal(), "x", false, false)); -#line 3579 "runtime.in" - addFunc(ve, run::gen294, primInt(), "rand"); -#line 3584 "runtime.in" - addFunc(ve, run::gen295, primVoid(), "srand", formal(primInt(), "seed", false, false)); -#line 3589 "runtime.in" - addFunc(ve, run::gen296, primReal(), "unitrand"); -#line 3595 "runtime.in" - addFunc(ve, run::gen297, primInt(), "ceil", formal(primReal(), "x", false, false)); -#line 3600 "runtime.in" - addFunc(ve, run::gen298, primInt(), "floor", formal(primReal(), "x", false, false)); -#line 3605 "runtime.in" - addFunc(ve, run::gen299, primInt(), "round", formal(primReal(), "x", false, false)); -#line 3611 "runtime.in" - addFunc(ve, run::gen300, primInt(), "Ceil", formal(primReal(), "x", false, false)); -#line 3616 "runtime.in" - addFunc(ve, run::gen301, primInt(), "Floor", formal(primReal(), "x", false, false)); -#line 3621 "runtime.in" - addFunc(ve, run::gen302, primInt(), "Round", formal(primReal(), "x", false, false)); -#line 3626 "runtime.in" - addFunc(ve, run::gen303, primReal(), "fmod", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); + addFunc(ve, run::gen281, primString() , "replace", formal(primString(), "s", false, false), formal(stringArray2(), "translate", false, false)); +#line 3499 "runtime.in" + addFunc(ve, run::gen282, primString() , "format", formal(primString(), "format", false, false), formal(primInt(), "x", false, false)); +#line 3514 "runtime.in" + addFunc(ve, run::gen283, primString() , "format", formal(primString(), "format", false, false), formal(primReal(), "x", false, false), formal(primString() , "locale", true, false)); #line 3632 "runtime.in" - addFunc(ve, run::gen304, primReal(), "atan2", formal(primReal(), "y", false, false), formal(primReal(), "x", false, false)); -#line 3637 "runtime.in" - addFunc(ve, run::gen305, primReal(), "hypot", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); -#line 3642 "runtime.in" - addFunc(ve, run::gen306, primReal(), "remainder", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); -#line 3647 "runtime.in" - addFunc(ve, run::gen307, primReal(), "J", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false)); -#line 3652 "runtime.in" - addFunc(ve, run::gen308, primReal(), "Y", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false)); -#line 3657 "runtime.in" - addFunc(ve, run::gen309, primReal(), "erf", formal(primReal(), "x", false, false)); -#line 3662 "runtime.in" - addFunc(ve, run::gen310, primReal(), "erfc", formal(primReal(), "x", false, false)); -#line 3667 "runtime.in" - addFunc(ve, run::gen311, primInt(), "factorial", formal(primInt(), "n", false, false)); -#line 3672 "runtime.in" - addFunc(ve, run::gen312, primInt(), "choose", formal(primInt(), "n", false, false), formal(primInt(), "k", false, false)); -#line 3683 "runtime.in" - addFunc(ve, run::gen313, primReal(), "gamma", formal(primReal(), "x", false, false)); -#line 3693 "runtime.in" - addFunc(ve, run::gen314, primPair(), "gamma", formal(primPair(), "z", false, true)); -#line 3699 "runtime.in" - addFunc(ve, run::gen315, realArray(), "quadraticroots", formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "c", false, false)); + addFunc(ve, run::gen284, primInt(), "hex", formal(primString() , "s", false, false)); +#line 3643 "runtime.in" + addFunc(ve, run::gen285, primString() , "string", formal(primInt(), "x", false, false)); +#line 3650 "runtime.in" + addFunc(ve, run::gen286, primString() , "string", formal(primReal(), "x", false, false), formal(primInt(), "digits", true, false)); +#line 3658 "runtime.in" + addFunc(ve, run::gen287, primString() , "time", formal(primString() , "format", true, false)); +#line 3669 "runtime.in" + addFunc(ve, run::gen288, primString() , "time", formal(primInt(), "seconds", false, false), formal(primString() , "format", true, false)); +#line 3682 "runtime.in" + addFunc(ve, run::gen289, primInt(), "seconds", formal(primString() , "t", true, false), formal(primString() , "format", true, false)); +#line 3694 "runtime.in" + addFunc(ve, run::gen290, realArray(), "_cputime"); #line 3708 "runtime.in" - addFunc(ve, run::gen316, pairArray(), "quadraticroots", formal(primPair(), "a", false, true), formal(primPair(), "b", false, true), formal(primPair(), "c", false, true)); -#line 3717 "runtime.in" - addFunc(ve, run::gen317, realArray(), "cubicroots", formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "c", false, false), formal(primReal(), "d", false, false)); -#line 3727 "runtime.in" - addFunc(ve, run::gen318, primBoolean(), "==", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); -#line 3735 "runtime.in" - addFunc(ve, run::gen319, primBoolean(), "!=", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); -#line 3740 "runtime.in" - addFunc(ve, run::gen320, primTransform(), "+", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); -#line 3745 "runtime.in" - addFunc(ve, run::gen321, primTransform(), "*", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); -#line 3750 "runtime.in" - addFunc(ve, run::gen322, primPair(), "*", formal(primTransform(), "t", false, false), formal(primPair(), "z", false, false)); + addFunc(ve, run::gen291, primReal(), "^", formal(primReal(), "x", false, false), formal(primInt(), "y", false, false)); +#line 3716 "runtime.in" + addFunc(ve, run::gen292, primPair(), "^", formal(primPair(), "z", false, false), formal(primInt(), "y", false, false)); +#line 3721 "runtime.in" + addFunc(ve, run::gen293, primInt(), "quotient", formal(primInt(), "x", false, false), formal(primInt(), "y", false, false)); +#line 3729 "runtime.in" + addFunc(ve, run::gen294, primInt(), "abs", formal(primInt(), "x", false, false)); +#line 3734 "runtime.in" + addFunc(ve, run::gen295, primInt(), "sgn", formal(primReal(), "x", false, false)); +#line 3739 "runtime.in" + addFunc(ve, run::gen296, primInt(), "rand"); +#line 3744 "runtime.in" + addFunc(ve, run::gen297, primVoid(), "srand", formal(primInt(), "seed", false, false)); +#line 3749 "runtime.in" + addFunc(ve, run::gen298, primReal(), "unitrand"); #line 3755 "runtime.in" - addFunc(ve, run::gen323, primPath(), "*", formal(primTransform(), "t", false, false), formal(primPath(), "g", false, false)); + addFunc(ve, run::gen299, primInt(), "ceil", formal(primReal(), "x", false, false)); #line 3760 "runtime.in" - addFunc(ve, run::gen324, primPen(), "*", formal(primTransform(), "t", false, false), formal(primPen(), "p", false, false)); + addFunc(ve, run::gen300, primInt(), "floor", formal(primReal(), "x", false, false)); #line 3765 "runtime.in" - addFunc(ve, run::gen325, primPicture(), "*", formal(primTransform(), "t", false, false), formal(primPicture(), "f", false, false)); -#line 3770 "runtime.in" - addFunc(ve, run::gen326, primPicture(), "*", formal(realArray2(), "t", false, false), formal(primPicture(), "f", false, false)); -#line 3775 "runtime.in" - addFunc(ve, run::gen327, primTransform(), "^", formal(primTransform(), "t", false, false), formal(primInt(), "n", false, false)); + addFunc(ve, run::gen301, primInt(), "round", formal(primReal(), "x", false, false)); +#line 3771 "runtime.in" + addFunc(ve, run::gen302, primInt(), "Ceil", formal(primReal(), "x", false, false)); +#line 3776 "runtime.in" + addFunc(ve, run::gen303, primInt(), "Floor", formal(primReal(), "x", false, false)); +#line 3781 "runtime.in" + addFunc(ve, run::gen304, primInt(), "Round", formal(primReal(), "x", false, false)); +#line 3786 "runtime.in" + addFunc(ve, run::gen305, primReal(), "fmod", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); +#line 3792 "runtime.in" + addFunc(ve, run::gen306, primReal(), "atan2", formal(primReal(), "y", false, false), formal(primReal(), "x", false, false)); +#line 3797 "runtime.in" + addFunc(ve, run::gen307, primReal(), "hypot", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); +#line 3802 "runtime.in" + addFunc(ve, run::gen308, primReal(), "remainder", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); +#line 3807 "runtime.in" + addFunc(ve, run::gen309, primReal(), "J", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false)); +#line 3812 "runtime.in" + addFunc(ve, run::gen310, primReal(), "Y", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false)); +#line 3817 "runtime.in" + addFunc(ve, run::gen311, primReal(), "erf", formal(primReal(), "x", false, false)); #line 3822 "runtime.in" - addFunc(ve, run::gen335, primTransform(), "shift", formal(primTransform(), "t", false, false)); + addFunc(ve, run::gen312, primReal(), "erfc", formal(primReal(), "x", false, false)); #line 3827 "runtime.in" - addFunc(ve, run::gen336, primTransform(), "shiftless", formal(primTransform(), "t", false, false)); + addFunc(ve, run::gen313, primInt(), "factorial", formal(primInt(), "n", false, false)); #line 3832 "runtime.in" - addFunc(ve, run::transformIdentity, primTransform(), "identity"); -#line 3837 "runtime.in" - addFunc(ve, run::gen338, primTransform(), "inverse", formal(primTransform(), "t", false, false)); -#line 3842 "runtime.in" - addFunc(ve, run::gen339, primTransform(), "shift", formal(primPair(), "z", false, false)); -#line 3847 "runtime.in" - addFunc(ve, run::gen340, primTransform(), "shift", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); -#line 3852 "runtime.in" - addFunc(ve, run::gen341, primTransform(), "xscale", formal(primReal(), "x", false, false)); -#line 3857 "runtime.in" - addFunc(ve, run::gen342, primTransform(), "yscale", formal(primReal(), "y", false, false)); -#line 3862 "runtime.in" - addFunc(ve, run::gen343, primTransform(), "scale", formal(primReal(), "x", false, false)); -#line 3867 "runtime.in" - addFunc(ve, run::gen344, primTransform(), "scale", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); -#line 3872 "runtime.in" - addFunc(ve, run::gen345, primTransform(), "slant", formal(primReal(), "s", false, false)); + addFunc(ve, run::gen314, primInt(), "choose", formal(primInt(), "n", false, false), formal(primInt(), "k", false, false)); +#line 3843 "runtime.in" + addFunc(ve, run::gen315, primReal(), "gamma", formal(primReal(), "x", false, false)); +#line 3853 "runtime.in" + addFunc(ve, run::gen316, primPair(), "gamma", formal(primPair(), "z", false, true)); +#line 3859 "runtime.in" + addFunc(ve, run::gen317, realArray(), "quadraticroots", formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "c", false, false)); +#line 3868 "runtime.in" + addFunc(ve, run::gen318, pairArray(), "quadraticroots", formal(primPair(), "a", false, true), formal(primPair(), "b", false, true), formal(primPair(), "c", false, true)); #line 3877 "runtime.in" - addFunc(ve, run::gen346, primTransform(), "rotate", formal(primReal(), "angle", false, false), formal(primPair(), "z", true, false)); -#line 3882 "runtime.in" - addFunc(ve, run::gen347, primTransform(), "reflect", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false)); + addFunc(ve, run::gen319, realArray(), "cubicroots", formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "c", false, false), formal(primReal(), "d", false, false)); +#line 3887 "runtime.in" + addFunc(ve, run::gen320, primBoolean(), "==", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); +#line 3895 "runtime.in" + addFunc(ve, run::gen321, primBoolean(), "!=", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); +#line 3900 "runtime.in" + addFunc(ve, run::gen322, primTransform(), "+", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); #line 3905 "runtime.in" - addFunc(ve, run::pairXPart, primReal(), "xpart", formal(primPair(), "z", false, false)); + addFunc(ve, run::gen323, primTransform(), "*", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); #line 3910 "runtime.in" - addFunc(ve, run::pairYPart, primReal(), "ypart", formal(primPair(), "z", false, false)); + addFunc(ve, run::gen324, primPair(), "*", formal(primTransform(), "t", false, false), formal(primPair(), "z", false, false)); #line 3915 "runtime.in" - addFunc(ve, run::gen353, primReal(), "length", formal(primPair(), "z", false, false)); + addFunc(ve, run::gen325, primPath(), "*", formal(primTransform(), "t", false, false), formal(primPath(), "g", false, false)); #line 3920 "runtime.in" - addFunc(ve, run::gen354, primReal(), "abs", formal(primPair(), "z", false, false)); + addFunc(ve, run::gen326, primPen(), "*", formal(primTransform(), "t", false, false), formal(primPen(), "p", false, false)); #line 3925 "runtime.in" - addFunc(ve, run::gen355, primPair(), "sqrt", formal(primPair(), "z", false, true)); + addFunc(ve, run::gen327, primPicture(), "*", formal(primTransform(), "t", false, false), formal(primPicture(), "f", false, false)); #line 3930 "runtime.in" - addFunc(ve, run::gen356, primReal(), "angle", formal(primPair(), "z", false, false), formal(primBoolean(), "warn", true, false)); -#line 3937 "runtime.in" - addFunc(ve, run::gen357, primReal(), "degrees", formal(primPair(), "z", false, false), formal(primBoolean(), "warn", true, false)); -#line 3944 "runtime.in" - addFunc(ve, run::gen358, primReal(), "radians", formal(primReal(), "degrees", false, false)); -#line 3950 "runtime.in" - addFunc(ve, run::gen359, primReal(), "degrees", formal(primReal(), "radians", false, false)); -#line 3956 "runtime.in" - addFunc(ve, run::gen360, primReal(), "Degrees", formal(primReal(), "radians", false, false)); -#line 3962 "runtime.in" - addFunc(ve, run::gen361, primReal(), "Sin", formal(primReal(), "deg", false, false)); -#line 3967 "runtime.in" - addFunc(ve, run::gen362, primReal(), "Cos", formal(primReal(), "deg", false, false)); -#line 3972 "runtime.in" - addFunc(ve, run::gen363, primReal(), "Tan", formal(primReal(), "deg", false, false)); -#line 3977 "runtime.in" - addFunc(ve, run::gen364, primReal(), "aSin", formal(primReal(), "x", false, false)); + addFunc(ve, run::gen328, primPicture(), "*", formal(realArray2(), "t", false, false), formal(primPicture(), "f", false, false)); +#line 3935 "runtime.in" + addFunc(ve, run::gen329, primTransform(), "^", formal(primTransform(), "t", false, false), formal(primInt(), "n", false, false)); #line 3982 "runtime.in" - addFunc(ve, run::gen365, primReal(), "aCos", formal(primReal(), "x", false, false)); + addFunc(ve, run::gen337, primTransform(), "shift", formal(primTransform(), "t", false, false)); #line 3987 "runtime.in" - addFunc(ve, run::gen366, primReal(), "aTan", formal(primReal(), "x", false, false)); + addFunc(ve, run::gen338, primTransform(), "shiftless", formal(primTransform(), "t", false, false)); #line 3992 "runtime.in" - addFunc(ve, run::gen367, primPair(), "unit", formal(primPair(), "z", false, false)); + addFunc(ve, run::transformIdentity, primTransform(), "identity"); #line 3997 "runtime.in" - addFunc(ve, run::gen368, primPair(), "dir", formal(primReal(), "degrees", false, false)); + addFunc(ve, run::gen340, primTransform(), "inverse", formal(primTransform(), "t", false, false)); #line 4002 "runtime.in" - addFunc(ve, run::gen369, primPair(), "dir", formal(primPair(), "z", false, true)); + addFunc(ve, run::gen341, primTransform(), "shift", formal(primPair(), "z", false, false)); #line 4007 "runtime.in" - addFunc(ve, run::gen370, primPair(), "expi", formal(primReal(), "angle", false, false)); + addFunc(ve, run::gen342, primTransform(), "shift", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); #line 4012 "runtime.in" - addFunc(ve, run::gen371, primPair(), "exp", formal(primPair(), "z", false, true)); + addFunc(ve, run::gen343, primTransform(), "xscale", formal(primReal(), "x", false, false)); #line 4017 "runtime.in" - addFunc(ve, run::gen372, primPair(), "log", formal(primPair(), "z", false, true)); + addFunc(ve, run::gen344, primTransform(), "yscale", formal(primReal(), "y", false, false)); #line 4022 "runtime.in" - addFunc(ve, run::gen373, primPair(), "sin", formal(primPair(), "z", false, true)); + addFunc(ve, run::gen345, primTransform(), "scale", formal(primReal(), "x", false, false)); #line 4027 "runtime.in" - addFunc(ve, run::gen374, primPair(), "cos", formal(primPair(), "z", false, true)); + addFunc(ve, run::gen346, primTransform(), "scale", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); #line 4032 "runtime.in" - addFunc(ve, run::gen375, primPair(), "conj", formal(primPair(), "z", false, false)); + addFunc(ve, run::gen347, primTransform(), "slant", formal(primReal(), "s", false, false)); #line 4037 "runtime.in" - addFunc(ve, run::gen376, primPair(), "realmult", formal(primPair(), "z", false, false), formal(primPair(), "w", false, false)); + addFunc(ve, run::gen348, primTransform(), "rotate", formal(primReal(), "angle", false, false), formal(primPair(), "z", true, false)); #line 4042 "runtime.in" - addFunc(ve, run::gen377, primTriple(), "realmult", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false)); -#line 4047 "runtime.in" - addFunc(ve, run::gen378, primReal(), "dot", formal(primPair(), "z", false, true), formal(primPair(), "w", false, true)); -#line 4067 "runtime.in" + addFunc(ve, run::gen349, primTransform(), "reflect", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false)); +#line 4065 "runtime.in" + addFunc(ve, run::pairXPart, primReal(), "xpart", formal(primPair(), "z", false, false)); +#line 4070 "runtime.in" + addFunc(ve, run::pairYPart, primReal(), "ypart", formal(primPair(), "z", false, false)); +#line 4075 "runtime.in" + addFunc(ve, run::gen355, primReal(), "length", formal(primPair(), "z", false, false)); +#line 4080 "runtime.in" + addFunc(ve, run::gen356, primReal(), "abs", formal(primPair(), "z", false, false)); +#line 4085 "runtime.in" + addFunc(ve, run::gen357, primPair(), "sqrt", formal(primPair(), "z", false, true)); +#line 4090 "runtime.in" + addFunc(ve, run::gen358, primReal(), "angle", formal(primPair(), "z", false, false), formal(primBoolean(), "warn", true, false)); +#line 4097 "runtime.in" + addFunc(ve, run::gen359, primReal(), "degrees", formal(primPair(), "z", false, false), formal(primBoolean(), "warn", true, false)); +#line 4104 "runtime.in" + addFunc(ve, run::gen360, primReal(), "radians", formal(primReal(), "degrees", false, false)); +#line 4110 "runtime.in" + addFunc(ve, run::gen361, primReal(), "degrees", formal(primReal(), "radians", false, false)); +#line 4116 "runtime.in" + addFunc(ve, run::gen362, primReal(), "Degrees", formal(primReal(), "radians", false, false)); +#line 4122 "runtime.in" + addFunc(ve, run::gen363, primReal(), "Sin", formal(primReal(), "deg", false, false)); +#line 4127 "runtime.in" + addFunc(ve, run::gen364, primReal(), "Cos", formal(primReal(), "deg", false, false)); +#line 4132 "runtime.in" + addFunc(ve, run::gen365, primReal(), "Tan", formal(primReal(), "deg", false, false)); +#line 4137 "runtime.in" + addFunc(ve, run::gen366, primReal(), "aSin", formal(primReal(), "x", false, false)); +#line 4142 "runtime.in" + addFunc(ve, run::gen367, primReal(), "aCos", formal(primReal(), "x", false, false)); +#line 4147 "runtime.in" + addFunc(ve, run::gen368, primReal(), "aTan", formal(primReal(), "x", false, false)); +#line 4152 "runtime.in" + addFunc(ve, run::gen369, primPair(), "unit", formal(primPair(), "z", false, false)); +#line 4157 "runtime.in" + addFunc(ve, run::gen370, primPair(), "dir", formal(primReal(), "degrees", false, false)); +#line 4162 "runtime.in" + addFunc(ve, run::gen371, primPair(), "dir", formal(primPair(), "z", false, true)); +#line 4167 "runtime.in" + addFunc(ve, run::gen372, primPair(), "expi", formal(primReal(), "angle", false, false)); +#line 4172 "runtime.in" + addFunc(ve, run::gen373, primPair(), "exp", formal(primPair(), "z", false, true)); +#line 4177 "runtime.in" + addFunc(ve, run::gen374, primPair(), "log", formal(primPair(), "z", false, true)); +#line 4182 "runtime.in" + addFunc(ve, run::gen375, primPair(), "sin", formal(primPair(), "z", false, true)); +#line 4187 "runtime.in" + addFunc(ve, run::gen376, primPair(), "cos", formal(primPair(), "z", false, true)); +#line 4192 "runtime.in" + addFunc(ve, run::gen377, primPair(), "conj", formal(primPair(), "z", false, false)); +#line 4197 "runtime.in" + addFunc(ve, run::gen378, primPair(), "realmult", formal(primPair(), "z", false, false), formal(primPair(), "w", false, false)); +#line 4202 "runtime.in" + addFunc(ve, run::gen379, primTriple(), "realmult", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false)); +#line 4207 "runtime.in" + addFunc(ve, run::gen380, primReal(), "dot", formal(primPair(), "z", false, true), formal(primPair(), "w", false, true)); +#line 4227 "runtime.in" addFunc(ve, run::tripleXPart, primReal(), "xpart", formal(primTriple(), "v", false, false)); -#line 4072 "runtime.in" +#line 4232 "runtime.in" addFunc(ve, run::tripleYPart, primReal(), "ypart", formal(primTriple(), "v", false, false)); -#line 4077 "runtime.in" +#line 4237 "runtime.in" addFunc(ve, run::tripleZPart, primReal(), "zpart", formal(primTriple(), "v", false, false)); -#line 4082 "runtime.in" - addFunc(ve, run::gen384, primTriple(), "*", formal(primReal(), "x", false, false), formal(primTriple(), "v", false, false)); -#line 4087 "runtime.in" - addFunc(ve, run::gen385, primTriple(), "*", formal(primTriple(), "v", false, false), formal(primReal(), "x", false, false)); -#line 4092 "runtime.in" - addFunc(ve, run::gen386, primTriple(), "/", formal(primTriple(), "v", false, false), formal(primReal(), "x", false, false)); -#line 4097 "runtime.in" - addFunc(ve, run::gen387, primReal(), "length", formal(primTriple(), "v", false, false)); -#line 4102 "runtime.in" - addFunc(ve, run::gen388, primReal(), "abs", formal(primTriple(), "v", false, false)); -#line 4107 "runtime.in" - addFunc(ve, run::gen389, primReal(), "polar", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false)); -#line 4113 "runtime.in" - addFunc(ve, run::gen390, primReal(), "azimuth", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false)); -#line 4119 "runtime.in" - addFunc(ve, run::gen391, primReal(), "colatitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false)); -#line 4125 "runtime.in" - addFunc(ve, run::gen392, primReal(), "latitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false)); -#line 4131 "runtime.in" - addFunc(ve, run::gen393, primReal(), "longitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false)); -#line 4138 "runtime.in" - addFunc(ve, run::gen394, primTriple(), "unit", formal(primTriple(), "v", false, false)); -#line 4143 "runtime.in" - addFunc(ve, run::gen395, primReal(), "dot", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false)); -#line 4148 "runtime.in" - addFunc(ve, run::gen396, primTriple(), "cross", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false)); -#line 4153 "runtime.in" - addFunc(ve, run::gen397, primTriple(), "expi", formal(primReal(), "polar", false, false), formal(primReal(), "azimuth", false, false)); -#line 4158 "runtime.in" - addFunc(ve, run::gen398, primTriple(), "dir", formal(primReal(), "colatitude", false, false), formal(primReal(), "longitude", false, false)); -#line 4163 "runtime.in" - addFunc(ve, run::gen399, primVoid(), "atupdate", formal(voidFunction(), "f", false, false)); -#line 4171 "runtime.in" - addFunc(ve, run::gen400, voidFunction(), "atupdate"); -#line 4176 "runtime.in" - addFunc(ve, run::gen401, primVoid(), "atexit", formal(voidFunction(), "f", false, false)); -#line 4181 "runtime.in" - addFunc(ve, run::gen402, voidFunction(), "atexit"); -#line 4186 "runtime.in" - addFunc(ve, run::gen403, primVoid(), "atbreakpoint", formal(breakpointFunction(), "f", false, false)); -#line 4191 "runtime.in" - addFunc(ve, run::gen404, primVoid(), "breakpoint", formal(primCode(), "s", true, false)); -#line 4196 "runtime.in" - addFunc(ve, run::gen405, primString() , "locatefile", formal(primString() , "file", false, false)); -#line 4201 "runtime.in" - addFunc(ve, run::gen406, primVoid(), "stop", formal(primString() , "file", false, false), formal(primInt(), "line", false, false), formal(primCode(), "s", true, false)); -#line 4209 "runtime.in" - addFunc(ve, run::gen407, primVoid(), "breakpoints"); -#line 4215 "runtime.in" - addFunc(ve, run::gen408, primVoid(), "clear", formal(primString() , "file", false, false), formal(primInt(), "line", false, false)); -#line 4221 "runtime.in" - addFunc(ve, run::gen409, primVoid(), "clear"); -#line 4226 "runtime.in" - addFunc(ve, run::gen410, primString() , "stripdirectory", formal(primString(), "s", false, false)); -#line 4232 "runtime.in" - addFunc(ve, run::gen411, primString() , "stripfile", formal(primString(), "s", false, false)); -#line 4238 "runtime.in" - addFunc(ve, run::gen412, primString() , "stripextension", formal(primString(), "s", false, false)); -#line 4244 "runtime.in" - addFunc(ve, run::gen413, primInt(), "convert", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false)); +#line 4242 "runtime.in" + addFunc(ve, run::gen386, primTriple(), "*", formal(primReal(), "x", false, false), formal(primTriple(), "v", false, false)); +#line 4247 "runtime.in" + addFunc(ve, run::gen387, primTriple(), "*", formal(primTriple(), "v", false, false), formal(primReal(), "x", false, false)); +#line 4252 "runtime.in" + addFunc(ve, run::gen388, primTriple(), "/", formal(primTriple(), "v", false, false), formal(primReal(), "x", false, false)); +#line 4257 "runtime.in" + addFunc(ve, run::gen389, primReal(), "length", formal(primTriple(), "v", false, false)); #line 4262 "runtime.in" - addFunc(ve, run::gen414, primInt(), "animate", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false)); -#line 4278 "runtime.in" - addFunc(ve, run::gen415, primInt(), "delete", formal(primString(), "s", false, false)); -#line 4288 "runtime.in" - addFunc(ve, run::gen416, primInt(), "rename", formal(primString(), "from", false, false), formal(primString(), "to", false, false)); -#line 4587 "runtime.in" - addFunc(ve, run::gen447, IntArray(), "complement", formal(IntArray(), "a", false, false), formal(primInt(), "n", false, false)); -#line 4619 "runtime.in" - addFunc(ve, run::gen449, IntArray(), "sequence", formal(primInt(), "n", false, false)); -#line 4652 "runtime.in" - addFunc(ve, run::gen452, primBoolean(), "all", formal(boolArray(), "a", false, false)); -#line 4661 "runtime.in" - addFunc(ve, run::gen453, boolArray(), "!", formal(boolArray(), "a", false, false)); -#line 4670 "runtime.in" - addFunc(ve, run::gen454, primInt(), "sum", formal(boolArray(), "a", false, false)); -#line 4833 "runtime.in" - addFunc(ve, run::gen461, primInt(), "find", formal(boolArray(), "a", false, false), formal(primInt(), "n", true, false)); -#line 4853 "runtime.in" - addFunc(ve, run::gen462, primBoolean(), "==", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false)); -#line 4898 "runtime.in" - addFunc(ve, run::gen464, realArray2(), "identity", formal(primInt(), "n", false, false)); -#line 4921 "runtime.in" - addFunc(ve, run::gen466, realArray2(), "inverse", formal(realArray2(), "a", false, false)); + addFunc(ve, run::gen390, primReal(), "abs", formal(primTriple(), "v", false, false)); +#line 4267 "runtime.in" + addFunc(ve, run::gen391, primReal(), "polar", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false)); +#line 4273 "runtime.in" + addFunc(ve, run::gen392, primReal(), "azimuth", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false)); +#line 4279 "runtime.in" + addFunc(ve, run::gen393, primReal(), "colatitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false)); +#line 4285 "runtime.in" + addFunc(ve, run::gen394, primReal(), "latitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false)); +#line 4291 "runtime.in" + addFunc(ve, run::gen395, primReal(), "longitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false)); +#line 4298 "runtime.in" + addFunc(ve, run::gen396, primTriple(), "unit", formal(primTriple(), "v", false, false)); +#line 4303 "runtime.in" + addFunc(ve, run::gen397, primReal(), "dot", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false)); +#line 4308 "runtime.in" + addFunc(ve, run::gen398, primTriple(), "cross", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false)); +#line 4313 "runtime.in" + addFunc(ve, run::gen399, primTriple(), "expi", formal(primReal(), "polar", false, false), formal(primReal(), "azimuth", false, false)); +#line 4318 "runtime.in" + addFunc(ve, run::gen400, primTriple(), "dir", formal(primReal(), "colatitude", false, false), formal(primReal(), "longitude", false, false)); +#line 4323 "runtime.in" + addFunc(ve, run::gen401, primVoid(), "atupdate", formal(voidFunction(), "f", false, false)); +#line 4331 "runtime.in" + addFunc(ve, run::gen402, voidFunction(), "atupdate"); +#line 4336 "runtime.in" + addFunc(ve, run::gen403, primVoid(), "atexit", formal(voidFunction(), "f", false, false)); +#line 4341 "runtime.in" + addFunc(ve, run::gen404, voidFunction(), "atexit"); +#line 4346 "runtime.in" + addFunc(ve, run::gen405, primVoid(), "atbreakpoint", formal(breakpointFunction(), "f", false, false)); +#line 4351 "runtime.in" + addFunc(ve, run::gen406, primVoid(), "breakpoint", formal(primCode(), "s", true, false)); +#line 4356 "runtime.in" + addFunc(ve, run::gen407, primString() , "locatefile", formal(primString() , "file", false, false)); +#line 4361 "runtime.in" + addFunc(ve, run::gen408, primVoid(), "stop", formal(primString() , "file", false, false), formal(primInt(), "line", false, false), formal(primCode(), "s", true, false)); +#line 4369 "runtime.in" + addFunc(ve, run::gen409, primVoid(), "breakpoints"); +#line 4375 "runtime.in" + addFunc(ve, run::gen410, primVoid(), "clear", formal(primString() , "file", false, false), formal(primInt(), "line", false, false)); +#line 4381 "runtime.in" + addFunc(ve, run::gen411, primVoid(), "clear"); +#line 4386 "runtime.in" + addFunc(ve, run::gen412, primString() , "stripdirectory", formal(primString(), "s", false, false)); +#line 4392 "runtime.in" + addFunc(ve, run::gen413, primString() , "stripfile", formal(primString(), "s", false, false)); +#line 4398 "runtime.in" + addFunc(ve, run::gen414, primString() , "stripextension", formal(primString(), "s", false, false)); +#line 4404 "runtime.in" + addFunc(ve, run::gen415, primInt(), "convert", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false)); +#line 4422 "runtime.in" + addFunc(ve, run::gen416, primInt(), "animate", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false)); +#line 4438 "runtime.in" + addFunc(ve, run::gen417, primInt(), "delete", formal(primString(), "s", false, false)); +#line 4448 "runtime.in" + addFunc(ve, run::gen418, primInt(), "rename", formal(primString(), "from", false, false), formal(primString(), "to", false, false)); +#line 4747 "runtime.in" + addFunc(ve, run::gen449, IntArray(), "complement", formal(IntArray(), "a", false, false), formal(primInt(), "n", false, false)); +#line 4779 "runtime.in" + addFunc(ve, run::gen451, IntArray(), "sequence", formal(primInt(), "n", false, false)); +#line 4812 "runtime.in" + addFunc(ve, run::gen454, primBoolean(), "all", formal(boolArray(), "a", false, false)); +#line 4821 "runtime.in" + addFunc(ve, run::gen455, boolArray(), "!", formal(boolArray(), "a", false, false)); +#line 4830 "runtime.in" + addFunc(ve, run::gen456, primInt(), "sum", formal(boolArray(), "a", false, false)); +#line 4993 "runtime.in" + addFunc(ve, run::gen463, primInt(), "find", formal(boolArray(), "a", false, false), formal(primInt(), "n", true, false)); #line 5013 "runtime.in" - addFunc(ve, run::gen467, realArray(), "solve", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false), formal(primBoolean(), "warn", true, false)); -#line 5064 "runtime.in" - addFunc(ve, run::gen468, realArray2(), "solve", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false), formal(primBoolean(), "warn", true, false)); -#line 5128 "runtime.in" - addFunc(ve, run::gen469, primReal(), "determinant", formal(realArray2(), "a", false, false)); -#line 5144 "runtime.in" - addFunc(ve, run::gen470, realArray(), "*", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false)); -#line 5162 "runtime.in" - addFunc(ve, run::gen471, realArray2(), "*", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false)); -#line 5197 "runtime.in" - addFunc(ve, run::gen472, primTriple(), "*", formal(realArray2(), "t", false, false), formal(primTriple(), "v", false, false)); -#line 5202 "runtime.in" - addFunc(ve, run::gen473, primPair(), "project", formal(primTriple(), "v", false, false), formal(realArray2(), "t", false, false)); -#line 5227 "runtime.in" - addFunc(ve, run::gen474, primReal(), "dot", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false)); -#line 5237 "runtime.in" - addFunc(ve, run::gen475, realArray(), "tridiagonal", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false), formal(realArray(), "c", false, false), formal(realArray(), "f", false, false)); -#line 5341 "runtime.in" - addFunc(ve, run::gen476, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x", false, false), formal(primBoolean(), "verbose", true, false)); -#line 5388 "runtime.in" - addFunc(ve, run::gen477, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x1", false, false), formal(primReal(), "x2", false, false), formal(primBoolean(), "verbose", true, false)); -#line 5470 "runtime.in" - addFunc(ve, run::gen478, primReal(), "simpson", formal(realRealFunction(), "f", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "acc", true, false), formal(primReal(), "dxmax", true, false)); -#line 5512 "runtime.in" - addFunc(ve, run::gen480, IntArray2(), "triangulate", formal(pairArray(), "z", false, false)); -#line 5547 "runtime.in" - addFunc(ve, run::gen481, primBoolean(), "==", formal(primFile(), "a", false, false), formal(primFile(), "b", false, false)); -#line 5555 "runtime.in" - addFunc(ve, run::gen482, primBoolean(), "!=", formal(primFile(), "a", false, false), formal(primFile(), "b", false, false)); -#line 5565 "runtime.in" - addFunc(ve, run::gen484, primFile(), "input", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false), formal(primString() , "comment", true, false)); -#line 5573 "runtime.in" - addFunc(ve, run::gen485, primFile(), "output", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false), formal(primString() , "comment", true, false)); -#line 5585 "runtime.in" - addFunc(ve, run::gen486, primFile(), "xinput", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false)); -#line 5599 "runtime.in" - addFunc(ve, run::gen487, primFile(), "xoutput", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false)); -#line 5617 "runtime.in" - addFunc(ve, run::gen488, primFile(), "binput", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false)); -#line 5624 "runtime.in" - addFunc(ve, run::gen489, primFile(), "boutput", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false)); -#line 5634 "runtime.in" - addFunc(ve, run::gen490, primBoolean(), "eof", formal(primFile(), "file", false, false)); -#line 5639 "runtime.in" - addFunc(ve, run::gen491, primBoolean(), "eol", formal(primFile(), "file", false, false)); -#line 5644 "runtime.in" - addFunc(ve, run::gen492, primBoolean(), "error", formal(primFile(), "file", false, false)); -#line 5649 "runtime.in" - addFunc(ve, run::gen493, primVoid(), "clear", formal(primFile(), "file", false, false)); -#line 5654 "runtime.in" - addFunc(ve, run::gen494, primVoid(), "close", formal(primFile(), "file", false, false)); -#line 5659 "runtime.in" - addFunc(ve, run::gen495, primInt(), "precision", formal(primFile(), "file", true, false), formal(primInt(), "digits", true, false)); -#line 5665 "runtime.in" - addFunc(ve, run::gen496, primVoid(), "flush", formal(primFile(), "file", false, false)); -#line 5670 "runtime.in" - addFunc(ve, run::gen497, primString() , "getc", formal(primFile(), "file", false, false)); -#line 5679 "runtime.in" - addFunc(ve, run::gen498, primInt(), "tell", formal(primFile(), "file", false, false)); -#line 5684 "runtime.in" - addFunc(ve, run::gen499, primVoid(), "seek", formal(primFile(), "file", false, false), formal(primInt(), "pos", false, false)); -#line 5689 "runtime.in" - addFunc(ve, run::gen500, primVoid(), "seekeof", formal(primFile(), "file", false, false)); -#line 5694 "runtime.in" - addFunc(ve, run::gen501, primFile(), "dimension", formal(primFile(), "file", false, false), formal(primInt(), "nx", false, false)); -#line 5701 "runtime.in" - addFunc(ve, run::gen502, primFile(), "dimension", formal(primFile(), "file", false, false), formal(primInt(), "nx", false, false), formal(primInt(), "ny", false, false)); + addFunc(ve, run::gen464, primBoolean(), "==", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false)); +#line 5058 "runtime.in" + addFunc(ve, run::gen466, realArray2(), "identity", formal(primInt(), "n", false, false)); +#line 5081 "runtime.in" + addFunc(ve, run::gen468, realArray2(), "inverse", formal(realArray2(), "a", false, false)); +#line 5173 "runtime.in" + addFunc(ve, run::gen469, realArray(), "solve", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false), formal(primBoolean(), "warn", true, false)); +#line 5224 "runtime.in" + addFunc(ve, run::gen470, realArray2(), "solve", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false), formal(primBoolean(), "warn", true, false)); +#line 5288 "runtime.in" + addFunc(ve, run::gen471, primReal(), "determinant", formal(realArray2(), "a", false, false)); +#line 5304 "runtime.in" + addFunc(ve, run::gen472, realArray(), "*", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false)); +#line 5322 "runtime.in" + addFunc(ve, run::gen473, realArray2(), "*", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false)); +#line 5357 "runtime.in" + addFunc(ve, run::gen474, primTriple(), "*", formal(realArray2(), "t", false, false), formal(primTriple(), "v", false, false)); +#line 5362 "runtime.in" + addFunc(ve, run::gen475, primPair(), "project", formal(primTriple(), "v", false, false), formal(realArray2(), "t", false, false)); +#line 5387 "runtime.in" + addFunc(ve, run::gen476, primReal(), "dot", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false)); +#line 5397 "runtime.in" + addFunc(ve, run::gen477, realArray(), "tridiagonal", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false), formal(realArray(), "c", false, false), formal(realArray(), "f", false, false)); +#line 5501 "runtime.in" + addFunc(ve, run::gen478, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x", false, false), formal(primBoolean(), "verbose", true, false)); +#line 5548 "runtime.in" + addFunc(ve, run::gen479, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x1", false, false), formal(primReal(), "x2", false, false), formal(primBoolean(), "verbose", true, false)); +#line 5630 "runtime.in" + addFunc(ve, run::gen480, primReal(), "simpson", formal(realRealFunction(), "f", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "acc", true, false), formal(primReal(), "dxmax", true, false)); +#line 5672 "runtime.in" + addFunc(ve, run::gen482, IntArray2(), "triangulate", formal(pairArray(), "z", false, false)); #line 5707 "runtime.in" - addFunc(ve, run::gen503, primFile(), "dimension", formal(primFile(), "file", false, false), formal(primInt(), "nx", false, false), formal(primInt(), "ny", false, false), formal(primInt(), "nz", false, false)); -#line 5713 "runtime.in" - addFunc(ve, run::gen504, primFile(), "csv", formal(primFile(), "file", false, false), formal(primBoolean(), "b", true, false)); -#line 5720 "runtime.in" - addFunc(ve, run::gen505, primFile(), "word", formal(primFile(), "file", false, false), formal(primBoolean(), "b", true, false)); -#line 5727 "runtime.in" - addFunc(ve, run::gen506, primFile(), "line", formal(primFile(), "file", false, false), formal(primBoolean(), "b", true, false)); -#line 5734 "runtime.in" - addFunc(ve, run::gen507, primFile(), "single", formal(primFile(), "file", false, false), formal(primBoolean(), "b", true, false)); -#line 5742 "runtime.in" - addFunc(ve, run::gen508, primFile(), "single", formal(primFile(), "file", false, false), formal(primReal(), "x", false, false), formal(primBoolean(), "b", true, false)); -#line 5750 "runtime.in" - addFunc(ve, run::gen509, primFile(), "single", formal(primFile(), "file", false, false), formal(primInt(), "x", false, false), formal(primBoolean(), "b", true, false)); -#line 5758 "runtime.in" - addFunc(ve, run::gen510, primFile(), "read1", formal(primFile(), "file", false, false)); -#line 5765 "runtime.in" - addFunc(ve, run::gen511, primFile(), "read2", formal(primFile(), "file", false, false)); -#line 5772 "runtime.in" - addFunc(ve, run::gen512, primFile(), "read3", formal(primFile(), "file", false, false)); -#line 5779 "runtime.in" - addFunc(ve, run::gen513, stringArray(), "history", formal(primString() , "name", false, false), formal(primInt(), "n", true, false)); -#line 5812 "runtime.in" - addFunc(ve, run::gen514, stringArray(), "history", formal(primInt(), "n", true, false)); -#line 5823 "runtime.in" - addFunc(ve, run::gen515, primString() , "readline", formal(primString() , "prompt", true, false), formal(primString() , "name", true, false), formal(primBoolean(), "tabcompletion", true, false)); + addFunc(ve, run::gen483, primBoolean(), "==", formal(primFile(), "a", false, false), formal(primFile(), "b", false, false)); +#line 5715 "runtime.in" + addFunc(ve, run::gen484, primBoolean(), "!=", formal(primFile(), "a", false, false), formal(primFile(), "b", false, false)); +#line 5725 "runtime.in" + addFunc(ve, run::gen486, primFile(), "input", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false), formal(primString() , "comment", true, false)); +#line 5733 "runtime.in" + addFunc(ve, run::gen487, primFile(), "output", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false), formal(primString() , "comment", true, false)); +#line 5745 "runtime.in" + addFunc(ve, run::gen488, primFile(), "xinput", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false)); +#line 5759 "runtime.in" + addFunc(ve, run::gen489, primFile(), "xoutput", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false)); +#line 5777 "runtime.in" + addFunc(ve, run::gen490, primFile(), "binput", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false)); +#line 5784 "runtime.in" + addFunc(ve, run::gen491, primFile(), "boutput", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false)); +#line 5794 "runtime.in" + addFunc(ve, run::gen492, primBoolean(), "eof", formal(primFile(), "file", false, false)); +#line 5799 "runtime.in" + addFunc(ve, run::gen493, primBoolean(), "eol", formal(primFile(), "file", false, false)); +#line 5804 "runtime.in" + addFunc(ve, run::gen494, primBoolean(), "error", formal(primFile(), "file", false, false)); +#line 5809 "runtime.in" + addFunc(ve, run::gen495, primVoid(), "clear", formal(primFile(), "file", false, false)); +#line 5814 "runtime.in" + addFunc(ve, run::gen496, primVoid(), "close", formal(primFile(), "file", false, false)); +#line 5819 "runtime.in" + addFunc(ve, run::gen497, primInt(), "precision", formal(primFile(), "file", true, false), formal(primInt(), "digits", true, false)); +#line 5825 "runtime.in" + addFunc(ve, run::gen498, primVoid(), "flush", formal(primFile(), "file", false, false)); +#line 5830 "runtime.in" + addFunc(ve, run::gen499, primString() , "getc", formal(primFile(), "file", false, false)); +#line 5839 "runtime.in" + addFunc(ve, run::gen500, primInt(), "tell", formal(primFile(), "file", false, false)); +#line 5844 "runtime.in" + addFunc(ve, run::gen501, primVoid(), "seek", formal(primFile(), "file", false, false), formal(primInt(), "pos", false, false)); +#line 5849 "runtime.in" + addFunc(ve, run::gen502, primVoid(), "seekeof", formal(primFile(), "file", false, false)); +#line 5854 "runtime.in" + addFunc(ve, run::gen503, primFile(), "dimension", formal(primFile(), "file", false, false), formal(primInt(), "nx", false, false)); +#line 5861 "runtime.in" + addFunc(ve, run::gen504, primFile(), "dimension", formal(primFile(), "file", false, false), formal(primInt(), "nx", false, false), formal(primInt(), "ny", false, false)); #line 5867 "runtime.in" - addFunc(ve, run::gen516, primVoid(), "saveline", formal(primString() , "name", false, false), formal(primString() , "value", false, false), formal(primBoolean(), "store", true, false)); -#line 5897 "runtime.in" - addFunc(ve, run::gen517, primVoid(), "generate_random_backtrace"); -#line 5906 "runtime.in" - addFunc(ve, run::gen518, primVoid(), "print_random_addresses", formal(primInt(), "n", true, false)); + addFunc(ve, run::gen505, primFile(), "dimension", formal(primFile(), "file", false, false), formal(primInt(), "nx", false, false), formal(primInt(), "ny", false, false), formal(primInt(), "nz", false, false)); +#line 5873 "runtime.in" + addFunc(ve, run::gen506, primFile(), "csv", formal(primFile(), "file", false, false), formal(primBoolean(), "b", true, false)); +#line 5880 "runtime.in" + addFunc(ve, run::gen507, primFile(), "word", formal(primFile(), "file", false, false), formal(primBoolean(), "b", true, false)); +#line 5887 "runtime.in" + addFunc(ve, run::gen508, primFile(), "line", formal(primFile(), "file", false, false), formal(primBoolean(), "b", true, false)); +#line 5894 "runtime.in" + addFunc(ve, run::gen509, primFile(), "single", formal(primFile(), "file", false, false), formal(primBoolean(), "b", true, false)); +#line 5902 "runtime.in" + addFunc(ve, run::gen510, primFile(), "single", formal(primFile(), "file", false, false), formal(primReal(), "x", false, false), formal(primBoolean(), "b", true, false)); +#line 5910 "runtime.in" + addFunc(ve, run::gen511, primFile(), "single", formal(primFile(), "file", false, false), formal(primInt(), "x", false, false), formal(primBoolean(), "b", true, false)); +#line 5918 "runtime.in" + addFunc(ve, run::gen512, primFile(), "read1", formal(primFile(), "file", false, false)); +#line 5925 "runtime.in" + addFunc(ve, run::gen513, primFile(), "read2", formal(primFile(), "file", false, false)); +#line 5932 "runtime.in" + addFunc(ve, run::gen514, primFile(), "read3", formal(primFile(), "file", false, false)); +#line 5939 "runtime.in" + addFunc(ve, run::gen515, stringArray(), "history", formal(primString() , "name", false, false), formal(primInt(), "n", true, false)); +#line 5972 "runtime.in" + addFunc(ve, run::gen516, stringArray(), "history", formal(primInt(), "n", true, false)); +#line 5983 "runtime.in" + addFunc(ve, run::gen517, primString() , "readline", formal(primString() , "prompt", true, false), formal(primString() , "name", true, false), formal(primBoolean(), "tabcompletion", true, false)); +#line 6027 "runtime.in" + addFunc(ve, run::gen518, primVoid(), "saveline", formal(primString() , "name", false, false), formal(primString() , "value", false, false), formal(primBoolean(), "store", true, false)); +#line 6057 "runtime.in" + addFunc(ve, run::gen519, primVoid(), "generate_random_backtrace"); +#line 6066 "runtime.in" + addFunc(ve, run::gen520, primVoid(), "print_random_addresses", formal(primInt(), "n", true, false)); } } // namespace trans diff --git a/Build/source/utils/asymptote/runtime.in b/Build/source/utils/asymptote/runtime.in index f0136b0bfd9..5400ed6be6a 100644 --- a/Build/source/utils/asymptote/runtime.in +++ b/Build/source/utils/asymptote/runtime.in @@ -408,6 +408,81 @@ double *copyArray2C(array *a, bool square=true, size_t dim2=0) return c; } +triple *copyTripleArray2C(array *a, bool square=true, size_t dim2=0) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2 << endl; + error(buf); + } + + triple *c=new triple[n*m]; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + triple *ci=c+i*m; + for(size_t j=0; j < m; j++) + ci[j]=read<triple>(ai,j); + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } + return c; +} + +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0) +{ + size_t n=checkArray(a); + size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); + if(n > 0 && dim2 && m != dim2) { + ostringstream buf; + buf << "second matrix dimension must be " << dim2 << endl; + error(buf); + } + + size_t nm=n*m; + double *cx=new double[3*nm]; + double *cy=cx+nm; + double *cz=cx+2*nm; + for(size_t i=0; i < n; i++) { + array *ai=read<array*>(a,i); + size_t aisize=checkArray(ai); + if(aisize == m) { + double *xi=cx+i*m; + double *yi=cy+i*m; + double *zi=cz+i*m; + for(size_t j=0; j < m; j++) { + triple v=read<triple>(ai,j); + xi[j]=v.getx(); + yi[j]=v.gety(); + zi[j]=v.getz(); + } + } else + error(square ? "matrix must be square" : "matrix must be rectangular"); + } + return cx; +} + +double norm(double *a, size_t n) +{ + if(n == 0) return 0.0; + double M=fabs(a[0]); + for(size_t i=1; i < n; ++i) + M=::max(M,fabs(a[i])); + return M; +} + +double norm(triple *a, size_t n) +{ + if(n == 0) return 0.0; + double M=a[0].abs2(); + for(size_t i=1; i < n; ++i) + M=::max(M,a[i].abs2()); + return sqrt(M); +} + static const char *incommensurate="Incommensurate matrices"; static const char *singular="Singular matrix"; static size_t *pivot,*Row,*Col; @@ -910,9 +985,8 @@ array *readpath(const string& psname, bool keep, while(true) { string out; gs >> out; + if(out.empty() && !gs.running()) break; buf << out; - string s=buf.str(); - if(gs.tailequals(s.c_str(),s.size(),"E",1)) break; } if(verbose > 2) cout << endl; @@ -1206,49 +1280,88 @@ patharray *_texpath(string *s, pen p=CURRENTPEN) string prefix=outname(); spaceToUnderscore(prefix); string psname=auxname(prefix,"ps"); - string texname=auxname(prefix,"tex"); string dviname=auxname(prefix,"dvi"); bbox b; - texfile tex(texname,b,true); + bool pdf=settings::pdf(getSetting<string>("tex")); + texfile tex(texname,b); tex.miniprologue(); - tex.setfont(p); - tex.verbatimline("\\special{ps:"); - tex.verbatimline(ASYo); - tex.verbatimline("/ASY1 true def"); - tex.verbatimline("/v {neg exch 4 copy 4 2 roll 2 copy 6 2 roll 2 copy (M) print ASYo ASYo (L) print ASYo add ASYo (L) print add ASYo add ASYo (L) print add ASYo ASYo (c) print} bind def"); - tex.verbatimline("/show {ASY1 {(Z) "+currentpoint+ - "/ASY1 false def} if currentpoint newpath moveto false charpath "+ - pathforall+"} bind def}"); - tex.verbatim(*s); - tex.verbatimline("\\special{ps: (E) print}"); + + if(!pdf) { + tex.verbatimline("\\special{ps:"); + tex.verbatimline(ASYo); + tex.verbatimline("/ASY1 true def"); + tex.verbatimline("/v {neg exch 4 copy 4 2 roll 2 copy 6 2 roll 2 copy (M) print ASYo ASYo (L) print ASYo add ASYo (L) print add ASYo add ASYo (L) print add ASYo ASYo (c) print} bind def"); + tex.verbatimline("/show {ASY1 {(Z) "+currentpoint+ + "/ASY1 false def} if currentpoint newpath moveto false charpath "+ + pathforall+"} bind def}"); + } + tex.verbatimline(*s); tex.epilogue(true); tex.close(); - ostringstream cmd; + // TODO: Put in common subproutine (cf. teprocess). string aux=auxname(prefix,"aux"); unlink(aux.c_str()); - cmd << texprogram(true) << " \\nonstopmode\\input '" << texname << "'"; + string program=texprogram(); + ostringstream cmd; + bool context=settings::context(getSetting<string>("tex")); + cmd << program << (context ? " --nonstopmode '" : + " \\nonstopmode\\input '") << texname << "'"; bool quiet=verbose <= 2; - int status=System(cmd,quiet ? 1 : 0,"texpath",texpathmessage()); + int status=System(cmd,quiet ? 1 : 0,true,"texpath",texpathmessage()); if(!status && getSetting<bool>("twice")) - status=System(cmd,quiet ? 1 : 0,"texpath",texpathmessage()); + status=System(cmd,quiet ? 1 : 0,true,"texpath",texpathmessage()); if(status) { if(quiet) { ostringstream cmd; - cmd << texprogram(true) << " \\scrollmode\\input '" << texname << "'"; + cmd << program << (context ? " --scrollmode '" : + " \\scrollmode\\input '") << texname << "'"; System(cmd,0); } } - if(!status) { - ostringstream cmd; - cmd << "'" << getSetting<string>("dvips") << "' -R -Pdownload35 -D600 " - << getSetting<string>("dvipsOptions"); - if(verbose <= 2) cmd << " -q"; - cmd << " -o '" << psname << "' '" << dviname << "'"; - status=System(cmd,0,true,"dvips"); + string pdfname; + if(!status) { + if(pdf) { + pdfname=auxname(prefix,"pdf"); + std::ofstream ps(psname.c_str()); + if(!ps) cannotwrite(psname); + + ps << ASYo << newl + << "/ASY1 true def" << newl + << "/fill {ASY1 {(Z) " << currentpoint << "/ASY1 false def} if " + << pathforall << " (M) " << currentpoint + << "currentpoint newpath moveto } bind def" << newl + << "/stroke {ASY1 {(Z) " << currentpoint + << "/ASY1 false def} if strokepath " + << pathforall << " (M) " << currentpoint + << "currentpoint newpath moveto } bind def" << newl; + + ostringstream cmd; + cmd << "'" << getSetting<string>("gs") + << "' -q -dNOCACHE -dNOPAUSE -dBATCH"; + if(safe) cmd << " -dSAFER"; + cmd << " -sDEVICE=epswrite -sOutputFile=- '" << pdfname << "'"; + iopipestream gs(cmd.str().c_str(),"gs","Ghostscript"); + + gs.block(false); + while(true) { + string line; + gs >> line; + if(line.empty() && !gs.running()) break; + ps << line; + } + ps.close(); + } else { + ostringstream cmd; + cmd << "'" << getSetting<string>("dvips") << "' -R -Pdownload35 -D600 " + << getSetting<string>("dvipsOptions"); + if(verbose <= 2) cmd << " -q"; + cmd << " -o '" << psname << "' '" << dviname << "'"; + status=System(cmd,0,true,"dvips"); + } } if(status != 0) @@ -1260,9 +1373,18 @@ patharray *_texpath(string *s, pen p=CURRENTPEN) if(!getSetting<bool>("keepaux")) unlink(aux.c_str()); unlink(auxname(prefix,"log").c_str()); - unlink(dviname.c_str()); + if(pdf) + unlink(pdfname.c_str()); + else + unlink(dviname.c_str()); + if(context) { + unlink(auxname(prefix,"top").c_str()); + unlink(auxname(prefix,"tua").c_str()); + unlink(auxname(prefix,"tui").c_str()); + } } - return readpath(psname,keep,twelvepercent,-twelvepercent); + return readpath(psname,keep,twelvepercent, + pdf ? twelvepercent : -twelvepercent); } patharray *textpath(string *s, pen p=CURRENTPEN) @@ -1270,7 +1392,6 @@ patharray *textpath(string *s, pen p=CURRENTPEN) array *P=new array(0); if(s->empty()) return P; - int status=0; string prefix=outname(); spaceToUnderscore(prefix); string outputname=auxname(prefix,getSetting<string>("textoutputtype")); @@ -1280,63 +1401,61 @@ patharray *textpath(string *s, pen p=CURRENTPEN) if(!text) cannotwrite(textname); - text << getSetting<string>("textprologue"); - text << p.Font() << endl; - text << *s; - text << getSetting<string>("textepilogue"); + text << getSetting<string>("textprologue") << newl + << p.Font() << newl + << *s << newl + << getSetting<string>("textepilogue") << endl; text.close(); - ostringstream cmd; - string textcommand=getSetting<string>("textcommand"); - cmd << textcommand << " '" << textname << "' '" - << outputname << "'"; - bool quiet=verbose <= 2; - status=System(cmd,quiet ? 1 : 0); - - string epsname=auxname(prefix,"eps"); - - if(status == 0) { - ostringstream cmd; - cmd << "'" << getSetting<string>("gs") - << "' -q -dNOCACHE -dNOPAUSE -dBATCH"; - if(safe) cmd << " -dSAFER"; - cmd << " -sDEVICE=epswrite -sOutputFile='" << epsname << "' '" - << outputname << "'"; - status=System(cmd,0,true,"gs"); - } - - if(status != 0) - error("textpath failed"); - - string psname=auxname(prefix+"_","ps"); - std::ifstream eps(epsname.c_str()); + string psname=auxname(prefix,"ps"); std::ofstream ps(psname.c_str()); - - if(!eps) cannotread(epsname); if(!ps) cannotwrite(psname); - ps << ASYo << endl - << "/ASY1 true def" << endl + ps << ASYo << newl + << "/ASY1 true def" << newl << "/fill {ASY1 {(Z) " << currentpoint << "/ASY1 false def} if " << pathforall << " (M) " << currentpoint - << "currentpoint newpath moveto } bind def" << endl + << "currentpoint newpath moveto } bind def" << newl << "/stroke {ASY1 {(Z) " << currentpoint << "/ASY1 false def} if strokepath " << pathforall << " (M) " << currentpoint << "currentpoint newpath moveto } bind def" << endl; - string line; - while(getline(eps,line)) - ps << line << endl; - ps << "(E) print" << endl; - eps.close(); + + ostringstream pipe; + pipe << getSetting<string>("textcommand") << " '" << textname << "'"; + iopipestream typesetter(pipe.str().c_str()); + + ostringstream pipe2; + pipe2 << "'" << getSetting<string>("gs") + << "' -q -dNOCACHE -dNOPAUSE -dBATCH"; + if(safe) pipe2 << " -dSAFER"; + pipe2 << " -sDEVICE=epswrite -sOutputFile=- -"; + iopipestream gs(pipe2.str().c_str(),"gs","Ghostscript"); + gs.block(false); + + // TODO: Simplify by connecting the pipes directly. + while(true) { + string out; + if(typesetter.isopen()) { + typesetter >> out; + if(!out.empty()) gs << out; + else if(!typesetter.running()) { + typesetter.pipeclose(); + gs.eof(); + } + } + string out2; + gs >> out2; + if(out2.empty() && !gs.running()) break; + ps << out2; + } ps.close(); - + + if(verbose > 2) cout << endl; + bool keep=getSetting<bool>("keep"); - if(!keep) { // Delete temporary files. + if(!keep) // Delete temporary files. unlink(textname.c_str()); - unlink(outputname.c_str()); - unlink(epsname.c_str()); - } return readpath(psname,keep,tenpercent,tenpercent); } @@ -1358,7 +1477,7 @@ patharray *_strokepath(path g, pen p=CURRENTPEN) ps.write(g); ps.strokepath(); ps.stroke(); - ps.verbatimline("(M) "+currentpoint+"(E) print"); + ps.verbatimline("(M) "+currentpoint); ps.epilogue(); ps.close(); return readpath(psname,getSetting<bool>("keep")); @@ -2408,8 +2527,8 @@ realarray* intersect(path p, path q, real fuzz=-1) (*V)[0]=s; (*V)[1]=t; return V; - } else - return new array(0); + } + return new array(0); } realarray2* intersections(path p, path q, real fuzz=-1) @@ -2772,6 +2891,40 @@ realarray2* intersections(path3 p, path3 q, real fuzz=-1) return V; } +realarray2* intersections(path3 p, triplearray2 *P, real fuzz=-1) +{ + triple *A=copyTripleArray2C(P,true,4); + if(fuzz <= 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), + norm(A,16)); + std::vector<real> T,U,V; + intersections(T,U,V,p,A,fuzz); + delete[] A; + size_t n=T.size(); + array *W=new array(n); + for(size_t i=0; i < n; ++i) { + array *Wi=new array(3); + (*W)[i]=Wi; + (*Wi)[0]=T[i]; + (*Wi)[1]=U[i]; + (*Wi)[2]=V[i]; + } + return W; // Sorting will done in asy. +} + +realarray* intersections(triple v, triplearray2 *P, real fuzz=-1) +{ + triple *A=copyTripleArray2C(P,true,4); + if(fuzz <= 0) fuzz=BigFuzz*::max(length(v),norm(A,16)); + real U,V; + if(intersections(U,V,v,A,fuzz)) { + array *W=new array(2); + (*W)[0]=U; + (*W)[1]=V; + return W; + } + return new array(0); +} + Int size(path3 p) { return p.size(); @@ -3073,7 +3226,8 @@ guide *reverse(guide *g) void _draw(picture *f, path3 g, pen p) { - f->append(new drawPath3(g,p)); + if(g.size() > 0) + f->append(new drawPath3(g,p)); } void draw(picture *f, triplearray2 *g, bool straight, penarray *p, real opacity, @@ -3120,39 +3274,45 @@ pair maxratio(picture *f) return f->bounds(::max,xratio,yratio); } -real minbound(realarray *a, real b) +triple minbound(triplearray2 *P, triple b) { - real *A=copyArrayC(a,16); - b=bound(A,::min,b); + 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)), + bound(A+32,::min,b.getz(),sqrtFuzz*norm(A+32,16))); delete[] A; return b; } -real maxbound(realarray *a, real b) +triple maxbound(triplearray2 *P, triple b) { - real *A=copyArrayC(a,16); - b=bound(A,::max,b); + 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)), + bound(A+32,::max,b.getz(),sqrtFuzz*norm(A+32,16))); delete[] A; return b; } -pair minbound(triplearray *a, realarray2 *t, pair b) +pair minbound(triplearray2 *P, realarray2 *t, pair b) { - triple *A=copyTripleArrayC(a,16); + triple *A=copyTripleArray2C(P,true,4); real *T=copyArray2C(t,4); - b=pair(bound(A,::min,xproject,T,b.getx()), - bound(A,::min,yproject,T,b.gety())); + real fuzz=sqrtFuzz*norm(A,16); + b=pair(bound(A,::min,xproject,T,b.getx(),fuzz), + bound(A,::min,yproject,T,b.gety(),fuzz)); delete[] T; delete[] A; return b; } -pair maxbound(triplearray *a, realarray2 *t, pair b) +pair maxbound(triplearray2 *P, realarray2 *t, pair b) { - triple *A=copyTripleArrayC(a,16); + triple *A=copyTripleArray2C(P,true,4); real *T=copyArray2C(t,4); - b=pair(bound(A,::max,xproject,T,b.getx()), - bound(A,::max,yproject,T,b.gety())); + real fuzz=sqrtFuzz*norm(A,16); + b=pair(bound(A,::max,xproject,T,b.getx(),fuzz), + bound(A,::max,yproject,T,b.gety(),fuzz)); delete[] T; delete[] A; return b; diff --git a/Build/source/utils/asymptote/settings.cc b/Build/source/utils/asymptote/settings.cc index 73735e297f1..8dffeb7d453 100644 --- a/Build/source/utils/asymptote/settings.cc +++ b/Build/source/utils/asymptote/settings.cc @@ -607,6 +607,27 @@ struct alignSetting : public argumentSetting { } }; +// For setting the alignment of a figure on the page. +struct engineSetting : public argumentSetting { + engineSetting(string name, char code, + string argname, string desc, + string defaultValue) + : argumentSetting(name, code, argname, description(desc,defaultValue), + types::primString(), (item)defaultValue) {} + + bool getOption() { + string str=optarg; + + if(str == "latex" || str == "pdflatex" || str == "xelatex" || + str == "tex" || str == "pdftex" || str == "context" || str == "none") { + value=str; + return true; + } + error("invalid argument for option"); + return false; + } +}; + template<class T> string stringCast(T x) { @@ -978,7 +999,7 @@ void initSettings() { addOption(new boolSetting("debug", 'd', "Enable debugging messages")); addOption(new incrementSetting("verbose", 'v', - "Increase verbosity level", &verbose)); + "Increase verbosity level (can specify multiple times)", &verbose)); // Resolve ambiguity with --version addOption(new incrementOption("vv", 0,"", &verbose,2)); addOption(new incrementOption("novv", 0,"", &verbose,-2)); @@ -986,9 +1007,10 @@ void initSettings() { addOption(new boolSetting("keep", 'k', "Keep intermediate files")); addOption(new boolSetting("keepaux", 0, "Keep intermediate LaTeX .aux files")); - addOption(new stringSetting("tex", 0,"engine", - "latex|pdflatex|xelatex|tex|pdftex|none", + addOption(new engineSetting("tex", 0, "engine", + "latex|pdflatex|xelatex|tex|pdftex|context|none", "latex")); + addOption(new boolSetting("twice", 0, "Run LaTeX twice (to resolve references)")); addOption(new boolSetting("inlinetex", 0, "Generate inline TeX code")); @@ -1101,7 +1123,6 @@ void initSettings() { addOption(new envSetting("gs", defaultGhostscript)); addOption(new envSetting("texpath", "")); addOption(new envSetting("texcommand", "")); - addOption(new envSetting("texdvicommand", "")); addOption(new envSetting("dvips", "dvips")); addOption(new envSetting("convert", "convert")); addOption(new envSetting("display", defaultDisplay)); @@ -1111,11 +1132,10 @@ void initSettings() { addOption(new envSetting("papertype", "letter")); addOption(new envSetting("dir", "")); addOption(new envSetting("sysdir", systemDir)); - addOption(new envSetting("textcommand", - "sh -c 'groff -e -P-b16 $1 > $2' groff ")); + addOption(new envSetting("textcommand","groff -e -P-b16")); addOption(new envSetting("textextension", "roff")); addOption(new envSetting("textoutputtype", "ps")); - addOption(new envSetting("textprologue", ".EQ\ndelim $$\n.EN\n")); + addOption(new envSetting("textprologue", ".EQ\ndelim $$\n.EN")); addOption(new envSetting("textinitialfont", ".fam T\n.ps 12")); addOption(new envSetting("textepilogue", "")); } @@ -1178,6 +1198,10 @@ void setPath() { pipe >> sysdir; size_t size=sysdir.size(); if(size > 2) { +// Workaround broken header file on i386-solaris with g++ 3.4.3. +#ifdef erase +#undef erase +#endif sysdir.erase(size-1,1); sysdir.append(dirsep+"texmf/asymptote"); Setting("sysdir")=sysdir; @@ -1209,16 +1233,22 @@ void SetPageDimensions() { } } -bool xelatex(const string& texengine) { +bool xe(const string& texengine) { return texengine == "xelatex"; } +bool context(const string& texengine) { + return texengine == "context"; +} + bool pdf(const string& texengine) { - return texengine == "pdflatex" || texengine == "pdftex" || xelatex(texengine); + return texengine == "pdflatex" || texengine == "pdftex" || xe(texengine) + || context(texengine); } bool latex(const string& texengine) { - return texengine == "latex" || texengine == "pdflatex" || xelatex(texengine); + return texengine == "latex" || texengine == "pdflatex" || + texengine == "xelatex"; } string nativeformat() { @@ -1230,10 +1260,26 @@ string defaultformat() { return (format == "") ? nativeformat() : format; } +// Begin TeX put command. +const char *beginput(const string& texengine) { + if(context(texengine)) + return "\\put"; + else + return "\\put(#1,#2)"; +} + +// End TeX put command. +const char *endput(const string& texengine) { + if(context(texengine)) + return " at #1 #2"; + else + return ""; +} + // TeX special command to set up currentmatrix for typesetting labels. const char *beginlabel(const string& texengine) { if(pdf(texengine)) - return xelatex(texengine) ? "\\special{pdf:literal q #5 0 0 cm}" : + return xe(texengine) ? "\\special{pdf:literal q #5 0 0 cm}" : "\\special{pdf:q #5 0 0 cm}"; else return "\\special{ps:gsave currentpoint currentpoint translate [#5 0 0] " @@ -1243,7 +1289,7 @@ const char *beginlabel(const string& texengine) { // TeX special command to restore currentmatrix after typesetting labels. const char *endlabel(const string& texengine) { if(pdf(texengine)) - return xelatex(texengine) ? "\\special{pdf:literal Q}" : "\\special{pdf:Q}"; + return xe(texengine) ? "\\special{pdf:literal Q}" : "\\special{pdf:Q}"; else return "\\special{ps:currentpoint grestore moveto}"; } @@ -1264,6 +1310,8 @@ const char *rawpostscript(const string& texengine) { const char *beginpicture(const string& texengine) { if(latex(texengine)) return "\\begin{picture}"; + if(context(texengine)) + return "%"; else return "\\picture"; } @@ -1272,6 +1320,8 @@ const char *beginpicture(const string& texengine) { const char *endpicture(const string& texengine) { if(latex(texengine)) return "\\end{picture}%"; + else if(context(texengine)) + return "%"; else return "\\endpicture%"; } @@ -1279,8 +1329,9 @@ const char *endpicture(const string& texengine) { // Begin TeX special command. const char *beginspecial(const string& texengine) { if(pdf(texengine)) - return xelatex(texengine) ? "\\special{pdf:literal " : "\\special{pdf:"; - return "\\special{ps:"; + return xe(texengine) ? "\\special{pdf:literal " : "\\special{pdf:"; + else + return "\\special{ps:"; } // End TeX special command. @@ -1291,7 +1342,7 @@ const char *endspecial() { // Default TeX units. const char *texunits(const string& texengine) { - return xelatex(texengine) ? "bp" : "pt"; + return xe(texengine) ? "bp" : "pt"; } @@ -1305,22 +1356,16 @@ const char **texabort(const string& texengine) return settings::pdf(texengine) ? pdftexerrors : texerrors; } -string texcommand(bool ps) +string texcommand() { - string command; - if(ps) { - command=getSetting<string>("texdvicommand"); - if(command == "") - command=latex(getSetting<string>("tex")) ? "latex" : "tex"; - } else - command=getSetting<string>("texcommand"); + string command=getSetting<string>("texcommand"); return command.empty() ? getSetting<string>("tex") : command; } -string texprogram(bool ps) +string texprogram() { string path=getSetting<string>("texpath"); - string engine=texcommand(ps); + string engine=texcommand(); if(!path.empty()) engine=(string) (path+"/"+engine); string program="'"+engine+"'"; string dir=stripFile(outname()); diff --git a/Build/source/utils/asymptote/settings.h b/Build/source/utils/asymptote/settings.h index 5a06acb7d8f..3e51fc3c9ea 100644 --- a/Build/source/utils/asymptote/settings.h +++ b/Build/source/utils/asymptote/settings.h @@ -93,10 +93,13 @@ Int getScroll(); bool pdf(const string& texengine); bool latex(const string& texengine); +bool context(const string& texengine); string nativeformat(); string defaultformat(); +const char *beginput(const string& texengine); +const char *endput(const string& texengine); const char *beginlabel(const string& texengine); const char *endlabel(const string& texengine); const char *rawpostscript(const string& texengine); @@ -109,8 +112,8 @@ const char *texunits(const string& texengine); extern bool fataltex[]; const char **texabort(const string& texengine); -string texcommand(bool ps=false); -string texprogram(bool ps=false); +string texcommand(); +string texprogram(); const double inches=72; const double cm=inches/2.54; diff --git a/Build/source/utils/asymptote/texfile.cc b/Build/source/utils/asymptote/texfile.cc index b8efab74dd0..f83f8d35aec 100644 --- a/Build/source/utils/asymptote/texfile.cc +++ b/Build/source/utils/asymptote/texfile.cc @@ -43,8 +43,12 @@ texfile::~texfile() void texfile::miniprologue() { texpreamble(*out,processData().TeXpreamble,false,true); - *out << "\\pagestyle{empty}" << newl; - *out << "\\begin{document}" << newl; + if(settings::latex(texengine)) { + *out << "\\pagestyle{empty}" << newl; + *out << "\\begin{document}" << newl; + } else if(settings::context(texengine)) { + *out << "\\setuppagenumbering[location=]" << endl; + } texfontencoding(*out); } @@ -63,30 +67,37 @@ void texfile::prologue() texdefines(*out,processData().TeXpreamble,false); double width=box.right-box.left; double height=box.top-box.bottom; - if(settings::pdf(texengine) && !inlinetex) { - double voffset=0.0; - if(settings::latex(texengine)) { - if(height < 12.0) voffset=height-12.0; - } else if(height < 10.0) voffset=height-10.0; + if(!inlinetex) { + if(settings::context(texengine)) { + *out << "\\definepapersize[asy][width=" << width << "bp,height=" + << height << "bp]" << newl + << "\\setuppapersize[asy][asy]" << newl; + } else if(settings::pdf(texengine)) { + double voffset=0.0; + if(settings::latex(texengine)) { + if(height < 12.0) voffset=height-12.0; + } else if(height < 10.0) voffset=height-10.0; - // Work around an apparent xelatex dimension bug - double xelatexBug=ps2tex; + // Work around an apparent xelatex dimension bug + double xelatexBug=ps2tex; - if(width > 0) - *out << "\\pdfpagewidth=" << width << "bp" << newl; - *out << "\\ifx\\pdfhorigin\\undefined" << newl - << "\\hoffset=-1in" << newl - << "\\voffset=" << voffset-72.0*xelatexBug << "bp" << newl; - if(height > 0) - *out << "\\pdfpageheight=" << height*0.5*(1.0+xelatexBug) << "bp" - << newl; - *out << "\\else" << newl - << "\\pdfhorigin=0bp" << newl - << "\\pdfvorigin=" << voffset << "bp" << newl; - if(height > 0) - *out << "\\pdfpageheight=" << height << "bp" << newl; - *out << "\\fi" << endl; + if(width > 0) + *out << "\\pdfpagewidth=" << width << "bp" << newl; + *out << "\\ifx\\pdfhorigin\\undefined" << newl + << "\\hoffset=-1in" << newl + << "\\voffset=" << voffset-72.0*xelatexBug << "bp" << newl; + if(height > 0) + *out << "\\pdfpageheight=" << height*0.5*(1.0+xelatexBug) << "bp" + << newl; + *out << "\\else" << newl + << "\\pdfhorigin=0bp" << newl + << "\\pdfvorigin=" << voffset << "bp" << newl; + if(height > 0) + *out << "\\pdfpageheight=" << height << "bp" << newl; + *out << "\\fi" << newl; + } } + if(settings::latex(texengine)) { *out << "\\setlength{\\unitlength}{1pt}" << newl; if(!inlinetex) { @@ -101,13 +112,21 @@ void texfile::prologue() } } else { if(!inlinetex) { - *out << "\\footline={}" << newl; - if(settings::pdf(texengine)) { - *out << "\\hoffset=-20pt" << newl - << "\\voffset=0pt" << newl; + if(settings::context(texengine)) { + *out << "\\setuplayout[width=16383pt,height=16383pt," + << "backspace=0pt,topspace=0pt," + << "header=0pt,headerdistance=0pt,footer=0pt]" << newl + << "\\usetypescript[modern]" << newl + << "\\starttext\\hbox{%" << newl; } else { - *out << "\\hoffset=36.6pt" << newl - << "\\voffset=54.0pt" << newl; + *out << "\\footline={}" << newl; + if(settings::pdf(texengine)) { + *out << "\\hoffset=-20pt" << newl + << "\\voffset=0pt" << newl; + } else { + *out << "\\hoffset=36.6pt" << newl + << "\\voffset=54.0pt" << newl; + } } } } @@ -118,13 +137,17 @@ void texfile::beginlayer(const string& psname, bool postscript) const char *units=settings::texunits(texengine); if(box.right > box.left && box.top > box.bottom) { if(postscript) { - *out << "\\includegraphics"; - if(!settings::pdf(texengine)) - *out << "[bb=" << box.left << " " << box.bottom << " " - << box.right << " " << box.top << "]"; - *out << "{" << psname << "}%" << newl; + if(settings::context(texengine)) + *out << "\\externalfigure[" << psname << "]%" << newl; + else { + *out << "\\includegraphics"; + if(!settings::pdf(texengine)) + *out << "[bb=" << box.left << " " << box.bottom << " " + << box.right << " " << box.top << "]"; + *out << "{" << psname << "}%" << newl; + } if(!inlinetex) - *out << "\\kern -" << (box.right-box.left)*ps2tex << units + *out << "\\kern " << (box.left-box.right)*ps2tex << units << "%" << newl; } else { *out << "\\leavevmode\\vbox to " << (box.top-box.bottom)*ps2tex @@ -139,7 +162,7 @@ void texfile::beginlayer(const string& psname, bool postscript) void texfile::endlayer() { if(inlinetex && (box.right > box.left && box.top > box.bottom)) - *out << "\\kern -" << (box.right-box.left)*ps2tex + *out << "\\kern " << (box.left-box.right)*ps2tex << settings::texunits(texengine) << "%" << newl; } @@ -258,7 +281,10 @@ void texfile::epilogue(bool pipe) if(!inlinetex || pipe) *out << "\\end{document}" << newl; } else { - *out << "\\bye" << newl; + if(settings::context(texengine)) + *out << "}\\stoptext" << newl; + else + *out << "\\bye" << newl; } out->flush(); } diff --git a/Build/source/utils/asymptote/texfile.h b/Build/source/utils/asymptote/texfile.h index e594ab4b7e6..f2a5d22dccd 100644 --- a/Build/source/utils/asymptote/texfile.h +++ b/Build/source/utils/asymptote/texfile.h @@ -77,8 +77,9 @@ void texpreamble(T& out, mem::list<string>& preamble=processData().TeXpreamble, << "\\setbox\\ASYbox\\hbox{\\ASYdimen=\\ht\\ASYbox%" << newl << "\\advance\\ASYdimen by\\dp\\ASYbox\\kern#3\\wd\\ASYbox" << "\\raise#4\\ASYdimen\\box\\ASYbox}%" << newl - << "\\put(#1,#2){#5\\wd\\ASYbox 0pt\\dp\\ASYbox 0pt\\ht\\ASYbox 0pt" - << "\\box\\ASYbox#6}}" << newl + << settings::beginput(texengine) + << "{#5\\wd\\ASYbox 0pt\\dp\\ASYbox 0pt\\ht\\ASYbox 0pt\\box\\ASYbox#6}" + << settings::endput(texengine) << "}%" << newl << "\\long\\def\\ASYalignT(#1,#2)(#3,#4)#5#6{%" << newl << "\\ASYaligned(#1,#2)(#3,#4){%" << newl << settings::beginlabel(texengine) << "%" << newl @@ -109,13 +110,17 @@ void texdefines(T& out, mem::list<string>& preamble=processData().TeXpreamble, } } texfontencoding(out); - if(settings::latex(settings::getSetting<string>("tex"))) { + string texengine=settings::getSetting<string>("tex"); + if(settings::latex(texengine)) { if(pipe || !settings::getSetting<bool>("inlinetex")) { out << "\\usepackage{graphicx}" << newl; if(!pipe) out << "\\usepackage{color}" << newl; } if(pipe) out << "\\begin{document}" << newl; + } else if(settings::context(texengine)) { + if(!pipe && !settings::getSetting<bool>("inlinetex")) + out << "\\usemodule[pictex]" << newl; } else { out << "\\input graphicx" << newl; if(!pipe) |