diff options
author | Karl Berry <karl@freefriends.org> | 2010-04-19 23:59:33 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-04-19 23:59:33 +0000 |
commit | dddce3148a2bc785603576b18ffcf72d39adbe47 (patch) | |
tree | 14f4c79ef11bcf0820a8d4ff2ab0c5ac009c365c | |
parent | a01e51b01f5819b6091af48cdca581e9f2a9282e (diff) |
asy 1.93
git-svn-id: svn://tug.org/texlive/trunk@17934 c570f23f-e606-0410-a88d-b1316a301751
170 files changed, 10349 insertions, 4456 deletions
diff --git a/Build/source/utils/README b/Build/source/utils/README index 3df55f6b993..a554ede4960 100644 --- a/Build/source/utils/README +++ b/Build/source/utils/README @@ -5,10 +5,10 @@ You may freely use, modify and/or distribute this file. Extra utilities we (optionally) compile for TeX Live. See comments in ../texk/README. -asymptote 1.88 - checked 2oct09 +asymptote 1.93 - checked 20apr10 update to TL from CTAN, to include prebuilt doc. see http://tug.org/texlive/build.html#asymptote - and tlpkg/bin/tl-update/asy + and tlpkg/bin/tl-update-asy dialog 1.1-20100119 - checked 21jan10 ftp://invisible-island.net/dialog/dialog.tar.gz diff --git a/Build/source/utils/asymptote/ChangeLog b/Build/source/utils/asymptote/ChangeLog index c2a47bd33f9..2591c21da06 100644 --- a/Build/source/utils/asymptote/ChangeLog +++ b/Build/source/utils/asymptote/ChangeLog @@ -1,4 +1,1488 @@ ------------------------------------------------------------------------ +r4873 | jcbowman | 2010-04-16 20:13:15 -0600 (Fri, 16 Apr 2010) | 8 lines +Changed paths: + M /trunk/asymptote/base/plain_picture.asy + M /trunk/asymptote/base/plain_shipout.asy + M /trunk/asymptote/base/plain_strings.asy + M /trunk/asymptote/drawverbatim.h + M /trunk/asymptote/picture.cc + M /trunk/asymptote/runsystem.in + M /trunk/asymptote/settings.cc + M /trunk/asymptote/settings.h + +Expose outname() to asy. + +Revert revision 4865 for strings containing spaces. + +Fix tex(picture). + +Add deactivatequote and activatequote functions for Babel users. + +------------------------------------------------------------------------ +r4872 | jcbowman | 2010-04-16 20:00:30 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/glrender.cc + +Redraw screen after export (for MSWindows). + +------------------------------------------------------------------------ +r4871 | jcbowman | 2010-04-16 14:00:51 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/GUI/xasyMainWin.py + M /trunk/asymptote/settings.cc + +Move backslash conversion into asy. + +------------------------------------------------------------------------ +r4870 | jcbowman | 2010-04-16 13:54:22 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/GUI/xasyMainWin.py + +Fix GUI export under MSWindows. + +------------------------------------------------------------------------ +r4869 | jcbowman | 2010-04-16 11:58:48 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/examples/label3.asy + +Improve camera position. + +------------------------------------------------------------------------ +r4868 | jcbowman | 2010-04-16 11:47:15 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/examples/washer.asy + +Set size. + +------------------------------------------------------------------------ +r4867 | jcbowman | 2010-04-16 11:06:15 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/examples/poster.asy + +Fix poster size. + +------------------------------------------------------------------------ +r4866 | jcbowman | 2010-04-16 10:46:48 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/examples/animations/inlinemovie.tex + +Revert unintended removal of inline option. + +------------------------------------------------------------------------ +r4865 | jcbowman | 2010-04-16 09:42:26 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_strings.asy + +Require user to double quote graphics file names containing spaces. + +------------------------------------------------------------------------ +r4864 | jcbowman | 2010-04-16 09:31:29 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_strings.asy + M /trunk/asymptote/texfile.cc + +Ensure double quote character is inactive. + +------------------------------------------------------------------------ +r4863 | jcbowman | 2010-04-16 08:49:27 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/picture.cc + +Clean up files even after errors. + +------------------------------------------------------------------------ +r4862 | jcbowman | 2010-04-16 01:00:40 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/drawfill.h + +Fix latticeshading with -svgemulation. + +------------------------------------------------------------------------ +r4861 | jcbowman | 2010-04-16 00:37:58 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/drawfill.h + M /trunk/asymptote/psfile.h + M /trunk/asymptote/texfile.h + +Fix SVG emulation. + +------------------------------------------------------------------------ +r4860 | jcbowman | 2010-04-16 00:17:49 -0600 (Fri, 16 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/pen.h + M /trunk/asymptote/texfile.cc + +Fix initial SVG pen. + +------------------------------------------------------------------------ +r4859 | jcbowman | 2010-04-15 23:44:32 -0600 (Thu, 15 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/GUI/xasy2asy.py + M /trunk/asymptote/GUI/xasyMainWin.py + +Fix GUI export; add SVG export. + +------------------------------------------------------------------------ +r4858 | jcbowman | 2010-04-15 23:32:29 -0600 (Thu, 15 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/base/plain_shipout.asy + M /trunk/asymptote/settings.cc + +Revert outname construction. +------------------------------------------------------------------------ +r4857 | jcbowman | 2010-04-15 15:42:29 -0600 (Thu, 15 Apr 2010) | 7 lines +Changed paths: + M /trunk/asymptote/base/animation.asy + M /trunk/asymptote/base/flowchart.asy + M /trunk/asymptote/base/plain_shipout.asy + M /trunk/asymptote/base/plain_strings.asy + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/doc/asymptote.sty + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/examples/animations/inlinemovie.tex + M /trunk/asymptote/fileio.h + M /trunk/asymptote/glrender.cc + M /trunk/asymptote/picture.cc + M /trunk/asymptote/runfile.in + M /trunk/asymptote/runlabel.in + M /trunk/asymptote/runsystem.in + M /trunk/asymptote/runtime.in + M /trunk/asymptote/settings.cc + M /trunk/asymptote/texfile.cc + M /trunk/asymptote/texfile.h + M /trunk/asymptote/util.cc + M /trunk/asymptote/util.h + +Allow spaces in output directory name. + +All output files are written to the directory part of settings.outname; +if this is empty, the current directory is used. + +Allow cd to other directories, preserving the output directory. + +------------------------------------------------------------------------ +r4856 | jcbowman | 2010-04-15 00:58:42 -0600 (Thu, 15 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/texfile.cc + +Remove obsolete bug workaround. + +------------------------------------------------------------------------ +r4855 | jcbowman | 2010-04-14 16:45:50 -0600 (Wed, 14 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Remove misleading deep qualifier. +------------------------------------------------------------------------ +r4854 | jcbowman | 2010-04-14 14:28:06 -0600 (Wed, 14 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/flowchart.asy + M /trunk/asymptote/doc/asymptote.texi + +Add parallelogram block to flowchart module. + +------------------------------------------------------------------------ +r4853 | jcbowman | 2010-04-14 12:12:07 -0600 (Wed, 14 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/configure.ac + +Check for LIBGL on MacOSX. + +------------------------------------------------------------------------ +r4852 | jcbowman | 2010-04-13 10:20:24 -0600 (Tue, 13 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/memory.h + +Fix preprocessor conditional. +------------------------------------------------------------------------ +r4851 | jcbowman | 2010-04-13 01:16:51 -0600 (Tue, 13 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/drawfill.h + +Fix latticeshade stroke bounds. + +------------------------------------------------------------------------ +r4850 | jcbowman | 2010-04-12 22:22:29 -0600 (Mon, 12 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/memory.h + +Support old versions of gcc again. + +------------------------------------------------------------------------ +r4849 | jcbowman | 2010-04-12 01:55:34 -0600 (Mon, 12 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/configure.ac + +Increment version to 1.93svn. +------------------------------------------------------------------------ +r4848 | jcbowman | 2010-04-11 09:41:33 -0600 (Sun, 11 Apr 2010) | 4 lines +Changed paths: + M /trunk/asymptote/interact.cc + M /trunk/asymptote/runhistory.in + +Call init_readline only once. + +Remove obsolete CYGWIN readline initialization code. + +------------------------------------------------------------------------ +r4847 | jcbowman | 2010-04-11 09:34:01 -0600 (Sun, 11 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/examples/odetest.asy + +Fix typo. +------------------------------------------------------------------------ +r4846 | jcbowman | 2010-04-11 02:26:26 -0600 (Sun, 11 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/configure.ac + M /trunk/asymptote/settings.cc + +Fix -lGL detection. +------------------------------------------------------------------------ +r4845 | jcbowman | 2010-04-11 00:51:59 -0600 (Sun, 11 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/common.h + M /trunk/asymptote/settings.cc + M /trunk/asymptote/util.h + +More CYGWIN portability changes. +------------------------------------------------------------------------ +r4844 | jcbowman | 2010-04-10 12:43:11 -0600 (Sat, 10 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/main.cc + M /trunk/asymptote/runmath.in + +Fix CYGWIN portability issues. +------------------------------------------------------------------------ +r4843 | jcbowman | 2010-04-10 11:12:46 -0600 (Sat, 10 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/memory.h + +Improve tr1 test. +------------------------------------------------------------------------ +r4842 | jcbowman | 2010-04-07 21:19:31 -0600 (Wed, 07 Apr 2010) | 4 lines +Changed paths: + M /trunk/asymptote/base/graph.asy + M /trunk/asymptote/doc/asymptote.texi + +Add autorotate argument to yaxis. + +Document assert(bool, string). + +------------------------------------------------------------------------ +r4841 | jcbowman | 2010-04-07 21:15:42 -0600 (Wed, 07 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/glrender.cc + +Fix aspect ratio. + +------------------------------------------------------------------------ +r4840 | jcbowman | 2010-04-07 16:18:14 -0600 (Wed, 07 Apr 2010) | 3 lines +Changed paths: + M /trunk/asymptote/base/contour3.asy + M /trunk/asymptote/base/graph3.asy + M /trunk/asymptote/base/plain_picture.asy + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/base/three_arrows.asy + +Add projection.normal to represent the normal to the projection plane, +which differs from projection.vector() for oblique projections. + +------------------------------------------------------------------------ +r4839 | jcbowman | 2010-04-07 13:32:07 -0600 (Wed, 07 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Make oblique projections work with billboard labels. + +------------------------------------------------------------------------ +r4838 | jcbowman | 2010-04-07 11:22:14 -0600 (Wed, 07 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/drawfill.h + +Fix latticeshading. + +------------------------------------------------------------------------ +r4837 | jcbowman | 2010-04-05 17:56:20 -0600 (Mon, 05 Apr 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/graph.asy + M /trunk/asymptote/base/graph3.asy + M /trunk/asymptote/base/plain_arcs.asy + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/fftw++.h + +Fix normal and true Circle calculations. + +------------------------------------------------------------------------ +r4836 | jcbowman | 2010-04-03 17:31:30 -0600 (Sat, 03 Apr 2010) | 1 line +Changed paths: + M /trunk/asymptote/fftw++.h + +Remove unwanted template. +------------------------------------------------------------------------ +r4835 | jcbowman | 2010-03-23 21:05:38 -0600 (Tue, 23 Mar 2010) | 1 line +Changed paths: + M /trunk/asymptote/base/plain_picture.asy + +Fix typo. +------------------------------------------------------------------------ +r4834 | jcbowman | 2010-03-23 20:44:50 -0600 (Tue, 23 Mar 2010) | 1 line +Changed paths: + M /trunk/asymptote/base/graph3.asy + M /trunk/asymptote/base/plain_picture.asy + M /trunk/asymptote/base/three_surface.asy + +Ignore null 3D paths. +------------------------------------------------------------------------ +r4833 | jcbowman | 2010-03-22 23:03:58 -0600 (Mon, 22 Mar 2010) | 1 line +Changed paths: + M /trunk/asymptote/runarray.in + +Fix revision 4820. +------------------------------------------------------------------------ +r4832 | jcbowman | 2010-03-21 22:35:06 -0600 (Sun, 21 Mar 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/graph.asy + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/examples/odetest.asy + +Add more predefined tick modifiers. + +------------------------------------------------------------------------ +r4831 | jcbowman | 2010-03-21 19:46:07 -0600 (Sun, 21 Mar 2010) | 1 line +Changed paths: + M /trunk/asymptote/base/slide.asy + +Fix last change. +------------------------------------------------------------------------ +r4830 | jcbowman | 2010-03-21 19:43:27 -0600 (Sun, 21 Mar 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/external.asy + M /trunk/asymptote/base/plain_strings.asy + M /trunk/asymptote/base/slide.asy + +Fix incorrect pt scaling. + +------------------------------------------------------------------------ +r4829 | jcbowman | 2010-03-20 23:19:37 -0600 (Sat, 20 Mar 2010) | 4 lines +Changed paths: + M /trunk/asymptote/base/ode.asy + M /trunk/asymptote/examples/odetest.asy + +Make integrate routines return structure including sampled time values. + +Enable dynamic timestepping for solveBVP. + +------------------------------------------------------------------------ +r4828 | jcbowman | 2010-03-19 09:36:21 -0600 (Fri, 19 Mar 2010) | 2 lines +Changed paths: + M /trunk/asymptote/configure.ac + +Configure Boehm gc with --enable-large-config by default. + +------------------------------------------------------------------------ +r4827 | jcbowman | 2010-03-16 17:40:26 -0600 (Tue, 16 Mar 2010) | 1 line +Changed paths: + M /trunk/asymptote/examples/triceratops.asy + +Fix url. +------------------------------------------------------------------------ +r4826 | jcbowman | 2010-03-07 09:48:36 -0700 (Sun, 07 Mar 2010) | 1 line +Changed paths: + M /trunk/asymptote/runarray.in + +Rename FFTWdelete to deleteAlign. +------------------------------------------------------------------------ +r4825 | jcbowman | 2010-03-07 09:45:27 -0700 (Sun, 07 Mar 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + M /trunk/asymptote/runarray.in + +Rename FFTWComplex to ComplexAlign. + +------------------------------------------------------------------------ +r4824 | jcbowman | 2010-03-04 12:59:27 -0700 (Thu, 04 Mar 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/contour.asy + +Fix array index. + +------------------------------------------------------------------------ +r4823 | jcbowman | 2010-03-01 09:07:51 -0700 (Mon, 01 Mar 2010) | 1 line +Changed paths: + M /trunk/asymptote/runmath.in + +Make CLZ and CTZ portable. +------------------------------------------------------------------------ +r4822 | jcbowman | 2010-02-28 21:54:54 -0700 (Sun, 28 Feb 2010) | 1 line +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/runmath.in + +Implement CLZ and CTZ bit functions. +------------------------------------------------------------------------ +r4821 | jcbowman | 2010-02-25 15:52:27 -0700 (Thu, 25 Feb 2010) | 1 line +Changed paths: + M /trunk/asymptote/runarray.in + +Ignore negative dxmax. +------------------------------------------------------------------------ +r4820 | jcbowman | 2010-02-25 15:50:04 -0700 (Thu, 25 Feb 2010) | 2 lines +Changed paths: + M /trunk/asymptote/runarray.in + M /trunk/asymptote/simpson.cc + +Fix simpson for a > b and f decreasing. + +------------------------------------------------------------------------ +r4819 | jcbowman | 2010-02-23 22:14:27 -0700 (Tue, 23 Feb 2010) | 2 lines +Changed paths: + M /trunk/asymptote/runarray.in + +Fix compilation on systems without OpenGL. + +------------------------------------------------------------------------ +r4818 | jcbowman | 2010-02-23 18:21:35 -0700 (Tue, 23 Feb 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + +Use portable definition of M_PI. + +------------------------------------------------------------------------ +r4817 | jcbowman | 2010-02-20 16:20:15 -0700 (Sat, 20 Feb 2010) | 1 line +Changed paths: + M /trunk/asymptote/drawgroup.h + M /trunk/asymptote/drawpath3.h + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + +Add missing arguments. +------------------------------------------------------------------------ +r4816 | jcbowman | 2010-02-19 14:57:19 -0700 (Fri, 19 Feb 2010) | 2 lines +Changed paths: + M /trunk/asymptote/common.h + M /trunk/asymptote/configure.ac + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/drawpath3.h + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + M /trunk/asymptote/glrender.cc + M /trunk/asymptote/glrender.h + M /trunk/asymptote/main.cc + M /trunk/asymptote/picture.cc + M /trunk/asymptote/settings.cc + M /trunk/asymptote/tr.cc + +Avoid implicit linking of libGL. + +------------------------------------------------------------------------ +r4815 | jcbowman | 2010-02-18 14:01:16 -0700 (Thu, 18 Feb 2010) | 1 line +Changed paths: + M /trunk/asymptote/base/math.asy + M /trunk/asymptote/doc/flowchartdemo.asy + M /trunk/asymptote/drawfill.h + A /trunk/asymptote/examples/clockarray.asy + A /trunk/asymptote/examples/washer.asy + M /trunk/asymptote/fftw++.h + +Fix odd sized shifts in fftw++.h. +------------------------------------------------------------------------ +r4814 | jcbowman | 2010-02-15 00:02:06 -0700 (Mon, 15 Feb 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + +Expose Shift functions. + +------------------------------------------------------------------------ +r4813 | jcbowman | 2010-02-13 16:09:35 -0700 (Sat, 13 Feb 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + +Remove ambiguous constructor. + +------------------------------------------------------------------------ +r4812 | hammera | 2010-02-10 07:14:26 -0700 (Wed, 10 Feb 2010) | 2 lines +Changed paths: + M /trunk/asymptote/virtualfieldaccess.h + +Minor change to comment. + +------------------------------------------------------------------------ +r4811 | hammera | 2010-02-10 07:13:54 -0700 (Wed, 10 Feb 2010) | 2 lines +Changed paths: + M /trunk/asymptote/types.cc + +Changed alignment of slashes in macro. + +------------------------------------------------------------------------ +r4810 | jcbowman | 2010-02-07 15:21:17 -0700 (Sun, 07 Feb 2010) | 1 line +Changed paths: + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/drawsurface.cc + +Fix compilation errors. +------------------------------------------------------------------------ +r4809 | jcbowman | 2010-02-07 15:13:15 -0700 (Sun, 07 Feb 2010) | 1 line +Changed paths: + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/drawsurface.cc + +Fix part names. +------------------------------------------------------------------------ +r4808 | jcbowman | 2010-02-07 11:34:19 -0700 (Sun, 07 Feb 2010) | 2 lines +Changed paths: + M /trunk/asymptote/prc/PRCTools/bitData.cc + +Update test code. + +------------------------------------------------------------------------ +r4807 | jcbowman | 2010-02-05 08:39:23 -0700 (Fri, 05 Feb 2010) | 2 lines +Changed paths: + M /trunk/asymptote/prc/oPRCFile.h + +Open oPRCFile in binary mode. + +------------------------------------------------------------------------ +r4806 | jcbowman | 2010-02-03 21:03:27 -0700 (Wed, 03 Feb 2010) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Fix formatting. + +------------------------------------------------------------------------ +r4805 | jcbowman | 2010-01-30 21:04:48 -0700 (Sat, 30 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Fix typo in documentation of singlereal. + +------------------------------------------------------------------------ +r4804 | jcbowman | 2010-01-25 20:33:52 -0700 (Mon, 25 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + +Make FFTW wisdom file name and effort flag public. + +------------------------------------------------------------------------ +r4803 | jcbowman | 2010-01-25 09:58:39 -0700 (Mon, 25 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + +Update documentation of fftw++ header file. + +------------------------------------------------------------------------ +r4802 | jcbowman | 2010-01-23 11:09:50 -0700 (Sat, 23 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/picture.cc + +Fix non-pdf output from PDF tex engines. + +------------------------------------------------------------------------ +r4801 | jcbowman | 2010-01-19 21:12:07 -0700 (Tue, 19 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/configure.ac + +Improve diagnostic. + +------------------------------------------------------------------------ +r4800 | jcbowman | 2010-01-19 02:50:50 -0700 (Tue, 19 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/flowchart.asy + M /trunk/asymptote/examples/controlsystem.asy + +Remove implicit cast in favour of block constructor. + +------------------------------------------------------------------------ +r4799 | jcbowman | 2010-01-12 14:31:13 -0700 (Tue, 12 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/examples/label3.asy + +Improve example. + +------------------------------------------------------------------------ +r4798 | jcbowman | 2010-01-11 10:41:52 -0700 (Mon, 11 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_Label.asy + +Fix transformed Label alignment. + +------------------------------------------------------------------------ +r4797 | jcbowman | 2010-01-09 22:08:23 -0700 (Sat, 09 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + +Fix typo. + +------------------------------------------------------------------------ +r4796 | jcbowman | 2010-01-09 22:06:11 -0700 (Sat, 09 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + +Fix conflicts. + +------------------------------------------------------------------------ +r4795 | jcbowman | 2010-01-09 14:40:13 -0700 (Sat, 09 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + +Avoid uninitialized variable warning. + +------------------------------------------------------------------------ +r4794 | jcbowman | 2010-01-09 14:38:02 -0700 (Sat, 09 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/fftw++.h + +Upgrade to latest version of fftw++.h. + +------------------------------------------------------------------------ +r4793 | jcbowman | 2010-01-09 14:34:31 -0700 (Sat, 09 Jan 2010) | 2 lines +Changed paths: + M /trunk/asymptote/glrender.cc + +Simplify code. + +------------------------------------------------------------------------ +r4792 | jcbowman | 2009-12-31 06:28:23 -0700 (Thu, 31 Dec 2009) | 1 line +Changed paths: + M /trunk/asymptote/configure.ac + +Increment version to 1.92svn. +------------------------------------------------------------------------ +r4791 | jcbowman | 2009-12-30 22:05:07 -0700 (Wed, 30 Dec 2009) | 1 line +Changed paths: + M /trunk/asymptote/patches/README + D /trunk/asymptote/patches/freeglut-cygwin.patch + +Remove obsolete freeglut patch. +------------------------------------------------------------------------ +r4790 | jcbowman | 2009-12-30 13:27:38 -0700 (Wed, 30 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/texfile.cc + M /trunk/asymptote/texfile.h + +Set default font after \begin{document}. + +------------------------------------------------------------------------ +r4789 | jcbowman | 2009-12-30 12:46:09 -0700 (Wed, 30 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_picture.asy + M /trunk/asymptote/drawfill.cc + M /trunk/asymptote/drawfill.h + M /trunk/asymptote/psfile.cc + M /trunk/asymptote/psfile.h + M /trunk/asymptote/runpicture.in + M /trunk/asymptote/runtime.in + M /trunk/asymptote/transform.h + +Support transformations in lattice shading. + +------------------------------------------------------------------------ +r4788 | jcbowman | 2009-12-30 12:31:21 -0700 (Wed, 30 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Update links. + +------------------------------------------------------------------------ +r4787 | jcbowman | 2009-12-19 08:18:46 -0700 (Sat, 19 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/contour.asy + +Untabify. + +------------------------------------------------------------------------ +r4786 | jcbowman | 2009-12-19 08:18:03 -0700 (Sat, 19 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/contour.asy + M /trunk/asymptote/examples/fillcontour.asy + +Increase epsilon. + +------------------------------------------------------------------------ +r4785 | jcbowman | 2009-12-12 11:33:40 -0700 (Sat, 12 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Replace "nonselfintersecting" by more standard term "simple". + +------------------------------------------------------------------------ +r4784 | jcbowman | 2009-12-11 17:34:20 -0700 (Fri, 11 Dec 2009) | 3 lines +Changed paths: + M /trunk/asymptote/base/contour.asy + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/doc/irregularcontour.asy + M /trunk/asymptote/examples/fillcontour.asy + +Use a more robust contour algorithm based on approximating the function as +a paraboloid, courtesy of Chris Savage. + +------------------------------------------------------------------------ +r4783 | jcbowman | 2009-12-11 16:21:04 -0700 (Fri, 11 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_paths.asy + +Avoid casting to path[] in write(guide[]). + +------------------------------------------------------------------------ +r4782 | jcbowman | 2009-12-05 23:13:51 -0700 (Sat, 05 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/base/plain_constants.asy + M /trunk/asymptote/examples/gamma3.asy + M /trunk/asymptote/examples/labelbox.asy + +More example updates. + +------------------------------------------------------------------------ +r4781 | jcbowman | 2009-12-05 22:55:34 -0700 (Sat, 05 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/doc/imagecontour.asy + M /trunk/asymptote/examples/logo3.asy + M /trunk/asymptote/examples/worksheet.asy + +Minor example updates. + +------------------------------------------------------------------------ +r4780 | jcbowman | 2009-12-05 22:35:57 -0700 (Sat, 05 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/flowchart.asy + M /trunk/asymptote/doc/flowchartdemo.asy + M /trunk/asymptote/examples/controlsystem.asy + +Implement operator --(block, block) to simplify flowchart syntax. + +------------------------------------------------------------------------ +r4779 | jcbowman | 2009-12-05 12:40:40 -0700 (Sat, 05 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/drawpath3.cc + +Add change missed in previous revision. + +------------------------------------------------------------------------ +r4778 | jcbowman | 2009-12-05 12:39:48 -0700 (Sat, 05 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/drawelement.h + M /trunk/asymptote/drawpath3.h + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + M /trunk/asymptote/path3.cc + M /trunk/asymptote/picture.cc + +Improve precision of minratio and maxratio routines. + +------------------------------------------------------------------------ +r4777 | jcbowman | 2009-12-02 21:50:16 -0700 (Wed, 02 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + +Fix transformed 3D labels under -render=0. + +------------------------------------------------------------------------ +r4776 | jcbowman | 2009-12-02 11:14:49 -0700 (Wed, 02 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_arrows.asy + +Revert revision 4775. + +------------------------------------------------------------------------ +r4775 | jcbowman | 2009-12-02 11:10:16 -0700 (Wed, 02 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_arrows.asy + +Retune HookHead2. + +------------------------------------------------------------------------ +r4774 | jcbowman | 2009-12-02 11:00:26 -0700 (Wed, 02 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_arrows.asy + +Fix 3D planar arrowhead gap. + +------------------------------------------------------------------------ +r4773 | pivaldi | 2009-12-01 10:13:58 -0700 (Tue, 01 Dec 2009) | 1 line +Changed paths: + M /trunk/asymptote/base/geometry.asy + +Fix ellispe arc defined by abscesses when angle of ellispe is not zero. +------------------------------------------------------------------------ +r4772 | jcbowman | 2009-12-01 00:50:44 -0700 (Tue, 01 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_arrows.asy + +Remove duplicate arrow angle scale factor. + +------------------------------------------------------------------------ +r4771 | jcbowman | 2009-12-01 00:49:20 -0700 (Tue, 01 Dec 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + +Fix offset in transformed 3D labels with render=0. + +------------------------------------------------------------------------ +r4770 | jcbowman | 2009-11-29 21:21:35 -0700 (Sun, 29 Nov 2009) | 2 lines +Changed paths: + A /trunk/asymptote/examples/animations (from /trunk/asymptote/examples/animations:4766) + +Revert r4767. + +------------------------------------------------------------------------ +r4769 | jcbowman | 2009-11-29 12:17:32 -0700 (Sun, 29 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_boxes.asy + +Fix pen size contributions to box and ellipse. + +------------------------------------------------------------------------ +r4768 | jcbowman | 2009-11-29 11:59:29 -0700 (Sun, 29 Nov 2009) | 5 lines +Changed paths: + M /trunk/asymptote/base/embed.asy + M /trunk/asymptote/doc/asymptote.sty + +Update inlinetex support for xelatex. + +Load hyperref before patches/movie15_dvipdfmx.sty (renamed to movie.sty) +under xelatex. + +------------------------------------------------------------------------ +r4767 | jcbowman | 2009-11-28 12:10:12 -0700 (Sat, 28 Nov 2009) | 1 line +Changed paths: + D /trunk/asymptote/examples/animations + + +------------------------------------------------------------------------ +r4766 | jcbowman | 2009-11-27 16:50:55 -0700 (Fri, 27 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/picture.cc + +Move convert options before geometry. + +------------------------------------------------------------------------ +r4765 | jcbowman | 2009-11-27 11:10:41 -0700 (Fri, 27 Nov 2009) | 3 lines +Changed paths: + M /trunk/asymptote/picture.cc + +Remove -alpha Off default convert option in favour of +convertOptions="-alpha Off". + +------------------------------------------------------------------------ +r4764 | jcbowman | 2009-11-27 10:45:11 -0700 (Fri, 27 Nov 2009) | 4 lines +Changed paths: + M /trunk/asymptote/picture.cc + M /trunk/asymptote/settings.cc + +Use pngalpha driver only if antialias=2. + +Fix size of pngalpha images. + +------------------------------------------------------------------------ +r4763 | jcbowman | 2009-11-26 17:32:36 -0700 (Thu, 26 Nov 2009) | 2 lines +Changed paths: + A /trunk/asymptote/examples/cos3.asy + A /trunk/asymptote/examples/exp3.asy + A /trunk/asymptote/examples/sin3.asy + +Add 3D examples. + +------------------------------------------------------------------------ +r4762 | jcbowman | 2009-11-26 09:09:58 -0700 (Thu, 26 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/embed.asy + M /trunk/asymptote/base/external.asy + M /trunk/asymptote/doc/asymptote.texi + +Use hypersetup to avoid hyperref option clashes. + +------------------------------------------------------------------------ +r4761 | jcbowman | 2009-11-26 08:31:15 -0700 (Thu, 26 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/examples/SierpinskiSponge.asy + +Reduce memory usage of example. + +------------------------------------------------------------------------ +r4760 | jcbowman | 2009-11-26 08:27:20 -0700 (Thu, 26 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Fix braces. + +------------------------------------------------------------------------ +r4759 | jcbowman | 2009-11-26 00:55:46 -0700 (Thu, 26 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/examples/logo3.asy + +Improve 3D logo. + +------------------------------------------------------------------------ +r4758 | jcbowman | 2009-11-25 13:21:37 -0700 (Wed, 25 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/settings.cc + +Change colorslinks to pdfborder={0 0 0} in hyperrefOptions. + +------------------------------------------------------------------------ +r4757 | jcbowman | 2009-11-25 09:17:37 -0700 (Wed, 25 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/runmath.in + +Reduce conflicts by renaming the Bessel functions J and Y to Jn and Yn. + +------------------------------------------------------------------------ +r4756 | jcbowman | 2009-11-25 08:56:22 -0700 (Wed, 25 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/settings.cc + +Add colorlinks to settings.hyperrefOptions. + +------------------------------------------------------------------------ +r4755 | hammera | 2009-11-18 21:38:56 -0700 (Wed, 18 Nov 2009) | 3 lines +Changed paths: + M /trunk/asymptote/camp.y + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/exp.h + M /trunk/asymptote/stm.cc + M /trunk/asymptote/stm.h + +Added % for the last answer on the interactive prompt. + + +------------------------------------------------------------------------ +r4754 | pivaldi | 2009-11-18 04:31:57 -0700 (Wed, 18 Nov 2009) | 1 line +Changed paths: + M /trunk/asymptote/base/geometry.asy + +Fix horizontal & vertical lines +------------------------------------------------------------------------ +r4753 | jcbowman | 2009-11-17 11:46:36 -0700 (Tue, 17 Nov 2009) | 2 lines +Changed paths: + A /trunk/asymptote/examples/polardatagraph.asy (from /trunk/asymptote/examples/polargraph.asy:4752) + D /trunk/asymptote/examples/polargraph.asy + +Rename example. + +------------------------------------------------------------------------ +r4752 | jcbowman | 2009-11-17 11:45:18 -0700 (Tue, 17 Nov 2009) | 2 lines +Changed paths: + A /trunk/asymptote/examples/polargraph.asy + +Add example of a polar graph produced from discrete data. + +------------------------------------------------------------------------ +r4751 | jcbowman | 2009-11-17 11:38:24 -0700 (Tue, 17 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_paths.asy + M /trunk/asymptote/base/three.asy + +Implement operator ..(tensionSpecifier t) and join3(tensionSpecifier t). + +------------------------------------------------------------------------ +r4750 | jcbowman | 2009-11-17 11:12:18 -0700 (Tue, 17 Nov 2009) | 3 lines +Changed paths: + M /trunk/asymptote/base/graph.asy + M /trunk/asymptote/doc/asymptote.texi + +Implement polargraph(picture pic=currentpicture, real[] r, real[] theta, +interpolate join=operator--). + +------------------------------------------------------------------------ +r4749 | jcbowman | 2009-11-17 10:08:04 -0700 (Tue, 17 Nov 2009) | 2 lines +Changed paths: + A /trunk/asymptote/examples/SierpinskiGasket.asy + A /trunk/asymptote/examples/SierpinskiSponge.asy + +Add Sierpinksi examples, courtesy of the cvgmt group. + +------------------------------------------------------------------------ +r4748 | jcbowman | 2009-11-13 23:59:23 -0700 (Fri, 13 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/examples/venn3.asy + +Improve example. + +------------------------------------------------------------------------ +r4747 | jcbowman | 2009-11-13 23:53:02 -0700 (Fri, 13 Nov 2009) | 2 lines +Changed paths: + A /trunk/asymptote/examples/venn3.asy + +Add example. + +------------------------------------------------------------------------ +r4746 | jcbowman | 2009-11-13 23:19:52 -0700 (Fri, 13 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/graph.asy + M /trunk/asymptote/base/graph_splinetype.asy + +Add check that parametric array for spline interpolation is increasing. + +------------------------------------------------------------------------ +r4745 | hammera | 2009-11-12 21:54:00 -0700 (Thu, 12 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/entry.cc + M /trunk/asymptote/entry.h + M /trunk/asymptote/table.h + +Removed unused lookInTopScope methods. + +------------------------------------------------------------------------ +r4744 | jcbowman | 2009-11-09 13:12:20 -0700 (Mon, 09 Nov 2009) | 1 line +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/configure.ac + +Increment version to 1.91svn. +------------------------------------------------------------------------ +r4743 | jcbowman | 2009-11-09 10:02:46 -0700 (Mon, 09 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Document SVG output. + +------------------------------------------------------------------------ +r4742 | jcbowman | 2009-11-09 08:16:15 -0700 (Mon, 09 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/texfile.cc + +Remove preprocessor symbol in preparation for upcoming dvisvgm-0.8.7 release. + +------------------------------------------------------------------------ +r4741 | jcbowman | 2009-11-09 07:57:29 -0700 (Mon, 09 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/texfile.cc + +Fix SVG axial, radial, and emulated tensor-patch shading. + +------------------------------------------------------------------------ +r4740 | jcbowman | 2009-11-09 01:36:31 -0700 (Mon, 09 Nov 2009) | 1 line +Changed paths: + M /trunk/asymptote/configure.ac + +Increment version to 1.90svn. +------------------------------------------------------------------------ +r4739 | jcbowman | 2009-11-09 00:26:17 -0700 (Mon, 09 Nov 2009) | 1 line +Changed paths: + M /trunk/asymptote/glrender.cc + +Fix timer argument. +------------------------------------------------------------------------ +r4738 | jcbowman | 2009-11-09 00:13:46 -0700 (Mon, 09 Nov 2009) | 1 line +Changed paths: + M /trunk/asymptote/texfile.cc + +Check for uninitialized shading pens. +------------------------------------------------------------------------ +r4737 | jcbowman | 2009-11-08 22:14:03 -0700 (Sun, 08 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/drawclipbegin.h + M /trunk/asymptote/drawclipend.h + M /trunk/asymptote/drawelement.h + M /trunk/asymptote/drawfill.h + M /trunk/asymptote/psfile.h + M /trunk/asymptote/texfile.cc + M /trunk/asymptote/texfile.h + +Implement emulation of Gouraud shading in SVG. + +------------------------------------------------------------------------ +r4736 | jcbowman | 2009-11-08 22:12:33 -0700 (Sun, 08 Nov 2009) | 3 lines +Changed paths: + M /trunk/asymptote/base/math.asy + +Add routine that returns the intersection time of the point on the line +through p and q that is closest to z. + +------------------------------------------------------------------------ +r4735 | jcbowman | 2009-11-06 11:55:09 -0700 (Fri, 06 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/builtin.cc + M /trunk/asymptote/runarray.in + +Improve missing fft diagnostic. + +------------------------------------------------------------------------ +r4734 | jcbowman | 2009-11-05 17:08:27 -0700 (Thu, 05 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/drawpath3.h + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + M /trunk/asymptote/runpicture.in + +Reduce PRC NURBS memory usage. + +------------------------------------------------------------------------ +r4733 | jcbowman | 2009-11-05 16:50:29 -0700 (Thu, 05 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/drawpath3.cc + A /trunk/asymptote/examples/NURBScurve.asy + M /trunk/asymptote/glrender.cc + +Fix rational NURBS curves; add example. + +------------------------------------------------------------------------ +r4732 | jcbowman | 2009-11-04 04:54:57 -0700 (Wed, 04 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Reduce maxangleiterations. + +------------------------------------------------------------------------ +r4731 | jcbowman | 2009-11-04 04:49:55 -0700 (Wed, 04 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/drawpath3.h + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/path.cc + M /trunk/asymptote/path.h + +Revert to previous value of fuzz in ratio. + +------------------------------------------------------------------------ +r4730 | jcbowman | 2009-11-03 13:29:46 -0700 (Tue, 03 Nov 2009) | 1 line +Changed paths: + M /trunk/asymptote/picture.cc + M /trunk/asymptote/psfile.h + M /trunk/asymptote/texfile.h + +Port recent changes to CYGWIN +------------------------------------------------------------------------ +r4729 | jcbowman | 2009-11-02 21:39:31 -0700 (Mon, 02 Nov 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/palette.asy + +Always generate at least NColors. + +------------------------------------------------------------------------ +r4728 | jcbowman | 2009-10-29 20:17:04 -0600 (Thu, 29 Oct 2009) | 4 lines +Changed paths: + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/path.cc + M /trunk/asymptote/path.h + M /trunk/asymptote/path3.h + M /trunk/asymptote/runpath3d.in + +Implement path3 unstraighten(path3). + +Increase fuzz in ratio. + +------------------------------------------------------------------------ +r4727 | jcbowman | 2009-10-29 10:16:17 -0600 (Thu, 29 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + M /trunk/asymptote/drawelement.h + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/drawpath3.h + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + M /trunk/asymptote/glrender.h + M /trunk/asymptote/prc/oPRCFile.cc + M /trunk/asymptote/runpicture.in + +Add support for NURBS curves. + +------------------------------------------------------------------------ +r4726 | jcbowman | 2009-10-28 23:44:27 -0600 (Wed, 28 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/drawpath.cc + M /trunk/asymptote/psfile.h + M /trunk/asymptote/settings.cc + M /trunk/asymptote/texfile.cc + M /trunk/asymptote/texfile.h + +For SVG output, explicitly draw a circle instead of a length 0 path. + +------------------------------------------------------------------------ +r4725 | jcbowman | 2009-10-28 02:36:35 -0600 (Wed, 28 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/drawpath.cc + M /trunk/asymptote/pen.h + M /trunk/asymptote/psfile.cc + M /trunk/asymptote/runtime.in + M /trunk/asymptote/texfile.cc + +Avoid unnecessary copying of linetype structure. + +------------------------------------------------------------------------ +r4724 | jcbowman | 2009-10-27 10:04:54 -0600 (Tue, 27 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/drawpath.cc + M /trunk/asymptote/pen.h + M /trunk/asymptote/psfile.cc + M /trunk/asymptote/runtime.in + M /trunk/asymptote/texfile.cc + +Avoid negative dash patterns. + +------------------------------------------------------------------------ +r4723 | jcbowman | 2009-10-27 02:32:34 -0600 (Tue, 27 Oct 2009) | 17 lines +Changed paths: + M /trunk/asymptote/base/CAD.asy + M /trunk/asymptote/base/flowchart.asy + M /trunk/asymptote/base/geometry.asy + M /trunk/asymptote/base/math.asy + M /trunk/asymptote/base/plain.asy + M /trunk/asymptote/base/plain_pens.asy + M /trunk/asymptote/base/plain_picture.asy + M /trunk/asymptote/base/plain_strings.asy + M /trunk/asymptote/base/solids.asy + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/doc/image.asy + M /trunk/asymptote/drawclipbegin.h + M /trunk/asymptote/drawclipend.h + M /trunk/asymptote/drawelement.h + M /trunk/asymptote/drawfill.cc + M /trunk/asymptote/drawfill.h + M /trunk/asymptote/drawimage.h + M /trunk/asymptote/drawlabel.h + M /trunk/asymptote/drawpath.cc + M /trunk/asymptote/drawpath.h + A /trunk/asymptote/examples/1overx.asy + M /trunk/asymptote/examples/Klein.asy + M /trunk/asymptote/examples/alignbox.asy + M /trunk/asymptote/examples/fequlogo.asy + M /trunk/asymptote/examples/strokepath.asy + M /trunk/asymptote/examples/transparency.asy + M /trunk/asymptote/pen.h + M /trunk/asymptote/picture.cc + M /trunk/asymptote/psfile.cc + M /trunk/asymptote/psfile.h + M /trunk/asymptote/runlabel.in + M /trunk/asymptote/runpicture.in + M /trunk/asymptote/runtime.in + M /trunk/asymptote/settings.cc + M /trunk/asymptote/texfile.cc + M /trunk/asymptote/texfile.h + +Change linetype pattern from a string to an array of reals: a string is +still accepted (for backwards compatibility), but the return type of +linetype(pen) is now real[] instead of string (backwards incompatible). + +Implement native SVG path output (still requires dvisvgm-0.8.6). + +Implement SVG emulation of tensor patch shading (for a single patch). + +Change split so that an empty delimiter splits on spaces, discarding +duplicate spaces. + +Add fillrule argument to draw(pic, path[], pen[]). + +Implement missing add routines. + +Implement 2D FFT. + +------------------------------------------------------------------------ +r4722 | jcbowman | 2009-10-27 01:46:53 -0600 (Tue, 27 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/path.cc + +Minor optimization. + +------------------------------------------------------------------------ +r4721 | jcbowman | 2009-10-26 10:54:05 -0600 (Mon, 26 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/examples/xsin1x.asy + +Generalize example. + +------------------------------------------------------------------------ +r4720 | jcbowman | 2009-10-26 10:46:27 -0600 (Mon, 26 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/examples/xsin1x.asy + +Improve example. + +------------------------------------------------------------------------ +r4719 | jcbowman | 2009-10-26 10:44:23 -0600 (Mon, 26 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/examples/xsin1x.asy + +Simplify example. + +------------------------------------------------------------------------ +r4718 | jcbowman | 2009-10-26 10:32:44 -0600 (Mon, 26 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/examples/xsin1x.asy + +Improve inset graph. + +------------------------------------------------------------------------ +r4717 | jcbowman | 2009-10-23 00:10:48 -0600 (Fri, 23 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + A /trunk/asymptote/examples/NURBSsphere.asy + M /trunk/asymptote/examples/NURBSsurface.asy + +Fix rational NURBS sizing; add example. + +------------------------------------------------------------------------ +r4716 | jcbowman | 2009-10-22 23:41:37 -0600 (Thu, 22 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/prc/oPRCFile.cc + +Fix control point normalization of rational NURBS surfaces. + +------------------------------------------------------------------------ +r4715 | jcbowman | 2009-10-22 00:29:30 -0600 (Thu, 22 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/picture.cc + +Enable workaround for dvisvgm bounding box bug (requires dvisvgm-0.8.6). + +------------------------------------------------------------------------ +r4714 | jcbowman | 2009-10-19 14:14:52 -0600 (Mon, 19 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/examples/animations/inlinemovie3.tex + +Fix typo. + +------------------------------------------------------------------------ +r4713 | jcbowman | 2009-10-19 14:13:51 -0600 (Mon, 19 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Fix inlinemovie3. + +------------------------------------------------------------------------ +r4712 | jcbowman | 2009-10-12 14:44:03 -0600 (Mon, 12 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/geometry.asy + +Resolve ambiguity in arc. + +------------------------------------------------------------------------ +r4711 | jcbowman | 2009-10-12 10:12:13 -0600 (Mon, 12 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/drawsurface.cc + +Don't garbage collect PRC entities. + +------------------------------------------------------------------------ +r4710 | jcbowman | 2009-10-11 08:39:19 -0600 (Sun, 11 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/examples/cyclohexane.asy + +Improve colours. + +------------------------------------------------------------------------ +r4709 | oshardt | 2009-10-10 15:04:06 -0600 (Sat, 10 Oct 2009) | 1 line +Changed paths: + M /trunk/asymptote/base/graph.asy + +Do not compute vector at (0,0); use a instead. +------------------------------------------------------------------------ +r4708 | jcbowman | 2009-10-09 02:13:23 -0600 (Fri, 09 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/drawlabel.h + +Convert labelpath to png for svg output. + +------------------------------------------------------------------------ +r4707 | jcbowman | 2009-10-08 16:28:27 -0600 (Thu, 08 Oct 2009) | 5 lines +Changed paths: + M /trunk/asymptote/picture.cc + +Add support for passing bbox to dvisvgm (currently disabled; this requires +dvisvgm-0.8.6 from http://dvisvgm.hg.sourceforge.net/hgweb/dvisvgm). + +Fix erase when outputting SVG graphics. + +------------------------------------------------------------------------ +r4706 | jcbowman | 2009-10-08 14:17:12 -0600 (Thu, 08 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/util.cc + +Fix formatting of error messages. + +------------------------------------------------------------------------ +r4705 | jcbowman | 2009-10-07 21:12:37 -0600 (Wed, 07 Oct 2009) | 4 lines +Changed paths: + M /trunk/asymptote/drawclipbegin.h + M /trunk/asymptote/drawelement.h + M /trunk/asymptote/drawfill.h + M /trunk/asymptote/drawimage.h + M /trunk/asymptote/examples/ring.asy + M /trunk/asymptote/examples/tensor.asy + M /trunk/asymptote/picture.cc + M /trunk/asymptote/picture.h + +Use ghostscript pngalpha driver to produce transparent png files. + +Produce transparent png files for unsupported SVG elements. + +------------------------------------------------------------------------ +r4704 | jcbowman | 2009-10-06 21:59:53 -0600 (Tue, 06 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/drawpath3.h + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + +Fix surface and path3 garbage collection. + +------------------------------------------------------------------------ +r4703 | jcbowman | 2009-10-06 21:06:44 -0600 (Tue, 06 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/drawsurface.h + M /trunk/asymptote/runarray.in + M /trunk/asymptote/runpicture.in + M /trunk/asymptote/runtimebase.in + +Improve garbage collection. + +------------------------------------------------------------------------ +r4702 | jcbowman | 2009-10-05 23:21:23 -0600 (Mon, 05 Oct 2009) | 5 lines +Changed paths: + M /trunk/asymptote/picture.cc + +Force pdfformat when using a pdflatex texengine with an alternative output +format. + +Force settings.align="B" for non-EPS output formats. + +------------------------------------------------------------------------ +r4701 | jcbowman | 2009-10-03 15:45:21 -0600 (Sat, 03 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/settings.cc + +Workaround broken curses.h header file on i386-solaris. + +------------------------------------------------------------------------ +r4700 | jcbowman | 2009-10-02 15:54:31 -0600 (Fri, 02 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/drawsurface.cc + +Fix center table compression under optimization. + +------------------------------------------------------------------------ +r4699 | jcbowman | 2009-10-02 09:03:23 -0600 (Fri, 02 Oct 2009) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Document Billboard and Embedded labels (see the example billboard.asy). + +------------------------------------------------------------------------ +r4698 | jcbowman | 2009-10-02 02:51:30 -0600 (Fri, 02 Oct 2009) | 1 line +Changed paths: + M /trunk/asymptote/doc/extra/intro.asy + +Add code for removed file. +------------------------------------------------------------------------ +r4697 | jcbowman | 2009-10-02 02:50:40 -0600 (Fri, 02 Oct 2009) | 1 line +Changed paths: + M /trunk/asymptote/configure.ac + +Increment version to 1.89svn. +------------------------------------------------------------------------ r4696 | jcbowman | 2009-10-02 01:25:43 -0600 (Fri, 02 Oct 2009) | 2 lines Changed paths: M /trunk/asymptote/prc/oPRCFile.cc diff --git a/Build/source/utils/asymptote/GUI/xasy2asy.py b/Build/source/utils/asymptote/GUI/xasy2asy.py index 99a747cccda..a86a1e732d1 100755 --- a/Build/source/utils/asymptote/GUI/xasy2asy.py +++ b/Build/source/utils/asymptote/GUI/xasy2asy.py @@ -54,8 +54,8 @@ def startQuickAsy(): AsyTempDir=mkdtemp(prefix="asy_", dir="./") else: AsyTempDir=mkdtemp(prefix="asy_")+os.sep - quickAsy = Popen([xasyOptions.options['asyPath']]+ - split("-noV -multiline -interactive -o"+AsyTempDir), + quickAsy = Popen([xasyOptions.options['asyPath'],"-noV","-multiline", + "-interactive","-o"+AsyTempDir], stdin=PIPE,stdout=PIPE,stderr=STDOUT) if quickAsy.returncode != None: quickAsyFailed = True diff --git a/Build/source/utils/asymptote/GUI/xasyMainWin.py b/Build/source/utils/asymptote/GUI/xasyMainWin.py index 0a1ddc63e36..95dd4fb7cbc 100755 --- a/Build/source/utils/asymptote/GUI/xasyMainWin.py +++ b/Build/source/utils/asymptote/GUI/xasyMainWin.py @@ -144,6 +144,7 @@ class xasyMainWin: self.exportMenu.add_command(label="PDF...",command=self.exportPDF,underline=0) self.exportMenu.add_command(label="GIF...",command=self.exportGIF,underline=0) self.exportMenu.add_command(label="PNG...",command=self.exportPNG,underline=1) + self.exportMenu.add_command(label="SVG...",command=self.exportSVG,underline=0) self.fileMenu.add_cascade(label="Export",menu=self.exportMenu,underline=1) self.fileMenu.add_separator() @@ -720,6 +721,9 @@ class xasyMainWin: def exportPNG(self): self.exportFile(self.filename,"png") + def exportSVG(self): + self.exportFile(self.filename,"svg") + def exportFile(self,inFile, outFormat): if(not self.testOrAcquireLock()): return @@ -743,9 +747,8 @@ class xasyMainWin: return fullname = os.path.abspath(outfilename) outName = os.path.basename(outfilename) - dirname = os.path.dirname(fullname) - command = xasyOptions.options['asyPath']+" -f %s -o %s %s"%(outFormat,fullname,inFile) - saver = subprocess.Popen(split(command),stdin=PIPE,stdout=PIPE,stderr=PIPE) + command=[xasyOptions.options['asyPath'],"-f"+outFormat,"-o"+fullname,inFile] + saver = subprocess.Popen(command,stdin=PIPE,stdout=PIPE,stderr=PIPE) saver.wait() if saver.returncode != 0: tkMessageBox.showerror("Export Error","Export Error:\n"+saver.stdout.read()+saver.stderr.read()) diff --git a/Build/source/utils/asymptote/ReleaseNotes b/Build/source/utils/asymptote/ReleaseNotes index f5ca14b310f..59d6eb02f87 100644 --- a/Build/source/utils/asymptote/ReleaseNotes +++ b/Build/source/utils/asymptote/ReleaseNotes @@ -1,3 +1,72 @@ +Release Notes for Version 1.93 + +Portability issues were addressed. Latticeshading bounds and behaviour +under svgemulation were fixed. The initial SVG pen was fixed. +A parallelogram block was added to the flowchart module. +Temporary files are cleaned up even after TeX errors. The GUI export +function was fixed; an SVG export option was added. The XeLaTex bounding +box was fixed. Spaces in output directory names are now allowed for +supporting drivers. One can cd to other directories, preserving the output +directory. All output files are written to the directory part of +settings.outname; if this is empty, the current directory is used. + +Release Notes for Version 1.92 + +Labels work correctly with oblique projections. Transformed Label +alignment and pt scalings were fixed. Latticeshading is now properly clipped. +The normal and true Circle calculations were fixed. The interface to the +simpson integrator and an array index in contour.asy were fixed. In the +flowchart module, the implicit cast from a pair to a virtual node was +removed in favour of a block constructor. The ode integrationg routines now +return a structure that includes the sampled time values; dynamic +timestepping was implemented for solveBVP. New predefined tick modifiers +were added. The CLZ and CTZ bit functions were implemented. PRC part names +were fixed. The GL library is now explicitly linked. Memory usage was +improved by configuring the garbage collector with --enable-large-config. +Null 3D paths are ignored. Non-pdf output is supported for PDF tex engines. +Portability changes for CYGWIN 1.7 were made. + +Release Notes for Version 1.91 + +The precision of the 3D perspective sizing routines were improved. The +offset in transformed 3D labels with render=0 was fixed. 3D planar +arrowhead gaps were fixed; a duplicate 3D arrow angle factor was removed. +Pen width contributions to the box and ellipse envelopes were fixed. A more +robust contour algorithm based on paraboloid approximation was implemented. +A polargraph routine for arrays was implemented. Default font problems were +fixed. The pdfborder={0 0 0} option was added to settings.hyperrefOptions; +the hypersetup command is now used to avoid hyperref option clashes. The +size of pngalpha images was fixed; the pngalpha driver is used only if +antialias=2. The -alpha Off default convert option was removed in favour of +convertOptions="-alpha Off". Inlinetex support for xelatex was updated. +Picture transformations are now respected by latticeshade. The Bessel +functions J and Y were renamed to Jn and Yn. An operator --(block, block) +was implemented to simplify the flowchart syntax. The expression % expands +to the last result returned at the interactive prompt. The GLU-1.3 library +included in the MSWindows distribution was fixed. + +Release Notes for Version 1.90 + +SVG axial, radial, and emulated tensor-patch shading were fixed; the +dependency on dvisvgm-0.8.7 was documented. + +Release Notes for Version 1.89 + +The draw, fill, and clip commands now pass raw SVG code directly to dvisvgm +(version 0.8.6 required); zero-length paths are output as circles. +Unsupported SVG elements are converted to PNG images; unimplemented SVG +features such as Gouraud and tensor-patch shading can be (partially) +emulated as vector elements using the -svgemulation option. +The control point normalization of rational NURBS surfaces was fixed; +3D NURBS curves are now implemented. A problem with inlinemovie3 was fixed. +The linetype pattern is now a real array: for backwards compatibility, a +string is still accepted, but the return type of linetype(pen) is now +real[] instead of string (backwards incompatible). The split routine was +changed so that an empty delimiter splits on spaces, discarding duplicates. +The palette routines are now guaranteed to generate at least the +specified number of colours. PNG output produces a transparent background. +Surface and path3 garbage collection was fixed. + Release Notes for Version 1.88 Compilation without OpenGL was fixed. PRC billboard labels were diff --git a/Build/source/utils/asymptote/asy-keywords.el b/Build/source/utils/asymptote/asy-keywords.el index d3704119f9b..56ef7697d2a 100644 --- a/Build/source/utils/asymptote/asy-keywords.el +++ b/Build/source/utils/asymptote/asy-keywords.el @@ -2,16 +2,16 @@ ;; This file is automatically generated by asy-list.pl. ;; Changes will be overwritten. ;; -(defvar asy-keywords-version "1.88") +(defvar asy-keywords-version "1.93") (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 )) (defvar asy-type-name '( -Braid FitResult Label Legend 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 light 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 )) +Braid FitResult Label Legend Segment Solution 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 light line linefit marginT marker mass object pair parabola path path3 pen picture point position projection real revolution scaleT scientific segment side slice solution 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 SQR 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 _projection _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 begin beginclip begingroup beginpoint between bevel bezier bezierP bezierPP bezierPPP bezulate bibliography bibliographystyle binarytree binarytreeNode binomial binput bins bisector bisectorpoint 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 cubicroots curabscissa curlSpecifier curpoint currentarrow currentexitfunction currentmomarrow currentpolarconicroutine curve cut cutafter cutbefore cyclic cylinder debugger deconstruct defaultdir defaultformat defaultpen defined degenerate degrees delete deletepreamble determinant diagonal diamond diffdiv 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 end endScript endclip endgroup endl endpoint endpoints eof eol equation equations erase erasestep erf erfc error errorbar errorbars eval excenter excircle exit exitXasyMode exitfunction exp expfactors expi expm1 exradius extend extension extouch fabs factorial fermat fft fhorner figure file filecode fill filldraw filloutside fillrule filltype find finite finiteDifferenceJacobian firstcut firstframe fit fit2 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 indexedfigure initXasyMode initdefaults input inradius insert inside integrate 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 light limits line linear linecap lineinversion linejoin linemargin lineskip linetype linewidth link list lm_enorm lm_evaluate_default lm_lmdif lm_lmpar lm_minimize lm_print_default lm_print_quiet lm_qrfac lm_qrsolv 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 maxbezier maxbound maxcoords maxlength maxratio maxtimes mean medial median midpoint min min3 minbezier minbound minipage minratio mintimes miterlimit momArrowPath momarrowsize monotonic multifigure nativeformat natural needshipout newl newpage newslide newton newtree nextframe nextnormal nextpage nib nodabscissa none norm normalvideo notaknot nowarn 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 overloadedMessage overwrite pack pad pairs palette parabola parabolanodesnumber parallel partialsum path path3 pattern pause pdf pedal periodic perp perpendicular perpendicularmark phantom phi1 phi2 phi3 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 readline realmult realquarticroots rectangle rectangular rectify reflect relabscissa relative relativedistance reldir relpoint reltime remainder remark removeDuplicates rename replace report resetdefaultpen restore restoredefaults reverse reversevideo rf rfind rgb rgba rgbint 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 solveBVP 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 texsize 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 uperiodic upscale uptodate usepackage usersetting usetypescript usleep value variance variancebiased vbox vector vectorfield verbatim view vline vperiodic vprojection warn warning windingnumber 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 CLZ CTZ 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 Jn 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 OmitTickInterval OmitTickIntervals OutTicks Ox Oy Palatino PaletteTicks Pen PenMargin PenMargins Pentype Portrait RadialShade Rainbow Range Relative Right RightTicks Rotate Round SQR Scale ScaleX ScaleY ScaleZ Seascape Segment 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 Yn Z ZX ZXgrid ZYgrid ZapfChancery ZapfDingbats _cputime _draw _eval _image _labelpath _projection _strokepath _texpath aCos aSin aTan abort abs accel acos acosh acot acsc activatequote add addArrow addMargins addSaveFunction addnode addnodes addpenarc addpenline 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 begin beginclip begingroup beginpoint between bevel bezier bezierP bezierPP bezierPPP bezulate bibliography bibliographystyle binarytree binarytreeNode binomial binput bins bisector bisectorpoint blend blockconnector boutput box bqe breakpoint breakpoints brick buildRestoreDefaults buildRestoreThunk buildcycle bulletcolor byte canonical canonicalcartesiansystem cartesiansystem case1 case2 case3 case4 cbrt cd ceil center centerToFocus centroid cevian change2 changecoordsys checkSegment checkconditionlength checker checkincreasing 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 connected connectedindex containmentTree contains contour contour3 contouredges controlSpecifier convert coordinates coordsys copy cos cosh cot countIntersections cputime crop cropcode cross crossframe crosshatch crossmarksize csc cubicroots curabscissa curlSpecifier curpoint currentarrow currentexitfunction currentmomarrow currentpolarconicroutine curve cut cutafter cutbefore cyclic cylinder deactivatequote debugger deconstruct defaultdir defaultformat defaultpen defined degenerate degrees delete deletepreamble determinant diagonal diamond diffdiv 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 end endScript endclip endgroup endl endpoint endpoints eof eol equation equations erase erasestep erf erfc error errorbar errorbars eval excenter excircle exit exitXasyMode exitfunction exp expfactors expi expm1 exradius extend extension extouch fabs factorial fermat fft fhorner figure file filecode fill filldraw filloutside fillrule filltype find finite finiteDifferenceJacobian firstcut firstframe fit fit2 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 indexedfigure initXasyMode initdefaults input inradius insert inside integrate interactive interior interp interpolate intersect intersection intersectionpoint intersectionpoints intersections intouch inverse inversion invisible is3D isCCW 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 light limits line linear linecap lineinversion linejoin linemargin lineskip linetype linewidth link list lm_enorm lm_evaluate_default lm_lmdif lm_lmpar lm_minimize lm_print_default lm_print_quiet lm_qrfac lm_qrsolv 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 maxbezier maxbound maxcoords maxlength maxratio maxtimes mean medial median midpoint min min3 minbezier minbound minipage minratio mintimes miterlimit momArrowPath momarrowsize monotonic multifigure nativeformat natural needshipout newl newpage newslide newton newtree nextframe nextnormal nextpage nib nodabscissa none norm normalvideo notaknot nowarn 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 outname outprefix output overloadedMessage overwrite pack pad pairs palette parabola parabolanodesnumber parallel parallelogram partialsum path path3 pattern pause pdf pedal periodic perp perpendicular perpendicularmark phantom phi1 phi2 phi3 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 readline realmult realquarticroots rectangle rectangular rectify reflect relabscissa relative relativedistance reldir relpoint reltime remainder remark removeDuplicates rename replace report resetdefaultpen restore restoredefaults reverse reversevideo rf rfind rgb rgba rgbint rms rotate rotateO rotation round roundbox roundedpath roundrectangle same samecoordsys sameside sample save savedefaults saveline scale scale3 scaleO scaleT scaleless scientific search searchindex searchtree sec secondaryX secondaryY seconds section sector seek seekeof segment sequence setcontour 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 solveBVP 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 texsize 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 uperiodic upscale uptodate usepackage usersetting usetypescript usleep value variance variancebiased vbox vector vectorfield verbatim view vline vperiodic vprojection warn warning windingnumber 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 Coeff 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 E_Euler E_PC E_RK2 E_RK3BS Emerald EndPoint Euler 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 LM_DWARF LM_MACHEP LM_SQRT_DWARF LM_SQRT_GIANT LM_USERTOL 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 PC PaleGoldenrod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip Peach PeachPuff Periwinkle Peru PineGreen Pink Plum PowderBlue ProcessBlue Purple RK2 RK3 RK3BS RK4 RK5 RK5DP RK5F 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 currentlight 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 defaultControl 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 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 lm_infmsg lm_shortmsg 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 ocgindex 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 stepfactor 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 viewportmargin 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 Coeff 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 Down Draw E ENE EPS ESE E_Euler E_PC E_RK2 E_RK3BS Emerald EndPoint Euler 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 LM_DWARF LM_MACHEP LM_SQRT_DWARF LM_SQRT_GIANT LM_USERTOL Label Lavender LavenderBlush LawnGreen Left 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 PC PaleGoldenrod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip Peach PeachPuff Periwinkle Peru PineGreen Pink Plum PowderBlue ProcessBlue Purple RK2 RK3 RK3BS RK4 RK5 RK5DP RK5F RawSienna Red RedOrange RedViolet Rhodamine Right 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 Up 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 currentlight 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 defaultControl defaultS defaultbackpen defaultcoordsys defaultexcursion defaultfilename defaultformat defaultmassformat defaultpen diagnostics differentlengths dot dotfactor dotframe dotted doublelinepen doublelinespacing down duplicateFuzz edge ellipsenodesnumberfactor eps epsgeo epsilon evenodd extendcap exterior 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 hyperbola hyperbolanodesnumberfactor identity4 ignore inXasyMode inch inches includegraphicscommand incommensurate inf infinity institutionpen intMax intMin interior invert invisible itempen itemskip itemstep labelmargin landscape lastnode left legendhskip legendlinelength legendmargin legendmarkersize legendmaxrelativewidth legendvskip lightblue lightcyan lightgray lightgreen lightgrey lightmagenta lightolive lightred lightyellow line linemargin lm_infmsg lm_shortmsg 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 none nopoint noprimary nullpath nullpen numarray ocgindex 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 stepfactor 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 viewportmargin 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 10e8b88045f..0ff8b3918ef 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.88 +Version: 1.93 Release: 1%{?dist} Summary: Descriptive vector graphics language diff --git a/Build/source/utils/asymptote/base/CAD.asy b/Build/source/utils/asymptote/base/CAD.asy index 7c333318f5c..b65e6478838 100644 --- a/Build/source/utils/asymptote/base/CAD.asy +++ b/Build/source/utils/asymptote/base/CAD.asy @@ -106,12 +106,12 @@ struct sCAD // E
cad.pE =
cad.pSurfaceTreatmentAllowed =
- pFullWidth + linetype("10 2.5");
+ pFullWidth + linetype(new real[] {10,2.5});
// F
cad.pF =
cad.pInvisibleEdge =
cad.pInvisibleContour =
- pHalfWidth + linetype("20 5");
+ pHalfWidth + linetype(new real[] {20,5});
// G
cad.pG =
cad.pMiddleLine =
@@ -120,7 +120,7 @@ struct sCAD cad.pCircularHole =
cad.pDivisionPlane =
cad.pTransferLine =
- pHalfWidth + linetype("40 5 5 5");
+ pHalfWidth + linetype(new real[] {40,5,5,5});
// H
// see J
// I
@@ -129,7 +129,7 @@ struct sCAD cad.pJ =
cad.pCuttingPlane =
cad.pSurfaceTreatmentRequested =
- pFullWidth + linetype("20 2.5 2.5 2.5");
+ pFullWidth + linetype(new real[] {20,2.5,2.5,2.5});
// K
cad.pK =
cad.pContourBeforeDeformation =
@@ -137,7 +137,7 @@ struct sCAD cad.pEndShapeRawMaterial =
cad.pContourEligibleType =
cad.pPartInFrontOfCuttingPlane =
- pHalfWidth + linetype("40 5 5 5 5 5");
+ pHalfWidth + linetype(new real[] {40,5,5,5,5,5});
return cad;
} // end of Create
diff --git a/Build/source/utils/asymptote/base/animation.asy b/Build/source/utils/asymptote/base/animation.asy index 27f7171a639..582b32bced4 100644 --- a/Build/source/utils/asymptote/base/animation.asy +++ b/Build/source/utils/asymptote/base/animation.asy @@ -33,8 +33,7 @@ struct animation { // been generated. void operator init(string prefix="", bool global=true) { - prefix=replace((prefix == "") ? outprefix() : stripdirectory(prefix), - " ","_"); + prefix=replace(stripdirectory(outprefix(prefix))," ","_"); this.prefix=prefix; this.global=global; } diff --git a/Build/source/utils/asymptote/base/contour.asy b/Build/source/utils/asymptote/base/contour.asy index fbb4cd1c71a..3c01640b2cc 100644 --- a/Build/source/utils/asymptote/base/contour.asy +++ b/Build/source/utils/asymptote/base/contour.asy @@ -1,307 +1,923 @@ -// Contour routines written by Radoslav Marinov and John Bowman. - +/* + Contour routines written by Radoslav Marinov, John Bowman, and Chris Savage. + + [2009/10/15: C Savage] generate oriented contours + [2009/10/19: C Savage] use boxes instead of triangles +*/ + +/* + Contours lines/guides are oriented throughout. By convention, + for a single contour, higher values are to the left and/or lower + values are to the right along the direction of the lines/guide. +*/ + import graph_settings; -real eps=10000*realEpsilon; - -// 1 -// 6 +-------------------+ 5 -// | \ / | -// | \ / | -// | \ / | -// | \ / | -// 2 | X | 0 -// | / \ | -// | / \ | -// | / \ | -// | / \ | -// 7 +-------------------+ 4 or 8 -// 3 +real eps=sqrtEpsilon; -private struct segment -{ - bool active; - pair a,b; // Endpoints; a is always an edge point if one exists. - int c; // Contour value. - int edge; // -1: interior, 0 to 3: edge, - // 4-8: single-vertex edge, 9: double-vertex edge. +/* + GRID CONTOURS + + Contours on a grid of points are determined as follows: + for each grid square, the function is approximated as the unique + paraboloid passing through the function values at the four + corners. The intersection of a paraboloid with the f(x,y)=c + plane is a line or hyperbola. + + Grid data structures: + + boxcontour: + Describes a particular contour segment in a grid square. + + boxdata: + Describes contours in a grid square (holds boxcontours). + + segment: + Describes a contour line. Usually a closed (interior) contour, + a line that terminates on the border, or a border segment used + to enclose a region. + + Segment: + Describes a contour line. + + Main grid routines: + + setcontour: + Determines the contours in a grid square. + + contouredges: + Determines the contour segments over a grid of function values. + + connect: + Converts contours into guides + +*/ + +typedef int boxtype; +boxtype exterior=-1; +boxtype edge = 0; +boxtype interior=+1; + +typedef int contourshape; +contourshape none =0; +contourshape line =1; +contourshape hyperbola=2; + +// Describe position by grid square and position in square +private struct gridpoint { + int i,j; + pair z; + void operator init(int i, int j, pair z) { + this.i=i; + this.j=j; + this.z=z; + } + void operator init(gridpoint gp) { + this.i=gp.i; + this.j=gp.j; + this.z=gp.z; + } } -// Case 1: line passes through two vertices of a triangle -private segment case1(pair p0, pair p1, int edge) +private bool same(gridpoint gp1, gridpoint gp2) { - // Will cause a duplicate guide; luckily case1 is rare - segment rtrn; - rtrn.active=true; - rtrn.a=p0; - rtrn.b=p1; - rtrn.edge=edge; - return rtrn; + return abs(gp2.z-gp1.z+(gp2.i-gp1.i,gp2.j-gp1.j)) < eps; } -// Case 2: line passes through a vertex and a side of a triangle -// (the first vertex passed and the side between the other two) -private segment case2(pair p0, pair p1, pair p2, - real v0, real v1, real v2, int edge) -{ - segment rtrn; - pair val=interp(p1,p2,abs(v1/(v2-v1))); - rtrn.active=true; - if(edge < 4) { - rtrn.a=val; - rtrn.b=p0; - } else { - rtrn.a=p0; - rtrn.b=val; + +// Describe contour in unit square(scaling to be done later). +private struct boxcontour { + bool active; + contourshape type; // Shape of contour segment(line or hyperbola) + pair a,b; // Start/end point of contour segment. + // Higher values to left along a--b. + real x0,y0,m; // For hyperbola: (x-x0)*(y-y0)=m + int signx,signy; // Sign of x-x0&y-y0 for hyperbola piece; + // identifies which direction it opens + int i,j; // Indices of lower left corner in position or + // data array. + int index; // Contour index + + void operator init(contourshape type, pair a, pair b, + real x0, real y0, real m, int signx, int signy, + int i, int j, int index) { + this.active=true; + this.type=type; + this.a=a; + this.b=b; + + this.x0=x0; + this.y0=y0; + this.m=m; + this.signx=signx; + this.signy=signy; + + this.i=i; + this.j=j; + this.index=index; + } + // Generate list of points along the line/hyperbola segment + // representing the contour in the box + gridpoint[] points(int subsample=1, bool first=true, bool last=true) { + gridpoint[] gp; + if(first) + gp.push(gridpoint(i,j,a)); + if(subsample > 0) { + // Linear case + if(type == line) { + for(int k=1; k <= subsample; ++k) { + pair z=interp(a,b,k/(subsample+1)); + gp.push(gridpoint(i,j,z)); + } + } else if(type == hyperbola) { + // Special hyperbolic case of m=0 + // The contours here are infinite lines at x=x0 and y=y0, + // but handedness always connects a semi-infinite + // horizontal segment with a semi-infinite vertical segment + // connected at (x0,y0). + // If (x0,y0) is outside the unit box, there is only one + // line segment to include; otherwise, there are both + // a horizontal and a vertical line segment to include. + if(m == 0) { + // Single line + if(a.x == b.x || a.y == b.y) { + for(int k=1; k <= subsample; ++k) { + pair z=interp(a,b,k/(subsample+1)); + gp.push(gridpoint(i,j,z)); + } + // Two lines(may get one extra point here) + } else { + int nsub=quotient(subsample,2); + pair mid=(x0,y0); + for(int k=1; k <= nsub; ++k) { + pair z=interp(a,mid,k/(nsub+1)); + gp.push(gridpoint(i,j,z)); + } + gp.push(gridpoint(i,j,mid)); + for(int k=1; k <= nsub; ++k) { + pair z=interp(mid,b,k/(nsub+1)); + gp.push(gridpoint(i,j,z)); + } + } + // General hyperbolic case (m != 0). + // Parametric equations(m > 0): + // x(t)=x0 +/- sqrt(m)*exp(t) + // y(t)=y0 +/- sqrt(m)*exp(-t) + // Parametric equations (m < 0): + // x(t)=x0 +/- sqrt(-m)*exp(t) + // y(t)=y0 -/+ sqrt(-m)*exp(-t) + // Points will be taken equally spaced in parameter t. + } else { + real sqrtm=sqrt(abs(m)); + real ta=log(signx*(a.x-x0)/sqrtm); + real tb=log(signx*(b.x-x0)/sqrtm); + real[] t=uniform(ta,tb,subsample+1); + for(int k=1; k <= subsample; ++k) { + pair z=(x0+signx*sqrtm*exp(t[k]), + y0+signy*sqrtm*exp(-t[k])); + gp.push(gridpoint(i,j,z)); + } + } + } + } + if(last) + gp.push(gridpoint(i,j,b)); + + return gp; } - rtrn.edge=edge; - return rtrn; } -// Case 3: line passes through two sides of a triangle -// (through the sides formed by the first & second, and second & third -// vertices) -private segment case3(pair p0, pair p1, pair p2, - real v0, real v1, real v2, int edge=-1) -{ - segment rtrn; - rtrn.active=true; - rtrn.a=interp(p1,p0,abs(v1/(v0-v1))); - rtrn.b=interp(p1,p2,abs(v1/(v2-v1))); - rtrn.edge=edge; - return rtrn; +// Hold data for a single grid square +private struct boxdata { + boxtype type; // Does box contain a contour segment (edge of + // contour region) or is it entirely interior/ + // exterior to contour region ? + real min,max; // Smallest/largest corner value + real max2; // Second-largest corner value + boxcontour[] data; // Stores actual contour segment data + + int count() {return data.length;} + void operator init(real f00, real f10, real f01, real f11) { + real[] X={f00,f10,f01,f11}; + min=min(X); + max=max(X); + X.delete(find(X == max)); + max2=max(X); + } + void settype(real c) { + // Interior case(f >= c) + if(min > c-eps) { + type=interior; + // Exterior case(f < c) + } else if(max < c-eps) { + type=exterior; + // Special case: only one corner at f=c, f < c elsewhere + //(no segment in this case) + } else if((max < c+eps) && (max2 < c-eps)) { + type=exterior; + // Edge of contour passes through box + } else { + type=edge; + } + } } -// Check if a line passes through a triangle, and draw the required line. -private segment checktriangle(pair p0, pair p1, pair p2, - real v0, real v1, real v2, int edge=-1) -{ - // default null return - static segment dflt; - real eps=eps*max(abs(v0),abs(v1),abs(v2)); +/* + Determine contours within a unit square box. - if(v0 < -eps) { - if(v1 < -eps) { - if(v2 < -eps) return dflt; // nothing to do - else if(v2 <= eps) return dflt; // nothing to do - else return case3(p0,p2,p1,v0,v2,v1); - } else if(v1 <= eps) { - if(v2 < -eps) return dflt; // nothing to do - else if(v2 <= eps) return case1(p1,p2,5+edge); - else return case2(p1,p0,p2,v1,v0,v2,5+edge); - } else { - if(v2 < -eps) return case3(p0,p1,p2,v0,v1,v2,edge); - else if(v2 <= eps) - return case2(p2,p0,p1,v2,v0,v1,edge); - else return case3(p1,p0,p2,v1,v0,v2,edge); - } - } else if(v0 <= eps) { - if(v1 < -eps) { - if(v2 < -eps) return dflt; // nothing to do - else if(v2 <= eps) return case1(p0,p2,4+edge); - else return case2(p0,p1,p2,v0,v1,v2,4+edge); - } else if(v1 <= eps) { - if(v2 < -eps) return case1(p0,p1,9); - else if(v2 <= eps) return dflt; // use finer partitioning. - else return case1(p0,p1,9); + Here, we approximate the function on the unit square to be a quadric + surface passing through the specified values at the four corners: + f(x,y)=(1-x)(1-y) f00+x(1-y) f10+(1-x)y f01+xy f11 + =a0+ax x+ay y+axy xy + where f00, f10, f01 and f11 are the function values at the four + corners of the unit square 0 < x < 1&0 < y < 1 and: + a0 =f00 + ax =f10-f00 + ay =f01-f00 + axy=f00+f11-f10-f01 + This can also be expressed in paraboloid form as: + f(x,y)=alpha [(x+y-cp)^2-(x-y-cn)^2]+d + where: + alpha=axy/4 + cp =-(ax+ay)/a11 + cn =-(ax-ay)/a11 + d =(a0 axy-ax ay)/axy + In the procedure below, we take f00 - > f00-c etc. for a contour + level c and we search for f=0. + + For this surface, there are two possible contour shapes: + linear: (y-y0)/(x-x0)=m + hyperbolic: (x-x0)*(y-y0)=m + The linear case has a single line. The hyperbolic case may have + zero, one or two segments within the box (there are two sides of + a hyperbola, each of which may or may not pass through the unit + square). A hyperbola with m=0 is a special case that is handled + separately below. + + If c0 is the desired contour level, we effectively find the + contours at c0-epsilon for arbitrarily small epsilon. Flat + regions equal to c0 are considered to be interior to the + contour curves. Regions that lie at the contour level are + considered to be interior to the contour curves. As a result, + contours are only constructed if they are immediately adjacent + to some region interior to the square that falls below the + contour value; in other words, if an edge falls on the contour + value, but a point within the square arbitrarily close to the + edge falls above the contour value, that edge (or applicable + portion) is not included. This requirement gives the following: + *) ensures contours on an edge are unique (do not appear in + an adjacent square with the same orientation) + *) no three line vertices (four line vertices are possible, but + are not usually an issue) + *) all segments can be joined into closed curves or curves that + terminate on the boundary (no unclosed curves terminate in + the interior region of the grid) + + Note the logic below skips cases that have been filtered out + by the boxdata.settype() routine. +*/ +private void setcontour(real f00, real f10, real f01, real f11, real epsf, + boxdata bd, int i, int j, int index) { + // SPECIAL CASE: two diagonal corners at the contour level with + // the other two below does not yield any contours within the + // unit box, but may have been previously misidentified as an + // edge containing region. + if(((f00*f11 == 0) && (f10*f01 > 0)) || ((f01*f10 == 0) && (f00*f11 > 0))) { + bd.type=exterior; + return; + } + + // NOTE: From this point on, we can assume at least one contour + // segment exists in the square. This allows several cases to + // be ignored or simplified below, particularly edge cases. + + // Form used to approximate function on unit square + real F(real x, real y) { + return interp(interp(f00,f10,x),interp(f01,f11,x),y); + } + + // Write contour as a0+ax*x+ay*y +axy*x*y=0 + real a0 =f00; + real ax =f10-f00; + if(abs(ax) < epsf) ax=0; + real ay =f01-f00; + if(abs(ay) < epsf) ay=0; + real axy=f00+f11-f01 -f10; + if(abs(axy) < epsf) axy=0; + + // Linear contour(s) + if(axy == 0) { + pair a,b; + // Horizontal + if(ax == 0) { + if(ay == 0) return; // Contour is at most an isolated point; ignore. + real y0=-a0/ay; + if(abs(y0-1) < eps) y0=1; + if((f00 > 0) || (f01 < 0)) { + a=(1,y0); + b=(0,y0); + } else { + a=(0,y0); + b=(1,y0); + } + // Vertical + } else if(ay == 0) { + real x0=-a0/ax; + if(abs(x0-1) < eps) x0=1; + if((f00 > 0) || (f10 < 0)) { + a=(x0,0); + b=(x0,1); + } else { + a=(x0,1); + b=(x0,0); + } + // Angled line } else { - if(v2 < -eps) return case2(p0,p1,p2,v0,v1,v2,4+edge); - else if(v2 <= eps) return case1(p0,p2,4+edge); - else return dflt; // nothing to do - } - } else { - if(v1 < -eps) { - if(v2 < -eps) return case3(p1,p0,p2,v1,v0,v2,edge); - else if(v2 <= eps) - return case2(p2,p0,p1,v2,v0,v1,edge); - else return case3(p0,p1,p2,v0,v1,v2,edge); - } else if(v1 <= eps) { - if(v2 < -eps) return case2(p1,p0,p2,v1,v0,v2,5+edge); - else if(v2 <= eps) return case1(p1,p2,5+edge); - else return dflt; // nothing to do + real x0=-a0/ax; + if(abs(x0-1) < eps) x0=1; + real y0=-a0/ay; + if(abs(y0-1) < eps) y0=1; + int count=0; + real[] farr={f00,f10,f11,f01}; + farr.cyclic=true; + pair[] corners={(0,0),(1,0),(1,1),(0,1)}; + pair[] sidedir={(1,0),(0,1),(-1,0),(0,-1)}; + + int count=0; + for(int i=0; i < farr.length; ++i) { + // Corner + if(farr[i] == 0) { + ++count; + if(farr[i-1] > 0) { + a=corners[i]; + } else { + b=corners[i]; + } + // Side + } else if(farr[i]*farr[i+1] < 0) { + ++count; + if(farr[i] > 0) { + a=corners[i]-(farr[i]/(farr[i+1]-farr[i]))*sidedir[i]; + } else { + b=corners[i]-(farr[i]/(farr[i+1]-farr[i]))*sidedir[i]; + } + } + } + // Check(if logic is correct above, this will not happen) + if(count != 2) { + abort("Unexpected error in setcontour routine: odd number of" + +" crossings (linear case)"); + } + } + boxcontour bc=boxcontour(line,a,b,0,0,0,1,1,i,j,index); + bd.data.push(bc); + return; + } + + // Hyperbolic contour(s) + // Described in form: (x-x0)*(y-y0)=m + real x0=-ay/axy; + if(abs(x0-1) < eps) x0=1; + real y0=-ax/axy; + if(abs(y0-1) < eps) y0=1; + real m =ay*ax-a0*axy; + m=(abs(m) < eps) ? 0 : m/axy^2; + + // Special case here: straight segments (possibly crossing) + if(m == 0) { + pair a,b; + int signx,signy; + // Assuming at least one corner is below contour level here + if(x0 == 0) { + signx=+1; + if(y0 == 0) { + a=(1,0); + b=(0,1); + signy=+1; + } else if(y0 == 1) { + a=(0,0); + b=(1,1); + signy=-1; + } else if(y0 < 0 || y0 > 1) { + a=(0,0); + b=(0,1); + signy=y0 > 0 ? -1 : +1; + } else { + if(f10 > 0) { + a=(1,y0); + b=(0,1); + signy=+1; + } else { + a=(0,0); + b=(1,y0); + signy=-1; + } + } + boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index); + bd.data.push(bc); + return; + } else if(x0 == 1) { + signx=-1; + if(y0 == 0) { + a=(1,1); + b=(0,0); + signy=+1; + } else if(y0 == 1) { + a=(0,1); + b=(1,0); + signy=-1; + } else if(y0 < 0 || y0 > 1) { + a=(1,1); + b=(1,0); + signy=y0 > 0 ? -1 : +1; + } else { + if(f01 > 0) { + a=(0,y0); + b=(1,0); + signy=-1; + } else { + a=(1,1); + b=(0,y0); + signy=+1; + } + } + boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index); + bd.data.push(bc); + return; + } else if(y0 == 0) { + signy=+1; + if(x0 < 0 || x0 > 1) { + a=(1,0); + b=(0,0); + signx=x0 > 0 ? -1 : +1; + } else { + if(f11 > 0) { + a=(x0,1); + b=(0,0); + signx=-1; + } else { + a=(1,0); + b=(x0,1); + signx=+1; + } + } + boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index); + bd.data.push(bc); + return; + } else if(y0 == 1) { + signy=-1; + if(x0 < 0 || x0 > 1) { + a=(0,1); + b=(1,1); + signx=x0 > 0 ? -1 : +1; + } else { + if(f00 > 0) { + a=(x0,0); + b=(1,1); + signx=+1; + } else { + a=(0,1); + b=(x0,0); + signx=-1; + } + } + boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index); + bd.data.push(bc); + return; + } else if(x0 < 0 || x0 > 1) { + signx=x0 > 0 ? -1 : +1; + if(f00 > 0) { + a=(1,y0); + b=(0,y0); + signy=+1; + } else { + a=(0,y0); + b=(1,y0); + signy=-1; + } + boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index); + bd.data.push(bc); + return; + } else if(y0 < 0 || y0 > 1) { + signy=y0 > 0 ? -1 : +1; + if(f00 > 0) { + a=(x0,0); + b=(x0,1); + signx=+1; + } else { + a=(x0,1); + b=(x0,0); + signx=-1; + } + boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index); + bd.data.push(bc); + return; } else { - if(v2 < -eps) return case3(p0,p2,p1,v0,v2,v1); - else if(v2 <= eps) return dflt; // nothing to do - else return dflt; // nothing to do - } - } -} + if(f10 > 0) { + a=(0,y0); + b=(x0,0); + boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,-1,-1,i,j,index); + bd.data.push(bc); + a=(1,y0); + b=(x0,1); + bc=boxcontour(hyperbola,a,b,x0,y0,m,+1,+1,i,j,index); + bd.data.push(bc); + return; + } else { + a=(x0,0); + b=(1,y0); + boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,+1,-1,i,j,index); + bd.data.push(bc); + a=(x0,1); + b=(0,y0); + bc=boxcontour(hyperbola,a,b,x0,y0,m,-1,+1,i,j,index); + bd.data.push(bc); + return; + } + } + } + + // General hyperbola case + int signc=(F(x0,y0) > 0) ? +1 : -1; + + pair[] points; + + real xB=(y0 == 0) ? infinity : x0-m/y0; + if(abs(xB) < eps) xB=0; + if(xB >= 0 && xB <= 1-eps) points.push((xB,0)); -// Collect connecting path segments. -private void collect(pair[][][] points, real[] c) -{ - // use to reverse an array, omitting the first point - int[] reverseF(int n) {return sequence(new int(int x){return n-1-x;},n-1);} - // use to reverse an array, omitting the last point - int[] reverseL(int n) {return sequence(new int(int x){return n-2-x;},n-1);} + real xT=(y0 == 1) ? infinity : x0+m/(1-y0); + if(abs(xT-1) < eps) xT=1; + if(xT >= eps && xT <= 1) points.push((xT,1)); + + real yL=(x0 == 0) ? infinity : y0-m/x0; + if(abs(yL-1) < eps) yL=1; - for(int cnt=0; cnt < c.length; ++cnt) { - pair[][] gdscnt=points[cnt]; - for(int i=0; i < gdscnt.length; ++i) { - pair[] gig=gdscnt[i]; - int Li=gig.length; - for(int j=i+1; j < gdscnt.length; ++j) { - pair[] gjg=gdscnt[j]; - int Lj=gjg.length; - if(abs(gig[0]-gjg[0]) < eps) { - gdscnt[j]=gjg[reverseF(Lj)]; - gdscnt[j].append(gig); - gdscnt.delete(i); - --i; - break; - } else if(abs(gig[0]-gjg[Lj-1]) < eps) { - gig.delete(0); - gdscnt[j].append(gig); - gdscnt.delete(i); - --i; - break; - } else if(abs(gig[Li-1]-gjg[0]) < eps) { - gjg.delete(0); - gig.append(gjg); - gdscnt[j]=gig; - gdscnt.delete(i); - --i; - break; - } else if(abs(gig[Li-1]-gjg[Lj-1]) < eps) { - gig.append(gjg[reverseL(Lj)]); - gdscnt[j]=gig; - gdscnt.delete(i); - --i; - break; - } + if(yL > eps && yL <= 1) points.push((0,yL)); + + real yR=(x0 == 1) ? infinity : y0+m/(1-x0); + if(abs(yR) < eps) yR=0; + if(yR >= 0 && yR <= 1-eps) points.push((1,yR)); + + // Check (if logic is correct above, this will not happen) + if(!(points.length == 2 || points.length == 4)) { + abort("Unexpected error in setcontour routine: odd number of" + +" crossings (hyperbolic case)"); + } + + // Lower left side + if((x0 > 0) && (y0 > 0) && (f00*signc < 0)) { + pair[] pts0; + for(int i=0; i < points.length; ++i) { + if((points[i].x < x0) && (points[i].y < y0)) { + pts0.push(points[i]); + } + } + if(pts0.length == 2) { + pair a0,b0; + if((f00 > 0) ^(pts0[0].x < pts0[1].x)) { + a0=pts0[0]; + b0=pts0[1]; + } else { + a0=pts0[1]; + b0=pts0[0]; + } + boxcontour bc=boxcontour(hyperbola,a0,b0,x0,y0,m,-1,-1,i,j,index); + bd.data.push(bc); + } + } + + // Lower right side + if((x0 < 1) && (y0 > 0) && (f10*signc < 0)) { + pair[] pts0; + for(int i=0; i < points.length; ++i) { + if((points[i].x > x0) && (points[i].y < y0)) { + pts0.push(points[i]); + } + } + if(pts0.length == 2) { + pair a0,b0; + if((f10 > 0) ^(pts0[0].x < pts0[1].x)) { + a0=pts0[0]; + b0=pts0[1]; + } else { + a0=pts0[1]; + b0=pts0[0]; + } + boxcontour bc=boxcontour(hyperbola,a0,b0,x0,y0,m,+1,-1,i,j,index); + bd.data.push(bc); + } + } + + // Upper right side + if((x0 < 1) && (y0 < 1) && (f11*signc < 0)) { + pair[] pts0; + for(int i=0; i < points.length; ++i) { + if((points[i].x > x0) && (points[i].y > y0)) { + pts0.push(points[i]); + } + } + if(pts0.length == 2) { + pair a0,b0; + if((f11 > 0) ^(pts0[0].x > pts0[1].x)) { + a0=pts0[0]; + b0=pts0[1]; + } else { + a0=pts0[1]; + b0=pts0[0]; } + boxcontour bc=boxcontour(hyperbola,a0,b0,x0,y0,m,+1,+1,i,j,index); + bd.data.push(bc); } } + + // Upper left side + if((x0 > 0) && (y0 < 1) && (f01*signc < 0)) { + pair[] pts0; + for(int i=0; i < points.length; ++i) { + if((points[i].x < x0) && (points[i].y > y0)) { + pts0.push(points[i]); + } + } + if(pts0.length == 2) { + pair a0,b0; + if((f01 > 0) ^(pts0[0].x > pts0[1].x)) { + a0=pts0[0]; + b0=pts0[1]; + } else { + a0=pts0[1]; + b0=pts0[0]; + } + boxcontour bc=boxcontour(hyperbola,a0,b0,x0,y0,m,-1,+1,i,j,index); + bd.data.push(bc); + } + } + return; } -// Join path segments. -private guide[][] connect(pair[][][] points, real[] c, interpolate join) -{ - // set up return value - guide[][] result=new guide[c.length][]; - for(int cnt=0; cnt < c.length; ++cnt) { - pair[][] pointscnt=points[cnt]; - guide[] resultcnt=result[cnt]=new guide[pointscnt.length]; - for(int i=0; i < pointscnt.length; ++i) { - pair[] pts=pointscnt[i]; - guide gd; - if(pts.length > 0) { - if(pts.length > 1 && abs(pts[0]-pts[pts.length-1]) < eps) { - guide[] g=sequence(new guide(int i) { - return pts[i]; - },pts.length-1); - g.push(cycle); - gd=join(...g); - } else - gd=join(...sequence(new guide(int i) { - return pts[i]; - },pts.length)); + +// Checks if end of first contour segment matches the beginning of +// the second. +private bool connected(boxcontour bc1, boxcontour bc2) { + return abs(bc2.a-bc1.b+(bc2.i-bc1.i,bc2.j-bc1.j)) < eps; +} + +// Returns index of first active element in bca that with beginning +// that connects to the end of bc, or -1 if no such element. +private int connectedindex(boxcontour bc, boxcontour[] bca, + bool activeonly=true) { + for(int i=0; i < bca.length; ++i) { + if(!bca[i].active) continue; + if(connected(bc,bca[i])) { + return i; + } + } + return -1; +} + +// Returns index of first active element in bca with end that connects +// to the start of bc, or -1 if no such element. +private int connectedindex(boxcontour[] bca, boxcontour bc, + bool activeonly=true) { + for(int i=0; i < bca.length; ++i) { + if(!bca[i].active) continue; + if(connected(bca[i],bc)) { + return i; + } + } + return -1; +} + + +// Processes indices for grid regions touching the +// end/start (forward=true/false) of the contour segment +private void searchindex(boxcontour bc, bool forward, void f(int i, int j)) { + pair z=forward ? bc.b : bc.a; + + int i=bc.i; + int j=bc.j; + + if(z == (0,0)) f(i-1,j-1); + if(z.y == 0) f(i,j-1); + if(z == (1,0)) f(i+1,j-1); + if(z.x == 1) f(i+1,j); + if(z == (1,1)) f(i+1,j+1); + if(z.y == 1) f(i,j+1); + if(z == (0,1)) f(i-1,j+1); + if(z.x == 0) f(i-1,j); +} + +// Contour segment +private struct segment { + gridpoint[] data; + void operator init() { + } + void operator init(boxcontour bc, int subsample=1) { + bc.active=false; + this.data.append(bc.points(subsample,first=true,last=true)); + } + void operator init(int i, int j, pair z) { + gridpoint gp=gridpoint(i,j,z); + data.push(gp); + } + void operator init(gridpoint[] gp) { + this.data.append(gp); + } + gridpoint start() { + if(data.length == 0) { + return gridpoint(-1,-1,(-infinity,-infinity)); + } + gridpoint gp=data[0]; + return gridpoint(gp.i,gp.j,gp.z); + } + gridpoint end() { + if(data.length == 0) { + return gridpoint(-1,-1,(-infinity,-infinity)); + } + gridpoint gp=data[data.length-1]; + return gridpoint(gp.i,gp.j,gp.z); + } + bool closed() { + return same(this.start(),this.end()); + } + void append(boxcontour bc, int subsample=1) { + bc.active=false; + data.append(bc.points(subsample,first=false,last=true)); + } + void prepend(boxcontour bc, int subsample=1) { + bc.active=false; + data.insert(0 ... bc.points(subsample,first=true,last=false)); + } + void append(int i, int j, pair z) { + gridpoint gp=gridpoint(i,j,z); + data.push(gp); + } + void prepend(int i, int j, pair z) { + gridpoint gp=gridpoint(i,j,z); + data.insert(0,gp); + } + segment copy() { + segment seg=new segment; + seg.data=new gridpoint[data.length]; + for(int i=0; i < data.length; ++i) { + seg.data[i]=gridpoint(data[i].i,data[i].j,data[i].z); + } + return seg; + } + segment reversecopy() { + segment seg=new segment; + seg.data=new gridpoint[data.length]; + for(int i=0; i < data.length; ++i) { + seg.data[data.length-i-1]=gridpoint(data[i].i,data[i].j,data[i].z); + } + return seg; + } +} + +// Container to hold edge and border segments that form one continuous line +private struct Segment { + segment[] edges; + segment[] borders; + void operator init() { + } + void operator init(segment seg) { + edges.push(seg); + } + void operator init(gridpoint[] gp) { + segment seg=segment(gp); + edges.push(seg); + } + gridpoint start() { + if(edges.length == 0) { + if(borders.length > 0) { + return borders[0].start(); } - resultcnt[i]=gd; + return gridpoint(-1,-1,(-infinity,-infinity)); } + return edges[0].start(); + } + gridpoint end() { + if(edges.length == 0 && borders.length == 0) { + return gridpoint(-1,-1,(-infinity,-infinity)); + } + if(edges.length > borders.length) { + return edges[edges.length-1].end(); + } else { + return borders[borders.length-1].end(); + } + } + bool closed() { + return same(this.start(),this.end()); + } + void addedge(segment seg) { + edges.push(seg); + } + void addedge(gridpoint[] gp) { + segment seg=segment(gp); + edges.push(seg); + } + void addborder(segment seg) { + borders.push(seg); + } + void addborder(gridpoint[] gp) { + segment seg=segment(gp); + borders.push(seg); + } + void append(Segment S) { + edges.append(S.edges); + borders.append(S.borders); } - return result; } +private Segment[] Segment(segment[] s) +{ + return sequence(new Segment(int i) {return Segment(s[i]);},s.length); +} -// Return contour guides for a 2D data array. -// z: two-dimensional array of nonoverlapping mesh points +private Segment[][] Segment(segment[][] s) +{ + Segment[][] S=new Segment[s.length][]; + for(int i=0; i < s.length; ++i) + S[i]=Segment(s[i]); + return S; +} + +// Return contour points for a 2D data array. // f: two-dimensional array of corresponding f(z) data values -// midpoint: optional array containing values of f at cell midpoints // c: array of contour values -// join: interpolation operator (e.g. operator -- or operator ..) -guide[][] contour(pair[][] z, real[][] f, - real[][] midpoint=new real[][], real[] c, - interpolate join=operator --) +// subsample: number of points to use in each box in addition to endpoints +segment[][] contouredges(real[][] f, real[] c, int subsample=1) { - int nx=z.length-1; - if(nx == 0) - abort("array z must have length >= 2"); - int ny=z[0].length-1; - if(ny == 0) - abort("array z[0] must have length >= 2"); + int nx=f.length-1; + if(nx <= 0) + abort("array f must have length >= 2"); + int ny=f[0].length-1; + if(ny <= 0) + abort("array f[0] must have length >= 2"); c=sort(c); - bool midpoints=midpoint.length > 0; + boxdata[][] bd=new boxdata[nx][ny]; + + segment[][] result=new segment[c.length][]; - segment segments[][][]=new segment[nx][ny][]; - - // go over region a rectangle at a time for(int i=0; i < nx; ++i) { - pair[] zi=z[i]; - pair[] zp=z[i+1]; + boxdata[] bdi=bd[i]; real[] fi=f[i]; real[] fp=f[i+1]; - real[] midpointi; - if(midpoints) midpointi=midpoint[i]; - segment[][] segmentsi=segments[i]; + for(int j=0; j < ny; ++j) { - segment[] segmentsij=segmentsi[j]; - - // define points - pair bleft=zi[j]; - pair bright=zp[j]; - pair tleft=zi[j+1]; - pair tright=zp[j+1]; - pair middle=0.25*(bleft+bright+tleft+tright); - - real f00=fi[j]; - real f01=fi[j+1]; - real f10=fp[j]; - real f11=fp[j+1]; - real fmm=midpoints ? midpoint[i][j] : 0.25*(f00+f01+f10+f11); - - // optimization: we make sure we don't work with empty rectangles + boxdata bdij=bdi[j]=boxdata(fi[j],fp[j],fi[j+1],fp[j+1]); + int checkcell(int cnt) { real C=c[cnt]; - real vertdat0=f00-C; // bottom-left vertex - real vertdat1=f10-C; // bottom-right vertex - real vertdat2=f01-C; // top-left vertex - real vertdat3=f11-C; // top-right vertex + + real f00=fi[j]; + real f10=fp[j]; + real f01=fi[j+1]; + real f11=fp[j+1]; + + real epsf=eps*max(abs(f00),abs(f10),abs(f01),abs(f11),abs(C)); + + f00=f00-C; + f10=f10-C; + f01=f01-C; + f11=f11-C; + + if(abs(f00) < epsf) f00=0; + if(abs(f10) < epsf) f10=0; + if(abs(f01) < epsf) f01=0; + if(abs(f11) < epsf) f11=0; + - // optimization: we make sure we don't work with empty rectangles int countm=0; int countz=0; int countp=0; - + void check(real vertdat) { - if(vertdat < -eps) ++countm; + if(vertdat < -eps)++countm; else { - if(vertdat <= eps) ++countz; - else ++countp; + if(vertdat <= eps)++countz; + else++countp; } } - check(vertdat0); - check(vertdat1); - check(vertdat2); - check(vertdat3); + check(f00); + check(f10); + check(f01); + check(f11); if(countm == 4) return 1; // nothing to do if(countp == 4) return -1; // nothing to do if((countm == 3 || countp == 3) && countz == 1) return 0; - // go through the triangles - - void addseg(segment seg) { - if(seg.active) { - seg.c=cnt; - segmentsij.push(seg); - } - } - real vertdat4=fmm-C; - addseg(checktriangle(bright,tright,middle, - vertdat1,vertdat3,vertdat4,0)); - addseg(checktriangle(tright,tleft,middle, - vertdat3,vertdat2,vertdat4,1)); - addseg(checktriangle(tleft,bleft,middle, - vertdat2,vertdat0,vertdat4,2)); - addseg(checktriangle(bleft,bright,middle, - vertdat0,vertdat1,vertdat4,3)); + // Calculate individual box contours + bdij.settype(C); + if(bdij.type == edge) + setcontour(f00,f10,f01,f11,epsf,bdij,i,j,cnt); return 0; } - + void process(int l, int u) { if(l >= u) return; int i=quotient(l+u,2); @@ -313,150 +929,171 @@ guide[][] contour(pair[][] z, real[][] f, process(i+1,u); } } - + process(0,c.length); } } - - // set up return value - pair[][][] points=new pair[c.length][][]; - + + // Find contours and follow them for(int i=0; i < nx; ++i) { - segment[][] segmentsi=segments[i]; + boxdata[] bdi=bd[i]; for(int j=0; j < ny; ++j) { - segment[] segmentsij=segmentsi[j]; - for(int k=0; k < segmentsij.length; ++k) { - segment C=segmentsij[k]; - - if(!C.active) continue; - - pair[] g=new pair[] {C.a,C.b}; - segmentsij[k].active=false; - - int forward(int I, int J, bool first=true) { - if(I >= 0 && I < nx && J >= 0 && J < ny) { - segment[] segmentsIJ=segments[I][J]; - for(int l=0; l < segmentsIJ.length; ++l) { - segment D=segmentsIJ[l]; - if(!D.active) continue; - if(abs(D.a-g[g.length-1]) < eps) { - g.push(D.b); - segmentsIJ[l].active=false; - if(D.edge >= 0 && !first) return D.edge; - first=false; - l=-1; - } else if(abs(D.b-g[g.length-1]) < eps) { - g.push(D.a); - segmentsIJ[l].active=false; - if(D.edge >= 0 && !first) return D.edge; - first=false; - l=-1; - } - } - } - return -1; - } - - int backward(int I, int J, bool first=true) { - if(I >= 0 && I < nx && J >= 0 && J < ny) { - segment[] segmentsIJ=segments[I][J]; - for(int l=0; l < segmentsIJ.length; ++l) { - segment D=segmentsIJ[l]; - if(!D.active) continue; - if(abs(D.a-g[0]) < eps) { - g.insert(0,D.b); - segmentsIJ[l].active=false; - if(D.edge >= 0 && !first) return D.edge; - first=false; - l=-1; - } else if(abs(D.b-g[0]) < eps) { - g.insert(0,D.a); - segmentsIJ[l].active=false; - if(D.edge >= 0 && !first) return D.edge; - first=false; - l=-1; + boxdata bd0=bdi[j]; + if(bd0.count() == 0) continue; + for(int k=0; k < bd0.count(); ++k) { + boxcontour bc0=bd0.data[k]; + + if(!bc0.active) continue; + + // Note: boxcontour set inactive when added to segment + segment seg=segment(bc0,subsample); + + // Forward direction + bool foundnext=true; + while(foundnext) { + foundnext=false; + searchindex(bc0,true,new void(int i, int j) { + if((i >= 0) && (i < nx) && (j >= 0) && (j < ny)) { + boxcontour[] data=bd[i][j].data; + int k0=connectedindex(bc0,data); + if(k0 >= 0) { + bc0=data[k0]; + seg.append(bc0,subsample); + foundnext=true; + } } - } - } - return -1; + }); } - - void follow(int f(int, int, bool first=true), int edge) { - int I=i; - int J=j; - while(true) { - static int ix[]={1,0,-1,0}; - static int iy[]={0,1,0,-1}; - if(edge >= 0 && edge < 4) { - I += ix[edge]; - J += iy[edge]; - edge=f(I,J); - } else { - if(edge == -1) break; - if(edge < 9) { - int edge0=(edge-5) % 4; - int edge1=(edge-4) % 4; - int ix0=ix[edge0]; - int iy0=iy[edge0]; - I += ix0; - J += iy0; - // Search all 3 corner cells - if((edge=f(I,J)) == -1) { - I += ix[edge1]; - J += iy[edge1]; - if((edge=f(I,J)) == -1) { - I -= ix0; - J -= iy0; - edge=f(I,J); - } - } - } else { - // Double-vertex edge: search all 8 surrounding cells - void search() { - for(int i=-1; i <= 1; ++i) { - for(int j=-1; j <= 1; ++j) { - if((edge=f(I+i,J+j,false)) >= 0) { - I += i; - J += j; - return; - } - } - } + + // Backward direction + bc0=bd0.data[k]; + bool foundprev=true; + while(foundprev) { + foundprev=false; + searchindex(bc0,false,new void(int i, int j) { + if((i >= 0) && (i < nx) && (j >= 0) && (j < ny)) { + boxcontour[] data=bd[i][j].data; + int k0=connectedindex(data,bc0); + if(k0 >= 0) { + bc0=data[k0]; + seg.prepend(bc0,subsample); + foundprev=true; } - search(); } - } - } + }); } - // Follow contour in cell - int edge=forward(i,j,first=false); - - // Follow contour forward outside of cell - follow(forward,edge); - - // Follow contour backward outside of cell - follow(backward,C.edge); - - points[C.c].push(g); + result[bc0.index].push(seg); } } } + + // Note: every segment here _should_ be cyclic or terminate on the + // boundary + return result; +} + +// Connect contours into guides. +// Same initial/final points indicates a closed path. +// Borders are always joined using--. +private guide connect(Segment S, pair[][] z, interpolate join) +{ + pair loc(gridpoint gp) { + pair offset=z[gp.i][gp.j]; + pair size=z[gp.i+1][gp.j+1]-z[gp.i][gp.j]; + return offset+(size.x*gp.z.x,size.y*gp.z.y); + } + pair[] loc(gridpoint[] gp) { + pair[] result=new pair[gp.length]; + for(int i; i < gp.length; ++i) { + result[i]=loc(gp[i]); + } + return result; + } + + bool closed=S.closed(); + + pair[][] edges=new pair[S.edges.length][]; + for(int i; i < S.edges.length; ++i) { + edges[i]=loc(S.edges[i].data); + } + pair[][] borders=new pair[S.borders.length][]; + for(int i; i < S.borders.length; ++i) { + borders[i]=loc(S.borders[i].data); + } + + if(edges.length == 0 && borders.length == 1) { + guide g=operator--(...borders[0]); + if(closed) g=g--cycle; + return g; + } + + if(edges.length == 1 && borders.length == 0) { + pair[] pts=edges[0]; + if(closed) pts.delete(pts.length-1); + guide g=join(...pts); + if(closed) g=join(g,cycle); + return g; + } + + guide[] ge=new guide[edges.length]; + for(int i=0; i < ge.length; ++i) + ge[i]=join(...edges[i]); + + guide[] gb=new guide[borders.length]; + for(int i=0; i < gb.length; ++i) + gb[i]=operator--(...borders[i]); + + guide g=ge[0]; + if(0 < gb.length) g=g&gb[0]; + for(int i=1; i < ge.length; ++i) { + g=g&ge[i]; + if(i < gb.length) g=g&gb[i]; + } + if(closed) g=g&cycle; + return g; +} - collect(points,c); // Required to join remaining case1 cycles. +// Connect contours into guides. +private guide[] connect(Segment[] S, pair[][] z, interpolate join) +{ + return sequence(new guide(int i) {return connect(S[i],z,join);},S.length); +} - return connect(points,c,join); +// Connect contours into guides. +private guide[][] connect(Segment[][] S, pair[][] z, interpolate join) +{ + guide[][] result=new guide[S.length][]; + for(int i=0; i < S.length; ++i) { + result[i]=connect(S[i],z,join); + } + return result; +} + +// Return contour guides for a 2D data array. +// z: two-dimensional array of nonoverlapping mesh points +// f: two-dimensional array of corresponding f(z) data values +// c: array of contour values +// join: interpolation operator (e.g. operator--or operator ..) +// subsample: number of interior points to include in each grid square +// (in addition to points on edge) +guide[][] contour(pair[][] z, real[][] f, real[] c, + interpolate join=operator--, int subsample=1) +{ + segment[][] seg=contouredges(f,c,subsample); + Segment[][] Seg=Segment(seg); + return connect(Seg,z,join); } // Return contour guides for a 2D data array on a uniform lattice // f: two-dimensional array of real data values -// midpoint: optional array containing data values at cell midpoints // a,b: diagonally opposite vertices of rectangular domain // c: array of contour values -// join: interpolation operator (e.g. operator -- or operator ..) -guide[][] contour(real[][] f, real[][] midpoint=new real[][], - pair a, pair b, real[] c, - interpolate join=operator --) +// join: interpolation operator (e.g. operator--or operator ..) +// subsample: number of interior points to include in each grid square +// (in addition to points on edge) +guide[][] contour(real[][] f, pair a, pair b, real[] c, + interpolate join=operator--, int subsample=1) { int nx=f.length-1; if(nx == 0) @@ -473,37 +1110,43 @@ guide[][] contour(real[][] f, real[][] midpoint=new real[][], zi[j]=(xi,interp(a.y,b.y,j/ny)); } } - return contour(z,f,midpoint,c,join); + return contour(z,f,c,join,subsample); } // return contour guides for a real-valued function -// f: real-valued function of two real variables -// a,b: diagonally opposite vertices of rectangular domain -// c: array of contour values -// nx,ny: number of subdivisions in x and y directions (determines accuracy) -// join: interpolation operator (e.g. operator -- or operator ..) +// f: real-valued function of two real variables +// a,b: diagonally opposite vertices of rectangular domain +// c: array of contour values +// nx,ny: number of subdivisions in x and y directions(determines accuracy) +// join: interpolation operator (e.g. operator--or operator ..) +// subsample: number of interior points to include in each grid square +// (in addition to points on edge) guide[][] contour(real f(real, real), pair a, pair b, real[] c, int nx=ngraph, int ny=nx, - interpolate join=operator --) + interpolate join=operator--, int subsample=1) { - // evaluate function at points and midpoints + // evaluate function at points and subsample real[][] dat=new real[nx+1][ny+1]; - real[][] midpoint=new real[nx+1][ny+1]; for(int i=0; i <= nx; ++i) { real x=interp(a.x,b.x,i/nx); - real x2=interp(a.x,b.x,(i+0.5)/nx); real[] dati=dat[i]; - real[] midpointi=midpoint[i]; for(int j=0; j <= ny; ++j) { dati[j]=f(x,interp(a.y,b.y,j/ny)); - midpointi[j]=f(x2,interp(a.y,b.y,(j+0.5)/ny)); } } - return contour(dat,midpoint,a,b,c,join); + return contour(dat,a,b,c,join,subsample); } - + +guide[][] contour(real f(pair), pair a, pair b, + real[] c, int nx=ngraph, int ny=nx, + interpolate join=operator--, int subsample=1) +{ + return contour(new real(real x, real y) {return f((x,y));}, + a,b,c,nx,ny,join,subsample); +} + void draw(picture pic=currentpicture, Label[] L=new Label[], guide[][] g, pen[] p) { @@ -530,6 +1173,239 @@ void draw(picture pic=currentpicture, Label[] L=new Label[], draw(pic,L,g,sequence(new pen(int) {return p;},g.length)); } +// Draw the contour +void draw(picture pic=currentpicture, Label L, + guide[] g, pen p=currentpen) +{ + draw(pic,g,p); + for(int i=0; i < g.length; ++i) { + if(L.s != "" && size(g[i]) > 1) { + label(pic,L,g[i],p); + } + } +} + +/* CONTOURS FOR IRREGULARLY SPACED POINTS */ +// +// +---------+ +// |\ /| +// | \ / | +// | \ / | +// | \ / | +// | X | +// | / \ | +// | / \ | +// | / \ | +// |/ \| +// +---------+ +// + +// Is triangle p0--p1--p2--cycle counterclockwise ? +private bool isCCW(pair p0, pair p1, pair p2) {return side(p0,p1,p2) < 0;} + +private struct segment +{ + bool active; + bool reversed; // True if lower values are to the left along line a--b. + pair a,b; // Endpoints; a is always an edge point if one exists. + int c; // Contour value. +} + +// Case 1: line passes through two vertices of a triangle +private segment case1(pair p0, pair p1, pair p2, + real v0, real v1, real v2) +{ + // Will cause a duplicate guide; luckily case1 is rare + segment rtrn; + rtrn.active=true; + rtrn.a=p0; + rtrn.b=p1; + rtrn.reversed=(isCCW(p0,p1,p2) ^(v2 > 0)); + return rtrn; +} + +// Cases 2 and 3: line passes through a vertex and a side of a triangle +//(the first vertex passed and the side between the other two) +private segment case2(pair p0, pair p1, pair p2, + real v0, real v1, real v2) +{ + segment rtrn; + rtrn.active=true; + pair val=interp(p1,p2,abs(v1/(v2-v1))); + rtrn.a=val; + rtrn.b=p0; + rtrn.reversed=!(isCCW(p0,p1,p2) ^(v2 > 0)); + return rtrn; +} + +private segment case3(pair p0, pair p1, pair p2, + real v0, real v1, real v2) +{ + segment rtrn; + rtrn.active=true; + pair val=interp(p1,p2,abs(v1/(v2-v1))); + rtrn.a=p0; + rtrn.b=val; + rtrn.reversed=(isCCW(p0,p1,p2) ^(v2 > 0)); + return rtrn; +} + +// Case 4: line passes through two sides of a triangle +//(through the sides formed by the first&second, and second&third vertices) +private segment case4(pair p0, pair p1, pair p2, + real v0, real v1, real v2) +{ + segment rtrn; + rtrn.active=true; + rtrn.a=interp(p1,p0,abs(v1/(v0-v1))); + rtrn.b=interp(p1,p2,abs(v1/(v2-v1))); + rtrn.reversed=(isCCW(p0,p1,p2) ^(v2 > 0)); + return rtrn; +} + +// Check if a line passes through a triangle, and draw the required line. +private segment checktriangle(pair p0, pair p1, pair p2, + real v0, real v1, real v2) +{ + // default null return + static segment dflt; + + real eps=eps*max(abs(v0),abs(v1),abs(v2),1); + + if(v0 < -eps) { + if(v1 < -eps) { + if(v2 < -eps) return dflt; // nothing to do + else if(v2 <= eps) return dflt; // nothing to do + else return case4(p0,p2,p1,v0,v2,v1); + } else if(v1 <= eps) { + if(v2 < -eps) return dflt; // nothing to do + else if(v2 <= eps) return case1(p1,p2,p0,v1,v2,v0); + else return case3(p1,p0,p2,v1,v0,v2); + } else { + if(v2 < -eps) return case4(p0,p1,p2,v0,v1,v2); + else if(v2 <= eps) + return case2(p2,p0,p1,v2,v0,v1); + else return case4(p1,p0,p2,v1,v0,v2); + } + } else if(v0 <= eps) { + if(v1 < -eps) { + if(v2 < -eps) return dflt; // nothing to do + else if(v2 <= eps) return case1(p0,p2,p1,v0,v2,v1); + else return case2(p0,p1,p2,v0,v1,v2); + } else if(v1 <= eps) { + if(v2 < -eps) return case1(p0,p1,p2,v0,v1,v2); + else if(v2 <= eps) return dflt; // use finer partitioning. + else return case1(p0,p1,p2,v0,v1,v2); + } else { + if(v2 < -eps) return case2(p0,p1,p2,v0,v1,v2); + else if(v2 <= eps) return case1(p0,p2,p1,v0,v2,v1); + else return dflt; // nothing to do + } + } else { + if(v1 < -eps) { + if(v2 < -eps) return case4(p1,p0,p2,v1,v0,v2); + else if(v2 <= eps) + return case2(p2,p0,p1,v2,v0,v1); + else return case4(p0,p1,p2,v0,v1,v2); + } else if(v1 <= eps) { + if(v2 < -eps) return case3(p1,p0,p2,v1,v0,v2); + else if(v2 <= eps) return case1(p1,p2,p0,v1,v2,v0); + else return dflt; // nothing to do + } else { + if(v2 < -eps) return case4(p0,p2,p1,v0,v2,v1); + else if(v2 <= eps) return dflt; // nothing to do + else return dflt; // nothing to do + } + } +} + +// Collect connecting path segments. +private void collect(pair[][][] points, real[] c) +{ + for(int cnt=0; cnt < c.length; ++cnt) { + pair[][] gdscnt=points[cnt]; + for(int i=0; i < gdscnt.length; ++i) { + pair[] gig=gdscnt[i]; + int Li=gig.length; + for(int j=i+1; j < gdscnt.length; ++j) { + pair[] gjg=gdscnt[j]; + int Lj=gjg.length; + if(abs(gig[0]-gjg[Lj-1]) < eps) { + gig.delete(0); + gdscnt[j].append(gig); + gdscnt.delete(i); + --i; + break; + } else if(abs(gig[Li-1]-gjg[0]) < eps) { + gjg.delete(0); + gig.append(gjg); + gdscnt[j]=gig; + gdscnt.delete(i); + --i; + break; + } + } + } + } +} + +// Join path segments. +private guide[][] connect(pair[][][] points, real[] c, interpolate join) +{ + // set up return value + guide[][] result=new guide[c.length][]; + for(int cnt=0; cnt < c.length; ++cnt) { + pair[][] pointscnt=points[cnt]; + guide[] resultcnt=result[cnt]=new guide[pointscnt.length]; + for(int i=0; i < pointscnt.length; ++i) { + pair[] pts=pointscnt[i]; + guide gd; + if(pts.length > 0) { + if(pts.length > 1 && abs(pts[0]-pts[pts.length-1]) < eps) { + guide[] g=sequence(new guide(int i) { + return pts[i]; + },pts.length-1); + g.push(cycle); + gd=join(...g); + } else + gd=join(...sequence(new guide(int i) { + return pts[i]; + },pts.length)); + } + resultcnt[i]=gd; + } + } + return result; +} + +guide[][] contour(pair[] z, real[] f, real[] c, interpolate join=operator--) +{ + if(z.length != f.length) + abort("z and f arrays have different lengths"); + + int[][] trn=triangulate(z); + + // array to store guides found so far + pair[][][] points=new pair[c.length][][]; + + for(int cnt=0; cnt < c.length; ++cnt) { + pair[][] pointscnt=points[cnt]; + real C=c[cnt]; + for(int i=0; i < trn.length; ++i) { + int[] trni=trn[i]; + int i0=trni[0], i1=trni[1], i2=trni[2]; + segment seg=checktriangle(z[i0],z[i1],z[i2],f[i0]-C,f[i1]-C,f[i2]-C); + if(seg.active) + pointscnt.push(seg.reversed ? new pair[] {seg.b,seg.a} : + new pair[] {seg.a,seg.b}); + } + } + + collect(points,c); + + return connect(points,c,join); +} + // Extend palette by the colors below and above at each end. pen[] extend(pen[] palette, pen below, pen above) { pen[] p=copy(palette); @@ -614,69 +1490,3 @@ void fill(picture pic=currentpicture, guide[][] g, pen[][] palette) } } } - -// routines for irregularly spaced points: - -// check existing guides and adds new segment to them if possible, -// or otherwise store segment as a new guide -private void addseg(pair[][] gds, segment seg) -{ - if(!seg.active) return; - // search for a path to extend - for(int i=0; i < gds.length; ++i) { - pair[] gd=gds[i]; - if(abs(gd[0]-seg.b) < eps) { - gd.insert(0,seg.a); - return; - } else if(abs(gd[gd.length-1]-seg.b) < eps) { - gd.push(seg.a); - return; - } else if(abs(gd[0]-seg.a) < eps) { - gd.insert(0,seg.b); - return; - } else if(abs(gd[gd.length-1]-seg.a) < eps) { - gd.push(seg.b); - return; - } - } - - // in case nothing is found - pair[] segm; - segm=new pair[] {seg.a,seg.b}; - gds.push(segm); - - return; -} - -guide[][] contour(real f(pair), pair a, pair b, - real[] c, int nx=ngraph, int ny=nx, - interpolate join=operator --) -{ - return contour(new real(real x, real y) {return f((x,y));},a,b,c,nx,ny,join); -} - -guide[][] contour(pair[] z, real[] f, real[] c, interpolate join=operator --) -{ - if(z.length != f.length) - abort("z and f arrays have different lengths"); - - int[][] trn=triangulate(z); - - // array to store guides found so far - pair[][][] points=new pair[c.length][][]; - - for(int cnt=0; cnt < c.length; ++cnt) { - pair[][] pointscnt=points[cnt]; - real C=c[cnt]; - for(int i=0; i < trn.length; ++i) { - int[] trni=trn[i]; - int i0=trni[0], i1=trni[1], i2=trni[2]; - addseg(pointscnt,checktriangle(z[i0],z[i1],z[i2], - f[i0]-C,f[i1]-C,f[i2]-C)); - } - } - - collect(points,c); - - return connect(points,c,join); -} diff --git a/Build/source/utils/asymptote/base/contour3.asy b/Build/source/utils/asymptote/base/contour3.asy index e9d8d928991..3d925be684e 100644 --- a/Build/source/utils/asymptote/base/contour3.asy +++ b/Build/source/utils/asymptote/base/contour3.asy @@ -181,7 +181,7 @@ vertex[][] contour3(triple[][][] v, real[][][] f, addval(w.kpb0,w.kpb1,w.kpb2,val2,w.v); } - triple dir=P.vector(); + triple dir=P.normal; void addnormals(weighted[] pts) { triple vec2=pts[1].v-pts[0].v; diff --git a/Build/source/utils/asymptote/base/embed.asy b/Build/source/utils/asymptote/base/embed.asy index ac8a09acb83..504b3af66b0 100644 --- a/Build/source/utils/asymptote/base/embed.asy +++ b/Build/source/utils/asymptote/base/embed.asy @@ -1,11 +1,12 @@ if(latex()) { +usepackage("hyperref"); +texpreamble("\hypersetup{"+settings.hyperrefOptions+"}"); texpreamble(" \ifx\pdfhorigin\undefined% \usepackage[3D,dvipdfmx]{movie15} \else% \usepackage[3D]{movie15} \fi%"); -usepackage("hyperref",settings.hyperrefOptions); } // See http://www.ctan.org/tex-archive/macros/latex/contrib/movie15/README diff --git a/Build/source/utils/asymptote/base/external.asy b/Build/source/utils/asymptote/base/external.asy index 9560e319299..053f1eff4c1 100644 --- a/Build/source/utils/asymptote/base/external.asy +++ b/Build/source/utils/asymptote/base/external.asy @@ -1,4 +1,5 @@ -usepackage("hyperref",settings.hyperrefOptions); +usepackage("hyperref"); +texpreamble("\hypersetup{"+settings.hyperrefOptions+"}"); // Embed object to be run in an external window. An image file name can be // specified; if not given one will be automatically generated. @@ -19,8 +20,8 @@ string embed(string name, string options="", real width=0, real height=0, atexit(exitfunction); } } - if(width != 0) options += ", width="+(string) (width*pt)+"pt"; - if(height != 0) options +=", height="+(string) (height*pt)+"pt"; + if(width != 0) options += ", width="+(string) (width/pt)+"pt"; + if(height != 0) options +=", height="+(string) (height/pt)+"pt"; return "\href{run:"+name+"}{"+graphic(image,options)+"}"; } diff --git a/Build/source/utils/asymptote/base/flowchart.asy b/Build/source/utils/asymptote/base/flowchart.asy index 5fe96ae8508..bb8fe21a4d6 100644 --- a/Build/source/utils/asymptote/base/flowchart.asy +++ b/Build/source/utils/asymptote/base/flowchart.asy @@ -10,28 +10,17 @@ restricted flowdir Vertical; real minblockwidth=0; real minblockheight=0; real mincirclediameter=0; +real defaultexcursion=0.1; struct block { // The absolute center of the block in user coordinates. pair center; - // The relative center of the block. - pair f_center; - // The size of the block pair size; - // Returns the relative position along the boundary of the block. - pair f_position(real x); - - pair shift(transform t=identity()) { - return t*center-f_center; - } - - // Returns the absolute position along the boundary of the block. - pair position(real x, transform t=identity()) { - return shift(t)+f_position(x); - } + // The relative center of the block. + pair f_center; // These eight variables return the appropriate location on the block // in relative coordinates, where the lower left corner of the block is (0,0). @@ -44,6 +33,26 @@ struct block { pair f_bottomleft; pair f_bottomright; + void operator init(pair z) { + center=z; + } + + void operator init(real x, real y) { + center=(x,y); + } + + pair shift(transform t=identity()) { + return t*center-f_center; + } + + // Returns the relative position along the boundary of the block. + pair f_position(real x); + + // Returns the absolute position along the boundary of the block. + pair position(real x, transform t=identity()) { + return shift(t)+f_position(x); + } + // These eight functions return the appropriate location on the block // in absolute coordinates. pair top(transform t=identity()) { @@ -73,6 +82,15 @@ struct block { // Return a frame representing the block. frame draw(pen p=currentpen); + + // Store optional label on outgoing edge. + Label label; + + // Store rectilinear path directions. + pair[] dirs; + + // Store optional arrow. + arrowbar arrow=None; }; // Construct a rectangular block with header and body objects. @@ -160,6 +178,47 @@ block rectangle(object body, pair center=(0,0), return block; } +block parallelogram(object body, pair center=(0,0), + pen fillpen=invisible, pen drawpen=currentpen, + real dx=3, real slope=2, + real minwidth=minblockwidth, + real minheight=minblockheight) +{ + frame f=body.f; + pair m=min(f); + pair M=max(f); + pair bound=maxbound(M-m+dx*(0,2),(minwidth,minheight)); + + real skew=bound.y/slope; + real a=bound.x+skew; + real b=bound.y; + + path shape=(0,0)--(a,0)--(a+skew,b)--(skew,b)--cycle; + + block block; + block.draw=new frame(pen p) { + frame block; + filldraw(block,shape,fillpen,drawpen); + add(block,shift(-0.5*(M+m))*f,((a+skew)/2,b/2)); + return block; + }; + block.f_position=new pair(real x) { + return point(shape,x); + }; + block.f_center=((a+skew)/2,b/2); + block.center=center; + block.size=(a+skew,b); + block.f_bottomleft=(0,0); + block.f_bottom=((a+skew)/2,0); + block.f_bottomright=(a,0); + block.f_right=(a+skew/2,b/2); + block.f_topright=(a+skew,b); + block.f_top=((a+skew)/2,b); + block.f_topleft=(skew,b); + block.f_left=(skew/2,b/2); + return block; +} + block diamond(object body, pair center=(0,0), pen fillpen=invisible, pen drawpen=currentpen, real ds=5, real dw=1, @@ -327,7 +386,7 @@ path path(pair point[] ... flowdir dir[]) path line=point[0]; pair current, prev=point[0]; for(int i=1; i < point.length; ++i) { - if(dir[i-1] == Horizontal) + if(i-1 >= dir.length || dir[i-1] == Horizontal) current=(point[i].x,point[i-1].y); else current=(point[i-1].x,point[i].y); @@ -348,9 +407,120 @@ path path(pair point[] ... flowdir dir[]) void draw(picture pic=currentpicture, block block, pen p=currentpen) { - pic.add(new void (frame f, transform t) { + pic.add(new void(frame f, transform t) { add(f,shift(block.shift(t))*block.draw(p)); },true); pic.addBox(block.center,block.center, -0.5*block.size+min(p),0.5*block.size+max(p)); } + +typedef block blockconnector(block, block); + +blockconnector blockconnector(picture pic, transform t, pen p=currentpen, + margin margin=PenMargin) +{ + return new block(block b1, block b2) { + if(b1.dirs.length == 0) { + if(abs(b1.center.y-b2.center.y) < sqrtEpsilon) { + // horizontally aligned + b1.dirs[0]=b1.center.x < b2.center.x ? right : left; + blockconnector(pic,t)(b1,b2); + } else if(abs(b1.center.x-b2.center.x) < sqrtEpsilon) { + // vertically aligned + b1.dirs[0]=b1.center.y < b2.center.y ? up : down; + blockconnector(pic,t)(b1,b2); + } else { + if(abs(b1.center.y-b2.center.y) < abs(b1.center.x-b2.center.x)) { + b1.dirs[0]=b1.center.x < b2.center.x ? right : left; + b1.dirs[1]=b1.center.y < b2.center.y ? up : down; + blockconnector(pic,t)(b1,b2); + } else { + b1.dirs[0]=b1.center.y < b2.center.y ? up : down; + b1.dirs[1]=b1.center.x < b2.center.x ? right : left; + blockconnector(pic,t)(b1,b2); + } + } + return b2; + } + + // compute the link for given directions (and label if any) + pair[] dirs=copy(b1.dirs); // deep copy + pair current,prev; + pair dir=dirs[0]; + if(dir == up) prev=b1.top(t); + if(dir == down) prev=b1.bottom(t); + if(dir == left) prev=b1.left(t); + if(dir == right) prev=b1.right(t); + path line=prev; + arrowbar arrow=b1.arrow; + + int i; + for(i=1; i < dirs.length-1; ++i) { + if(abs(length(dirs[i-1])-1) < sqrtEpsilon) + current=prev+t*dirs[i-1]*defaultexcursion; + else + current=prev+t*dirs[i-1]; + + if(current != prev) { + line=line--current; + prev=current; + } + } + dir=dirs[dirs.length-1]; + current=0; + if(dir == up) current=b2.bottom(t); + if(dir == down) current=b2.top(t); + if(dir == left) current=b2.right(t); + if(dir == right) current=b2.left(t); + if(abs(dirs[i-1].y) < sqrtEpsilon && + abs(prev.x-current.x) > sqrtEpsilon) { + prev=(current.x,prev.y); + line=line--prev; // horizontal + } else if(abs(dirs[i-1].x) < sqrtEpsilon && + abs(prev.y-current.y) > sqrtEpsilon) { + prev=(prev.x,current.y); + line=line--prev; + } + if(current != prev) + line=line--current; + + draw(pic,b1.label,line,p,arrow,margin); + + b1.label=""; + b1.dirs.delete(); + b1.arrow=None; + return b2; + }; +} + +struct Dir +{ + pair z; + void operator init(pair z) {this.z=z;} +} + +Dir Right=Dir(right); +Dir Left=Dir(left); +Dir Up=Dir(up); +Dir Down=Dir(down); + +// Add a label to the current link +block operator --(block b1, Label label) +{ + b1.label=label; + return b1; +} + +// Add a direction to the current link +block operator --(block b1, Dir dir) +{ + b1.dirs.push(dir.z); + return b1; +} + +// Add an arrowbar to the current link +block operator --(block b, arrowbar arrowbar) +{ + b.arrow=arrowbar; + return b; +} diff --git a/Build/source/utils/asymptote/base/geometry.asy b/Build/source/utils/asymptote/base/geometry.asy index 3d9d84563b7..8679ada4c75 100644 --- a/Build/source/utils/asymptote/base/geometry.asy +++ b/Build/source/utils/asymptote/base/geometry.asy @@ -1163,7 +1163,7 @@ private void Drawline(picture pic=currentpicture, Label L="",pair P, bool dirP=t // Calculate the points and direction vector in the transformed space. pair z=t*P; pair q=t*Q; - pair v=t*Q-z; + pair v=q-z; // path g; pair ptp,ptq; real cp = dirP ? 1:0; @@ -1171,7 +1171,7 @@ private void Drawline(picture pic=currentpicture, Label L="",pair P, bool dirP=t // Handle horizontal and vertical lines. if(v.x == 0) { if(m.x <= z.x && z.x <= M.x) - if (dot(v,(z.x,m.y)) < 0) { + if (dot(v,m-z) < 0) { ptp=(z.x,z.y+cp*(m.y-z.y)); ptq=(z.x,q.y+cq*(M.y-q.y)); } else { @@ -1179,7 +1179,7 @@ private void Drawline(picture pic=currentpicture, Label L="",pair P, bool dirP=t ptq=(z.x,z.y+cp*(M.y-z.y)); } } else if(v.y == 0) { - if (dot(v,(m.x,z.y)) < 0) { + if (dot(v,m-z) < 0) { ptp=(z.x+cp*(m.x-z.x),z.y); ptq=(q.x+cq*(M.x-q.x),z.y); } else { @@ -1210,7 +1210,7 @@ private void Drawline(picture pic=currentpicture, Label L="",pair P, bool dirP=t lL.out(opic,g); } g=pathModifier(g); - if(linetype(p) == ""){ + if(linetype(p).length == 0){ pair m=midpoint(g); pen tp; tp=dirP ? p : addpenline(p); @@ -7016,7 +7016,7 @@ arc arc(ellipse el, explicit abscissa x1, explicit abscissa x2, bool direction=C {/*<asyxml></code><documentation>Return the arc from 'point(c,x1)' to 'point(c,x2)' in the direction 'direction'.</documentation></function></asyxml>*/ real a=degrees(point(el,x1)-el.C); real b=degrees(point(el,x2)-el.C); - arc oa=arc(el,a,b,fromCenter,direction); + arc oa=arc(el,a-el.angle,b-el.angle,fromCenter,direction); return oa; } @@ -7135,8 +7135,7 @@ void perpendicular(picture pic=currentpicture, pair z, pair align, path g, // Return an interior arc BAC of triangle ABC, given a radius r > 0. // If r < 0, return the corresponding exterior arc of radius |r|. -path arc(explicit pair B, explicit pair A, explicit pair C, - real r=arrowfactor) +path arc(explicit pair B, explicit pair A, explicit pair C, real r) { return arc(A,r,degrees(B-A),degrees(C-A)); } diff --git a/Build/source/utils/asymptote/base/graph.asy b/Build/source/utils/asymptote/base/graph.asy index e9f01880d67..9ac9983ddef 100644 --- a/Build/source/utils/asymptote/base/graph.asy +++ b/Build/source/utils/asymptote/base/graph.asy @@ -1,5 +1,4 @@ private import math; - import graph_splinetype; import graph_settings; @@ -826,14 +825,19 @@ ticks Ticks(int sign, Label F="", ticklabel ticklabel=null, typedef tickvalues tickmodifier(tickvalues); tickvalues None(tickvalues v) {return v;} -tickmodifier OmitTick(... real[] x) { +// Tickmodifier that removes all ticks in the intervals [a[i],b[i]]. +tickmodifier OmitTickIntervals(real[] a, real[] b) { return new tickvalues(tickvalues v) { - void omit(real[] a) { - if(a.length != 0) { - real norm=max(abs(a)); - for(int i=0; i < x.length; ++i) { - int j=find(abs(a-x[i]) < zerotickfuzz*norm); - if(j >= 0) a.delete(j); + if(a.length != b.length) abort(differentlengths); + void omit(real[] A) { + if(A.length != 0) { + real norm=max(abs(A)); + for(int i=0; i < a.length; ++i) { + int j; + while((j=find(A > a[i]-zerotickfuzz*norm + & A < b[i]+zerotickfuzz*norm)) >= 0) { + A.delete(j); + } } } } @@ -843,20 +847,20 @@ tickmodifier OmitTick(... real[] x) { }; } -tickmodifier NoZero=OmitTick(0); +// Tickmodifier that removes all ticks in the interval [a,b]. +tickmodifier OmitTickInterval(real a, real b) { + return OmitTickIntervals(new real[] {a}, new real[] {b}); +} -// Tickmodifier that removes all major ticks in the interval [a,b]. -tickmodifier Break(real a, real b) { - return new tickvalues(tickvalues v) { - real[] V=v.major; - real[] major; - for(int i=0; i < V.length; ++i) - if(V[i] < a-epsilon || V[i] > b+epsilon) major.push(V[i]); - v.major=major; - return v; - }; +// Tickmodifier that removes the specified ticks. +tickmodifier OmitTick(... real[] x) { + return OmitTickIntervals(x,x); } +tickmodifier NoZero=OmitTick(0); + +tickmodifier Break(real, real)=OmitTickInterval; + // Automatic tick construction routine. ticks Ticks(int sign, Label F="", ticklabel ticklabel=null, bool beginlabel=true, bool endlabel=true, @@ -1536,7 +1540,7 @@ void xaxis(picture pic=currentpicture, Label L="", axis axis=YZero, void yaxis(picture pic=currentpicture, Label L="", axis axis=XZero, real ymin=-infinity, real ymax=infinity, pen p=currentpen, ticks ticks=NoTicks, arrowbar arrow=None, margin margin=NoMargin, - bool above=false) + bool above=false, bool autorotate=true) { if(ymin > ymax) return; @@ -1590,7 +1594,7 @@ void yaxis(picture pic=currentpicture, Label L="", axis axis=XZero, if(L.defaultposition) L.position(axis.position); L.align(L.align,axis.align); - if(L.defaulttransform) { + if(autorotate && L.defaulttransform) { frame f; add(f,Label(L.s,(0,0),L.p)); if(length(max(f)-min(f)) > ylabelwidth*fontsize(L.p)) @@ -1977,15 +1981,8 @@ guide[] graph(picture pic=currentpicture, pair z(real), real a, real b, },a,b,n); } -string differentlengths="attempt to graph arrays of different lengths"; string conditionlength="condition array has different length than data"; -void checklengths(int x, int y, string text=differentlengths) -{ - if(x != y) - abort(text+": "+string(x)+" != "+string(y)); -} - void checkconditionlength(int x, int y) { checklengths(x,y,conditionlength); @@ -2070,6 +2067,19 @@ guide polargraph(picture pic=currentpicture, real r(real), real a, real b, },a,b,n); } +guide polargraph(picture pic=currentpicture, real[] r, real[] theta, + interpolate join=operator--) +{ + int n=r.length; + checklengths(n,theta.length); + int i=0; + return graph(join)(new pair(real) { + pair w=Scale(pic,polar(r[i],theta[i])); + ++i; + return w; + },0,0,n-1); +} + void errorbar(picture pic, pair z, pair dp, pair dm, pen p=currentpen, real size=0) { @@ -2166,7 +2176,7 @@ picture vectorfield(path vector(pair), pair a, pair b, path g=vector(z); return abs(point(g,size(g)-1)-point(g,0)); } - real max=size((0,0)); + real max=size(a); for(int i=0; i <= nx; ++i) { real x=interp(a.x,b.x,i*dx); for(int j=0; j <= ny; ++j) @@ -2198,8 +2208,9 @@ path Arc(pair c, real r, real angle1, real angle2, bool direction, { angle1=radians(angle1); angle2=radians(angle2); - if(angle1 >= angle2 && direction) angle1 -= 2pi; - if(angle2 >= angle1 && !direction) angle2 -= 2pi; + if(direction) { + if(angle1 >= angle2) angle1 -= 2pi; + } else if(angle2 >= angle1) angle2 -= 2pi; return shift(c)*polargraph(new real(real t){return r;},angle1,angle2,n, operator ..); } diff --git a/Build/source/utils/asymptote/base/graph3.asy b/Build/source/utils/asymptote/base/graph3.asy index 1357f3e7c87..32f66851e75 100644 --- a/Build/source/utils/asymptote/base/graph3.asy +++ b/Build/source/utils/asymptote/base/graph3.asy @@ -126,7 +126,7 @@ void labelaxis(picture pic, transform3 T, Label L, path3 g, locate1.dir(T,g,locate,t); triple pathdir=locate1.pathdir; - triple perp=cross(pathdir,P.vector()); + triple perp=cross(pathdir,P.normal); if(align == O) align=unit(sgn(dot(sign*locate1.dir,perp))*perp); path[] g=project(box(T*m,T*M),P); @@ -149,9 +149,11 @@ void labelaxis(picture pic, transform3 T, Label L, path3 g, },exact=false); path3[] G=path3(texpath(L)); - G=L.align.is3D ? align(G,O,align,L.p) : L.T3*G; - triple v=point(g,relative(L,g)); - pic.addBox(v,v,min(G),max(G)); + if(G.length > 0) { + G=L.align.is3D ? align(G,O,align,L.p) : L.T3*G; + triple v=point(g,relative(L,g)); + pic.addBox(v,v,min(G),max(G)); + } } // Tick construction routine for a user-specified array of tick values. @@ -509,7 +511,7 @@ real ztrans(transform3 t, real z) private triple defaultdir(triple X, triple Y, triple Z, bool opposite=false, projection P) { - triple u=cross(P.vector(),Z); + triple u=cross(P.normal,Z); return abs(dot(u,X)) > abs(dot(u,Y)) ? -X : (opposite ? Y : -Y); } @@ -964,7 +966,7 @@ void xaxis3(picture pic=currentpicture, Label L="", axis axis=YZZero, bool back=false; if(axis.type == Both) { - triple v=currentprojection.vector(); + triple v=currentprojection.normal; back=dot((0,pic.userMax.y-pic.userMin.y,0),v)*sgn(v.z) > 0; } @@ -1039,7 +1041,7 @@ void yaxis3(picture pic=currentpicture, Label L="", axis axis=XZZero, bool back=false; if(axis.type == Both) { - triple v=currentprojection.vector(); + triple v=currentprojection.normal; back=dot((pic.userMax.x-pic.userMin.x,0,0),v)*sgn(v.z) > 0; } @@ -1842,10 +1844,11 @@ path3 Arc(triple c, triple v1, triple v2, triple normal=O, bool direction=CCW, real phi1=radians(longitude(v1,warn=false)); real phi2=radians(longitude(v2,warn=false)); - if(phi1 >= phi2 && direction) phi1 -= 2pi; - if(phi2 >= phi1 && !direction) phi2 -= 2pi; + if(direction) { + if(phi1 >= phi2) phi1 -= 2pi; + } else if(phi2 >= phi1) phi2 -= 2pi; - real piby2=pi/2; + static real piby2=pi/2; return shift(c)*T*polargraph(new real(real theta, real phi) {return r;}, new real(real t) {return piby2;}, new real(real t) {return interp(phi1,phi2,t);}, @@ -1869,5 +1872,10 @@ path3 Arc(triple c, real r, real theta1, real phi1, real theta2, real phi2, // True circle path3 Circle(triple c, real r, triple normal=Z, int n=nCircle) { - return Arc(c,r,90,0,90,360,normal,n)&cycle; + static real piby2=pi/2; + return shift(c)*align(unit(normal))* + polargraph(new real(real theta, real phi) {return r;}, + new real(real t) {return piby2;}, + new real(real t) {return interp(0,2pi,t);},n,operator ..); + } diff --git a/Build/source/utils/asymptote/base/graph_splinetype.asy b/Build/source/utils/asymptote/base/graph_splinetype.asy index fbcb1b00c75..02f780ca02e 100644 --- a/Build/source/utils/asymptote/base/graph_splinetype.asy +++ b/Build/source/utils/asymptote/base/graph_splinetype.asy @@ -1,3 +1,5 @@ +private import math; + typedef real[] splinetype(real[], real[]); restricted real[] Spline(real[] x, real[] y); @@ -11,6 +13,12 @@ void checklengths(int x, int y, string text=differentlengths) abort(text+": "+string(x)+" != "+string(y)); } +void checkincreasing(real[] x) +{ + if(!increasing(x,true)) + abort("strictly increasing array expected"); +} + // Linear interpolation real[] linear(real[] x, real[] y) { @@ -32,6 +40,7 @@ real[] notaknot(real[] x, real[] y) { int n=x.length; checklengths(n,y.length); + checkincreasing(x); real[] d; if(n > 3) { real[] a=new real[n]; @@ -75,6 +84,7 @@ real[] periodic(real[] x, real[] y) { int n=x.length; checklengths(n,y.length); + checkincreasing(x); if(abs(y[n-1]-y[0]) > sqrtEpsilon*norm(y)) abort("function values are not periodic"); real[] d; @@ -110,6 +120,7 @@ real[] natural(real[] x, real[] y) { int n=x.length; checklengths(n,y.length); + checkincreasing(x); real[] d; if(n > 2) { real[] a=new real[n]; @@ -144,6 +155,7 @@ splinetype clamped(real slopea, real slopeb) return new real[] (real[] x, real[] y) { int n=x.length; checklengths(n,y.length); + checkincreasing(x); real[] d; if(n > 2) { real[] a=new real[n]; @@ -183,6 +195,7 @@ real[] monotonic(real[] x, real[] y) { int n=x.length; checklengths(n,y.length); + checkincreasing(x); real[] d=new real[n]; if(n > 2) { real[] h=new real[n-1]; diff --git a/Build/source/utils/asymptote/base/math.asy b/Build/source/utils/asymptote/base/math.asy index 85d41d86d07..eef703cb7ee 100644 --- a/Build/source/utils/asymptote/base/math.asy +++ b/Build/source/utils/asymptote/base/math.asy @@ -38,6 +38,15 @@ bool polygon(path p) return cyclic(p) && piecewisestraight(p); } +// Return the intersection time of the point on the line through p and q +// that is closest to z. +real intersect(pair p, pair q, pair z) +{ + pair u=q-p; + real denom=dot(u,u); + return denom == 0 ? infinity : dot(z-p,u)/denom; +} + // Return the intersection time of the extension of the line segment PQ // with the plane perpendicular to n and passing through Z. real intersect(triple P, triple Q, triple n, triple Z) @@ -185,6 +194,30 @@ real[][] operator /(real[][] a, real b) return a*(1/b); } +private string incommensurate= + "Multiplication of incommensurate matrices is undefined"; + +pair[][] operator * (pair[][] a, pair[][] b) +{ + int n=a.length; + int nb=b.length; + int nb0=b[0].length; + pair[][] m=new pair[n][nb0]; + for(int i=0; i < n; ++i) { + pair[] ai=a[i]; + pair[] mi=m[i]; + if(ai.length != nb) + abort(incommensurate); + for(int j=0; j < nb0; ++j) { + pair sum; + for(int k=0; k < nb; ++k) + sum += ai[k]*b[k][j]; + mi[j]=sum; + } + } + return m; +} + bool square(real[][] m) { int n=m.length; @@ -371,3 +404,20 @@ pair[] quarticroots(real a, real b, real c, real d, real e) return roots; } + +pair[][] fft(pair[][] a, int sign=1) +{ + pair[][] A=new pair[a.length][]; + int k=0; + for(pair[] v : a) { + A[k]=fft(v,sign); + ++k; + } + a=transpose(A); + k=0; + for(pair[] v : a) { + A[k]=fft(v,sign); + ++k; + } + return transpose(A); +} diff --git a/Build/source/utils/asymptote/base/ode.asy b/Build/source/utils/asymptote/base/ode.asy index 77ab8d6e589..0b88060e081 100644 --- a/Build/source/utils/asymptote/base/ode.asy +++ b/Build/source/utils/asymptote/base/ode.asy @@ -244,17 +244,31 @@ real adjust(real h, real error, real tolmin, real tolmax, RKTableau tableau) return h; } +struct solution +{ + real[] t; + real[] y; +} + +void write(solution S) +{ + for(int i=0; i < S.t.length; ++i) + write(S.t[i],S.y[i]); +} + // Integrate dy/dt+cy=f(t,y) from a to b using initial conditions y, // specifying either the step size h or the number of steps n. -real[] integrate(real y, real c=0, real g(real t, real y), real a, real b=a, - real h=0, int n=0, bool dynamic=false, real tolmin=0, - real tolmax=0, real dtmin=0, real dtmax=realMax, - RKTableau tableau, bool verbose=false) +solution integrate(real y, real c=0, real g(real t, real y), real a, real b=a, + real h=0, int n=0, bool dynamic=false, real tolmin=0, + real tolmax=0, real dtmin=0, real dtmax=realMax, + RKTableau tableau, bool verbose=false) { - real[] Y={y}; + solution S; + S.t=new real[] {a}; + S.y=new real[]{y}; if(h == 0) { - if(b == a) return Y; + if(b == a) return S; if(n == 0) abort("Either n or h must be specified"); else h=(b-a)/n; } @@ -302,30 +316,49 @@ real[] integrate(real y, real c=0, real g(real t, real y), real a, real b=a, if(h >= dt) { t += dt; y=y0+highOrder; - Y.push(y); + S.t.push(t); + S.y.push(y); f0=f1; } h=min(max(h,dtmin),dtmax); } else { t += h; y=y0+highOrder; - Y.push(y); + S.y.push(y); } } - return Y; + return S; +} + +struct Solution +{ + real[] t; + real[][] y; +} + +void write(Solution S) +{ + for(int i=0; i < S.t.length; ++i) { + write(S.t[i],tab); + for(real y : S.y[i]) + write(y,tab); + write(); + } } // Integrate a set of equations, dy/dt=f(t,y), from a to b using initial // conditions y, specifying either the step size h or the number of steps n. -real[][] integrate(real[] y, real[] f(real t, real[] y), real a, real b=a, +Solution integrate(real[] y, real[] f(real t, real[] y), real a, real b=a, real h=0, int n=0, bool dynamic=false, real tolmin=0, real tolmax=0, real dtmin=0, real dtmax=realMax, RKTableau tableau, bool verbose=false) { - real[][] Y={copy(y)}; + Solution S; + S.t=new real[] {a}; + S.y=new real[][] {copy(y)}; if(h == 0) { - if(b == a) return Y; + if(b == a) return S; if(n == 0) abort("Either n or h must be specified"); else h=(b-a)/n; } @@ -366,17 +399,19 @@ real[][] integrate(real[] y, real[] f(real t, real[] y), real a, real b=a, if(h >= dt) { t += dt; y += highOrder; - Y.push(y); + S.t.push(t); + S.y.push(y); f0=f1; } h=min(max(h,dtmin),dtmax); } else { t += h; y += highOrder; - Y.push(y); + S.t.push(t); + S.y.push(y); } } - return Y; + return S; } real[][] finiteDifferenceJacobian(real[] f(real[]), real[] t, @@ -408,12 +443,14 @@ real[] newton(int iterations=100, real[] f(real[]), real[][] jacobian(real[]), } real[] solveBVP(real[] f(real, real[]), real a, real b=a, real h=0, int n=0, + bool dynamic=false, real tolmin=0, real tolmax=0, real dtmin=0, + real dtmax=realMax, RKTableau tableau, bool verbose=false, real[] initial(real[]), real[] discrepancy(real[]), - real[] guess, RKTableau tableau, int iterations=100) + real[] guess, int iterations=100) { real[] g(real[] t) { - real[][] y=integrate(initial(t),f,a,b,h,n,tableau); - return discrepancy(y[y.length-1]); + real[][] y=integrate(initial(t),f,a,b,h,n,dynamic,tolmin,tolmax,dtmin,dtmax, + tableau,verbose).y;return discrepancy(y[y.length-1]); } real[][] jacobian(real[] t) {return finiteDifferenceJacobian(g,t);} return initial(newton(iterations,g,jacobian,guess)); diff --git a/Build/source/utils/asymptote/base/palette.asy b/Build/source/utils/asymptote/base/palette.asy index fabbdc2cd5b..41a40a04a85 100644 --- a/Build/source/utils/asymptote/base/palette.asy +++ b/Build/source/utils/asymptote/base/palette.asy @@ -305,7 +305,7 @@ pen[] Wheel(int NColors=32766) if(settings.gray) return Grayscale(NColors); int nintervals=6; - int n=quotient(NColors,nintervals); + int n=-quotient(NColors,-nintervals); pen[] Palette; if(n == 0) return Palette; @@ -333,7 +333,7 @@ pen[] Rainbow(int NColors=32766) int offset=1; int nintervals=5; - int n=quotient(NColors-1,nintervals); + int n=-quotient(NColors-1,-nintervals); pen[] Palette; if(n == 0) return Palette; @@ -366,7 +366,7 @@ private pen[] BWRainbow(int NColors, bool two) if(two) nintervals += 6; int num=NColors-offset; - int n=quotient(num,nintervals*divisor)*divisor; + int n=-quotient(num,-nintervals*divisor)*divisor; NColors=n*nintervals+offset; pen[] Palette; @@ -395,7 +395,7 @@ private pen[] BWRainbow(int NColors, bool two) for(int i=0; i < n; ++i) Palette[k+i]=rgb(1.0-i*ninv,0.0,1.0); else { - int n3=quotient(n,3); + int n3=-quotient(n,-3); int n23=2*n3; real third=n3*ninv; real twothirds=n23*ninv; diff --git a/Build/source/utils/asymptote/base/plain.asy b/Build/source/utils/asymptote/base/plain.asy index f9e18b883ea..cc1a5064038 100644 --- a/Build/source/utils/asymptote/base/plain.asy +++ b/Build/source/utils/asymptote/base/plain.asy @@ -24,6 +24,7 @@ if(version.VERSION != VERSION) { version.VERSION+" of plain.asy"+'\n'); } +include plain_strings; include plain_pens; include plain_paths; include plain_filldraw; @@ -33,7 +34,6 @@ include plain_Label; include plain_shipout; include plain_arcs; include plain_boxes; -include plain_strings; include plain_markers; include plain_arrows; include plain_debugger; diff --git a/Build/source/utils/asymptote/base/plain_Label.asy b/Build/source/utils/asymptote/base/plain_Label.asy index b75d0de3967..6e6f231375a 100644 --- a/Build/source/utils/asymptote/base/plain_Label.asy +++ b/Build/source/utils/asymptote/base/plain_Label.asy @@ -75,11 +75,19 @@ transform scaleless(transform t) A=conj(U)*A*U; real D=abs(A[0][0]); - if(D != 0) A[0][0] /= D; + if(D != 0) { + A[0][0] /= D; + A[0][1] /= D; + } + D=abs(A[1][1]); - if(D != 0) A[1][1] /= D; + if(D != 0) { + A[1][0] /= D; + A[1][1] /= D; + } A=U*A*conj(U); + return (0,0,A[0][0].x,A[0][1].x,A[1][0].x,A[1][1].x); } @@ -209,7 +217,8 @@ transform Slant(transform t) {return scaleless(t);} transform Scale(transform t) {return t;} embed Rotate(pair z) { - return new transform(transform t) {return rotate(degrees(shiftless(t)*z));}; + return new transform(transform t) {return rotate(degrees(shiftless(t)*z, + warn=false));}; } struct Label { @@ -288,7 +297,7 @@ struct Label { void label(frame f, transform t=identity(), pair position, pair align) { pen p0=p == nullpen ? currentpen : p; - align=length(align)*unit(scaleless(shiftless(t))*align); + align=length(align)*unit(shiftless(t)*align); label(f,s,size,embed(t)*shiftless(T), t*position+align*labelmargin(p0)+shift(T)*0,align,p0); } diff --git a/Build/source/utils/asymptote/base/plain_arcs.asy b/Build/source/utils/asymptote/base/plain_arcs.asy index 01e750f42cd..140bc3cff19 100644 --- a/Build/source/utils/asymptote/base/plain_arcs.asy +++ b/Build/source/utils/asymptote/base/plain_arcs.asy @@ -23,8 +23,9 @@ path arc(pair c, explicit pair z1, explicit pair z2, bool direction=CCW) real t1=intersect(unitcircle,(0,0)--2*z1)[0]; real t2=intersect(unitcircle,(0,0)--2*z2)[0]; static int n=length(unitcircle); - if(t1 >= t2 && direction) t1 -= n; - if(t2 >= t1 && !direction) t2 -= n; + if(direction) { + if (t1 >= t2) t1 -= n; + } else if(t2 >= t1) t2 -= n; return shift(c)*scale(r)*subpath(unitcircle,t1,t2); } diff --git a/Build/source/utils/asymptote/base/plain_boxes.asy b/Build/source/utils/asymptote/base/plain_boxes.asy index ff82a0b0b32..0c6401311d8 100644 --- a/Build/source/utils/asymptote/base/plain_boxes.asy +++ b/Build/source/utils/asymptote/base/plain_boxes.asy @@ -4,7 +4,8 @@ path box(frame dest, frame src=dest, real xmargin=0, real ymargin=xmargin, { pair z=(xmargin,ymargin); int sign=filltype == NoFill ? 1 : -1; - path g=box(min(src)+0.5*sign*min(p)-z,max(src)+0.5*sign*max(p)+z); + pair h=0.5*sign*(max(p)-min(p)); + path g=box(min(src)-h-z,max(src)+h+z); frame F; if(above == false) { filltype.fill(F,g,p); @@ -45,8 +46,8 @@ path ellipse(frame dest, frame src=dest, real xmargin=0, real ymargin=xmargin, pair D=M-m; static real factor=0.5*sqrt(2); int sign=filltype == NoFill ? 1 : -1; - path g=ellipse(0.5*(M+m),factor*D.x+0.5*sign*max(p).x+xmargin, - factor*D.y+0.5*sign*max(p).y+ymargin); + pair h=0.5*sign*(max(p)-min(p)); + path g=ellipse(0.5*(M+m),factor*D.x+h.x+xmargin,factor*D.y+h.y+ymargin); frame F; if(above == false) { filltype.fill(F,g,p); diff --git a/Build/source/utils/asymptote/base/plain_constants.asy b/Build/source/utils/asymptote/base/plain_constants.asy index 32138756891..ba8947c91c2 100644 --- a/Build/source/utils/asymptote/base/plain_constants.asy +++ b/Build/source/utils/asymptote/base/plain_constants.asy @@ -8,10 +8,10 @@ restricted real bp=1; // A PostScript point. restricted real pt=72.0/72.27; // A TeX pt; smaller than a PostScript bp. restricted pair I=(0,1); -restricted pair up=(0,1); -restricted pair down=(0,-1); restricted pair right=(1,0); restricted pair left=(-1,0); +restricted pair up=(0,1); +restricted pair down=(0,-1); restricted pair E=(1,0); restricted pair N=(0,1); diff --git a/Build/source/utils/asymptote/base/plain_paths.asy b/Build/source/utils/asymptote/base/plain_paths.asy index bf3f2790c1d..3dab68fe32e 100644 --- a/Build/source/utils/asymptote/base/plain_paths.asy +++ b/Build/source/utils/asymptote/base/plain_paths.asy @@ -15,6 +15,7 @@ tensionSpecifier operator tension(real t, bool atLeast) { return operator tension(t,t,atLeast); } + guide operator controls(pair z) { return operator controls(z,z); @@ -92,19 +93,26 @@ void write(file file, string s="", explicit path[] x, suffix suffix=none) write(file,suffix); } -void write(file file, string s="", explicit guide[] x, suffix suffix=none) +void write(string s="", explicit path[] x, suffix suffix=endl) { - write(file,s,(path[]) x,suffix); + write(stdout,s,x,suffix); } -void write(string s="", explicit path[] x, suffix suffix=endl) +void write(file file, string s="", explicit guide[] x, suffix suffix=none) { - write(stdout,s,x,suffix); + write(file,s); + if(x.length > 0) write(file,x[0]); + for(int i=1; i < x.length; ++i) { + write(file,endl); + write(file," ^^"); + write(file,x[i]); + } + write(file,suffix); } void write(string s="", explicit guide[] x, suffix suffix=endl) { - write(stdout,s,(path[]) x,suffix); + write(stdout,s,x,suffix); } private string nopoints="nullpath has no points"; @@ -127,23 +135,19 @@ pair max(explicit path[] p) return maxp; } -guide operator ::(... guide[] a) +interpolate operator ..(tensionSpecifier t) { - if(a.length == 0) return nullpath; - guide g=a[0]; - for(int i=1; i < a.length; ++i) - g=g..operator tension(1,true)..a[i]; - return g; + return new guide(... guide[] a) { + if(a.length == 0) return nullpath; + guide g=a[0]; + for(int i=1; i < a.length; ++i) + g=g..t..a[i]; + return g; + }; } -guide operator ---(... guide[] a) -{ - if(a.length == 0) return nullpath; - guide g=a[0]; - for(int i=1; i < a.length; ++i) - g=g..operator tension(infinity,true)..a[i]; - return g; -} +interpolate operator ::=operator ..(operator tension(1,true)); +interpolate operator ---=operator ..(operator tension(infinity,true)); // return an arbitrary intersection point of paths p and q pair intersectionpoint(path p, path q, real fuzz=-1) @@ -283,7 +287,7 @@ path buildcycle(... path[] p) for(int i=0; i < n; ++i) { real[][] t=intersections(p[i],p[j]); if(t.length == 0) - return nullpath; + return nullpath; ta[i]=t[0][0]; tb[j]=t[0][1]; j=i; } @@ -302,7 +306,7 @@ path buildcycle(... path[] p) int L=length(p[i]); real t=Tb-L; if(abs(c-point(p[i],0.5(Ta+t))) < - abs(c-point(p[i],0.5(Ta+Tb)))) Tb=t; + abs(c-point(p[i],0.5(Ta+Tb)))) Tb=t; while(Tb < Ta) Tb += L; } G=G&subpath(p[i],Ta,Tb); diff --git a/Build/source/utils/asymptote/base/plain_pens.asy b/Build/source/utils/asymptote/base/plain_pens.asy index a8a0d0c7461..5b0bdbd5879 100644 --- a/Build/source/utils/asymptote/base/plain_pens.asy +++ b/Build/source/utils/asymptote/base/plain_pens.asy @@ -1,12 +1,17 @@ real labelmargin=0.3; real dotfactor=6; -pen solid=linetype(""); -pen dotted=linetype("0 4"); -pen dashed=linetype("8 8"); -pen longdashed=linetype("24 8"); -pen dashdotted=linetype("8 8 0 8"); -pen longdashdotted=linetype("24 8 0 8"); +pen solid=linetype(new real[]); +pen dotted=linetype(new real[] {0,4}); +pen dashed=linetype(new real[] {8,8}); +pen longdashed=linetype(new real[] {24,8}); +pen dashdotted=linetype(new real[] {8,8,0,8}); +pen longdashdotted=linetype(new real[] {24,8,0,8}); + +pen linetype(string pattern, real offset=0, bool scale=true, bool adjust=true) +{ + return linetype((real[]) split(pattern),offset,scale,adjust); +} void defaultpen(real w) {defaultpen(linewidth(w));} pen operator +(pen p, real w) {return p+linewidth(w);} diff --git a/Build/source/utils/asymptote/base/plain_picture.asy b/Build/source/utils/asymptote/base/plain_picture.asy index e13120a198c..56ebf9f4bbe 100644 --- a/Build/source/utils/asymptote/base/plain_picture.asy +++ b/Build/source/utils/asymptote/base/plain_picture.asy @@ -4,11 +4,6 @@ pair viewportsize=0; // Horizontal and vertical viewport limits. restricted bool Aspect=true; restricted bool IgnoreAspect=false; -pair size(frame f) -{ - return max(f)-min(f); -} - typedef real[][] transform3; restricted transform3 identity4=identity(4); @@ -360,6 +355,7 @@ pair point(frame f, pair dir) path[] align(path[] g, transform t=identity(), pair position, pair align, pen p=currentpen) { + if(g.length == 0) return g; pair m=min(g); pair M=max(g); pair dir=rectify(inverse(t)*-align); @@ -385,18 +381,15 @@ struct transformation { transform3 modelview; // For orientation and positioning transform3 projection; // For 3D to 2D projection bool infinity; - bool oblique; - void operator init(transform3 modelview, bool oblique=false) { + void operator init(transform3 modelview) { this.modelview=modelview; this.projection=identity4; infinity=true; - this.oblique=oblique; } void operator init(transform3 modelview, transform3 projection) { this.modelview=modelview; this.projection=projection; infinity=false; - oblique=false; } transform3 compute() { return infinity ? modelview : projection*modelview; @@ -406,7 +399,6 @@ struct transformation { T.modelview=copy(modelview); T.projection=copy(projection); T.infinity=infinity; - T.oblique=oblique; return T; } } @@ -414,11 +406,11 @@ struct transformation { struct projection { transform3 t; // projection*modelview (cached) bool infinity; - bool oblique; bool absolute=false; triple camera; // Position of camera. triple up; // A vector that should be projected to direction (0,1). triple target; // Point where camera is looking at. + triple normal; // Normal vector from target to projection plane. pair viewportshift; // Fractional viewport shift. real zoom=1; // Zoom factor. real angle; // Lens angle (for perspective projection). @@ -434,7 +426,6 @@ struct projection { T=projector(camera,up,target); t=T.compute(); infinity=T.infinity; - oblique=T.oblique; ninterpolate=infinity ? 1 : 16; } @@ -443,12 +434,14 @@ struct projection { } void operator init(triple camera, triple up=(0,0,1), triple target=(0,0,0), + triple normal=camera-target, real zoom=1, real angle=0, pair viewportshift=0, bool showtarget=true, bool autoadjust=true, bool center=false, projector projector) { this.camera=camera; this.up=up; this.target=target; + this.normal=normal; this.zoom=zoom; this.angle=angle; this.viewportshift=viewportshift; @@ -464,10 +457,10 @@ struct projection { P.t=t; P.infinity=infinity; P.absolute=absolute; - P.oblique=oblique; P.camera=camera; P.up=up; P.target=target; + P.normal=normal; P.zoom=zoom; P.angle=angle; P.viewportshift=viewportshift; @@ -1281,7 +1274,7 @@ struct picture { } - // Calculate additional scaling required if only an approximate thisture + // Calculate additional scaling required if only an approximate picture // size estimate is available. transform3 scale3(frame f, real xsize3=this.xsize3, real ysize3=this.ysize3, real zsize3=this.zsize3, @@ -1567,12 +1560,24 @@ void add(picture pic=currentpicture, drawer d, bool exact=false) pic.add(d,exact); } +typedef void drawer3(frame f, transform3 t, picture pic, projection P); +void add(picture pic=currentpicture, drawer3 d, bool exact=false) +{ + pic.add(d,exact); +} + void add(picture pic=currentpicture, void d(picture,transform), bool exact=false) { pic.add(d,exact); } +void add(picture pic=currentpicture, void d(picture,transform3), + bool exact=false) +{ + pic.add(d,exact); +} + void begingroup(picture pic=currentpicture) { pic.add(new void(frame f, transform) { @@ -1628,7 +1633,7 @@ void latticeshade(picture pic=currentpicture, path[] g, bool stroke=false, p=copy(p); } pic.add(new void(frame f, transform t) { - latticeshade(f,t*g,stroke,fillrule,p,false); + latticeshade(f,t*g,stroke,fillrule,p,t,false); },true); pic.addPath(g); } @@ -1738,7 +1743,8 @@ void tensorshade(picture pic=currentpicture, path[] g, bool stroke=false, // Smoothly shade the regions between consecutive paths of a sequence using a // given array of pens: -void draw(picture pic=currentpicture, path[] g, pen[] p) +void draw(picture pic=currentpicture, path[] g, pen fillrule=currentpen, + pen[] p) { path[] G; pen[][] P; @@ -1753,7 +1759,7 @@ void draw(picture pic=currentpicture, path[] g, pen[] p) P.push(new pen[] {p[i],p[i],p[i+1],p[i+1]}); } } - tensorshade(pic,G,P); + tensorshade(pic,G,fillrule,P); } void functionshade(picture pic=currentpicture, path[] g, bool stroke=false, @@ -1883,7 +1889,14 @@ void add(picture dest=currentpicture, frame src, pair position, pair align, add(dest,align(src,align),position,group,filltype,above); } -// Like attach(picture,frame,pair) but extend picture to accommodate frame; +// Like add(frame,frame,pair) but align frame in direction align. +void add(frame dest, frame src, pair position, pair align, + bool group=true, filltype filltype=NoFill, bool above=true) +{ + add(dest,align(src,align),position,group,filltype,above); +} + +// Like add(picture,frame,pair,pair) but extend picture to accommodate frame; void attach(picture dest=currentpicture, frame src, pair position, pair align, bool group=true, filltype filltype=NoFill, bool above=true) @@ -1935,22 +1948,29 @@ void postscript(picture pic=currentpicture, string s) },true); } -void tex(picture pic=currentpicture, string s) +void postscript(picture pic=currentpicture, string s, pair min, pair max) { - pic.add(new void(frame f, transform) { - tex(f,s); + pic.add(new void(frame f, transform t) { + postscript(f,s,t*min,t*max); },true); } -void postscript(picture pic=currentpicture, string s, pair min, pair max) +void tex(picture pic=currentpicture, string s) { - pic.add(new void(frame f, transform t) { - postscript(f,s,t*min,t*max); + // Force TeX string s to be evaluated immediately (in case it is a macro). + frame g; + tex(g,s); + size(g); + pic.add(new void(frame f, transform) { + tex(f,s); },true); } void tex(picture pic=currentpicture, string s, pair min, pair max) { + frame g; + tex(g,s); + size(g); pic.add(new void(frame f, transform t) { tex(f,s,t*min,t*max); },true); @@ -1968,3 +1988,31 @@ void erase(picture pic=currentpicture) pic.uptodate=false; pic.erase(); } + +void begin(picture pic=currentpicture, string name, string id="", + bool visible=true) +{ + if(!latex() || !pdf()) return; + settings.twice=true; + if(id == "") id=string(++ocgindex); + tex(pic,"\begin{ocg}{"+name+"}{"+id+"}{"+(visible ? "1" : "0")+"}"); + layer(pic); +} + +void end(picture pic=currentpicture) +{ + if(!latex() || !pdf()) return; + tex(pic,"\end{ocg}"); + layer(pic); +} + +// For users of the LaTeX babel package. +void deactivatequote(picture pic=currentpicture) +{ + tex(pic,"\catcode`\"=12"); +} + +void activatequote(picture pic=currentpicture) +{ + tex(pic,"\catcode`\"=13"); +} diff --git a/Build/source/utils/asymptote/base/plain_shipout.asy b/Build/source/utils/asymptote/base/plain_shipout.asy index 9691a8e2fcf..e96a3a8acb1 100644 --- a/Build/source/utils/asymptote/base/plain_shipout.asy +++ b/Build/source/utils/asymptote/base/plain_shipout.asy @@ -2,9 +2,7 @@ string defaultfilename; string outprefix(string prefix=defaultfilename) { - string s=prefix != "" ? prefix : - (settings.outname == "" && interactive()) ? "out" : settings.outname; - return stripextension(s); + return stripextension(prefix != "" ? prefix : outname()); } string outformat(string format="") @@ -14,7 +12,6 @@ string outformat(string format="") return format; } - bool shipped; // Was a picture or frame already shipped out? frame currentpatterns; diff --git a/Build/source/utils/asymptote/base/plain_strings.asy b/Build/source/utils/asymptote/base/plain_strings.asy index 598d61e4249..138ab05ca05 100644 --- a/Build/source/utils/asymptote/base/plain_strings.asy +++ b/Build/source/utils/asymptote/base/plain_strings.asy @@ -83,19 +83,28 @@ string verbatim(string s) } // Split a string into an array of substrings delimited by delimiter -string[] split(string s, string delimiter=" ") +// If delimiter is an empty string, use space delimiter, discarding duplicates. +string[] split(string s, string delimiter="") { + bool prune=false; + if(delimiter == "") { + prune=true; + delimiter=" "; + } + string[] S; int last=0; int i; int N=length(delimiter); + int n=length(s); while((i=find(s,delimiter,last)) >= 0) { if(i >= last) S.push(substr(s,last,i-last)); last=i+N; + if(prune) + while(substr(s,last,1) == " ") ++last; } - int n=length(s); - if(n >= last) + if(n > last || (n == last && !prune)) S.push(substr(s,last,n-last)); return S; } @@ -150,7 +159,12 @@ string graphic(string name, string options="") { if(latex()) { if(options != "") options="["+options+"]"; - return "\includegraphics"+options+"{"+name+"}"; + if(find(name," ") < 0) + return "\includegraphics"+options+"{"+name+"}"; + else { + return "\includegraphics"+options+ + (pdf() ? "{\""+stripextension(name)+"\".pdf}" : "{\""+name+"\"}"); + } } if(settings.tex != "context") notimplemented("graphic"); @@ -160,10 +174,10 @@ string graphic(string name, string options="") string minipage(string s, real width=100bp) { if(latex()) - return "\begin{minipage}{"+(string) (width*pt)+"pt}"+s+"\end{minipage}"; + return "\begin{minipage}{"+(string) (width/pt)+"pt}"+s+"\end{minipage}"; if(settings.tex != "context") notimplemented("minipage"); - return "\startframedtext[none][frame=off,width="+(string) (width*pt)+ + return "\startframedtext[none][frame=off,width="+(string) (width/pt)+ "pt]"+s+"\stopframedtext"; } @@ -197,20 +211,3 @@ string phantom(string s) } restricted int ocgindex=0; - -void begin(picture pic=currentpicture, string name, string id="", - bool visible=true) -{ - if(!latex() || !pdf()) return; - settings.twice=true; - if(id == "") id=string(++ocgindex); - tex(pic,"\begin{ocg}{"+name+"}{"+id+"}{"+(visible ? "1" : "0")+"}"); - layer(pic); -} - -void end(picture pic=currentpicture) -{ - if(!latex() || !pdf()) return; - tex(pic,"\end{ocg}"); - layer(pic); -} diff --git a/Build/source/utils/asymptote/base/slide.asy b/Build/source/utils/asymptote/base/slide.asy index 579253b182f..dc1608203e1 100644 --- a/Build/source/utils/asymptote/base/slide.asy +++ b/Build/source/utils/asymptote/base/slide.asy @@ -526,8 +526,8 @@ void item(string s, pen p=itempen, bool step=itemstep) frame b; label(b,bullet,(0,0),p); real bulletwidth=max(b).x-min(b).x; - remark(bullet+"\hangindent"+(string) bulletwidth+"pt$\,$"+s,p, - -bulletwidth*pt,step=step); + remark(bullet+"\hangindent"+(string) (bulletwidth/pt)+"pt$\,$"+s,p, + -bulletwidth,step=step); } void subitem(string s, pen p=itempen) diff --git a/Build/source/utils/asymptote/base/solids.asy b/Build/source/utils/asymptote/base/solids.asy index db98af3088c..7e5883bc884 100644 --- a/Build/source/utils/asymptote/base/solids.asy +++ b/Build/source/utils/asymptote/base/solids.asy @@ -1,7 +1,7 @@ import three; import graph3; -pen defaultbackpen=linetype("4 4",4,scale=false); +pen defaultbackpen=linetype(new real[] {4,4},4,scale=false); // A solid geometry package. diff --git a/Build/source/utils/asymptote/base/three.asy b/Build/source/utils/asymptote/base/three.asy index 5c3a404514f..cc7534f6f79 100644 --- a/Build/source/utils/asymptote/base/three.asy +++ b/Build/source/utils/asymptote/base/three.asy @@ -17,6 +17,7 @@ real linegranularity=0.005; int linesectors=8; // Number of angular sectors. real dotgranularity=0.0001; real angleprecision=1e-5; // Precision for centering perspective projections. +int maxangleiterations=25; real rendermargin=0.02; string defaultembed3Doptions; @@ -190,7 +191,9 @@ projection operator * (transform3 t, projection P) projection P=P.copy(); if(!P.absolute) { P.camera=t*P.camera; + P.normal=t*(P.target+P.normal); P.target=t*P.target; + P.normal -= P.target; P.calculate(); } return P; @@ -268,9 +271,10 @@ projection oblique(real angle=45) t[0][2]=-c2; t[1][2]=-s2; t[2][2]=1; - return projection((c2,s2,1),up=Y, + t[2][3]=-1; + return projection((c2,s2,1),up=Y,normal=(0,0,1), new transformation(triple,triple,triple) { - return transformation(t,oblique=true);}); + return transformation(t);}); } projection obliqueZ(real angle=45) {return oblique(angle);} @@ -287,9 +291,10 @@ projection obliqueX(real angle=45) t[1][2]=1; t[2][2]=0; t[2][0]=1; - return projection((1,c2,s2), + t[2][3]=-1; + return projection((1,c2,s2),normal=(1,0,0), new transformation(triple,triple,triple) { - return transformation(t,oblique=true);}); + return transformation(t);}); } projection obliqueY(real angle=45) @@ -302,9 +307,10 @@ projection obliqueY(real angle=45) t[1][2]=1; t[2][1]=-1; t[2][2]=0; - return projection((c2,-1,s2), + t[2][3]=-1; + return projection((c2,-1,s2),normal=(0,-1,0), new transformation(triple,triple,triple) { - return transformation(t,oblique=true);}); + return transformation(t);}); } projection oblique=oblique(); @@ -349,13 +355,13 @@ triple invert(pair z, triple normal, triple point, // Map pair to a triple on the projection plane. triple invert(pair z, projection P=currentprojection) { - return invert(z,P.vector(),P.target,P); + return invert(z,P.normal,P.target,P); } // Map pair dir to a triple direction at point v on the projection plane. triple invert(pair dir, triple v, projection P=currentprojection) { - return invert(project(v,P)+dir,P.vector(),v,P)-v; + return invert(project(v,P)+dir,P.normal,v,P)-v; } pair xypart(triple v) @@ -675,24 +681,22 @@ guide3 operator .. (... guide3[] g) }; } -guide3 operator ::(... guide3[] a) -{ - if(a.length == 0) return nullpath3; - guide3 g=a[0]; - for(int i=1; i < a.length; ++i) - g=g.. tension atleast 1 ..a[i]; - return g; -} +typedef guide3 interpolate3(... guide3[]); -guide3 operator ---(... guide3[] a) +interpolate3 join3(tensionSpecifier t) { - if(a.length == 0) return nullpath3; - guide3 g=a[0]; - for(int i=1; i < a.length; ++i) - g=g.. tension atleast infinity ..a[i]; - return g; + return new guide3(... guide3[] a) { + if(a.length == 0) return nullpath3; + guide3 g=a[0]; + for(int i=1; i < a.length; ++i) + g=g..t..a[i]; + return g; + }; } +interpolate3 operator ::=join3(operator tension(1,true)); +interpolate3 operator ---=join3(operator tension(infinity,true)); + flatguide3 operator cast(guide3 g) { flatguide3 f; @@ -1056,12 +1060,12 @@ path3 invert(path p, triple normal, triple point, path3 invert(path p, triple point, projection P=currentprojection) { - return path3(p,new triple(pair z) {return invert(z,P.vector(),point,P);}); + return path3(p,new triple(pair z) {return invert(z,P.normal,point,P);}); } path3 invert(path p, projection P=currentprojection) { - return path3(p,new triple(pair z) {return invert(z,P.vector(),P.target,P);}); + return path3(p,new triple(pair z) {return invert(z,P.normal,P.target,P);}); } // Construct a path from a path3 by applying P to each control point. @@ -1250,7 +1254,7 @@ path3 solve(flatguide3 g) path nurb(path3 p, projection P, int ninterpolate=P.ninterpolate) { triple f=P.camera; - triple u=unit(P.vector()); + triple u=unit(P.normal); transform3 t=P.t; path nurb(triple v0, triple v1, triple v2, triple v3) { @@ -1360,8 +1364,9 @@ triple normal(path3 p) if(abs(a) >= fuzz && abs(b) >= fuzz) { triple n=cross(unit(a),unit(b)); real absn=abs(n); + if(absn < sqrtEpsilon) return false; n=unit(n); - if(absnormal > 0 && absn > sqrtEpsilon && + if(absnormal > 0 && abs(normal-n) > sqrtEpsilon && abs(normal+n) > sqrtEpsilon) return true; else { @@ -1455,7 +1460,7 @@ private transform3 flip(transform3 t, triple X, triple Y, triple Z, return scale(s(v.x),s(v.y),s(v.z)); } - triple u=unit(P.vector()); + triple u=unit(P.normal); triple up=unit(perp(P.up,u)); bool upright=dot(Z,u) >= 0; if(dot(Y,up) < 0) { @@ -1782,7 +1787,7 @@ transform3 align(triple u) // return a rotation that maps X,Y to the projection plane. transform3 transform3(projection P=currentprojection) { - triple w=unit(P.oblique ? P.camera : P.vector()); + triple w=unit(P.normal); triple v=unit(perp(P.up,w)); if(v == O) v=cross(perp(w),w); triple u=cross(v,w); @@ -1864,8 +1869,6 @@ triple max(explicit path3[] p) return maxp; } -typedef guide3 interpolate3(... guide3[]); - path3 randompath3(int n, bool cumulate=true, interpolate3 join=operator ..) { guide3 g; @@ -1948,8 +1951,9 @@ path3 arc(triple c, triple v1, triple v2, triple normal=O, bool direction=CCW) real t1=t1[0]; real t2=t2[0]; int n=length(unitcircle3); - if(t1 >= t2 && direction) t1 -= n; - if(t2 >= t1 && !direction) t2 -= n; + if(direction) { + if (t1 >= t2) t1 -= n; + } else if(t2 >= t1) t2 -= n; path3 p=subpath(unitcircle3,t1,t2); if(align) p=T*p; @@ -1986,11 +1990,6 @@ path3 plane(triple u, triple v, triple O=O) return O--O+u--O+u+v--O+v--cycle; } -triple size3(frame f) -{ - return max3(f)-min3(f); -} - // PRC/OpenGL support include three_light; @@ -2125,10 +2124,9 @@ draw=new void(frame f, path3 g, material p=currentpen, } else _draw(f,g,q,name); } else _draw(f,g,q,name); } - string type=linetype(adjust(q,arclength(g),cyclic(g))); - if(length(type) == 0) drawthick(g); + real[] dash=linetype(adjust(q,arclength(g),cyclic(g))); + if(dash.length == 0) drawthick(g); else { - real[] dash=(real[]) split(type," "); if(sum(dash) > 0) { dash.cyclic=true; real offset=offset(q); @@ -2418,7 +2416,7 @@ for(i=0; i < count; i++) { var center=new Array( "; for(int i=0; i < center.length; ++i) - s += "Vector3("+format(center[i],",")+"), + s += "Vector3("+format(center[i]/cm,",")+"), "; s += "); @@ -2457,7 +2455,7 @@ runtime.addEventHandler(billboardHandler); runtime.refresh(); "; -return s; + return s; } string lightscript(light light) { @@ -2674,7 +2672,6 @@ struct scene // Choose the angle to be just large enough to view the entire image. real angle(projection P) { T=identity4; - int maxiterations=100; real h=-0.5*P.target.z; pair r,R; real diff=realMax; @@ -2695,7 +2692,7 @@ struct scene } diff=abs(s-lasts); ++i; - } while (diff > angleprecision && i < maxiterations); + } while (diff > angleprecision && i < maxangleiterations); real aspect=width > 0 ? height/width : 1; real rx=-r.x*aspect; real Rx=R.x*aspect; @@ -2767,7 +2764,9 @@ object embed(string label="", string text=label, string prefix=defaultfilename, bool preview=settings.render > 0; if(prc) { // The movie15.sty package cannot handle spaces or dots in filenames. - prefix=replace(prefix,new string[][]{{" ","_"},{".","_"}}); + string dir=stripfile(prefix); + prefix=dir+replace(stripdirectory(prefix), + new string[][]{{" ","_"},{".","_"}}); if(settings.embed || nativeformat() == "pdf") prefix += "+"+(string) file3.length; } else @@ -3063,7 +3062,8 @@ frame[] fit3(string prefix="", picture[] pictures, picture all, for(int i=settings.reverse ? pictures.length-1 : 0; i >= 0 && i < pictures.length && !settings.interrupt; settings.reverse ? --i : ++i) { - embedder(prefix,out[i],format,view,options,script,light,S.P); + frame f=embedder(prefix,out[i],format,view,options,script,light,S.P); + if(!settings.loop) out[i]=f; } if(!settings.loop) break; } diff --git a/Build/source/utils/asymptote/base/three_arrows.asy b/Build/source/utils/asymptote/base/three_arrows.asy index 161a716bca6..b4319219284 100644 --- a/Build/source/utils/asymptote/base/three_arrows.asy +++ b/Build/source/utils/asymptote/base/three_arrows.asy @@ -70,6 +70,7 @@ struct arrowhead3 real size(pen p)=arrowsize; real arcsize(pen p)=arcarrowsize; real gap=1; + real size; bool splitpath=true; surface head(path3 g, position position=EndPoint, @@ -88,7 +89,7 @@ struct arrowhead3 if(filltype == null) filltype=FillDraw(p); bool draw=filltype.type != filltype.Fill; triple v=point(s,length(s)); - triple N=normal == O ? P.vector() : normal; + triple N=normal == O ? P.normal : normal; triple w=unit(v-point(s,0)); transform3 t=transform3(w,unit(cross(w,N))); path3[] H=t*path3(h); @@ -180,8 +181,7 @@ arrowhead3 HookHead3(real dir=arrowdir, real barb=arrowbarb) filltype filltype=null, bool forwards=true, projection P=currentprojection) { if(size == 0) size=a.size(p); - - angle=min(angle*arrowhookfactor,45); + bool relative=position.relative; real position=position.position.x; if(relative) position=reltime(g,position); @@ -265,11 +265,12 @@ arrowhead3 DefaultHead2(triple normal=O) { projection P=currentprojection) { if(size == 0) size=a.size(p); path h=a.project(g,forwards,P); + a.size=min(size,arclength(h)); path[] H=a.align(DefaultHead.head(h,p,size,angle),h); H=forwards ? yscale(-1)*H : H; return a.surface(g,position,size,H,p,filltype,normal,P); }; - a.gap=1.01; + a.gap=1.005; return a; } arrowhead3 DefaultHead2=DefaultHead2(); @@ -282,14 +283,14 @@ arrowhead3 HookHead2(real dir=arrowdir, real barb=arrowbarb, triple normal=O) filltype filltype=null, bool forwards=true, projection P=currentprojection) { if(size == 0) size=a.size(p); - angle=min(angle*arrowhookfactor,45); path h=a.project(g,forwards,P); + a.size=min(size,arclength(h)); path[] H=a.align(HookHead.head(h,p,size,angle),h); H=forwards ? yscale(-1)*H : H; return a.surface(g,position,size,H,p,filltype,normal,P); }; a.arrowhead2=HookHead; - a.gap=1.01; + a.gap=1.005; return a; } arrowhead3 HookHead2=HookHead2(); @@ -302,6 +303,7 @@ arrowhead3 TeXHead2(triple normal=O) { bool forwards=true, projection P=currentprojection) { if(size == 0) size=a.size(p); path h=a.project(g,forwards,P); + a.size=min(size,arclength(h)); h=rotate(-degrees(dir(h,length(h)),warn=false))*h; path[] H=TeXHead.head(h,p,size,angle); H=forwards ? yscale(-1)*H : H; @@ -311,8 +313,8 @@ arrowhead3 TeXHead2(triple normal=O) { }; a.arrowhead2=TeXHead; a.size=TeXHead.size; - a.gap=0.83; a.splitpath=false; + a.gap=1.005; return a; } arrowhead3 TeXHead2=TeXHead2(); @@ -359,6 +361,7 @@ void drawarrow(picture pic, arrowhead3 arrowhead=DefaultHead3, path3 r=subpath(g,position,0); size=min(arrowsizelimit*arclength(r),size); surface head=arrowhead.head(g,position,q,size,angle,filltype,forwards,P); + if(arrowhead.size > 0) size=arrowhead.size; bool endpoint=position > L-sqrtEpsilon; if(arrowhead.splitpath || endpoint) { if(position > 0) { @@ -526,11 +529,11 @@ void bar(picture pic, triple a, triple d, triple perp=O, pic.add(new void(frame f, transform3 t, picture pic2, projection P) { picture opic; triple A=t*a; - triple v=d == O ? abs(perp)*unit(cross(P.vector(),perp)) : d; + triple v=d == O ? abs(perp)*unit(cross(P.normal,perp)) : d; draw(opic,A-v--A+v,p,light); add(f,opic.fit3(identity4,pic2,P)); }); - triple v=d == O ? cross(currentprojection.vector(),perp) : d; + triple v=d == O ? cross(currentprojection.normal,perp) : d; pen q=(pen) p; triple m=min3(q); triple M=max3(q); diff --git a/Build/source/utils/asymptote/base/three_surface.asy b/Build/source/utils/asymptote/base/three_surface.asy index e520229371f..1be7eb0259c 100644 --- a/Build/source/utils/asymptote/base/three_surface.asy +++ b/Build/source/utils/asymptote/base/three_surface.asy @@ -1343,7 +1343,7 @@ triple rectify(triple dir) path3[] align(path3[] g, transform3 t=identity4, triple position, triple align, pen p=currentpen) { - if(determinant(t) == 0) return g; + if(determinant(t) == 0 || g.length == 0) return g; triple m=min(g); triple dir=rectify(inverse(t)*-align); triple a=m+realmult(dir,max(g)-m); @@ -1353,7 +1353,7 @@ path3[] align(path3[] g, transform3 t=identity4, triple position, surface align(surface s, transform3 t=identity4, triple position, triple align, pen p=currentpen) { - if(determinant(t) == 0) return s; + if(determinant(t) == 0 || s.s.length == 0) return s; triple m=min(s); triple dir=rectify(inverse(t)*-align); triple a=m+realmult(dir,max(s)-m); @@ -1367,17 +1367,11 @@ surface surface(Label L, triple position=O) shift(position)*L.T3*s; } -path[] path(Label L, pair z=0, projection P) +private path[] path(Label L, pair z=0, projection P) { path[] g=texpath(L); - if(L.defaulttransform3) { - return L.align.is3D ? align(g,z,project(L.align.dir3,P)-project(O,P),L.p) : - shift(z)*g; - } else { - path3[] G=path3(g); - return L.align.is3D ? shift(z)*project(align(G,L.T3,O,L.align.dir3,L.p),P) : - shift(z)*project(L.T3*G,P); - } + return L.align.is3D ? align(g,z,project(L.align.dir3,P)-project(O,P),L.p) : + shift(z)*g; } void label(frame f, Label L, triple position, align align=NoAlign, @@ -1397,15 +1391,18 @@ void label(frame f, Label L, triple position, align align=NoAlign, for(patch S : surface(L,position).s) draw3D(f,S,position,L.p,light,partname(name,++i),interaction); } else { - if(L.filltype == NoFill) - fill(f,path(L,project(position,P.t),P), - color(L.T3*Z,L.p,light,shiftless(P.T.modelview))); - else { - frame d; - fill(d,path(L,project(position,P.t),P), - color(L.T3*Z,L.p,light,shiftless(P.T.modelview))); - add(f,d,L.filltype); - } + pen p=color(L.T3*Z,L.p,light,shiftless(P.T.modelview)); + if(L.defaulttransform3) { + if(L.filltype == NoFill) + fill(f,path(L,project(position,P.t),P),p); + else { + frame d; + fill(d,path(L,project(position,P.t),P),p); + add(f,d,L.filltype); + } + } else + for(patch S : surface(L,position).s) + fill(f,project(S.external(),P,1),p); } } @@ -1430,22 +1427,30 @@ void label(picture pic=currentpicture, Label L, triple position, L.T=L.T*scale(abs(P.camera-v)/abs(P.vector())); if(L.defaulttransform3) L.T3=transform3(P); + if(is3D()) { int i=-1; for(patch S : surface(L,v).s) draw3D(f,S,v,L.p,light,partname(name,++i),interaction); } + if(pic != null) { - if(L.filltype == NoFill) - fill(project(v,P.t),pic,path(L,P), - color(L.T3*Z,L.p,light,shiftless(P.T.modelview))); - else { - picture d; - fill(project(v,P.t),d,path(L,P), - color(L.T3*Z,L.p,light,shiftless(P.T.modelview))); - add(pic,d,L.filltype); - } + pen p=color(L.T3*Z,L.p,light,shiftless(P.T.modelview)); + if(L.defaulttransform3) { + if(L.filltype == NoFill) + fill(project(v,P.t),pic,path(L,P),p); + else { + picture d; + fill(project(v,P.t),d,path(L,P),p); + add(pic,d,L.filltype); + } + } else + pic.add(new void(frame f, transform T) { + for(patch S : surface(L,v).s) + fill(f,T*project(S.external(),P,1),p); + }); } + },!L.defaulttransform3); Label L=L.copy(); @@ -1678,12 +1683,28 @@ void dot(picture pic=currentpicture, Label L, triple v, align align=NoAlign, label(pic,L,v); } +pair minbound(triple[] A, projection P) +{ + pair b=project(A[0],P); + for(triple v : A) + b=minbound(b,project(v,P.t)); + return b; +} + +pair maxbound(triple[] A, projection P) +{ + pair b=project(A[0],P); + for(triple v : A) + b=maxbound(b,project(v,P.t)); + return b; +} + pair minbound(triple[][] A, projection P) { pair b=project(A[0][0],P); for(triple[] a : A) { for(triple v : a) { - b=minbound(b,project(v,P)); + b=minbound(b,project(v,P.t)); } } return b; @@ -1694,7 +1715,7 @@ pair maxbound(triple[][] A, projection P) pair b=project(A[0][0],P); for(triple[] a : A) { for(triple v : a) { - b=maxbound(b,project(v,P)); + b=maxbound(b,project(v,P.t)); } } return b; @@ -1711,6 +1732,24 @@ triple[][] operator / (triple[][] a, real[][] b) return A; } +// Draw a NURBS curve. +void draw(picture pic=currentpicture, triple[] P, real[] knot, + real[] weights=new real[], pen p=currentpen, string name="") +{ + P=copy(P); + knot=copy(knot); + weights=copy(weights); + pic.add(new void(frame f, transform3 t, picture pic, projection Q) { + if(is3D()) { + triple[] P=t*P; + draw(f,P,knot,weights,p,name); + if(pic != null) + pic.addBox(minbound(P,Q),maxbound(P,Q)); + } + },true); + pic.addBox(minbound(P),maxbound(P)); +} + // Draw a NURBS surface. void draw(picture pic=currentpicture, triple[][] P, real[] uknot, real[] vknot, real[][] weights=new real[][], material m=currentpen, @@ -1734,14 +1773,11 @@ void draw(picture pic=currentpicture, triple[][] P, real[] uknot, real[] vknot, PRCshininess=PRCshininess(m.shininess); draw(f,P,uknot,vknot,weights,m.p,m.opacity,m.shininess,PRCshininess, granularity,colors,lighton,name); - if(pic != null) { - triple[][] R=weights.length > 0 ? P/weights : P; - pic.addBox(minbound(R,Q),maxbound(R,Q)); - } + if(pic != null) + pic.addBox(minbound(P,Q),maxbound(P,Q)); } },true); - triple[][] R=weights.length > 0 ? P/weights : P; - pic.addBox(minbound(R),maxbound(R)); + pic.addBox(minbound(P),maxbound(P)); } // A structure to subdivide two intersecting patches about their intersection. diff --git a/Build/source/utils/asymptote/builtin.cc b/Build/source/utils/asymptote/builtin.cc index 5f269e4e87d..3bca4b4ba06 100644 --- a/Build/source/utils/asymptote/builtin.cc +++ b/Build/source/utils/asymptote/builtin.cc @@ -1392,11 +1392,6 @@ void base_venv(venv &ve) formal(IntRealFunction(),"f"), formal(realArray(),"a")); -#ifdef HAVE_LIBFFTW3 - addFunc(ve,pairArrayFFT,pairArray(),"fft",formal(pairArray(),"a"), - formal(primInt(),"sign",true)); -#endif - addConstant<Int>(ve, Int_MAX, primInt(), "intMax"); addConstant<Int>(ve, Int_MIN, primInt(), "intMin"); addConstant<double>(ve, HUGE_VAL, primReal(), "inf"); diff --git a/Build/source/utils/asymptote/camp.tab.cc b/Build/source/utils/asymptote/camp.tab.cc index 52b5558ce1e..728b0851496 100644 --- a/Build/source/utils/asymptote/camp.tab.cc +++ b/Build/source/utils/asymptote/camp.tab.cc @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,11 +54,88 @@ /* Pure parsers. */ #define YYPURE 0 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 0 +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "camp.y" + +/***** + * camp.y + * Andy Hammerlindl 08/12/2002 + * + * The grammar of the camp language. + *****/ + +#include "errormsg.h" +#include "exp.h" +#include "newexp.h" +#include "dec.h" +#include "fundec.h" +#include "stm.h" +#include "modifier.h" + +// Avoid error messages with unpatched bison-1.875: +#ifndef __attribute__ +#define __attribute__(x) +#endif + +// Used when a position needs to be determined and no token is +// available. Defined in camp.l. +position lexerPos(); + +bool lexerEOF(); + +int yylex(void); /* function prototype */ + +void yyerror(const char *s) +{ + if (!lexerEOF()) { + em.error(lexerPos()); + em << s; + em.cont(); + } +} + +namespace absyntax { file *root; } + +using namespace absyntax; +using sym::symbol; +using mem::string; + + +/* Line 189 of yacc.c */ +#line 119 "camp.tab.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -129,141 +205,16 @@ EXP_IN_PARENS_RULE = 318 }; #endif -/* Tokens. */ -#define ID 258 -#define ADD 259 -#define SUBTRACT 260 -#define TIMES 261 -#define DIVIDE 262 -#define MOD 263 -#define EXPONENT 264 -#define DOTS 265 -#define COLONS 266 -#define DASHES 267 -#define INCR 268 -#define LONGDASH 269 -#define CONTROLS 270 -#define TENSION 271 -#define ATLEAST 272 -#define CURL 273 -#define COR 274 -#define CAND 275 -#define BAR 276 -#define AMPERSAND 277 -#define EQ 278 -#define NEQ 279 -#define LT 280 -#define LE 281 -#define GT 282 -#define GE 283 -#define CARETS 284 -#define LOGNOT 285 -#define OPERATOR 286 -#define STRING 287 -#define LOOSE 288 -#define ASSIGN 289 -#define DIRTAG 290 -#define JOIN_PREC 291 -#define AND 292 -#define ELLIPSIS 293 -#define ACCESS 294 -#define UNRAVEL 295 -#define IMPORT 296 -#define INCLUDE 297 -#define FROM 298 -#define QUOTE 299 -#define STRUCT 300 -#define TYPEDEF 301 -#define NEW 302 -#define IF 303 -#define ELSE 304 -#define WHILE 305 -#define DO 306 -#define FOR 307 -#define BREAK 308 -#define CONTINUE 309 -#define RETURN_ 310 -#define THIS 311 -#define EXPLICIT 312 -#define GARBAGE 313 -#define LIT 314 -#define PERM 315 -#define MODIFIER 316 -#define UNARY 317 -#define EXP_IN_PARENS_RULE 318 - - - - -/* Copy the first part of user declarations. */ -#line 1 "camp.y" - -/***** - * camp.y - * Andy Hammerlindl 08/12/2002 - * - * The grammar of the camp language. - *****/ - -#include "errormsg.h" -#include "exp.h" -#include "newexp.h" -#include "dec.h" -#include "fundec.h" -#include "stm.h" -#include "modifier.h" - -// Avoid error messages with unpatched bison-1.875: -#ifndef __attribute__ -#define __attribute__(x) -#endif - -// Used when a position needs to be determined and no token is -// available. Defined in camp.l. -position lexerPos(); - -bool lexerEOF(); -int yylex(void); /* function prototype */ -void yyerror(const char *s) -{ - if (!lexerEOF()) { - em.error(lexerPos()); - em << s; - em.cont(); - } -} - -namespace absyntax { file *root; } - -using namespace absyntax; -using sym::symbol; -using mem::string; - - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 46 "camp.y" { + +/* Line 214 of yacc.c */ +#line 46 "camp.y" + position pos; bool boo; struct { @@ -307,22 +258,23 @@ typedef union YYSTYPE //absyntax::funheader *fh; absyntax::formal *fl; absyntax::formals *fls; -} -/* Line 187 of yacc.c. */ -#line 313 "camp.tab.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 266 "camp.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 326 "camp.tab.c" +/* Line 264 of yacc.c */ +#line 278 "camp.tab.c" #ifdef short # undef short @@ -397,14 +349,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -485,9 +437,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -521,12 +473,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -537,16 +489,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 2252 +#define YYLAST 2361 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 81 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 51 /* YYNRULES -- Number of rules. */ -#define YYNRULES 203 +#define YYNRULES 204 /* YYNRULES -- Number of states. */ -#define YYNSTATES 388 +#define YYNSTATES 389 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -562,15 +514,15 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 34, 2, 2, - 48, 49, 32, 29, 51, 31, 50, 33, 2, 2, + 48, 49, 32, 30, 51, 31, 50, 33, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 42, 54, - 2, 2, 2, 40, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 41, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 52, 2, 53, 35, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 45, 2, 47, 2, 2, 2, 2, + 2, 2, 2, 46, 2, 47, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -586,8 +538,8 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 30, 36, 37, 38, 39, 41, - 43, 44, 46, 55, 56, 57, 58, 59, 60, 61, + 25, 26, 27, 28, 29, 36, 37, 38, 39, 40, + 43, 44, 45, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80 }; @@ -598,133 +550,133 @@ static const yytype_uint8 yytranslate[] = static const yytype_uint16 yyprhs[] = { 0, 0, 3, 5, 6, 9, 10, 13, 15, 19, - 21, 23, 26, 29, 31, 33, 36, 39, 41, 43, - 45, 49, 55, 61, 65, 71, 77, 81, 85, 89, - 91, 95, 97, 101, 103, 105, 107, 111, 113, 117, - 120, 123, 125, 128, 130, 133, 137, 141, 146, 148, - 152, 154, 158, 160, 163, 167, 172, 174, 176, 180, - 183, 188, 192, 198, 200, 202, 205, 207, 211, 213, - 217, 220, 222, 226, 228, 229, 232, 236, 242, 248, - 255, 259, 262, 264, 267, 270, 274, 278, 283, 288, - 293, 298, 302, 307, 311, 316, 320, 324, 326, 328, - 332, 334, 338, 341, 343, 347, 349, 351, 353, 355, - 358, 363, 369, 372, 375, 378, 382, 386, 390, 394, - 398, 402, 406, 410, 414, 418, 422, 426, 430, 434, - 438, 442, 446, 450, 454, 457, 461, 466, 470, 475, - 481, 488, 495, 503, 509, 513, 519, 527, 541, 545, - 548, 551, 554, 557, 561, 565, 569, 573, 577, 581, - 586, 588, 590, 593, 596, 600, 605, 609, 615, 623, - 625, 629, 633, 635, 637, 640, 645, 649, 655, 658, - 663, 665, 667, 670, 676, 684, 690, 698, 708, 717, - 720, 723, 726, 730, 732, 734, 735, 737, 739, 740, - 742, 743, 745, 747 + 21, 23, 25, 28, 31, 33, 35, 38, 41, 43, + 45, 47, 51, 57, 63, 67, 73, 79, 83, 87, + 91, 93, 97, 99, 103, 105, 107, 109, 113, 115, + 119, 122, 125, 127, 130, 132, 135, 139, 143, 148, + 150, 154, 156, 160, 162, 165, 169, 174, 176, 178, + 182, 185, 190, 194, 200, 202, 204, 207, 209, 213, + 215, 219, 222, 224, 228, 230, 231, 234, 238, 244, + 250, 257, 261, 264, 266, 269, 272, 276, 280, 285, + 290, 295, 300, 304, 309, 313, 318, 322, 326, 328, + 330, 334, 336, 340, 343, 345, 349, 351, 353, 355, + 357, 360, 365, 371, 374, 377, 380, 384, 388, 392, + 396, 400, 404, 408, 412, 416, 420, 424, 428, 432, + 436, 440, 444, 448, 452, 456, 459, 463, 468, 472, + 477, 483, 490, 497, 505, 511, 515, 521, 529, 543, + 547, 550, 553, 556, 559, 563, 567, 571, 575, 579, + 583, 588, 590, 592, 595, 598, 602, 607, 611, 617, + 625, 627, 631, 635, 637, 639, 642, 647, 651, 657, + 660, 665, 667, 669, 672, 678, 686, 692, 700, 710, + 719, 722, 725, 728, 732, 734, 736, 737, 739, 741, + 742, 744, 745, 747, 749 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 82, 0, -1, 83, -1, -1, 83, 86, -1, -1, - 84, 86, -1, 3, -1, 85, 50, 3, -1, 88, - -1, 125, -1, 87, 88, -1, 87, 125, -1, 78, - -1, 77, -1, 87, 78, -1, 87, 77, -1, 94, - -1, 112, -1, 113, -1, 56, 93, 54, -1, 60, - 85, 57, 90, 54, -1, 60, 85, 57, 32, 54, - -1, 57, 85, 54, -1, 60, 91, 56, 90, 54, - -1, 60, 91, 56, 32, 54, -1, 58, 92, 54, - -1, 59, 3, 54, -1, 59, 38, 54, -1, 3, - -1, 3, 3, 3, -1, 89, -1, 90, 51, 89, - -1, 38, -1, 3, -1, 3, -1, 91, 3, 3, - -1, 92, -1, 93, 51, 92, -1, 95, 54, -1, - 96, 100, -1, 97, -1, 85, 98, -1, 85, -1, - 52, 53, -1, 98, 52, 53, -1, 52, 119, 53, - -1, 99, 52, 119, 53, -1, 101, -1, 100, 51, - 101, -1, 102, -1, 102, 41, 103, -1, 3, -1, - 3, 98, -1, 3, 48, 49, -1, 3, 48, 108, - 49, -1, 119, -1, 105, -1, 45, 84, 47, -1, - 45, 47, -1, 45, 55, 103, 47, -1, 45, 106, - 47, -1, 45, 106, 55, 103, 47, -1, 51, -1, - 107, -1, 107, 51, -1, 103, -1, 107, 51, 103, - -1, 109, -1, 109, 55, 111, -1, 55, 111, -1, - 111, -1, 109, 51, 111, -1, 74, -1, -1, 110, - 96, -1, 110, 96, 102, -1, 110, 96, 102, 41, - 103, -1, 96, 3, 48, 49, 127, -1, 96, 3, - 48, 108, 49, 127, -1, 62, 3, 104, -1, 63, - 94, -1, 42, -1, 119, 42, -1, 42, 119, -1, - 119, 42, 119, -1, 115, 50, 3, -1, 85, 52, - 119, 53, -1, 115, 52, 119, 53, -1, 85, 52, - 114, 53, -1, 115, 52, 114, 53, -1, 85, 48, - 49, -1, 85, 48, 117, 49, -1, 115, 48, 49, - -1, 115, 48, 117, 49, -1, 48, 119, 49, -1, - 48, 85, 49, -1, 73, -1, 119, -1, 3, 41, - 119, -1, 118, -1, 118, 55, 116, -1, 55, 116, - -1, 116, -1, 118, 51, 116, -1, 85, -1, 115, - -1, 76, -1, 38, -1, 76, 119, -1, 48, 85, - 49, 119, -1, 48, 85, 98, 49, 119, -1, 29, - 119, -1, 31, 119, -1, 36, 119, -1, 119, 29, - 119, -1, 119, 31, 119, -1, 119, 32, 119, -1, - 119, 33, 119, -1, 119, 34, 119, -1, 119, 35, - 119, -1, 119, 25, 119, -1, 119, 26, 119, -1, - 119, 27, 119, -1, 119, 28, 119, -1, 119, 23, - 119, -1, 119, 24, 119, -1, 119, 20, 119, -1, - 119, 19, 119, -1, 119, 30, 119, -1, 119, 22, - 119, -1, 119, 21, 119, -1, 119, 37, 119, -1, - 119, 13, 119, -1, 64, 97, -1, 64, 97, 99, - -1, 64, 97, 99, 98, -1, 64, 97, 98, -1, - 64, 97, 98, 105, -1, 64, 97, 48, 49, 127, - -1, 64, 97, 98, 48, 49, 127, -1, 64, 97, - 48, 108, 49, 127, -1, 64, 97, 98, 48, 108, - 49, 127, -1, 119, 40, 119, 42, 119, -1, 119, - 41, 119, -1, 48, 119, 51, 119, 49, -1, 48, - 119, 51, 119, 51, 119, 49, -1, 48, 119, 51, - 119, 51, 119, 51, 119, 51, 119, 51, 119, 49, - -1, 119, 120, 119, -1, 119, 121, -1, 13, 119, - -1, 12, 119, -1, 119, 13, -1, 119, 4, 119, - -1, 119, 5, 119, -1, 119, 6, 119, -1, 119, - 7, 119, -1, 119, 8, 119, -1, 119, 9, 119, - -1, 61, 45, 83, 47, -1, 12, -1, 122, -1, - 121, 122, -1, 122, 121, -1, 121, 122, 121, -1, - 45, 18, 119, 47, -1, 45, 119, 47, -1, 45, - 119, 51, 119, 47, -1, 45, 119, 51, 119, 51, - 119, 47, -1, 10, -1, 10, 123, 10, -1, 10, - 124, 10, -1, 11, -1, 14, -1, 16, 119, -1, - 16, 119, 46, 119, -1, 16, 17, 119, -1, 16, - 17, 119, 46, 119, -1, 15, 119, -1, 15, 119, - 46, 119, -1, 54, -1, 127, -1, 126, 54, -1, - 65, 48, 119, 49, 125, -1, 65, 48, 119, 49, - 125, 66, 125, -1, 67, 48, 119, 49, 125, -1, - 68, 125, 67, 48, 119, 49, 54, -1, 69, 48, - 128, 54, 129, 54, 130, 49, 125, -1, 69, 48, - 96, 3, 42, 119, 49, 125, -1, 70, 54, -1, - 71, 54, -1, 72, 54, -1, 72, 119, 54, -1, - 119, -1, 104, -1, -1, 131, -1, 95, -1, -1, - 119, -1, -1, 131, -1, 126, -1, 131, 51, 126, - -1 + 84, 86, -1, 3, -1, 85, 50, 3, -1, 34, + -1, 88, -1, 125, -1, 87, 88, -1, 87, 125, + -1, 78, -1, 77, -1, 87, 78, -1, 87, 77, + -1, 94, -1, 112, -1, 113, -1, 56, 93, 54, + -1, 60, 85, 57, 90, 54, -1, 60, 85, 57, + 32, 54, -1, 57, 85, 54, -1, 60, 91, 56, + 90, 54, -1, 60, 91, 56, 32, 54, -1, 58, + 92, 54, -1, 59, 3, 54, -1, 59, 38, 54, + -1, 3, -1, 3, 3, 3, -1, 89, -1, 90, + 51, 89, -1, 38, -1, 3, -1, 3, -1, 91, + 3, 3, -1, 92, -1, 93, 51, 92, -1, 95, + 54, -1, 96, 100, -1, 97, -1, 85, 98, -1, + 85, -1, 52, 53, -1, 98, 52, 53, -1, 52, + 119, 53, -1, 99, 52, 119, 53, -1, 101, -1, + 100, 51, 101, -1, 102, -1, 102, 40, 103, -1, + 3, -1, 3, 98, -1, 3, 48, 49, -1, 3, + 48, 108, 49, -1, 119, -1, 105, -1, 46, 84, + 47, -1, 46, 47, -1, 46, 55, 103, 47, -1, + 46, 106, 47, -1, 46, 106, 55, 103, 47, -1, + 51, -1, 107, -1, 107, 51, -1, 103, -1, 107, + 51, 103, -1, 109, -1, 109, 55, 111, -1, 55, + 111, -1, 111, -1, 109, 51, 111, -1, 74, -1, + -1, 110, 96, -1, 110, 96, 102, -1, 110, 96, + 102, 40, 103, -1, 96, 3, 48, 49, 127, -1, + 96, 3, 48, 108, 49, 127, -1, 62, 3, 104, + -1, 63, 94, -1, 42, -1, 119, 42, -1, 42, + 119, -1, 119, 42, 119, -1, 115, 50, 3, -1, + 85, 52, 119, 53, -1, 115, 52, 119, 53, -1, + 85, 52, 114, 53, -1, 115, 52, 114, 53, -1, + 85, 48, 49, -1, 85, 48, 117, 49, -1, 115, + 48, 49, -1, 115, 48, 117, 49, -1, 48, 119, + 49, -1, 48, 85, 49, -1, 73, -1, 119, -1, + 3, 40, 119, -1, 118, -1, 118, 55, 116, -1, + 55, 116, -1, 116, -1, 118, 51, 116, -1, 85, + -1, 115, -1, 76, -1, 38, -1, 76, 119, -1, + 48, 85, 49, 119, -1, 48, 85, 98, 49, 119, + -1, 30, 119, -1, 31, 119, -1, 36, 119, -1, + 119, 30, 119, -1, 119, 31, 119, -1, 119, 32, + 119, -1, 119, 33, 119, -1, 119, 34, 119, -1, + 119, 35, 119, -1, 119, 25, 119, -1, 119, 26, + 119, -1, 119, 27, 119, -1, 119, 28, 119, -1, + 119, 23, 119, -1, 119, 24, 119, -1, 119, 20, + 119, -1, 119, 19, 119, -1, 119, 29, 119, -1, + 119, 22, 119, -1, 119, 21, 119, -1, 119, 37, + 119, -1, 119, 13, 119, -1, 64, 97, -1, 64, + 97, 99, -1, 64, 97, 99, 98, -1, 64, 97, + 98, -1, 64, 97, 98, 105, -1, 64, 97, 48, + 49, 127, -1, 64, 97, 98, 48, 49, 127, -1, + 64, 97, 48, 108, 49, 127, -1, 64, 97, 98, + 48, 108, 49, 127, -1, 119, 41, 119, 42, 119, + -1, 119, 40, 119, -1, 48, 119, 51, 119, 49, + -1, 48, 119, 51, 119, 51, 119, 49, -1, 48, + 119, 51, 119, 51, 119, 51, 119, 51, 119, 51, + 119, 49, -1, 119, 120, 119, -1, 119, 121, -1, + 13, 119, -1, 12, 119, -1, 119, 13, -1, 119, + 4, 119, -1, 119, 5, 119, -1, 119, 6, 119, + -1, 119, 7, 119, -1, 119, 8, 119, -1, 119, + 9, 119, -1, 61, 46, 83, 47, -1, 12, -1, + 122, -1, 121, 122, -1, 122, 121, -1, 121, 122, + 121, -1, 46, 18, 119, 47, -1, 46, 119, 47, + -1, 46, 119, 51, 119, 47, -1, 46, 119, 51, + 119, 51, 119, 47, -1, 10, -1, 10, 123, 10, + -1, 10, 124, 10, -1, 11, -1, 14, -1, 16, + 119, -1, 16, 119, 45, 119, -1, 16, 17, 119, + -1, 16, 17, 119, 45, 119, -1, 15, 119, -1, + 15, 119, 45, 119, -1, 54, -1, 127, -1, 126, + 54, -1, 65, 48, 119, 49, 125, -1, 65, 48, + 119, 49, 125, 66, 125, -1, 67, 48, 119, 49, + 125, -1, 68, 125, 67, 48, 119, 49, 54, -1, + 69, 48, 128, 54, 129, 54, 130, 49, 125, -1, + 69, 48, 96, 3, 42, 119, 49, 125, -1, 70, + 54, -1, 71, 54, -1, 72, 54, -1, 72, 119, + 54, -1, 119, -1, 104, -1, -1, 131, -1, 95, + -1, -1, 119, -1, -1, 131, -1, 126, -1, 131, + 51, 126, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 177, 177, 181, 182, 187, 188, 193, 194, 198, - 199, 200, 202, 207, 208, 209, 211, 216, 217, 218, - 219, 221, 223, 225, 226, 228, 230, 232, 233, 238, - 240, 244, 245, 250, 251, 255, 257, 261, 262, 267, - 271, 275, 276, 280, 284, 285, 289, 290, 295, 296, - 301, 302, 307, 308, 309, 311, 316, 317, 321, 326, - 327, 329, 331, 336, 337, 338, 342, 344, 349, 350, - 352, 356, 357, 362, 363, 367, 369, 371, 376, 378, - 383, 384, 388, 389, 390, 391, 395, 396, 398, 399, - 401, 402, 405, 409, 410, 412, 414, 416, 420, 421, - 425, 426, 428, 432, 433, 439, 440, 441, 442, 444, - 445, 447, 449, 451, 453, 454, 455, 456, 457, 458, - 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, - 469, 470, 471, 472, 473, 475, 477, 479, 481, 483, - 485, 490, 492, 497, 499, 501, 503, 505, 507, 509, - 515, 517, 520, 522, 523, 525, 526, 527, 528, 530, - 537, 538, 540, 543, 546, 552, 553, 554, 557, 563, - 564, 566, 568, 569, 573, 575, 578, 581, 587, 588, - 593, 594, 595, 596, 598, 600, 602, 604, 606, 608, - 609, 610, 611, 615, 619, 623, 624, 625, 629, 630, - 634, 635, 639, 640 + 0, 177, 177, 181, 182, 187, 188, 193, 194, 195, + 200, 201, 202, 204, 209, 210, 211, 213, 218, 219, + 220, 221, 223, 225, 227, 228, 230, 232, 234, 235, + 240, 242, 246, 247, 252, 253, 257, 259, 263, 264, + 269, 273, 277, 278, 282, 286, 287, 291, 292, 297, + 298, 303, 304, 309, 310, 311, 313, 318, 319, 323, + 328, 329, 331, 333, 338, 339, 340, 344, 346, 351, + 352, 354, 358, 359, 364, 365, 369, 371, 373, 378, + 380, 385, 386, 390, 391, 392, 393, 397, 398, 400, + 401, 403, 404, 407, 411, 412, 414, 416, 418, 422, + 423, 427, 428, 430, 434, 435, 441, 442, 443, 444, + 446, 447, 449, 451, 453, 455, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 477, 479, 481, 483, + 485, 487, 492, 494, 499, 501, 503, 505, 507, 509, + 511, 517, 519, 522, 524, 525, 527, 528, 529, 530, + 532, 539, 540, 542, 545, 548, 554, 555, 556, 559, + 565, 566, 568, 570, 571, 575, 577, 580, 583, 589, + 590, 595, 596, 597, 598, 600, 602, 604, 606, 608, + 610, 611, 612, 613, 617, 621, 625, 626, 627, 631, + 632, 636, 637, 641, 642 }; #endif @@ -736,9 +688,9 @@ static const char *const yytname[] = "$end", "error", "$undefined", "ID", "ADD", "SUBTRACT", "TIMES", "DIVIDE", "MOD", "EXPONENT", "DOTS", "COLONS", "DASHES", "INCR", "LONGDASH", "CONTROLS", "TENSION", "ATLEAST", "CURL", "COR", "CAND", - "BAR", "AMPERSAND", "EQ", "NEQ", "LT", "LE", "GT", "GE", "'+'", "CARETS", + "BAR", "AMPERSAND", "EQ", "NEQ", "LT", "LE", "GT", "GE", "CARETS", "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "LOGNOT", "OPERATOR", "STRING", - "LOOSE", "'?'", "ASSIGN", "':'", "DIRTAG", "JOIN_PREC", "'{'", "AND", + "LOOSE", "ASSIGN", "'?'", "':'", "DIRTAG", "JOIN_PREC", "AND", "'{'", "'}'", "'('", "')'", "'.'", "','", "'['", "']'", "';'", "ELLIPSIS", "ACCESS", "UNRAVEL", "IMPORT", "INCLUDE", "FROM", "QUOTE", "STRUCT", "TYPEDEF", "NEW", "IF", "ELSE", "WHILE", "DO", "FOR", "BREAK", @@ -763,9 +715,9 @@ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 43, - 284, 45, 42, 47, 37, 94, 285, 286, 287, 288, - 63, 289, 58, 290, 291, 123, 292, 125, 40, 41, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 43, 45, 42, 47, 37, 94, 285, 286, 287, 288, + 289, 63, 58, 290, 291, 292, 123, 125, 40, 41, 46, 44, 91, 93, 59, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, @@ -776,53 +728,53 @@ static const yytype_uint16 yytoknum[] = /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 81, 82, 83, 83, 84, 84, 85, 85, 86, - 86, 86, 86, 87, 87, 87, 87, 88, 88, 88, - 88, 88, 88, 88, 88, 88, 88, 88, 88, 89, - 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, - 95, 96, 96, 97, 98, 98, 99, 99, 100, 100, - 101, 101, 102, 102, 102, 102, 103, 103, 104, 105, - 105, 105, 105, 106, 106, 106, 107, 107, 108, 108, - 108, 109, 109, 110, 110, 111, 111, 111, 112, 112, - 113, 113, 114, 114, 114, 114, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 116, 116, - 117, 117, 117, 118, 118, 119, 119, 119, 119, 119, + 0, 81, 82, 83, 83, 84, 84, 85, 85, 85, + 86, 86, 86, 86, 87, 87, 87, 87, 88, 88, + 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, + 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, + 94, 95, 96, 96, 97, 98, 98, 99, 99, 100, + 100, 101, 101, 102, 102, 102, 102, 103, 103, 104, + 105, 105, 105, 105, 106, 106, 106, 107, 107, 108, + 108, 108, 109, 109, 110, 110, 111, 111, 111, 112, + 112, 113, 113, 114, 114, 114, 114, 115, 115, 115, + 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, + 116, 117, 117, 117, 118, 118, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 120, 120, 120, 120, 120, 121, 121, 121, 121, 122, - 122, 122, 122, 122, 123, 123, 123, 123, 124, 124, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 126, 127, 128, 128, 128, 129, 129, - 130, 130, 131, 131 + 119, 120, 120, 120, 120, 120, 121, 121, 121, 121, + 122, 122, 122, 122, 122, 123, 123, 123, 123, 124, + 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 126, 127, 128, 128, 128, 129, + 129, 130, 130, 131, 131 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 0, 2, 0, 2, 1, 3, 1, - 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, - 3, 5, 5, 3, 5, 5, 3, 3, 3, 1, - 3, 1, 3, 1, 1, 1, 3, 1, 3, 2, - 2, 1, 2, 1, 2, 3, 3, 4, 1, 3, - 1, 3, 1, 2, 3, 4, 1, 1, 3, 2, - 4, 3, 5, 1, 1, 2, 1, 3, 1, 3, - 2, 1, 3, 1, 0, 2, 3, 5, 5, 6, - 3, 2, 1, 2, 2, 3, 3, 4, 4, 4, - 4, 3, 4, 3, 4, 3, 3, 1, 1, 3, - 1, 3, 2, 1, 3, 1, 1, 1, 1, 2, - 4, 5, 2, 2, 2, 3, 3, 3, 3, 3, + 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, + 1, 3, 5, 5, 3, 5, 5, 3, 3, 3, + 1, 3, 1, 3, 1, 1, 1, 3, 1, 3, + 2, 2, 1, 2, 1, 2, 3, 3, 4, 1, + 3, 1, 3, 1, 2, 3, 4, 1, 1, 3, + 2, 4, 3, 5, 1, 1, 2, 1, 3, 1, + 3, 2, 1, 3, 1, 0, 2, 3, 5, 5, + 6, 3, 2, 1, 2, 2, 3, 3, 4, 4, + 4, 4, 3, 4, 3, 4, 3, 3, 1, 1, + 3, 1, 3, 2, 1, 3, 1, 1, 1, 1, + 2, 4, 5, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 2, 3, 4, 3, 4, 5, - 6, 6, 7, 5, 3, 5, 7, 13, 3, 2, - 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, - 1, 1, 2, 2, 3, 4, 3, 5, 7, 1, - 3, 3, 1, 1, 2, 4, 3, 5, 2, 4, - 1, 1, 2, 5, 7, 5, 7, 9, 8, 2, - 2, 2, 3, 1, 1, 0, 1, 1, 0, 1, - 0, 1, 1, 3 + 3, 3, 3, 3, 3, 2, 3, 4, 3, 4, + 5, 6, 6, 7, 5, 3, 5, 7, 13, 3, + 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, + 4, 1, 1, 2, 2, 3, 4, 3, 5, 7, + 1, 3, 3, 1, 1, 2, 4, 3, 5, 2, + 4, 1, 1, 2, 5, 7, 5, 7, 9, 8, + 2, 2, 2, 3, 1, 1, 0, 1, 1, 0, + 1, 0, 1, 1, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -830,623 +782,645 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 3, 0, 2, 1, 7, 0, 0, 0, 0, 0, - 108, 5, 0, 180, 0, 0, 0, 0, 0, 0, + 3, 0, 2, 1, 7, 0, 0, 0, 0, 9, + 0, 109, 5, 0, 181, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 97, 107, 14, 13, 105, 4, 0, 9, 17, 0, - 0, 41, 194, 18, 19, 106, 193, 10, 0, 181, - 105, 151, 150, 112, 113, 114, 0, 105, 0, 35, - 33, 0, 37, 0, 0, 0, 0, 0, 7, 0, - 0, 3, 0, 43, 81, 0, 43, 134, 0, 0, - 0, 195, 189, 190, 191, 0, 109, 0, 0, 0, - 42, 16, 15, 11, 12, 39, 52, 40, 48, 50, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, - 172, 160, 152, 173, 0, 0, 0, 0, 0, 0, + 0, 98, 108, 15, 14, 106, 4, 0, 10, 18, + 0, 0, 42, 195, 19, 20, 107, 194, 11, 0, + 182, 106, 152, 151, 113, 114, 115, 0, 106, 0, + 36, 34, 0, 38, 0, 0, 0, 0, 0, 7, + 0, 0, 3, 0, 44, 82, 0, 44, 135, 0, + 0, 0, 196, 190, 191, 192, 0, 110, 0, 0, + 0, 43, 17, 16, 12, 13, 40, 53, 41, 49, + 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 170, 173, 161, 153, 174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 149, 161, 182, 0, - 58, 6, 96, 0, 95, 0, 0, 0, 20, 23, - 26, 27, 28, 0, 0, 0, 80, 0, 52, 74, - 0, 137, 135, 0, 0, 0, 197, 0, 202, 0, - 196, 192, 7, 91, 0, 103, 0, 100, 98, 8, - 82, 44, 0, 0, 0, 74, 53, 0, 0, 93, - 0, 86, 0, 0, 153, 154, 155, 156, 157, 158, - 0, 0, 0, 0, 133, 128, 127, 131, 130, 125, - 126, 121, 122, 123, 124, 115, 129, 116, 117, 118, - 119, 120, 132, 0, 144, 0, 0, 148, 162, 163, - 110, 0, 0, 36, 38, 29, 0, 31, 0, 0, - 0, 159, 74, 0, 74, 73, 0, 68, 0, 71, - 0, 0, 74, 138, 0, 136, 0, 0, 0, 52, - 198, 0, 0, 102, 92, 0, 0, 84, 89, 83, - 87, 45, 54, 0, 49, 51, 57, 56, 94, 90, - 88, 178, 0, 174, 170, 171, 0, 0, 166, 0, - 164, 111, 145, 0, 0, 22, 0, 21, 25, 24, - 54, 0, 139, 70, 0, 74, 74, 75, 46, 59, - 63, 0, 66, 0, 64, 0, 0, 0, 183, 185, - 0, 0, 199, 0, 203, 99, 104, 101, 85, 78, - 55, 0, 176, 0, 143, 165, 0, 0, 30, 32, - 55, 141, 72, 69, 76, 0, 61, 0, 65, 140, - 0, 47, 0, 0, 0, 200, 79, 179, 0, 175, - 167, 0, 146, 0, 0, 60, 0, 67, 142, 184, - 186, 0, 0, 201, 177, 0, 0, 77, 62, 188, - 0, 168, 0, 187, 0, 0, 0, 147 + 0, 0, 0, 0, 0, 0, 0, 150, 162, 183, + 0, 59, 6, 97, 0, 96, 0, 0, 0, 21, + 24, 27, 28, 29, 0, 0, 0, 81, 0, 53, + 75, 0, 138, 136, 0, 0, 0, 198, 0, 203, + 0, 197, 193, 7, 92, 0, 104, 0, 101, 99, + 8, 83, 45, 0, 0, 0, 75, 54, 0, 0, + 94, 0, 87, 0, 0, 154, 155, 156, 157, 158, + 159, 0, 0, 0, 0, 134, 129, 128, 132, 131, + 126, 127, 122, 123, 124, 125, 130, 116, 117, 118, + 119, 120, 121, 133, 145, 0, 0, 0, 149, 163, + 164, 111, 0, 0, 37, 39, 30, 0, 32, 0, + 0, 0, 160, 75, 0, 75, 74, 0, 69, 0, + 72, 0, 0, 75, 139, 0, 137, 0, 0, 0, + 53, 199, 0, 0, 103, 93, 0, 0, 85, 90, + 84, 88, 46, 55, 0, 50, 52, 58, 57, 95, + 91, 89, 179, 0, 175, 171, 172, 0, 0, 167, + 0, 165, 112, 146, 0, 0, 23, 0, 22, 26, + 25, 55, 0, 140, 71, 0, 75, 75, 76, 47, + 60, 64, 0, 67, 0, 65, 0, 0, 0, 184, + 186, 0, 0, 200, 0, 204, 100, 105, 102, 86, + 79, 56, 0, 177, 0, 144, 166, 0, 0, 31, + 33, 56, 142, 73, 70, 77, 0, 62, 0, 66, + 141, 0, 48, 0, 0, 0, 201, 80, 180, 0, + 176, 168, 0, 147, 0, 0, 61, 0, 68, 143, + 185, 187, 0, 0, 202, 178, 0, 0, 78, 63, + 189, 0, 169, 0, 188, 0, 0, 0, 148 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 1, 2, 56, 50, 35, 36, 37, 237, 238, - 61, 62, 63, 38, 39, 40, 41, 186, 162, 97, - 98, 99, 275, 42, 276, 313, 314, 246, 247, 248, - 249, 43, 44, 182, 45, 175, 176, 177, 46, 135, - 136, 137, 202, 203, 47, 48, 49, 169, 323, 372, - 170 + -1, 1, 2, 57, 51, 36, 37, 38, 238, 239, + 62, 63, 64, 39, 40, 41, 42, 187, 163, 98, + 99, 100, 276, 43, 277, 314, 315, 247, 248, 249, + 250, 44, 45, 183, 46, 176, 177, 178, 47, 136, + 137, 138, 203, 204, 48, 49, 50, 170, 324, 373, + 171 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -230 +#define YYPACT_NINF -236 static const yytype_int16 yypact[] = { - -230, 40, 476, -230, -230, 780, 780, 780, 780, 780, - -230, -230, 780, -230, 6, 60, 6, 18, 20, 27, - 76, 60, 60, 46, 83, 202, 96, 91, 113, 647, - -230, 17, -230, -230, 35, -230, 547, -230, -230, 140, - 176, -230, -230, -230, -230, 111, 1972, -230, 148, -230, - 118, 152, 152, 152, 152, -230, 334, 108, 1147, 204, - -230, 205, -230, 92, 38, 155, 156, 157, 162, -8, - 163, -230, 167, 19, -230, 210, 171, 124, 780, 780, - 160, 780, -230, -230, -230, 896, 152, 168, 219, 291, - 172, -230, -230, -230, -230, -230, 125, 174, -230, 187, - 626, 227, 693, 780, 780, 780, 780, 780, 780, 14, - -230, -230, 17, -230, 780, 780, 780, 780, 780, 780, - 780, 780, 780, 780, 780, 780, 780, 780, 780, 780, - 780, 780, 780, 780, 701, 780, -230, 189, -230, 693, - -230, -230, 17, 37, -230, 780, 236, 6, -230, -230, - -230, -230, -230, 15, 16, 405, -230, 190, 126, -22, - 715, 90, 193, 1483, 1529, 194, -230, 245, -230, 197, - 201, -230, 213, -230, 823, -230, 216, 133, 1972, -230, - 780, -230, 206, 947, 209, -14, 172, 210, 758, -230, - 230, -230, 215, 997, 1972, 1972, 1972, 1972, 1972, 1972, - 780, 769, 266, 272, 119, 2086, 2114, 2142, 2170, 2198, - 2198, 2207, 2207, 2207, 2207, 158, 413, 158, 152, 152, - 152, 152, 279, 1930, 1972, 780, 1195, 119, 189, -230, - -230, 780, 1243, -230, -230, 280, 231, -230, 147, 232, - 149, -230, -12, 167, 221, -230, 238, 134, 60, -230, - 1047, 618, -10, -230, 715, 172, 202, 202, 780, 9, - 780, 780, 780, -230, -230, 823, 823, 1972, -230, 780, - -230, -230, 167, 247, -230, -230, -230, 1972, -230, -230, - -230, 1801, 780, 1844, -230, -230, 780, 1713, -230, 780, - -230, -230, -230, 780, 294, -230, 295, -230, -230, -230, - -230, 250, -230, -230, 167, 221, 221, 210, -230, -230, - -230, 758, -230, 12, 249, 167, 252, 1097, 239, -230, - 1575, 780, 1972, 248, -230, 1972, -230, -230, 1972, -230, - 167, 780, 1887, 780, 2050, -230, 1291, 1339, -230, -230, - -230, -230, -230, -230, 274, 260, -230, 758, 758, -230, - 167, -230, 202, 263, 1621, 780, -230, 2014, 780, 2014, - -230, 780, -230, 780, 758, -230, 271, -230, -230, -230, - -230, 202, 270, 201, 2014, 1757, 1387, -230, -230, -230, - 202, -230, 780, -230, 1435, 780, 1667, -230 + -236, 58, 478, -236, -236, 892, 892, 892, 892, -236, + 892, -236, -236, 892, -236, 13, 28, 13, 19, 18, + -3, 25, 28, 28, 31, 46, 620, 84, 12, 118, + 696, -236, 17, -236, -236, 11, -236, 549, -236, -236, + 140, 70, -236, -236, -236, -236, 34, 1957, -236, 147, + -236, 110, 150, 150, 150, 150, -236, 336, 103, 1260, + 156, -236, 202, -236, 113, -10, 164, 171, 172, 174, + -12, 177, -236, 176, 143, -236, 225, 184, 117, 892, + 892, 169, 892, -236, -236, -236, 1009, 150, 239, 232, + 292, 187, -236, -236, -236, -236, -236, 125, 189, -236, + 203, 664, 242, 740, 892, 892, 892, 892, 892, 892, + 72, -236, -236, 17, -236, 892, 892, 892, 892, 892, + 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, + 892, 892, 892, 892, 892, 772, 892, -236, 200, -236, + 740, -236, -236, 17, 105, -236, 892, 245, 13, -236, + -236, -236, -236, -236, 16, 36, 407, -236, 196, 126, + -25, 816, 43, 201, 1596, 1642, 207, -236, 254, -236, + 206, 212, -236, 224, -236, 936, -236, 217, 124, 1957, + -236, 892, -236, 214, 1060, 215, -14, 187, 225, 827, + -236, 222, -236, 219, 1110, 1957, 1957, 1957, 1957, 1957, + 1957, 892, 881, 264, 266, 464, 2203, 2231, 2259, 2287, + 2315, 2315, 948, 948, 948, 948, 416, 112, 112, 150, + 150, 150, 150, 178, 1957, 1914, 892, 1308, 464, 200, + -236, -236, 892, 1356, -236, -236, 276, 226, -236, 149, + 229, 166, -236, 87, 176, 210, -236, 237, 131, 28, + -236, 1160, 168, 94, -236, 816, 187, 620, 620, 892, + -6, 892, 892, 892, -236, -236, 936, 936, 1957, -236, + 892, -236, -236, 176, 241, -236, -236, -236, 1957, -236, + -236, -236, 2000, 892, 2043, -236, -236, 892, 1826, -236, + 892, -236, -236, -236, 892, 288, -236, 289, -236, -236, + -236, -236, 244, -236, -236, 176, 210, 210, 225, -236, + -236, -236, 827, -236, 22, 246, 176, 247, 1210, 233, + -236, 1688, 892, 1957, 248, -236, 1957, -236, -236, 1957, + -236, 176, 892, 2086, 892, 2166, -236, 1404, 1452, -236, + -236, -236, -236, -236, -236, 258, 259, -236, 827, 827, + -236, 176, -236, 620, 255, 1734, 892, -236, 2129, 892, + 2129, -236, 892, -236, 892, 827, -236, 261, -236, -236, + -236, -236, 620, 252, 212, 2129, 1870, 1500, -236, -236, + -236, 620, -236, 892, -236, 1548, 892, 1780, -236 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -230, -230, 254, -230, 10, 265, -230, 287, 34, 177, - 316, -6, -230, 314, 255, -13, 318, -23, -230, -230, - 151, 41, -215, 269, 184, -230, -230, -172, -230, -230, - -229, -230, -230, 259, -230, -160, 257, -230, -5, -230, - -120, 214, -230, -230, -20, -75, -168, -230, -230, -230, - -1 + -236, -236, 238, -236, 10, 256, -236, 274, 21, 159, + 297, -8, -236, 298, 243, -18, 296, -24, -236, -236, + 133, 23, -215, 251, 170, -236, -236, -173, -236, -236, + -235, -236, -236, 234, -236, -160, 235, -236, -5, -236, + -120, 198, -236, -236, -20, -75, -168, -236, -236, -236, + -15 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -44 +#define YYTABLE_NINF -45 static const yytype_int16 yytable[] = { - 51, 52, 53, 54, 55, 80, 168, 58, 75, 59, - 65, 90, 34, 273, 263, 303, 94, 229, 235, 235, - 4, 66, 57, 68, 85, 64, 86, 243, 69, 200, - 201, 73, 76, 244, 143, 272, 312, 300, -43, 315, - 3, 244, 88, 244, 60, 244, 34, 236, 239, 153, - 90, 321, 245, 9, 161, 10, 67, 242, 60, 346, - 245, 157, 245, 4, 245, 12, 34, 347, 167, 88, - 301, 157, 71, 163, 164, 302, 342, 343, 19, 72, - 316, 22, 178, 87, 183, 88, 231, 89, 88, 184, - 30, 34, 149, 31, 78, 178, 345, 193, 194, 195, - 196, 197, 198, 199, 329, 326, 327, 204, 290, 205, + 52, 53, 54, 55, 76, 56, 81, 169, 59, 66, + 304, 91, 35, 274, -44, 264, 60, 95, 230, 236, + 4, 69, 67, 58, 244, 86, 65, 87, 73, 70, + 245, 4, 74, 77, 144, 273, 322, 313, 89, 236, + 89, 245, 243, 72, 150, 154, 158, 35, 237, 246, + 91, 61, 9, 10, 162, 11, 61, 68, 3, 88, + 246, 89, 9, 90, 168, 13, 83, 35, 240, 347, + 302, 343, 344, 97, 164, 165, 303, 348, 20, 79, + 317, 23, 101, 179, 102, 184, 103, 201, 202, 252, + 31, 253, 35, 32, 80, 185, 179, 346, 194, 195, + 196, 197, 198, 199, 200, 330, 327, 328, 205, 291, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 226, - 227, 79, 366, 367, 183, 251, 341, 230, 252, 255, - 232, 234, 184, 147, 81, 82, 148, 349, 124, 377, - 126, 127, 128, 129, 130, 250, 87, 142, 88, 100, - 89, 101, 356, 102, 134, 34, 87, 83, 88, 178, - 139, 172, 159, 185, 242, 267, 160, 157, 157, 96, - 5, 6, 368, 277, 265, 305, 324, 130, 266, 306, - 127, 128, 129, 130, 95, 281, 283, 7, 296, 8, - 296, 297, 138, 299, 9, 4, 10, -34, 146, 150, - 151, 152, 11, 158, 5, 6, 12, 173, -34, 154, - 287, 88, 179, 174, 184, 187, 291, 165, 188, 19, - 191, 7, 22, 8, 134, 307, 318, 319, 9, 233, - 10, 30, 258, 181, 31, 254, 277, 11, 259, 317, - 12, 260, 261, 320, 262, 322, 13, 325, 73, 268, - 178, 178, 271, 19, 328, 264, 22, 23, 279, 24, - 25, 26, 27, 28, 29, 30, 284, 332, 31, 278, - 168, 334, 285, 294, 336, 295, 298, 304, 337, 109, - 110, 111, 112, 113, 4, 245, 330, 338, 235, 340, - 348, 350, 355, 5, 6, 352, 277, 365, 124, 125, - 126, 127, 128, 129, 130, 364, 354, 370, 378, 380, - 7, 141, 8, 93, 134, 155, 357, 9, 359, 10, - 339, 240, 369, 180, 70, 74, 166, 4, 274, 12, - 77, 156, 277, 277, 181, 253, 5, 6, 344, 0, - 228, 379, 19, 374, 373, 22, 375, 190, 376, 277, - 383, 192, 0, 7, 30, 8, 0, 31, 0, 0, - 9, 0, 10, 0, 0, 0, 0, 384, 0, 11, - 386, 140, 12, 0, 0, 0, 0, 0, 13, 0, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 0, 24, 25, 26, 27, 28, 29, 30, 4, 0, - 31, 32, 33, 0, 0, 0, 0, 5, 6, 0, - 0, 0, 0, 109, 110, 111, 112, 113, 0, 0, - 0, 0, 0, 0, 7, 0, 8, 0, 0, 0, - 0, 9, 124, 10, 126, 127, 128, 129, 130, 0, - 11, 0, 241, 12, 0, 0, 0, 0, 134, 13, - 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 0, 24, 25, 26, 27, 28, 29, 30, 4, - 0, 31, 32, 33, 0, 0, 0, 0, 5, 6, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 227, 228, 82, 367, 368, 184, 301, 342, 231, 256, + 235, 233, 245, 316, 128, 129, 130, 131, 350, 245, + 378, 88, 143, 89, 232, 90, 251, 185, 88, -35, + 89, 246, 140, 357, 148, 160, 35, 149, 246, 161, + 179, 4, 84, 186, 243, 266, 268, 158, 158, 267, + 5, 6, 306, 369, 278, 131, 307, 325, 110, 111, + 112, 113, 114, 89, 96, 158, 282, 284, 7, 8, + 297, 139, 9, 298, 10, 147, 11, 125, 126, 127, + 128, 129, 130, 131, 252, 310, 13, 297, 151, 311, + 300, 288, 12, 312, 135, 152, 153, 292, 159, 20, + -35, 308, 23, 155, 89, 180, 166, 319, 320, 185, + 188, 31, 173, 189, 32, 192, 135, 278, 234, 182, + 318, 5, 6, 255, 321, 259, 323, 260, 326, 74, + 261, 179, 179, 262, 263, 329, 265, 269, 272, 7, + 8, 279, 280, 9, 285, 10, 286, 11, 333, 295, + 296, 169, 335, 299, 246, 337, 305, 13, 174, 338, + 331, 339, 236, 341, 175, 4, 351, 349, 365, 353, + 20, 381, 356, 23, 5, 6, 366, 278, 379, 371, + 156, 94, 31, 142, 241, 32, 71, 355, 340, 78, + 75, 275, 7, 8, 157, 167, 9, 358, 10, 360, + 11, 345, 254, 370, 181, 229, 191, 193, 0, 4, + 13, 374, 0, 278, 278, 182, 0, 0, 5, 6, + 0, 0, 380, 20, 375, 0, 23, 376, 0, 377, + 278, 384, 0, 0, 0, 31, 7, 8, 32, 0, + 9, 0, 10, 0, 11, 0, 0, 0, 385, 0, + 0, 387, 12, 141, 13, 0, 0, 0, 0, 0, + 14, 0, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 0, 25, 26, 27, 28, 29, 30, 31, + 4, 0, 32, 33, 34, 0, 0, 0, 0, 5, + 6, 0, 0, 0, 0, 0, 110, 111, 112, 113, + 114, 0, 0, 0, 0, 0, 0, 7, 8, 0, + 0, 9, 0, 10, 0, 11, 126, 127, 128, 129, + 130, 131, 0, 12, 242, 13, 0, 0, 0, 0, + 0, 14, 135, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 0, 25, 26, 27, 28, 29, 30, + 31, 4, 0, 32, 33, 34, 0, 0, 0, 0, + 5, 6, 0, 0, 126, 127, 128, 129, 130, 131, + 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, + 135, 0, 9, 0, 10, 0, 11, 0, 0, 0, + 0, 0, 0, 0, 12, 0, 13, 0, 0, 0, + 0, 0, 14, 0, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 0, 25, 26, 27, 28, 29, + 30, 31, 4, 0, 32, 33, 34, 0, 0, 0, + 0, 5, 6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, + 8, 0, 0, 9, 0, 10, 0, 11, 0, 0, + 0, 0, 0, 0, 0, 12, 0, 13, 0, 0, + 0, 0, 0, 14, 0, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 0, 25, 26, 27, 28, + 29, 30, 31, 4, 0, 32, 92, 93, 0, 0, + 0, 0, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 0, 8, 0, 0, - 0, 0, 9, 0, 10, 0, 0, 0, 0, 0, - 0, 11, 0, 0, 12, 0, 0, 0, 0, 0, - 13, 0, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 0, 24, 25, 26, 27, 28, 29, 30, - 4, 0, 31, 32, 33, 0, 0, 0, 0, 5, - 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 0, 8, 0, - 0, 0, 0, 9, 0, 10, 0, 0, 0, 0, - 0, 0, 11, 0, 0, 12, 0, 0, 0, 0, - 0, 13, 0, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 0, 24, 25, 26, 27, 28, 29, - 30, 4, 0, 31, 91, 92, 0, 0, 0, 172, - 5, 6, 0, 0, 0, 0, 0, 0, 5, 6, - 0, 0, 0, 0, 0, 0, 0, 7, 0, 8, - 4, 0, 0, 0, 9, 7, 10, 8, 0, 5, - 6, 0, 9, 251, 10, 309, 12, 0, 0, 310, - 0, 0, 0, 311, 12, 189, 7, 0, 8, 19, - 0, 174, 22, 9, 0, 10, 0, 19, 0, 0, - 22, 30, 0, 0, 31, 12, 4, 0, 0, 30, - 0, 84, 31, 0, 4, 5, 6, 0, 19, 0, - 0, 22, 0, 5, 6, 0, 0, 0, 4, 225, - 30, 0, 7, 31, 8, 0, 0, 5, 6, 9, - 7, 10, 8, 0, 0, 180, 0, 9, 0, 10, - 0, 12, 0, 0, 7, 0, 8, 0, 0, 12, - 0, 9, 0, 10, 19, 0, 0, 22, 0, 0, - 0, 4, 19, 12, 0, 22, 30, 0, 181, 31, - 5, 6, 4, 0, 30, 0, 19, 31, 0, 22, - 0, 5, 6, 4, 0, 0, 282, 7, 30, 8, - 0, 31, 5, 6, 9, 0, 10, 0, 7, 0, - 8, 0, 0, 251, 0, 9, 12, 10, 0, 7, - 0, 8, 0, 0, 0, 0, 9, 12, 10, 19, - 0, 0, 22, 0, 0, 0, 172, 0, 12, 0, - 19, 30, 0, 22, 31, 5, 6, 0, 0, 0, - 0, 19, 30, 0, 22, 31, 0, 0, 0, 0, - 0, 0, 7, 30, 8, 0, 31, 0, 0, 9, - 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 19, 0, 0, 22, 0, 0, - 0, 0, 0, 0, 0, 0, 30, 0, 0, 31, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 0, 0, 0, 0, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 0, 131, 0, 0, 132, 133, 0, 0, - 0, 134, 0, 0, 0, 0, 0, 0, 0, 0, - 171, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 0, 0, 0, 0, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 0, 131, 0, 0, 132, 133, 269, - 0, 0, 134, 0, 0, 0, 0, 0, 0, 0, - 270, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 0, 0, 0, 0, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 0, 131, 0, 0, 132, 133, 269, - 0, 0, 134, 0, 0, 0, 0, 0, 0, 0, - 280, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 0, 0, 0, 0, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 0, 131, 0, 0, 132, 133, 0, - 0, 0, 134, 0, 0, 0, 0, 0, 0, 0, - 308, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 0, 0, 0, 0, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 0, 131, 0, 0, 132, 133, 0, - 0, 0, 134, 0, 0, 0, 0, 0, 0, 0, - 351, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 0, 0, 0, 0, 114, 115, 116, 117, + 7, 8, 0, 0, 9, 0, 10, 0, 11, 0, + 0, 0, 0, 0, 0, 0, 12, 173, 13, 0, + 0, 0, 0, 0, 14, 0, 5, 6, 0, 0, + 0, 20, 0, 0, 23, 24, 0, 25, 26, 27, + 28, 29, 30, 31, 7, 8, 32, 0, 9, 4, + 10, 0, 11, 0, 0, 0, 0, 0, 5, 6, + 0, 0, 13, 190, 0, 0, 0, 0, 0, 175, + 0, 0, 0, 0, 0, 20, 7, 8, 23, 0, + 9, 0, 10, 0, 11, 0, 0, 31, 0, 0, + 32, 0, 0, 4, 13, 0, 0, 0, 0, 0, + 85, 0, 5, 6, 0, 0, 0, 20, 0, 0, + 23, 0, 0, 0, 0, 0, 0, 0, 0, 31, + 7, 8, 32, 0, 9, 4, 10, 0, 11, 0, + 0, 0, 181, 0, 5, 6, 0, 0, 13, 0, + 226, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 20, 7, 8, 23, 0, 9, 0, 10, 0, + 11, 0, 0, 31, 0, 0, 32, 0, 0, 4, + 13, 0, 0, 0, 0, 0, 0, 0, 5, 6, + 4, 0, 0, 20, 0, 0, 23, 0, 0, 5, + 6, 0, 0, 0, 0, 31, 7, 8, 32, 0, + 9, 0, 10, 0, 11, 0, 0, 7, 8, 0, + 0, 9, 0, 10, 13, 11, 0, 0, 0, 182, + 0, 0, 0, 252, 0, 13, 0, 20, 0, 0, + 23, 0, 0, 0, 4, 0, 0, 0, 20, 31, + 0, 23, 32, 5, 6, 4, 0, 0, 283, 0, + 31, 0, 0, 32, 5, 6, 0, 0, 0, 0, + 0, 7, 8, 0, 0, 9, 0, 10, 0, 11, + 0, 0, 7, 8, 0, 0, 9, 0, 10, 13, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 173, + 13, 0, 20, 0, 0, 23, 0, 0, 5, 6, + 0, 0, 0, 20, 31, 0, 23, 32, 110, 111, + 112, 113, 114, 0, 0, 31, 7, 8, 32, 0, + 9, 0, 10, 0, 11, 0, 0, 125, 126, 127, + 128, 129, 130, 131, 13, 132, 0, 0, 0, 0, + 0, 0, 0, 0, 135, 0, 0, 20, 0, 0, + 23, 0, 0, 0, 0, 0, 0, 0, 0, 31, + 0, 0, 32, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 113, 114, 0, 0, 0, 0, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 0, 132, 0, 0, 133, + 134, 0, 0, 0, 0, 135, 0, 0, 0, 0, + 0, 0, 0, 172, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 0, 0, 0, 0, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 0, 132, 0, 0, + 133, 134, 270, 0, 0, 0, 135, 0, 0, 0, + 0, 0, 0, 271, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 0, 0, 0, 0, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 0, 132, 0, 0, + 133, 134, 270, 0, 0, 0, 135, 0, 0, 0, + 0, 0, 0, 281, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 0, 0, 0, 0, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 0, 132, 0, 0, + 133, 134, 0, 0, 0, 0, 135, 0, 0, 0, + 0, 0, 0, 309, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 0, 0, 0, 0, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 0, 132, 0, 0, + 133, 134, 0, 0, 0, 0, 135, 0, 0, 0, + 0, 0, 0, 352, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 0, 0, 0, 0, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 0, 132, 0, 0, + 133, 134, 0, 0, 0, 0, 135, 0, 0, 145, + 0, 146, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 0, 0, 0, 0, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 0, 131, 0, 0, 132, 133, 0, - 0, 0, 134, 0, 0, 0, 144, 0, 145, 103, + 128, 129, 130, 131, 0, 132, 0, 0, 133, 134, + 0, 0, 0, 0, 135, 289, 0, 0, 0, 290, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 0, 0, 0, 0, 114, 115, 116, 117, 118, 119, + 114, 0, 0, 0, 0, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 0, 131, 0, 0, 132, 133, 0, 0, 0, - 134, 0, 288, 0, 0, 0, 289, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 0, 0, - 0, 0, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 0, - 131, 0, 0, 132, 133, 0, 0, 0, 134, 0, - 0, 0, 292, 0, 293, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 0, 0, 0, 0, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 0, 131, 0, - 0, 132, 133, 0, 0, 0, 134, 0, 360, 0, - 0, 0, 361, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 0, 0, 0, 0, 114, 115, + 130, 131, 0, 132, 0, 0, 133, 134, 0, 0, + 0, 0, 135, 0, 0, 293, 0, 294, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 0, + 0, 0, 0, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 0, 132, 0, 0, 133, 134, 0, 0, 0, 0, + 135, 361, 0, 0, 0, 362, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 0, 0, 0, + 0, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 0, 132, + 0, 0, 133, 134, 0, 0, 0, 0, 135, 0, + 0, 363, 0, 364, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 0, 0, 0, 0, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 0, 131, 0, 0, 132, - 133, 0, 0, 0, 134, 0, 0, 0, 362, 0, - 363, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 0, 0, 0, 0, 114, 115, 116, 117, + 126, 127, 128, 129, 130, 131, 0, 132, 0, 0, + 133, 134, 0, 0, 0, 0, 135, 0, 0, 0, + 0, 383, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 0, 0, 0, 0, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 0, 131, 0, 0, 132, 133, 0, - 0, 0, 134, 0, 0, 0, 0, 0, 382, 103, + 128, 129, 130, 131, 0, 132, 0, 0, 133, 134, + 0, 0, 0, 0, 135, 0, 0, 0, 0, 386, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 0, 0, 0, 0, 114, 115, 116, 117, 118, 119, + 114, 0, 0, 0, 0, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 0, 131, 0, 0, 132, 133, 0, 0, 0, - 134, 0, 0, 0, 0, 0, 385, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 0, 0, - 0, 0, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 0, - 131, 0, 0, 132, 133, 0, 0, 0, 134, 0, - 0, 0, 256, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 0, 0, 0, 0, 114, 115, + 130, 131, 0, 132, 0, 0, 133, 134, 0, 0, + 0, 0, 135, 0, 0, 257, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 0, 0, 0, + 0, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 0, 132, + 0, 0, 133, 134, 0, 0, 0, 0, 135, 0, + 0, 258, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 0, 0, 0, 0, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 0, 132, 0, 0, 133, 134, + 0, 0, 0, 0, 135, 0, 0, 354, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 0, + 0, 0, 0, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 0, 132, 0, 0, 133, 134, 0, 0, 0, 0, + 135, 0, 0, 372, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 0, 0, 0, 0, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 0, 131, 0, 0, 132, - 133, 0, 0, 0, 134, 0, 0, 0, 257, 103, + 126, 127, 128, 129, 130, 131, 0, 132, 0, 0, + 133, 134, 0, 0, 0, 0, 135, 0, 0, 388, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 0, 0, 0, 0, 114, 115, 116, 117, 118, 119, + 114, 0, 0, 0, 0, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 0, 131, 0, 0, 132, 133, 0, 0, 0, - 134, 0, 0, 0, 353, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 0, 0, 0, 0, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 0, 131, 0, - 0, 132, 133, 0, 0, 0, 134, 0, 0, 0, - 371, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 0, 0, 0, 0, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 0, 131, 0, 0, 132, 133, 0, - 0, 0, 134, 0, 0, 0, 387, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 0, 0, - 0, 0, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 0, - 131, 0, 0, 132, 133, 0, 0, 0, 134, 0, - 335, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 0, 0, 0, 0, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 0, 131, 0, 0, 132, 133, 0, - 0, 0, 134, 0, 381, 103, 104, 105, 106, 107, - 108, 0, 110, 111, 112, 113, 0, 0, 0, 0, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 0, 131, 0, - 0, 132, 133, 0, 0, 0, 134, 331, 103, 104, - 105, 106, 107, 108, 0, 110, 111, 112, 113, 0, - 0, 0, 0, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 0, 131, 0, 0, 132, 133, 0, 0, 0, 134, - 333, 103, 104, 105, 106, 107, 108, 0, 110, 111, - 112, 113, 0, 0, 0, 0, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 0, 131, 0, 0, 132, 133, 0, - 0, 0, 134, 358, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 0, 0, 0, 0, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 0, 131, 0, 0, - 132, 133, 286, 0, 0, 134, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 0, 0, 0, - 0, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 0, 131, - 0, 0, 132, 133, 0, 0, 0, 134, 103, 104, - 105, 106, 107, 108, 0, 110, 111, 112, 113, 0, - 0, 0, 0, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 0, 131, 0, 0, 132, 133, 0, 0, 0, 134, - 109, 110, 111, 112, 113, 0, 0, 0, 0, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 0, 131, 0, 0, - 132, 0, 0, 0, 0, 134, 109, 110, 111, 112, - 113, 0, 0, 0, 0, 0, 115, 116, 117, 118, + 130, 131, 0, 132, 0, 0, 133, 134, 0, 0, + 0, 0, 135, 336, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 0, 0, 0, 0, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 0, 132, 0, 0, + 133, 134, 0, 0, 0, 0, 135, 382, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 0, + 0, 0, 0, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 0, 132, 0, 0, 133, 134, 287, 0, 0, 0, + 135, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 0, 0, 0, 0, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 0, 131, 109, 110, 111, 112, 113, 0, - 0, 134, 0, 0, 0, 116, 117, 118, 119, 120, + 129, 130, 131, 0, 132, 0, 0, 133, 134, 0, + 0, 0, 0, 135, 104, 105, 106, 107, 108, 109, + 0, 111, 112, 113, 114, 0, 0, 0, 0, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 0, 132, 0, 0, + 133, 134, 0, 0, 0, 332, 135, 104, 105, 106, + 107, 108, 109, 0, 111, 112, 113, 114, 0, 0, + 0, 0, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 0, + 132, 0, 0, 133, 134, 0, 0, 0, 334, 135, + 104, 105, 106, 107, 108, 109, 0, 111, 112, 113, + 114, 0, 0, 0, 0, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 0, 132, 0, 0, 133, 134, 0, 0, + 0, 359, 135, 104, 105, 106, 107, 108, 109, 0, + 111, 112, 113, 114, 0, 0, 0, 0, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 0, 132, 0, 0, 133, + 134, 0, 0, 0, 0, 135, 110, 111, 112, 113, + 114, 0, 0, 0, 0, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 0, 132, 0, 0, 0, 134, 0, 0, + 0, 0, 135, 110, 111, 112, 113, 114, 0, 0, + 0, 0, 0, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 0, + 132, 110, 111, 112, 113, 114, 0, 0, 0, 135, + 0, 0, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 0, 132, 110, + 111, 112, 113, 114, 0, 0, 0, 135, 0, 0, + 0, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 0, 132, 110, 111, 112, + 113, 114, 0, 0, 0, 135, 0, 0, 0, 0, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 0, 132, 110, 111, 112, 113, 114, + 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 0, 131, 109, 110, 111, 112, 113, 0, 0, 134, - 0, 0, 0, 0, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 0, 131, - 109, 110, 111, 112, 113, 0, 0, 134, 0, 0, - 0, 0, 0, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 0, 131, 109, 110, - 111, 112, 113, 0, 0, 134, 0, 109, 110, 111, - 112, 113, 0, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 0, 131, 124, 125, 126, 127, - 128, 129, 130, 134, 131, 0, 0, 0, 0, 0, - 0, 0, 134 + 131, 0, 132, 0, 0, 0, 0, 0, 0, 0, + 0, 135 }; static const yytype_int16 yycheck[] = { - 5, 6, 7, 8, 9, 25, 81, 12, 21, 3, - 16, 34, 2, 185, 174, 244, 36, 137, 3, 3, - 3, 3, 12, 3, 29, 15, 31, 49, 18, 15, - 16, 21, 22, 55, 57, 49, 251, 49, 3, 49, - 0, 55, 50, 55, 38, 55, 36, 32, 32, 57, - 73, 42, 74, 36, 77, 38, 38, 48, 38, 47, - 74, 52, 74, 3, 74, 48, 56, 55, 81, 50, - 242, 52, 45, 78, 79, 243, 305, 306, 61, 3, - 252, 64, 87, 48, 89, 50, 49, 52, 50, 52, - 73, 81, 54, 76, 48, 100, 311, 102, 103, 104, - 105, 106, 107, 108, 272, 265, 266, 112, 228, 114, + 5, 6, 7, 8, 22, 10, 26, 82, 13, 17, + 245, 35, 2, 186, 3, 175, 3, 37, 138, 3, + 3, 3, 3, 13, 49, 30, 16, 32, 3, 19, + 55, 3, 22, 23, 58, 49, 42, 252, 50, 3, + 50, 55, 48, 46, 54, 57, 52, 37, 32, 74, + 74, 38, 34, 36, 78, 38, 38, 38, 0, 48, + 74, 50, 34, 52, 82, 48, 54, 57, 32, 47, + 243, 306, 307, 3, 79, 80, 244, 55, 61, 48, + 253, 64, 48, 88, 50, 90, 52, 15, 16, 46, + 73, 48, 82, 76, 48, 52, 101, 312, 103, 104, + 105, 106, 107, 108, 109, 273, 266, 267, 113, 229, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 48, 347, 348, 139, 45, 304, 142, 48, 162, - 145, 147, 52, 51, 48, 54, 54, 315, 29, 364, - 31, 32, 33, 34, 35, 160, 48, 49, 50, 48, - 52, 50, 330, 52, 45, 155, 48, 54, 50, 174, - 52, 3, 48, 48, 48, 180, 52, 52, 52, 3, - 12, 13, 350, 188, 51, 51, 261, 35, 55, 55, - 32, 33, 34, 35, 54, 200, 201, 29, 51, 31, - 51, 54, 54, 54, 36, 3, 38, 3, 3, 54, - 54, 54, 45, 3, 12, 13, 48, 49, 56, 56, - 225, 50, 3, 55, 52, 51, 231, 67, 41, 61, - 3, 29, 64, 31, 45, 248, 256, 257, 36, 3, - 38, 73, 48, 53, 76, 52, 251, 45, 3, 254, - 48, 54, 51, 258, 41, 260, 54, 262, 248, 53, - 265, 266, 53, 61, 269, 49, 64, 65, 53, 67, - 68, 69, 70, 71, 72, 73, 10, 282, 76, 49, - 355, 286, 10, 3, 289, 54, 54, 49, 293, 10, - 11, 12, 13, 14, 3, 74, 49, 3, 3, 49, - 51, 49, 54, 12, 13, 66, 311, 47, 29, 30, - 31, 32, 33, 34, 35, 41, 321, 54, 47, 49, - 29, 56, 31, 36, 45, 71, 331, 36, 333, 38, - 296, 154, 352, 42, 18, 21, 81, 3, 187, 48, - 22, 72, 347, 348, 53, 161, 12, 13, 307, -1, - 136, 371, 61, 358, 355, 64, 361, 100, 363, 364, - 380, 102, -1, 29, 73, 31, -1, 76, -1, -1, - 36, -1, 38, -1, -1, -1, -1, 382, -1, 45, - 385, 47, 48, -1, -1, -1, -1, -1, 54, -1, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - -1, 67, 68, 69, 70, 71, 72, 73, 3, -1, - 76, 77, 78, -1, -1, -1, -1, 12, 13, -1, - -1, -1, -1, 10, 11, 12, 13, 14, -1, -1, - -1, -1, -1, -1, 29, -1, 31, -1, -1, -1, - -1, 36, 29, 38, 31, 32, 33, 34, 35, -1, - 45, -1, 47, 48, -1, -1, -1, -1, 45, 54, - -1, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, -1, 67, 68, 69, 70, 71, 72, 73, 3, - -1, 76, 77, 78, -1, -1, -1, -1, 12, 13, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 29, -1, 31, -1, -1, - -1, -1, 36, -1, 38, -1, -1, -1, -1, -1, - -1, 45, -1, -1, 48, -1, -1, -1, -1, -1, + 135, 136, 48, 348, 349, 140, 49, 305, 143, 163, + 148, 146, 55, 49, 32, 33, 34, 35, 316, 55, + 365, 48, 49, 50, 49, 52, 161, 52, 48, 3, + 50, 74, 52, 331, 51, 48, 156, 54, 74, 52, + 175, 3, 54, 48, 48, 51, 181, 52, 52, 55, + 12, 13, 51, 351, 189, 35, 55, 262, 10, 11, + 12, 13, 14, 50, 54, 52, 201, 202, 30, 31, + 51, 54, 34, 54, 36, 3, 38, 29, 30, 31, + 32, 33, 34, 35, 46, 47, 48, 51, 54, 51, + 54, 226, 46, 55, 46, 54, 54, 232, 3, 61, + 56, 249, 64, 56, 50, 3, 67, 257, 258, 52, + 51, 73, 3, 40, 76, 3, 46, 252, 3, 53, + 255, 12, 13, 52, 259, 48, 261, 3, 263, 249, + 54, 266, 267, 51, 40, 270, 49, 53, 53, 30, + 31, 49, 53, 34, 10, 36, 10, 38, 283, 3, + 54, 356, 287, 54, 74, 290, 49, 48, 49, 294, + 49, 3, 3, 49, 55, 3, 49, 51, 40, 66, + 61, 49, 54, 64, 12, 13, 47, 312, 47, 54, + 72, 37, 73, 57, 155, 76, 19, 322, 297, 23, + 22, 188, 30, 31, 73, 82, 34, 332, 36, 334, + 38, 308, 162, 353, 42, 137, 101, 103, -1, 3, + 48, 356, -1, 348, 349, 53, -1, -1, 12, 13, + -1, -1, 372, 61, 359, -1, 64, 362, -1, 364, + 365, 381, -1, -1, -1, 73, 30, 31, 76, -1, + 34, -1, 36, -1, 38, -1, -1, -1, 383, -1, + -1, 386, 46, 47, 48, -1, -1, -1, -1, -1, 54, -1, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, -1, 67, 68, 69, 70, 71, 72, 73, 3, -1, 76, 77, 78, -1, -1, -1, -1, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 29, -1, 31, -1, - -1, -1, -1, 36, -1, 38, -1, -1, -1, -1, - -1, -1, 45, -1, -1, 48, -1, -1, -1, -1, - -1, 54, -1, 56, 57, 58, 59, 60, 61, 62, + 13, -1, -1, -1, -1, -1, 10, 11, 12, 13, + 14, -1, -1, -1, -1, -1, -1, 30, 31, -1, + -1, 34, -1, 36, -1, 38, 30, 31, 32, 33, + 34, 35, -1, 46, 47, 48, -1, -1, -1, -1, + -1, 54, 46, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, -1, 67, 68, 69, 70, 71, 72, - 73, 3, -1, 76, 77, 78, -1, -1, -1, 3, - 12, 13, -1, -1, -1, -1, -1, -1, 12, 13, - -1, -1, -1, -1, -1, -1, -1, 29, -1, 31, - 3, -1, -1, -1, 36, 29, 38, 31, -1, 12, - 13, -1, 36, 45, 38, 47, 48, -1, -1, 51, - -1, -1, -1, 55, 48, 49, 29, -1, 31, 61, - -1, 55, 64, 36, -1, 38, -1, 61, -1, -1, - 64, 73, -1, -1, 76, 48, 3, -1, -1, 73, - -1, 54, 76, -1, 3, 12, 13, -1, 61, -1, - -1, 64, -1, 12, 13, -1, -1, -1, 3, 18, - 73, -1, 29, 76, 31, -1, -1, 12, 13, 36, - 29, 38, 31, -1, -1, 42, -1, 36, -1, 38, - -1, 48, -1, -1, 29, -1, 31, -1, -1, 48, - -1, 36, -1, 38, 61, -1, -1, 64, -1, -1, - -1, 3, 61, 48, -1, 64, 73, -1, 53, 76, - 12, 13, 3, -1, 73, -1, 61, 76, -1, 64, - -1, 12, 13, 3, -1, -1, 17, 29, 73, 31, - -1, 76, 12, 13, 36, -1, 38, -1, 29, -1, - 31, -1, -1, 45, -1, 36, 48, 38, -1, 29, - -1, 31, -1, -1, -1, -1, 36, 48, 38, 61, - -1, -1, 64, -1, -1, -1, 3, -1, 48, -1, - 61, 73, -1, 64, 76, 12, 13, -1, -1, -1, - -1, 61, 73, -1, 64, 76, -1, -1, -1, -1, - -1, -1, 29, 73, 31, -1, 76, -1, -1, 36, - -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 61, -1, -1, 64, -1, -1, - -1, -1, -1, -1, -1, -1, 73, -1, -1, 76, + 73, 3, -1, 76, 77, 78, -1, -1, -1, -1, + 12, 13, -1, -1, 30, 31, 32, 33, 34, 35, + -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, + 46, -1, 34, -1, 36, -1, 38, -1, -1, -1, + -1, -1, -1, -1, 46, -1, 48, -1, -1, -1, + -1, -1, 54, -1, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, -1, 67, 68, 69, 70, 71, + 72, 73, 3, -1, 76, 77, 78, -1, -1, -1, + -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, + 31, -1, -1, 34, -1, 36, -1, 38, -1, -1, + -1, -1, -1, -1, -1, 46, -1, 48, -1, -1, + -1, -1, -1, 54, -1, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, -1, 67, 68, 69, 70, + 71, 72, 73, 3, -1, 76, 77, 78, -1, -1, + -1, -1, 12, 13, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 30, 31, -1, -1, 34, -1, 36, -1, 38, -1, + -1, -1, -1, -1, -1, -1, 46, 3, 48, -1, + -1, -1, -1, -1, 54, -1, 12, 13, -1, -1, + -1, 61, -1, -1, 64, 65, -1, 67, 68, 69, + 70, 71, 72, 73, 30, 31, 76, -1, 34, 3, + 36, -1, 38, -1, -1, -1, -1, -1, 12, 13, + -1, -1, 48, 49, -1, -1, -1, -1, -1, 55, + -1, -1, -1, -1, -1, 61, 30, 31, 64, -1, + 34, -1, 36, -1, 38, -1, -1, 73, -1, -1, + 76, -1, -1, 3, 48, -1, -1, -1, -1, -1, + 54, -1, 12, 13, -1, -1, -1, 61, -1, -1, + 64, -1, -1, -1, -1, -1, -1, -1, -1, 73, + 30, 31, 76, -1, 34, 3, 36, -1, 38, -1, + -1, -1, 42, -1, 12, 13, -1, -1, 48, -1, + 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 61, 30, 31, 64, -1, 34, -1, 36, -1, + 38, -1, -1, 73, -1, -1, 76, -1, -1, 3, + 48, -1, -1, -1, -1, -1, -1, -1, 12, 13, + 3, -1, -1, 61, -1, -1, 64, -1, -1, 12, + 13, -1, -1, -1, -1, 73, 30, 31, 76, -1, + 34, -1, 36, -1, 38, -1, -1, 30, 31, -1, + -1, 34, -1, 36, 48, 38, -1, -1, -1, 53, + -1, -1, -1, 46, -1, 48, -1, 61, -1, -1, + 64, -1, -1, -1, 3, -1, -1, -1, 61, 73, + -1, 64, 76, 12, 13, 3, -1, -1, 17, -1, + 73, -1, -1, 76, 12, 13, -1, -1, -1, -1, + -1, 30, 31, -1, -1, 34, -1, 36, -1, 38, + -1, -1, 30, 31, -1, -1, 34, -1, 36, 48, + 38, -1, -1, -1, -1, -1, -1, -1, -1, 3, + 48, -1, 61, -1, -1, 64, -1, -1, 12, 13, + -1, -1, -1, 61, 73, -1, 64, 76, 10, 11, + 12, 13, 14, -1, -1, 73, 30, 31, 76, -1, + 34, -1, 36, -1, 38, -1, -1, 29, 30, 31, + 32, 33, 34, 35, 48, 37, -1, -1, -1, -1, + -1, -1, -1, -1, 46, -1, -1, 61, -1, -1, + 64, -1, -1, -1, -1, -1, -1, -1, -1, 73, + -1, -1, 76, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, -1, -1, -1, -1, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, -1, 37, -1, -1, 40, + 41, -1, -1, -1, -1, 46, -1, -1, -1, -1, + -1, -1, -1, 54, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, -1, 37, -1, -1, + 40, 41, 42, -1, -1, -1, 46, -1, -1, -1, + -1, -1, -1, 53, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, -1, 37, -1, -1, + 40, 41, 42, -1, -1, -1, 46, -1, -1, -1, + -1, -1, -1, 53, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, -1, 37, -1, -1, + 40, 41, -1, -1, -1, -1, 46, -1, -1, -1, + -1, -1, -1, 53, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, -1, 37, -1, -1, + 40, 41, -1, -1, -1, -1, 46, -1, -1, -1, + -1, -1, -1, 53, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, -1, 37, -1, -1, + 40, 41, -1, -1, -1, -1, 46, -1, -1, 49, + -1, 51, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, -1, -1, -1, -1, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, -1, 37, -1, -1, 40, 41, + -1, -1, -1, -1, 46, 47, -1, -1, -1, 51, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, -1, 40, 41, -1, -1, - -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, - 54, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, -1, 40, 41, 42, - -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, - 53, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, -1, 40, 41, 42, - -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, - 53, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, -1, 40, 41, -1, - -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, - 53, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, -1, 40, 41, -1, - -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, - 53, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, -1, 40, 41, -1, - -1, -1, 45, -1, -1, -1, 49, -1, 51, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, -1, 37, -1, -1, 40, 41, -1, -1, -1, - 45, -1, 47, -1, -1, -1, 51, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, - -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, - 37, -1, -1, 40, 41, -1, -1, -1, 45, -1, - -1, -1, 49, -1, 51, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, - -1, 40, 41, -1, -1, -1, 45, -1, 47, -1, - -1, -1, 51, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, -1, -1, -1, -1, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, -1, 37, -1, -1, 40, - 41, -1, -1, -1, 45, -1, -1, -1, 49, -1, - 51, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, -1, 40, 41, -1, - -1, -1, 45, -1, -1, -1, -1, -1, 51, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, -1, 37, -1, -1, 40, 41, -1, -1, -1, - 45, -1, -1, -1, -1, -1, 51, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, - -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, - 37, -1, -1, 40, 41, -1, -1, -1, 45, -1, - -1, -1, 49, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, -1, -1, -1, -1, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, -1, 37, -1, -1, 40, - 41, -1, -1, -1, 45, -1, -1, -1, 49, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, -1, 37, -1, -1, 40, 41, -1, -1, -1, - 45, -1, -1, -1, 49, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, - -1, 40, 41, -1, -1, -1, 45, -1, -1, -1, - 49, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, -1, 40, 41, -1, - -1, -1, 45, -1, -1, -1, 49, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, - -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, - 37, -1, -1, 40, 41, -1, -1, -1, 45, -1, - 47, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, -1, 40, 41, -1, - -1, -1, 45, -1, 47, 4, 5, 6, 7, 8, - 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, - -1, 40, 41, -1, -1, -1, 45, 46, 4, 5, - 6, 7, 8, 9, -1, 11, 12, 13, 14, -1, + -1, -1, 46, -1, -1, 49, -1, 51, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - -1, 37, -1, -1, 40, 41, -1, -1, -1, 45, - 46, 4, 5, 6, 7, 8, 9, -1, 11, 12, - 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, -1, 40, 41, -1, - -1, -1, 45, 46, 4, 5, 6, 7, 8, 9, + -1, 37, -1, -1, 40, 41, -1, -1, -1, -1, + 46, 47, -1, -1, -1, 51, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, + -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, + -1, -1, 40, 41, -1, -1, -1, -1, 46, -1, + -1, 49, -1, 51, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, -1, - 40, 41, 42, -1, -1, 45, 4, 5, 6, 7, + 40, 41, -1, -1, -1, -1, 46, -1, -1, -1, + -1, 51, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, -1, -1, -1, -1, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, -1, 37, -1, -1, 40, 41, + -1, -1, -1, -1, 46, -1, -1, -1, -1, 51, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, -1, 37, -1, -1, 40, 41, -1, -1, + -1, -1, 46, -1, -1, 49, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, - -1, -1, 40, 41, -1, -1, -1, 45, 4, 5, - 6, 7, 8, 9, -1, 11, 12, 13, 14, -1, + -1, -1, 40, 41, -1, -1, -1, -1, 46, -1, + -1, 49, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, -1, -1, -1, -1, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, -1, 37, -1, -1, 40, 41, + -1, -1, -1, -1, 46, -1, -1, 49, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - -1, 37, -1, -1, 40, 41, -1, -1, -1, 45, + -1, 37, -1, -1, 40, 41, -1, -1, -1, -1, + 46, -1, -1, 49, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, -1, - 40, -1, -1, -1, -1, 45, 10, 11, 12, 13, - 14, -1, -1, -1, -1, -1, 20, 21, 22, 23, + 40, 41, -1, -1, -1, -1, 46, -1, -1, 49, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, -1, 37, 10, 11, 12, 13, 14, -1, - -1, 45, -1, -1, -1, 21, 22, 23, 24, 25, + 34, 35, -1, 37, -1, -1, 40, 41, -1, -1, + -1, -1, 46, 47, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, -1, 37, -1, -1, + 40, 41, -1, -1, -1, -1, 46, 47, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, + -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - -1, 37, 10, 11, 12, 13, 14, -1, -1, 45, - -1, -1, -1, -1, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, - 10, 11, 12, 13, 14, -1, -1, 45, -1, -1, - -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, -1, 37, 10, 11, - 12, 13, 14, -1, -1, 45, -1, 10, 11, 12, - 13, 14, -1, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, -1, 37, 29, 30, 31, 32, - 33, 34, 35, 45, 37, -1, -1, -1, -1, -1, - -1, -1, 45 + -1, 37, -1, -1, 40, 41, 42, -1, -1, -1, + 46, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, -1, -1, -1, -1, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, -1, 37, -1, -1, 40, 41, -1, + -1, -1, -1, 46, 4, 5, 6, 7, 8, 9, + -1, 11, 12, 13, 14, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, -1, 37, -1, -1, + 40, 41, -1, -1, -1, 45, 46, 4, 5, 6, + 7, 8, 9, -1, 11, 12, 13, 14, -1, -1, + -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, + 37, -1, -1, 40, 41, -1, -1, -1, 45, 46, + 4, 5, 6, 7, 8, 9, -1, 11, 12, 13, + 14, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, -1, 37, -1, -1, 40, 41, -1, -1, + -1, 45, 46, 4, 5, 6, 7, 8, 9, -1, + 11, 12, 13, 14, -1, -1, -1, -1, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, -1, 37, -1, -1, 40, + 41, -1, -1, -1, -1, 46, 10, 11, 12, 13, + 14, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, -1, 37, -1, -1, -1, 41, -1, -1, + -1, -1, 46, 10, 11, 12, 13, 14, -1, -1, + -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, + 37, 10, 11, 12, 13, 14, -1, -1, -1, 46, + -1, -1, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, -1, 37, 10, + 11, 12, 13, 14, -1, -1, -1, 46, -1, -1, + -1, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, -1, 37, 10, 11, 12, + 13, 14, -1, -1, -1, 46, -1, -1, -1, -1, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, -1, 37, 10, 11, 12, 13, 14, + -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, -1, 37, -1, -1, -1, -1, -1, -1, -1, + -1, 46 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 82, 83, 0, 3, 12, 13, 29, 31, 36, - 38, 45, 48, 54, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, - 73, 76, 77, 78, 85, 86, 87, 88, 94, 95, - 96, 97, 104, 112, 113, 115, 119, 125, 126, 127, - 85, 119, 119, 119, 119, 119, 84, 85, 119, 3, - 38, 91, 92, 93, 85, 92, 3, 38, 3, 85, - 91, 45, 3, 85, 94, 96, 85, 97, 48, 48, - 125, 48, 54, 54, 54, 119, 119, 48, 50, 52, - 98, 77, 78, 88, 125, 54, 3, 100, 101, 102, - 48, 50, 52, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 37, 40, 41, 45, 120, 121, 122, 54, 52, - 47, 86, 49, 98, 49, 51, 3, 51, 54, 54, - 54, 54, 54, 57, 56, 83, 104, 52, 3, 48, - 52, 98, 99, 119, 119, 67, 95, 96, 126, 128, - 131, 54, 3, 49, 55, 116, 117, 118, 119, 3, - 42, 53, 114, 119, 52, 48, 98, 51, 41, 49, - 117, 3, 114, 119, 119, 119, 119, 119, 119, 119, - 15, 16, 123, 124, 119, 119, 119, 119, 119, 119, + 0, 82, 83, 0, 3, 12, 13, 30, 31, 34, + 36, 38, 46, 48, 54, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, + 72, 73, 76, 77, 78, 85, 86, 87, 88, 94, + 95, 96, 97, 104, 112, 113, 115, 119, 125, 126, + 127, 85, 119, 119, 119, 119, 119, 84, 85, 119, + 3, 38, 91, 92, 93, 85, 92, 3, 38, 3, + 85, 91, 46, 3, 85, 94, 96, 85, 97, 48, + 48, 125, 48, 54, 54, 54, 119, 119, 48, 50, + 52, 98, 77, 78, 88, 125, 54, 3, 100, 101, + 102, 48, 50, 52, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 37, 40, 41, 46, 120, 121, 122, 54, + 52, 47, 86, 49, 98, 49, 51, 3, 51, 54, + 54, 54, 54, 54, 57, 56, 83, 104, 52, 3, + 48, 52, 98, 99, 119, 119, 67, 95, 96, 126, + 128, 131, 54, 3, 49, 55, 116, 117, 118, 119, + 3, 42, 53, 114, 119, 52, 48, 98, 51, 40, + 49, 117, 3, 114, 119, 119, 119, 119, 119, 119, + 119, 15, 16, 123, 124, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 18, 119, 119, 122, 121, - 119, 49, 119, 3, 92, 3, 32, 89, 90, 32, - 90, 47, 48, 49, 55, 74, 108, 109, 110, 111, - 119, 45, 48, 105, 52, 98, 49, 49, 48, 3, - 54, 51, 41, 116, 49, 51, 55, 119, 53, 42, - 53, 53, 49, 108, 101, 103, 105, 119, 49, 53, - 53, 119, 17, 119, 10, 10, 42, 119, 47, 51, - 121, 119, 49, 51, 3, 54, 51, 54, 54, 54, - 49, 108, 127, 111, 49, 51, 55, 96, 53, 47, - 51, 55, 103, 106, 107, 49, 108, 119, 125, 125, - 119, 42, 119, 129, 126, 119, 116, 116, 119, 127, - 49, 46, 119, 46, 119, 47, 119, 119, 3, 89, - 49, 127, 111, 111, 102, 103, 47, 55, 51, 127, - 49, 53, 66, 49, 119, 54, 127, 119, 46, 119, - 47, 51, 49, 51, 41, 47, 103, 103, 127, 125, - 54, 49, 130, 131, 119, 119, 119, 103, 47, 125, - 49, 47, 51, 125, 119, 51, 119, 49 + 119, 119, 119, 119, 119, 119, 18, 119, 119, 122, + 121, 119, 49, 119, 3, 92, 3, 32, 89, 90, + 32, 90, 47, 48, 49, 55, 74, 108, 109, 110, + 111, 119, 46, 48, 105, 52, 98, 49, 49, 48, + 3, 54, 51, 40, 116, 49, 51, 55, 119, 53, + 42, 53, 53, 49, 108, 101, 103, 105, 119, 49, + 53, 53, 119, 17, 119, 10, 10, 42, 119, 47, + 51, 121, 119, 49, 51, 3, 54, 51, 54, 54, + 54, 49, 108, 127, 111, 49, 51, 55, 96, 53, + 47, 51, 55, 103, 106, 107, 49, 108, 119, 125, + 125, 119, 42, 119, 129, 126, 119, 116, 116, 119, + 127, 49, 45, 119, 45, 119, 47, 119, 119, 3, + 89, 49, 127, 111, 111, 102, 103, 47, 55, 51, + 127, 49, 53, 66, 49, 119, 54, 127, 119, 45, + 119, 47, 51, 49, 51, 40, 47, 103, 103, 127, + 125, 54, 49, 130, 131, 119, 119, 119, 103, 47, + 125, 49, 47, 51, 125, 119, 51, 119, 49 }; #define yyerrok (yyerrstatus = 0) @@ -1631,17 +1605,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -1675,11 +1652,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1959,10 +1936,8 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1978,11 +1953,10 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ - -/* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -1990,9 +1964,9 @@ int yynerrs; -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -2016,66 +1990,68 @@ yyparse () #endif #endif { - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -2105,7 +2081,6 @@ yyparse () YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -2113,7 +2088,6 @@ yyparse () yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -2136,9 +2110,8 @@ yyparse () (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2149,7 +2122,6 @@ yyparse () yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -2159,6 +2131,9 @@ yyparse () YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2167,16 +2142,16 @@ yyparse () yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2208,20 +2183,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -2261,756 +2232,1060 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 177 "camp.y" { absyntax::root = (yyvsp[(1) - (1)].b); ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 181 "camp.y" { (yyval.b) = new file(lexerPos(), false); ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 183 "camp.y" { (yyval.b) = (yyvsp[(1) - (2)].b); (yyval.b)->add((yyvsp[(2) - (2)].run)); ;} break; case 5: + +/* Line 1455 of yacc.c */ #line 187 "camp.y" { (yyval.b) = new block(lexerPos(), true); ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 189 "camp.y" { (yyval.b) = (yyvsp[(1) - (2)].b); (yyval.b)->add((yyvsp[(2) - (2)].run)); ;} break; case 7: + +/* Line 1455 of yacc.c */ #line 193 "camp.y" { (yyval.n) = new simpleName((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; case 8: + +/* Line 1455 of yacc.c */ #line 194 "camp.y" { (yyval.n) = new qualifiedName((yyvsp[(2) - (3)].pos), (yyvsp[(1) - (3)].n), (yyvsp[(3) - (3)].ps).sym); ;} break; case 9: -#line 198 "camp.y" - { (yyval.run) = (yyvsp[(1) - (1)].d); ;} + +/* Line 1455 of yacc.c */ +#line 195 "camp.y" + { (yyval.n) = new simpleName((yyvsp[(1) - (1)].ps).pos, + symbol::trans("operator answer")); ;} break; case 10: -#line 199 "camp.y" - { (yyval.run) = (yyvsp[(1) - (1)].s); ;} + +/* Line 1455 of yacc.c */ +#line 200 "camp.y" + { (yyval.run) = (yyvsp[(1) - (1)].d); ;} break; case 11: + +/* Line 1455 of yacc.c */ #line 201 "camp.y" - { (yyval.run) = new modifiedRunnable((yyvsp[(1) - (2)].ml)->getPos(), (yyvsp[(1) - (2)].ml), (yyvsp[(2) - (2)].d)); ;} + { (yyval.run) = (yyvsp[(1) - (1)].s); ;} break; case 12: + +/* Line 1455 of yacc.c */ #line 203 "camp.y" - { (yyval.run) = new modifiedRunnable((yyvsp[(1) - (2)].ml)->getPos(), (yyvsp[(1) - (2)].ml), (yyvsp[(2) - (2)].s)); ;} + { (yyval.run) = new modifiedRunnable((yyvsp[(1) - (2)].ml)->getPos(), (yyvsp[(1) - (2)].ml), (yyvsp[(2) - (2)].d)); ;} break; case 13: -#line 207 "camp.y" - { (yyval.ml) = new modifierList((yyvsp[(1) - (1)].mod).pos); (yyval.ml)->add((yyvsp[(1) - (1)].mod).val); ;} + +/* Line 1455 of yacc.c */ +#line 205 "camp.y" + { (yyval.run) = new modifiedRunnable((yyvsp[(1) - (2)].ml)->getPos(), (yyvsp[(1) - (2)].ml), (yyvsp[(2) - (2)].s)); ;} break; case 14: -#line 208 "camp.y" - { (yyval.ml) = new modifierList((yyvsp[(1) - (1)].perm).pos); (yyval.ml)->add((yyvsp[(1) - (1)].perm).val); ;} + +/* Line 1455 of yacc.c */ +#line 209 "camp.y" + { (yyval.ml) = new modifierList((yyvsp[(1) - (1)].mod).pos); (yyval.ml)->add((yyvsp[(1) - (1)].mod).val); ;} break; case 15: + +/* Line 1455 of yacc.c */ #line 210 "camp.y" - { (yyval.ml) = (yyvsp[(1) - (2)].ml); (yyval.ml)->add((yyvsp[(2) - (2)].mod).val); ;} + { (yyval.ml) = new modifierList((yyvsp[(1) - (1)].perm).pos); (yyval.ml)->add((yyvsp[(1) - (1)].perm).val); ;} break; case 16: + +/* Line 1455 of yacc.c */ #line 212 "camp.y" - { (yyval.ml) = (yyvsp[(1) - (2)].ml); (yyval.ml)->add((yyvsp[(2) - (2)].perm).val); ;} + { (yyval.ml) = (yyvsp[(1) - (2)].ml); (yyval.ml)->add((yyvsp[(2) - (2)].mod).val); ;} break; case 17: -#line 216 "camp.y" - { (yyval.d) = (yyvsp[(1) - (1)].vd); ;} + +/* Line 1455 of yacc.c */ +#line 214 "camp.y" + { (yyval.ml) = (yyvsp[(1) - (2)].ml); (yyval.ml)->add((yyvsp[(2) - (2)].perm).val); ;} break; case 18: -#line 217 "camp.y" - { (yyval.d) = (yyvsp[(1) - (1)].d); ;} + +/* Line 1455 of yacc.c */ +#line 218 "camp.y" + { (yyval.d) = (yyvsp[(1) - (1)].vd); ;} break; case 19: -#line 218 "camp.y" + +/* Line 1455 of yacc.c */ +#line 219 "camp.y" { (yyval.d) = (yyvsp[(1) - (1)].d); ;} break; case 20: + +/* Line 1455 of yacc.c */ #line 220 "camp.y" - { (yyval.d) = new accessdec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].ipl)); ;} + { (yyval.d) = (yyvsp[(1) - (1)].d); ;} break; case 21: + +/* Line 1455 of yacc.c */ #line 222 "camp.y" - { (yyval.d) = new unraveldec((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].n), (yyvsp[(4) - (5)].ipl)); ;} + { (yyval.d) = new accessdec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].ipl)); ;} break; case 22: + +/* Line 1455 of yacc.c */ #line 224 "camp.y" - { (yyval.d) = new unraveldec((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].n), WILDCARD); ;} + { (yyval.d) = new unraveldec((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].n), (yyvsp[(4) - (5)].ipl)); ;} break; case 23: -#line 225 "camp.y" - { (yyval.d) = new unraveldec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].n), WILDCARD); ;} + +/* Line 1455 of yacc.c */ +#line 226 "camp.y" + { (yyval.d) = new unraveldec((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].n), WILDCARD); ;} break; case 24: + +/* Line 1455 of yacc.c */ #line 227 "camp.y" - { (yyval.d) = new fromaccessdec((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].ps).sym, (yyvsp[(4) - (5)].ipl)); ;} + { (yyval.d) = new unraveldec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].n), WILDCARD); ;} break; case 25: + +/* Line 1455 of yacc.c */ #line 229 "camp.y" - { (yyval.d) = new fromaccessdec((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].ps).sym, WILDCARD); ;} + { (yyval.d) = new fromaccessdec((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].ps).sym, (yyvsp[(4) - (5)].ipl)); ;} break; case 26: + +/* Line 1455 of yacc.c */ #line 231 "camp.y" - { (yyval.d) = new importdec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].ip)); ;} + { (yyval.d) = new fromaccessdec((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].ps).sym, WILDCARD); ;} break; case 27: -#line 232 "camp.y" - { (yyval.d) = new includedec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].ps).sym); ;} + +/* Line 1455 of yacc.c */ +#line 233 "camp.y" + { (yyval.d) = new importdec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].ip)); ;} break; case 28: + +/* Line 1455 of yacc.c */ #line 234 "camp.y" - { (yyval.d) = new includedec((yyvsp[(1) - (3)].pos), (string)*(yyvsp[(2) - (3)].ps).sym); ;} + { (yyval.d) = new includedec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].ps).sym); ;} break; case 29: -#line 238 "camp.y" - { (yyval.ip) = new idpair((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} + +/* Line 1455 of yacc.c */ +#line 236 "camp.y" + { (yyval.d) = new includedec((yyvsp[(1) - (3)].pos), (string)*(yyvsp[(2) - (3)].ps).sym); ;} break; case 30: + +/* Line 1455 of yacc.c */ #line 240 "camp.y" - { (yyval.ip) = new idpair((yyvsp[(1) - (3)].ps).pos, (yyvsp[(1) - (3)].ps).sym, (yyvsp[(2) - (3)].ps).sym , (yyvsp[(3) - (3)].ps).sym); ;} + { (yyval.ip) = new idpair((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; case 31: -#line 244 "camp.y" - { (yyval.ipl) = new idpairlist(); (yyval.ipl)->add((yyvsp[(1) - (1)].ip)); ;} + +/* Line 1455 of yacc.c */ +#line 242 "camp.y" + { (yyval.ip) = new idpair((yyvsp[(1) - (3)].ps).pos, (yyvsp[(1) - (3)].ps).sym, (yyvsp[(2) - (3)].ps).sym , (yyvsp[(3) - (3)].ps).sym); ;} break; case 32: + +/* Line 1455 of yacc.c */ #line 246 "camp.y" - { (yyval.ipl) = (yyvsp[(1) - (3)].ipl); (yyval.ipl)->add((yyvsp[(3) - (3)].ip)); ;} + { (yyval.ipl) = new idpairlist(); (yyval.ipl)->add((yyvsp[(1) - (1)].ip)); ;} break; case 33: -#line 250 "camp.y" - { (yyval.ps) = (yyvsp[(1) - (1)].ps); ;} + +/* Line 1455 of yacc.c */ +#line 248 "camp.y" + { (yyval.ipl) = (yyvsp[(1) - (3)].ipl); (yyval.ipl)->add((yyvsp[(3) - (3)].ip)); ;} break; case 34: -#line 251 "camp.y" + +/* Line 1455 of yacc.c */ +#line 252 "camp.y" { (yyval.ps) = (yyvsp[(1) - (1)].ps); ;} break; case 35: -#line 255 "camp.y" - { (yyval.ip) = new idpair((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} + +/* Line 1455 of yacc.c */ +#line 253 "camp.y" + { (yyval.ps) = (yyvsp[(1) - (1)].ps); ;} break; case 36: + +/* Line 1455 of yacc.c */ #line 257 "camp.y" - { (yyval.ip) = new idpair((yyvsp[(1) - (3)].ps).pos, (yyvsp[(1) - (3)].ps).sym, (yyvsp[(2) - (3)].ps).sym , (yyvsp[(3) - (3)].ps).sym); ;} + { (yyval.ip) = new idpair((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; case 37: -#line 261 "camp.y" - { (yyval.ipl) = new idpairlist(); (yyval.ipl)->add((yyvsp[(1) - (1)].ip)); ;} + +/* Line 1455 of yacc.c */ +#line 259 "camp.y" + { (yyval.ip) = new idpair((yyvsp[(1) - (3)].ps).pos, (yyvsp[(1) - (3)].ps).sym, (yyvsp[(2) - (3)].ps).sym , (yyvsp[(3) - (3)].ps).sym); ;} break; case 38: + +/* Line 1455 of yacc.c */ #line 263 "camp.y" - { (yyval.ipl) = (yyvsp[(1) - (3)].ipl); (yyval.ipl)->add((yyvsp[(3) - (3)].ip)); ;} + { (yyval.ipl) = new idpairlist(); (yyval.ipl)->add((yyvsp[(1) - (1)].ip)); ;} break; case 39: -#line 267 "camp.y" - { (yyval.vd) = (yyvsp[(1) - (2)].vd); ;} + +/* Line 1455 of yacc.c */ +#line 265 "camp.y" + { (yyval.ipl) = (yyvsp[(1) - (3)].ipl); (yyval.ipl)->add((yyvsp[(3) - (3)].ip)); ;} break; case 40: -#line 271 "camp.y" - { (yyval.vd) = new vardec((yyvsp[(1) - (2)].t)->getPos(), (yyvsp[(1) - (2)].t), (yyvsp[(2) - (2)].dil)); ;} + +/* Line 1455 of yacc.c */ +#line 269 "camp.y" + { (yyval.vd) = (yyvsp[(1) - (2)].vd); ;} break; case 41: -#line 275 "camp.y" - { (yyval.t) = (yyvsp[(1) - (1)].t); ;} + +/* Line 1455 of yacc.c */ +#line 273 "camp.y" + { (yyval.vd) = new vardec((yyvsp[(1) - (2)].t)->getPos(), (yyvsp[(1) - (2)].t), (yyvsp[(2) - (2)].dil)); ;} break; case 42: -#line 276 "camp.y" - { (yyval.t) = new arrayTy((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].dim)); ;} + +/* Line 1455 of yacc.c */ +#line 277 "camp.y" + { (yyval.t) = (yyvsp[(1) - (1)].t); ;} break; case 43: -#line 280 "camp.y" - { (yyval.t) = new nameTy((yyvsp[(1) - (1)].n)); ;} + +/* Line 1455 of yacc.c */ +#line 278 "camp.y" + { (yyval.t) = new arrayTy((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].dim)); ;} break; case 44: -#line 284 "camp.y" - { (yyval.dim) = new dimensions((yyvsp[(1) - (2)].pos)); ;} + +/* Line 1455 of yacc.c */ +#line 282 "camp.y" + { (yyval.t) = new nameTy((yyvsp[(1) - (1)].n)); ;} break; case 45: -#line 285 "camp.y" - { (yyval.dim) = (yyvsp[(1) - (3)].dim); (yyval.dim)->increase(); ;} + +/* Line 1455 of yacc.c */ +#line 286 "camp.y" + { (yyval.dim) = new dimensions((yyvsp[(1) - (2)].pos)); ;} break; case 46: -#line 289 "camp.y" - { (yyval.elist) = new explist((yyvsp[(1) - (3)].pos)); (yyval.elist)->add((yyvsp[(2) - (3)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 287 "camp.y" + { (yyval.dim) = (yyvsp[(1) - (3)].dim); (yyval.dim)->increase(); ;} break; case 47: + +/* Line 1455 of yacc.c */ #line 291 "camp.y" - { (yyval.elist) = (yyvsp[(1) - (4)].elist); (yyval.elist)->add((yyvsp[(3) - (4)].e)); ;} + { (yyval.elist) = new explist((yyvsp[(1) - (3)].pos)); (yyval.elist)->add((yyvsp[(2) - (3)].e)); ;} break; case 48: -#line 295 "camp.y" - { (yyval.dil) = new decidlist((yyvsp[(1) - (1)].di)->getPos()); (yyval.dil)->add((yyvsp[(1) - (1)].di)); ;} + +/* Line 1455 of yacc.c */ +#line 293 "camp.y" + { (yyval.elist) = (yyvsp[(1) - (4)].elist); (yyval.elist)->add((yyvsp[(3) - (4)].e)); ;} break; case 49: + +/* Line 1455 of yacc.c */ #line 297 "camp.y" - { (yyval.dil) = (yyvsp[(1) - (3)].dil); (yyval.dil)->add((yyvsp[(3) - (3)].di)); ;} + { (yyval.dil) = new decidlist((yyvsp[(1) - (1)].di)->getPos()); (yyval.dil)->add((yyvsp[(1) - (1)].di)); ;} break; case 50: -#line 301 "camp.y" - { (yyval.di) = new decid((yyvsp[(1) - (1)].dis)->getPos(), (yyvsp[(1) - (1)].dis)); ;} + +/* Line 1455 of yacc.c */ +#line 299 "camp.y" + { (yyval.dil) = (yyvsp[(1) - (3)].dil); (yyval.dil)->add((yyvsp[(3) - (3)].di)); ;} break; case 51: + +/* Line 1455 of yacc.c */ #line 303 "camp.y" - { (yyval.di) = new decid((yyvsp[(1) - (3)].dis)->getPos(), (yyvsp[(1) - (3)].dis), (yyvsp[(3) - (3)].vi)); ;} + { (yyval.di) = new decid((yyvsp[(1) - (1)].dis)->getPos(), (yyvsp[(1) - (1)].dis)); ;} break; case 52: -#line 307 "camp.y" - { (yyval.dis) = new decidstart((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} + +/* Line 1455 of yacc.c */ +#line 305 "camp.y" + { (yyval.di) = new decid((yyvsp[(1) - (3)].dis)->getPos(), (yyvsp[(1) - (3)].dis), (yyvsp[(3) - (3)].vi)); ;} break; case 53: -#line 308 "camp.y" - { (yyval.dis) = new decidstart((yyvsp[(1) - (2)].ps).pos, (yyvsp[(1) - (2)].ps).sym, (yyvsp[(2) - (2)].dim)); ;} + +/* Line 1455 of yacc.c */ +#line 309 "camp.y" + { (yyval.dis) = new decidstart((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; case 54: -#line 309 "camp.y" - { (yyval.dis) = new fundecidstart((yyvsp[(1) - (3)].ps).pos, (yyvsp[(1) - (3)].ps).sym, 0, - new formals((yyvsp[(2) - (3)].pos))); ;} + +/* Line 1455 of yacc.c */ +#line 310 "camp.y" + { (yyval.dis) = new decidstart((yyvsp[(1) - (2)].ps).pos, (yyvsp[(1) - (2)].ps).sym, (yyvsp[(2) - (2)].dim)); ;} break; case 55: -#line 312 "camp.y" - { (yyval.dis) = new fundecidstart((yyvsp[(1) - (4)].ps).pos, (yyvsp[(1) - (4)].ps).sym, 0, (yyvsp[(3) - (4)].fls)); ;} + +/* Line 1455 of yacc.c */ +#line 311 "camp.y" + { (yyval.dis) = new fundecidstart((yyvsp[(1) - (3)].ps).pos, (yyvsp[(1) - (3)].ps).sym, 0, + new formals((yyvsp[(2) - (3)].pos))); ;} break; case 56: -#line 316 "camp.y" - { (yyval.vi) = (yyvsp[(1) - (1)].e); ;} + +/* Line 1455 of yacc.c */ +#line 314 "camp.y" + { (yyval.dis) = new fundecidstart((yyvsp[(1) - (4)].ps).pos, (yyvsp[(1) - (4)].ps).sym, 0, (yyvsp[(3) - (4)].fls)); ;} break; case 57: -#line 317 "camp.y" - { (yyval.vi) = (yyvsp[(1) - (1)].ai); ;} + +/* Line 1455 of yacc.c */ +#line 318 "camp.y" + { (yyval.vi) = (yyvsp[(1) - (1)].e); ;} break; case 58: -#line 322 "camp.y" - { (yyval.b) = (yyvsp[(2) - (3)].b); ;} + +/* Line 1455 of yacc.c */ +#line 319 "camp.y" + { (yyval.vi) = (yyvsp[(1) - (1)].ai); ;} break; case 59: -#line 326 "camp.y" - { (yyval.ai) = new arrayinit((yyvsp[(1) - (2)].pos)); ;} + +/* Line 1455 of yacc.c */ +#line 324 "camp.y" + { (yyval.b) = (yyvsp[(2) - (3)].b); ;} break; case 60: + +/* Line 1455 of yacc.c */ #line 328 "camp.y" - { (yyval.ai) = new arrayinit((yyvsp[(1) - (4)].pos)); (yyval.ai)->addRest((yyvsp[(3) - (4)].vi)); ;} + { (yyval.ai) = new arrayinit((yyvsp[(1) - (2)].pos)); ;} break; case 61: + +/* Line 1455 of yacc.c */ #line 330 "camp.y" - { (yyval.ai) = (yyvsp[(2) - (3)].ai); ;} + { (yyval.ai) = new arrayinit((yyvsp[(1) - (4)].pos)); (yyval.ai)->addRest((yyvsp[(3) - (4)].vi)); ;} break; case 62: + +/* Line 1455 of yacc.c */ #line 332 "camp.y" - { (yyval.ai) = (yyvsp[(2) - (5)].ai); (yyval.ai)->addRest((yyvsp[(4) - (5)].vi)); ;} + { (yyval.ai) = (yyvsp[(2) - (3)].ai); ;} break; case 63: -#line 336 "camp.y" - { (yyval.ai) = new arrayinit((yyvsp[(1) - (1)].pos)); ;} + +/* Line 1455 of yacc.c */ +#line 334 "camp.y" + { (yyval.ai) = (yyvsp[(2) - (5)].ai); (yyval.ai)->addRest((yyvsp[(4) - (5)].vi)); ;} break; case 64: -#line 337 "camp.y" - { (yyval.ai) = (yyvsp[(1) - (1)].ai); ;} + +/* Line 1455 of yacc.c */ +#line 338 "camp.y" + { (yyval.ai) = new arrayinit((yyvsp[(1) - (1)].pos)); ;} break; case 65: -#line 338 "camp.y" - { (yyval.ai) = (yyvsp[(1) - (2)].ai); ;} + +/* Line 1455 of yacc.c */ +#line 339 "camp.y" + { (yyval.ai) = (yyvsp[(1) - (1)].ai); ;} break; case 66: -#line 342 "camp.y" - { (yyval.ai) = new arrayinit((yyvsp[(1) - (1)].vi)->getPos()); - (yyval.ai)->add((yyvsp[(1) - (1)].vi));;} + +/* Line 1455 of yacc.c */ +#line 340 "camp.y" + { (yyval.ai) = (yyvsp[(1) - (2)].ai); ;} break; case 67: -#line 345 "camp.y" - { (yyval.ai) = (yyvsp[(1) - (3)].ai); (yyval.ai)->add((yyvsp[(3) - (3)].vi)); ;} + +/* Line 1455 of yacc.c */ +#line 344 "camp.y" + { (yyval.ai) = new arrayinit((yyvsp[(1) - (1)].vi)->getPos()); + (yyval.ai)->add((yyvsp[(1) - (1)].vi));;} break; case 68: -#line 349 "camp.y" - { (yyval.fls) = (yyvsp[(1) - (1)].fls); ;} + +/* Line 1455 of yacc.c */ +#line 347 "camp.y" + { (yyval.ai) = (yyvsp[(1) - (3)].ai); (yyval.ai)->add((yyvsp[(3) - (3)].vi)); ;} break; case 69: + +/* Line 1455 of yacc.c */ #line 351 "camp.y" - { (yyval.fls) = (yyvsp[(1) - (3)].fls); (yyval.fls)->addRest((yyvsp[(3) - (3)].fl)); ;} + { (yyval.fls) = (yyvsp[(1) - (1)].fls); ;} break; case 70: -#line 352 "camp.y" - { (yyval.fls) = new formals((yyvsp[(1) - (2)].pos)); (yyval.fls)->addRest((yyvsp[(2) - (2)].fl)); ;} + +/* Line 1455 of yacc.c */ +#line 353 "camp.y" + { (yyval.fls) = (yyvsp[(1) - (3)].fls); (yyval.fls)->addRest((yyvsp[(3) - (3)].fl)); ;} break; case 71: -#line 356 "camp.y" - { (yyval.fls) = new formals((yyvsp[(1) - (1)].fl)->getPos()); (yyval.fls)->add((yyvsp[(1) - (1)].fl)); ;} + +/* Line 1455 of yacc.c */ +#line 354 "camp.y" + { (yyval.fls) = new formals((yyvsp[(1) - (2)].pos)); (yyval.fls)->addRest((yyvsp[(2) - (2)].fl)); ;} break; case 72: + +/* Line 1455 of yacc.c */ #line 358 "camp.y" - { (yyval.fls) = (yyvsp[(1) - (3)].fls); (yyval.fls)->add((yyvsp[(3) - (3)].fl)); ;} + { (yyval.fls) = new formals((yyvsp[(1) - (1)].fl)->getPos()); (yyval.fls)->add((yyvsp[(1) - (1)].fl)); ;} break; case 73: -#line 362 "camp.y" - { (yyval.boo) = true; ;} + +/* Line 1455 of yacc.c */ +#line 360 "camp.y" + { (yyval.fls) = (yyvsp[(1) - (3)].fls); (yyval.fls)->add((yyvsp[(3) - (3)].fl)); ;} break; case 74: -#line 363 "camp.y" - { (yyval.boo) = false; ;} + +/* Line 1455 of yacc.c */ +#line 364 "camp.y" + { (yyval.boo) = true; ;} break; case 75: -#line 368 "camp.y" - { (yyval.fl) = new formal((yyvsp[(2) - (2)].t)->getPos(), (yyvsp[(2) - (2)].t), 0, 0, (yyvsp[(1) - (2)].boo)); ;} + +/* Line 1455 of yacc.c */ +#line 365 "camp.y" + { (yyval.boo) = false; ;} break; case 76: + +/* Line 1455 of yacc.c */ #line 370 "camp.y" - { (yyval.fl) = new formal((yyvsp[(2) - (3)].t)->getPos(), (yyvsp[(2) - (3)].t), (yyvsp[(3) - (3)].dis), 0, (yyvsp[(1) - (3)].boo)); ;} + { (yyval.fl) = new formal((yyvsp[(2) - (2)].t)->getPos(), (yyvsp[(2) - (2)].t), 0, 0, (yyvsp[(1) - (2)].boo)); ;} break; case 77: + +/* Line 1455 of yacc.c */ #line 372 "camp.y" - { (yyval.fl) = new formal((yyvsp[(2) - (5)].t)->getPos(), (yyvsp[(2) - (5)].t), (yyvsp[(3) - (5)].dis), (yyvsp[(5) - (5)].vi), (yyvsp[(1) - (5)].boo)); ;} + { (yyval.fl) = new formal((yyvsp[(2) - (3)].t)->getPos(), (yyvsp[(2) - (3)].t), (yyvsp[(3) - (3)].dis), 0, (yyvsp[(1) - (3)].boo)); ;} break; case 78: -#line 377 "camp.y" - { (yyval.d) = new fundec((yyvsp[(3) - (5)].pos), (yyvsp[(1) - (5)].t), (yyvsp[(2) - (5)].ps).sym, new formals((yyvsp[(3) - (5)].pos)), (yyvsp[(5) - (5)].s)); ;} + +/* Line 1455 of yacc.c */ +#line 374 "camp.y" + { (yyval.fl) = new formal((yyvsp[(2) - (5)].t)->getPos(), (yyvsp[(2) - (5)].t), (yyvsp[(3) - (5)].dis), (yyvsp[(5) - (5)].vi), (yyvsp[(1) - (5)].boo)); ;} break; case 79: + +/* Line 1455 of yacc.c */ #line 379 "camp.y" - { (yyval.d) = new fundec((yyvsp[(3) - (6)].pos), (yyvsp[(1) - (6)].t), (yyvsp[(2) - (6)].ps).sym, (yyvsp[(4) - (6)].fls), (yyvsp[(6) - (6)].s)); ;} + { (yyval.d) = new fundec((yyvsp[(3) - (5)].pos), (yyvsp[(1) - (5)].t), (yyvsp[(2) - (5)].ps).sym, new formals((yyvsp[(3) - (5)].pos)), (yyvsp[(5) - (5)].s)); ;} break; case 80: -#line 383 "camp.y" - { (yyval.d) = new recorddec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].b)); ;} + +/* Line 1455 of yacc.c */ +#line 381 "camp.y" + { (yyval.d) = new fundec((yyvsp[(3) - (6)].pos), (yyvsp[(1) - (6)].t), (yyvsp[(2) - (6)].ps).sym, (yyvsp[(4) - (6)].fls), (yyvsp[(6) - (6)].s)); ;} break; case 81: -#line 384 "camp.y" - { (yyval.d) = new typedec((yyvsp[(1) - (2)].pos), (yyvsp[(2) - (2)].vd)); ;} + +/* Line 1455 of yacc.c */ +#line 385 "camp.y" + { (yyval.d) = new recorddec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].b)); ;} break; case 82: -#line 388 "camp.y" - { (yyval.slice) = new slice((yyvsp[(1) - (1)].pos), 0, 0); ;} + +/* Line 1455 of yacc.c */ +#line 386 "camp.y" + { (yyval.d) = new typedec((yyvsp[(1) - (2)].pos), (yyvsp[(2) - (2)].vd)); ;} break; case 83: -#line 389 "camp.y" - { (yyval.slice) = new slice((yyvsp[(2) - (2)].pos), (yyvsp[(1) - (2)].e), 0); ;} + +/* Line 1455 of yacc.c */ +#line 390 "camp.y" + { (yyval.slice) = new slice((yyvsp[(1) - (1)].pos), 0, 0); ;} break; case 84: -#line 390 "camp.y" - { (yyval.slice) = new slice((yyvsp[(1) - (2)].pos), 0, (yyvsp[(2) - (2)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 391 "camp.y" + { (yyval.slice) = new slice((yyvsp[(2) - (2)].pos), (yyvsp[(1) - (2)].e), 0); ;} break; case 85: -#line 391 "camp.y" - { (yyval.slice) = new slice((yyvsp[(2) - (3)].pos), (yyvsp[(1) - (3)].e), (yyvsp[(3) - (3)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 392 "camp.y" + { (yyval.slice) = new slice((yyvsp[(1) - (2)].pos), 0, (yyvsp[(2) - (2)].e)); ;} break; case 86: -#line 395 "camp.y" - { (yyval.e) = new fieldExp((yyvsp[(2) - (3)].pos), (yyvsp[(1) - (3)].e), (yyvsp[(3) - (3)].ps).sym); ;} + +/* Line 1455 of yacc.c */ +#line 393 "camp.y" + { (yyval.slice) = new slice((yyvsp[(2) - (3)].pos), (yyvsp[(1) - (3)].e), (yyvsp[(3) - (3)].e)); ;} break; case 87: -#line 396 "camp.y" - { (yyval.e) = new subscriptExp((yyvsp[(2) - (4)].pos), - new nameExp((yyvsp[(1) - (4)].n)->getPos(), (yyvsp[(1) - (4)].n)), (yyvsp[(3) - (4)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 397 "camp.y" + { (yyval.e) = new fieldExp((yyvsp[(2) - (3)].pos), (yyvsp[(1) - (3)].e), (yyvsp[(3) - (3)].ps).sym); ;} break; case 88: + +/* Line 1455 of yacc.c */ #line 398 "camp.y" - { (yyval.e) = new subscriptExp((yyvsp[(2) - (4)].pos), (yyvsp[(1) - (4)].e), (yyvsp[(3) - (4)].e)); ;} + { (yyval.e) = new subscriptExp((yyvsp[(2) - (4)].pos), + new nameExp((yyvsp[(1) - (4)].n)->getPos(), (yyvsp[(1) - (4)].n)), (yyvsp[(3) - (4)].e)); ;} break; case 89: -#line 399 "camp.y" - { (yyval.e) = new sliceExp((yyvsp[(2) - (4)].pos), - new nameExp((yyvsp[(1) - (4)].n)->getPos(), (yyvsp[(1) - (4)].n)), (yyvsp[(3) - (4)].slice)); ;} + +/* Line 1455 of yacc.c */ +#line 400 "camp.y" + { (yyval.e) = new subscriptExp((yyvsp[(2) - (4)].pos), (yyvsp[(1) - (4)].e), (yyvsp[(3) - (4)].e)); ;} break; case 90: + +/* Line 1455 of yacc.c */ #line 401 "camp.y" - { (yyval.e) = new sliceExp((yyvsp[(2) - (4)].pos), (yyvsp[(1) - (4)].e), (yyvsp[(3) - (4)].slice)); ;} + { (yyval.e) = new sliceExp((yyvsp[(2) - (4)].pos), + new nameExp((yyvsp[(1) - (4)].n)->getPos(), (yyvsp[(1) - (4)].n)), (yyvsp[(3) - (4)].slice)); ;} break; case 91: -#line 402 "camp.y" + +/* Line 1455 of yacc.c */ +#line 403 "camp.y" + { (yyval.e) = new sliceExp((yyvsp[(2) - (4)].pos), (yyvsp[(1) - (4)].e), (yyvsp[(3) - (4)].slice)); ;} + break; + + case 92: + +/* Line 1455 of yacc.c */ +#line 404 "camp.y" { (yyval.e) = new callExp((yyvsp[(2) - (3)].pos), new nameExp((yyvsp[(1) - (3)].n)->getPos(), (yyvsp[(1) - (3)].n)), new arglist()); ;} break; - case 92: -#line 406 "camp.y" + case 93: + +/* Line 1455 of yacc.c */ +#line 408 "camp.y" { (yyval.e) = new callExp((yyvsp[(2) - (4)].pos), new nameExp((yyvsp[(1) - (4)].n)->getPos(), (yyvsp[(1) - (4)].n)), (yyvsp[(3) - (4)].alist)); ;} break; - case 93: -#line 409 "camp.y" - { (yyval.e) = new callExp((yyvsp[(2) - (3)].pos), (yyvsp[(1) - (3)].e), new arglist()); ;} - break; - case 94: + +/* Line 1455 of yacc.c */ #line 411 "camp.y" - { (yyval.e) = new callExp((yyvsp[(2) - (4)].pos), (yyvsp[(1) - (4)].e), (yyvsp[(3) - (4)].alist)); ;} + { (yyval.e) = new callExp((yyvsp[(2) - (3)].pos), (yyvsp[(1) - (3)].e), new arglist()); ;} break; case 95: + +/* Line 1455 of yacc.c */ #line 413 "camp.y" - { (yyval.e) = (yyvsp[(2) - (3)].e); ;} + { (yyval.e) = new callExp((yyvsp[(2) - (4)].pos), (yyvsp[(1) - (4)].e), (yyvsp[(3) - (4)].alist)); ;} break; case 96: + +/* Line 1455 of yacc.c */ #line 415 "camp.y" - { (yyval.e) = new nameExp((yyvsp[(2) - (3)].n)->getPos(), (yyvsp[(2) - (3)].n)); ;} + { (yyval.e) = (yyvsp[(2) - (3)].e); ;} break; case 97: -#line 416 "camp.y" - { (yyval.e) = new thisExp((yyvsp[(1) - (1)].pos)); ;} + +/* Line 1455 of yacc.c */ +#line 417 "camp.y" + { (yyval.e) = new nameExp((yyvsp[(2) - (3)].n)->getPos(), (yyvsp[(2) - (3)].n)); ;} break; case 98: -#line 420 "camp.y" - { (yyval.arg).name=0; (yyval.arg).val=(yyvsp[(1) - (1)].e); ;} + +/* Line 1455 of yacc.c */ +#line 418 "camp.y" + { (yyval.e) = new thisExp((yyvsp[(1) - (1)].pos)); ;} break; case 99: -#line 421 "camp.y" - { (yyval.arg).name=(yyvsp[(1) - (3)].ps).sym; (yyval.arg).val=(yyvsp[(3) - (3)].e); ;} + +/* Line 1455 of yacc.c */ +#line 422 "camp.y" + { (yyval.arg).name=0; (yyval.arg).val=(yyvsp[(1) - (1)].e); ;} break; case 100: -#line 425 "camp.y" - { (yyval.alist) = (yyvsp[(1) - (1)].alist); ;} + +/* Line 1455 of yacc.c */ +#line 423 "camp.y" + { (yyval.arg).name=(yyvsp[(1) - (3)].ps).sym; (yyval.arg).val=(yyvsp[(3) - (3)].e); ;} break; case 101: + +/* Line 1455 of yacc.c */ #line 427 "camp.y" - { (yyval.alist) = (yyvsp[(1) - (3)].alist); (yyval.alist)->rest = (yyvsp[(3) - (3)].arg); ;} + { (yyval.alist) = (yyvsp[(1) - (1)].alist); ;} break; case 102: -#line 428 "camp.y" - { (yyval.alist) = new arglist(); (yyval.alist)->rest = (yyvsp[(2) - (2)].arg); ;} + +/* Line 1455 of yacc.c */ +#line 429 "camp.y" + { (yyval.alist) = (yyvsp[(1) - (3)].alist); (yyval.alist)->rest = (yyvsp[(3) - (3)].arg); ;} break; case 103: -#line 432 "camp.y" - { (yyval.alist) = new arglist(); (yyval.alist)->add((yyvsp[(1) - (1)].arg)); ;} + +/* Line 1455 of yacc.c */ +#line 430 "camp.y" + { (yyval.alist) = new arglist(); (yyval.alist)->rest = (yyvsp[(2) - (2)].arg); ;} break; case 104: + +/* Line 1455 of yacc.c */ #line 434 "camp.y" - { (yyval.alist) = (yyvsp[(1) - (3)].alist); (yyval.alist)->add((yyvsp[(3) - (3)].arg)); ;} + { (yyval.alist) = new arglist(); (yyval.alist)->add((yyvsp[(1) - (1)].arg)); ;} break; case 105: -#line 439 "camp.y" - { (yyval.e) = new nameExp((yyvsp[(1) - (1)].n)->getPos(), (yyvsp[(1) - (1)].n)); ;} + +/* Line 1455 of yacc.c */ +#line 436 "camp.y" + { (yyval.alist) = (yyvsp[(1) - (3)].alist); (yyval.alist)->add((yyvsp[(3) - (3)].arg)); ;} break; case 106: -#line 440 "camp.y" - { (yyval.e) = (yyvsp[(1) - (1)].e); ;} + +/* Line 1455 of yacc.c */ +#line 441 "camp.y" + { (yyval.e) = new nameExp((yyvsp[(1) - (1)].n)->getPos(), (yyvsp[(1) - (1)].n)); ;} break; case 107: -#line 441 "camp.y" + +/* Line 1455 of yacc.c */ +#line 442 "camp.y" { (yyval.e) = (yyvsp[(1) - (1)].e); ;} break; case 108: -#line 442 "camp.y" - { (yyval.e) = new stringExp((yyvsp[(1) - (1)].ps).pos, *(yyvsp[(1) - (1)].ps).sym); ;} + +/* Line 1455 of yacc.c */ +#line 443 "camp.y" + { (yyval.e) = (yyvsp[(1) - (1)].e); ;} break; case 109: + +/* Line 1455 of yacc.c */ #line 444 "camp.y" - { (yyval.e) = new scaleExp((yyvsp[(1) - (2)].e)->getPos(), (yyvsp[(1) - (2)].e), (yyvsp[(2) - (2)].e)); ;} + { (yyval.e) = new stringExp((yyvsp[(1) - (1)].ps).pos, *(yyvsp[(1) - (1)].ps).sym); ;} break; case 110: + +/* Line 1455 of yacc.c */ #line 446 "camp.y" - { (yyval.e) = new castExp((yyvsp[(2) - (4)].n)->getPos(), new nameTy((yyvsp[(2) - (4)].n)), (yyvsp[(4) - (4)].e)); ;} + { (yyval.e) = new scaleExp((yyvsp[(1) - (2)].e)->getPos(), (yyvsp[(1) - (2)].e), (yyvsp[(2) - (2)].e)); ;} break; case 111: + +/* Line 1455 of yacc.c */ #line 448 "camp.y" - { (yyval.e) = new castExp((yyvsp[(2) - (5)].n)->getPos(), new arrayTy((yyvsp[(2) - (5)].n), (yyvsp[(3) - (5)].dim)), (yyvsp[(5) - (5)].e)); ;} + { (yyval.e) = new castExp((yyvsp[(2) - (4)].n)->getPos(), new nameTy((yyvsp[(2) - (4)].n)), (yyvsp[(4) - (4)].e)); ;} break; case 112: + +/* Line 1455 of yacc.c */ #line 450 "camp.y" - { (yyval.e) = new unaryExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), (yyvsp[(1) - (2)].ps).sym); ;} + { (yyval.e) = new castExp((yyvsp[(2) - (5)].n)->getPos(), new arrayTy((yyvsp[(2) - (5)].n), (yyvsp[(3) - (5)].dim)), (yyvsp[(5) - (5)].e)); ;} break; case 113: + +/* Line 1455 of yacc.c */ #line 452 "camp.y" { (yyval.e) = new unaryExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), (yyvsp[(1) - (2)].ps).sym); ;} break; case 114: -#line 453 "camp.y" + +/* Line 1455 of yacc.c */ +#line 454 "camp.y" { (yyval.e) = new unaryExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), (yyvsp[(1) - (2)].ps).sym); ;} break; case 115: -#line 454 "camp.y" - { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 455 "camp.y" + { (yyval.e) = new unaryExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), (yyvsp[(1) - (2)].ps).sym); ;} break; case 116: -#line 455 "camp.y" + +/* Line 1455 of yacc.c */ +#line 456 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 117: -#line 456 "camp.y" + +/* Line 1455 of yacc.c */ +#line 457 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 118: -#line 457 "camp.y" + +/* Line 1455 of yacc.c */ +#line 458 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 119: -#line 458 "camp.y" + +/* Line 1455 of yacc.c */ +#line 459 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 120: -#line 459 "camp.y" + +/* Line 1455 of yacc.c */ +#line 460 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 121: -#line 460 "camp.y" + +/* Line 1455 of yacc.c */ +#line 461 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 122: -#line 461 "camp.y" + +/* Line 1455 of yacc.c */ +#line 462 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 123: -#line 462 "camp.y" + +/* Line 1455 of yacc.c */ +#line 463 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 124: -#line 463 "camp.y" + +/* Line 1455 of yacc.c */ +#line 464 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 125: -#line 464 "camp.y" + +/* Line 1455 of yacc.c */ +#line 465 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 126: -#line 465 "camp.y" + +/* Line 1455 of yacc.c */ +#line 466 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 127: -#line 466 "camp.y" - { (yyval.e) = new andExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 467 "camp.y" + { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 128: -#line 467 "camp.y" - { (yyval.e) = new orExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 468 "camp.y" + { (yyval.e) = new andExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 129: -#line 468 "camp.y" - { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 469 "camp.y" + { (yyval.e) = new orExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 130: -#line 469 "camp.y" + +/* Line 1455 of yacc.c */ +#line 470 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 131: -#line 470 "camp.y" + +/* Line 1455 of yacc.c */ +#line 471 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 132: -#line 471 "camp.y" + +/* Line 1455 of yacc.c */ +#line 472 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 133: -#line 472 "camp.y" + +/* Line 1455 of yacc.c */ +#line 473 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 134: + +/* Line 1455 of yacc.c */ #line 474 "camp.y" - { (yyval.e) = new newRecordExp((yyvsp[(1) - (2)].pos), (yyvsp[(2) - (2)].t)); ;} + { (yyval.e) = new binaryExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 135: + +/* Line 1455 of yacc.c */ #line 476 "camp.y" - { (yyval.e) = new newArrayExp((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].t), (yyvsp[(3) - (3)].elist), 0, 0); ;} + { (yyval.e) = new newRecordExp((yyvsp[(1) - (2)].pos), (yyvsp[(2) - (2)].t)); ;} break; case 136: + +/* Line 1455 of yacc.c */ #line 478 "camp.y" - { (yyval.e) = new newArrayExp((yyvsp[(1) - (4)].pos), (yyvsp[(2) - (4)].t), (yyvsp[(3) - (4)].elist), (yyvsp[(4) - (4)].dim), 0); ;} + { (yyval.e) = new newArrayExp((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].t), (yyvsp[(3) - (3)].elist), 0, 0); ;} break; case 137: + +/* Line 1455 of yacc.c */ #line 480 "camp.y" - { (yyval.e) = new newArrayExp((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].t), 0, (yyvsp[(3) - (3)].dim), 0); ;} + { (yyval.e) = new newArrayExp((yyvsp[(1) - (4)].pos), (yyvsp[(2) - (4)].t), (yyvsp[(3) - (4)].elist), (yyvsp[(4) - (4)].dim), 0); ;} break; case 138: + +/* Line 1455 of yacc.c */ #line 482 "camp.y" - { (yyval.e) = new newArrayExp((yyvsp[(1) - (4)].pos), (yyvsp[(2) - (4)].t), 0, (yyvsp[(3) - (4)].dim), (yyvsp[(4) - (4)].ai)); ;} + { (yyval.e) = new newArrayExp((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].t), 0, (yyvsp[(3) - (3)].dim), 0); ;} break; case 139: + +/* Line 1455 of yacc.c */ #line 484 "camp.y" - { (yyval.e) = new newFunctionExp((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].t), new formals((yyvsp[(3) - (5)].pos)), (yyvsp[(5) - (5)].s)); ;} + { (yyval.e) = new newArrayExp((yyvsp[(1) - (4)].pos), (yyvsp[(2) - (4)].t), 0, (yyvsp[(3) - (4)].dim), (yyvsp[(4) - (4)].ai)); ;} break; case 140: + +/* Line 1455 of yacc.c */ #line 486 "camp.y" + { (yyval.e) = new newFunctionExp((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].t), new formals((yyvsp[(3) - (5)].pos)), (yyvsp[(5) - (5)].s)); ;} + break; + + case 141: + +/* Line 1455 of yacc.c */ +#line 488 "camp.y" { (yyval.e) = new newFunctionExp((yyvsp[(1) - (6)].pos), new arrayTy((yyvsp[(2) - (6)].t)->getPos(), (yyvsp[(2) - (6)].t), (yyvsp[(3) - (6)].dim)), new formals((yyvsp[(4) - (6)].pos)), (yyvsp[(6) - (6)].s)); ;} break; - case 141: -#line 491 "camp.y" + case 142: + +/* Line 1455 of yacc.c */ +#line 493 "camp.y" { (yyval.e) = new newFunctionExp((yyvsp[(1) - (6)].pos), (yyvsp[(2) - (6)].t), (yyvsp[(4) - (6)].fls), (yyvsp[(6) - (6)].s)); ;} break; - case 142: -#line 493 "camp.y" + case 143: + +/* Line 1455 of yacc.c */ +#line 495 "camp.y" { (yyval.e) = new newFunctionExp((yyvsp[(1) - (7)].pos), new arrayTy((yyvsp[(2) - (7)].t)->getPos(), (yyvsp[(2) - (7)].t), (yyvsp[(3) - (7)].dim)), (yyvsp[(5) - (7)].fls), (yyvsp[(7) - (7)].s)); ;} break; - case 143: -#line 498 "camp.y" - { (yyval.e) = new conditionalExp((yyvsp[(2) - (5)].pos), (yyvsp[(1) - (5)].e), (yyvsp[(3) - (5)].e), (yyvsp[(5) - (5)].e)); ;} - break; - case 144: -#line 499 "camp.y" - { (yyval.e) = new assignExp((yyvsp[(2) - (3)].pos), (yyvsp[(1) - (3)].e), (yyvsp[(3) - (3)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 500 "camp.y" + { (yyval.e) = new conditionalExp((yyvsp[(2) - (5)].pos), (yyvsp[(1) - (5)].e), (yyvsp[(3) - (5)].e), (yyvsp[(5) - (5)].e)); ;} break; case 145: -#line 502 "camp.y" - { (yyval.e) = new pairExp((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].e), (yyvsp[(4) - (5)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 501 "camp.y" + { (yyval.e) = new assignExp((yyvsp[(2) - (3)].pos), (yyvsp[(1) - (3)].e), (yyvsp[(3) - (3)].e)); ;} break; case 146: + +/* Line 1455 of yacc.c */ #line 504 "camp.y" - { (yyval.e) = new tripleExp((yyvsp[(1) - (7)].pos), (yyvsp[(2) - (7)].e), (yyvsp[(4) - (7)].e), (yyvsp[(6) - (7)].e)); ;} + { (yyval.e) = new pairExp((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].e), (yyvsp[(4) - (5)].e)); ;} break; case 147: + +/* Line 1455 of yacc.c */ #line 506 "camp.y" - { (yyval.e) = new transformExp((yyvsp[(1) - (13)].pos), (yyvsp[(2) - (13)].e), (yyvsp[(4) - (13)].e), (yyvsp[(6) - (13)].e), (yyvsp[(8) - (13)].e), (yyvsp[(10) - (13)].e), (yyvsp[(12) - (13)].e)); ;} + { (yyval.e) = new tripleExp((yyvsp[(1) - (7)].pos), (yyvsp[(2) - (7)].e), (yyvsp[(4) - (7)].e), (yyvsp[(6) - (7)].e)); ;} break; case 148: + +/* Line 1455 of yacc.c */ #line 508 "camp.y" - { (yyvsp[(2) - (3)].j)->pushFront((yyvsp[(1) - (3)].e)); (yyvsp[(2) - (3)].j)->pushBack((yyvsp[(3) - (3)].e)); (yyval.e) = (yyvsp[(2) - (3)].j); ;} + { (yyval.e) = new transformExp((yyvsp[(1) - (13)].pos), (yyvsp[(2) - (13)].e), (yyvsp[(4) - (13)].e), (yyvsp[(6) - (13)].e), (yyvsp[(8) - (13)].e), (yyvsp[(10) - (13)].e), (yyvsp[(12) - (13)].e)); ;} break; case 149: + +/* Line 1455 of yacc.c */ #line 510 "camp.y" + { (yyvsp[(2) - (3)].j)->pushFront((yyvsp[(1) - (3)].e)); (yyvsp[(2) - (3)].j)->pushBack((yyvsp[(3) - (3)].e)); (yyval.e) = (yyvsp[(2) - (3)].j); ;} + break; + + case 150: + +/* Line 1455 of yacc.c */ +#line 512 "camp.y" { (yyvsp[(2) - (2)].se)->setSide(camp::OUT); joinExp *jexp = new joinExp((yyvsp[(2) - (2)].se)->getPos(), symbol::trans("..")); @@ -3018,288 +3293,397 @@ yyreduce: jexp->pushBack((yyvsp[(1) - (2)].e)); jexp->pushBack((yyvsp[(2) - (2)].se)); ;} break; - case 150: -#line 516 "camp.y" - { (yyval.e) = new prefixExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), symbol::trans("+")); ;} - break; - case 151: + +/* Line 1455 of yacc.c */ #line 518 "camp.y" - { (yyval.e) = new prefixExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), symbol::trans("-")); ;} + { (yyval.e) = new prefixExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), symbol::trans("+")); ;} break; case 152: -#line 521 "camp.y" - { (yyval.e) = new postfixExp((yyvsp[(2) - (2)].ps).pos, (yyvsp[(1) - (2)].e), symbol::trans("+")); ;} + +/* Line 1455 of yacc.c */ +#line 520 "camp.y" + { (yyval.e) = new prefixExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), symbol::trans("-")); ;} break; case 153: -#line 522 "camp.y" - { (yyval.e) = new selfExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 523 "camp.y" + { (yyval.e) = new postfixExp((yyvsp[(2) - (2)].ps).pos, (yyvsp[(1) - (2)].e), symbol::trans("+")); ;} break; case 154: + +/* Line 1455 of yacc.c */ #line 524 "camp.y" { (yyval.e) = new selfExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 155: -#line 525 "camp.y" + +/* Line 1455 of yacc.c */ +#line 526 "camp.y" { (yyval.e) = new selfExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 156: -#line 526 "camp.y" + +/* Line 1455 of yacc.c */ +#line 527 "camp.y" { (yyval.e) = new selfExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 157: -#line 527 "camp.y" + +/* Line 1455 of yacc.c */ +#line 528 "camp.y" { (yyval.e) = new selfExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 158: + +/* Line 1455 of yacc.c */ #line 529 "camp.y" { (yyval.e) = new selfExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 159: + +/* Line 1455 of yacc.c */ #line 531 "camp.y" - { (yyval.e) = new quoteExp((yyvsp[(1) - (4)].pos), (yyvsp[(3) - (4)].b)); ;} + { (yyval.e) = new selfExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 160: -#line 537 "camp.y" - { (yyval.j) = new joinExp((yyvsp[(1) - (1)].ps).pos,(yyvsp[(1) - (1)].ps).sym); ;} + +/* Line 1455 of yacc.c */ +#line 533 "camp.y" + { (yyval.e) = new quoteExp((yyvsp[(1) - (4)].pos), (yyvsp[(3) - (4)].b)); ;} break; case 161: + +/* Line 1455 of yacc.c */ #line 539 "camp.y" - { (yyval.j) = (yyvsp[(1) - (1)].j); ;} + { (yyval.j) = new joinExp((yyvsp[(1) - (1)].ps).pos,(yyvsp[(1) - (1)].ps).sym); ;} break; case 162: + +/* Line 1455 of yacc.c */ #line 541 "camp.y" + { (yyval.j) = (yyvsp[(1) - (1)].j); ;} + break; + + case 163: + +/* Line 1455 of yacc.c */ +#line 543 "camp.y" { (yyvsp[(1) - (2)].se)->setSide(camp::OUT); (yyval.j) = (yyvsp[(2) - (2)].j); (yyval.j)->pushFront((yyvsp[(1) - (2)].se)); ;} break; - case 163: -#line 544 "camp.y" + case 164: + +/* Line 1455 of yacc.c */ +#line 546 "camp.y" { (yyvsp[(2) - (2)].se)->setSide(camp::IN); (yyval.j) = (yyvsp[(1) - (2)].j); (yyval.j)->pushBack((yyvsp[(2) - (2)].se)); ;} break; - case 164: -#line 547 "camp.y" + case 165: + +/* Line 1455 of yacc.c */ +#line 549 "camp.y" { (yyvsp[(1) - (3)].se)->setSide(camp::OUT); (yyvsp[(3) - (3)].se)->setSide(camp::IN); (yyval.j) = (yyvsp[(2) - (3)].j); (yyval.j)->pushFront((yyvsp[(1) - (3)].se)); (yyval.j)->pushBack((yyvsp[(3) - (3)].se)); ;} break; - case 165: -#line 552 "camp.y" + case 166: + +/* Line 1455 of yacc.c */ +#line 554 "camp.y" { (yyval.se) = new specExp((yyvsp[(2) - (4)].ps).pos, (yyvsp[(2) - (4)].ps).sym, (yyvsp[(3) - (4)].e)); ;} break; - case 166: -#line 553 "camp.y" + case 167: + +/* Line 1455 of yacc.c */ +#line 555 "camp.y" { (yyval.se) = new specExp((yyvsp[(1) - (3)].pos), symbol::opTrans("spec"), (yyvsp[(2) - (3)].e)); ;} break; - case 167: -#line 555 "camp.y" + case 168: + +/* Line 1455 of yacc.c */ +#line 557 "camp.y" { (yyval.se) = new specExp((yyvsp[(1) - (5)].pos), symbol::opTrans("spec"), new pairExp((yyvsp[(3) - (5)].pos), (yyvsp[(2) - (5)].e), (yyvsp[(4) - (5)].e))); ;} break; - case 168: -#line 558 "camp.y" + case 169: + +/* Line 1455 of yacc.c */ +#line 560 "camp.y" { (yyval.se) = new specExp((yyvsp[(1) - (7)].pos), symbol::opTrans("spec"), new tripleExp((yyvsp[(3) - (7)].pos), (yyvsp[(2) - (7)].e), (yyvsp[(4) - (7)].e), (yyvsp[(6) - (7)].e))); ;} break; - case 169: -#line 563 "camp.y" - { (yyval.j) = new joinExp((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} - break; - case 170: + +/* Line 1455 of yacc.c */ #line 565 "camp.y" - { (yyval.j) = new joinExp((yyvsp[(1) - (3)].ps).pos, (yyvsp[(1) - (3)].ps).sym); (yyval.j)->pushBack((yyvsp[(2) - (3)].e)); ;} + { (yyval.j) = new joinExp((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; case 171: + +/* Line 1455 of yacc.c */ #line 567 "camp.y" { (yyval.j) = new joinExp((yyvsp[(1) - (3)].ps).pos, (yyvsp[(1) - (3)].ps).sym); (yyval.j)->pushBack((yyvsp[(2) - (3)].e)); ;} break; case 172: -#line 568 "camp.y" - { (yyval.j) = new joinExp((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} + +/* Line 1455 of yacc.c */ +#line 569 "camp.y" + { (yyval.j) = new joinExp((yyvsp[(1) - (3)].ps).pos, (yyvsp[(1) - (3)].ps).sym); (yyval.j)->pushBack((yyvsp[(2) - (3)].e)); ;} break; case 173: -#line 569 "camp.y" + +/* Line 1455 of yacc.c */ +#line 570 "camp.y" { (yyval.j) = new joinExp((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; case 174: -#line 573 "camp.y" + +/* Line 1455 of yacc.c */ +#line 571 "camp.y" + { (yyval.j) = new joinExp((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} + break; + + case 175: + +/* Line 1455 of yacc.c */ +#line 575 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), (yyvsp[(1) - (2)].ps).sym, new booleanExp((yyvsp[(1) - (2)].ps).pos, false)); ;} break; - case 175: -#line 576 "camp.y" + case 176: + +/* Line 1455 of yacc.c */ +#line 578 "camp.y" { (yyval.e) = new ternaryExp((yyvsp[(1) - (4)].ps).pos, (yyvsp[(2) - (4)].e), (yyvsp[(1) - (4)].ps).sym, (yyvsp[(4) - (4)].e), new booleanExp((yyvsp[(1) - (4)].ps).pos, false)); ;} break; - case 176: -#line 579 "camp.y" + case 177: + +/* Line 1455 of yacc.c */ +#line 581 "camp.y" { (yyval.e) = new binaryExp((yyvsp[(1) - (3)].ps).pos, (yyvsp[(3) - (3)].e), (yyvsp[(1) - (3)].ps).sym, new booleanExp((yyvsp[(2) - (3)].ps).pos, true)); ;} break; - case 177: -#line 582 "camp.y" + case 178: + +/* Line 1455 of yacc.c */ +#line 584 "camp.y" { (yyval.e) = new ternaryExp((yyvsp[(1) - (5)].ps).pos, (yyvsp[(3) - (5)].e), (yyvsp[(1) - (5)].ps).sym, (yyvsp[(5) - (5)].e), new booleanExp((yyvsp[(2) - (5)].ps).pos, true)); ;} break; - case 178: -#line 587 "camp.y" - { (yyval.e) = new unaryExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), (yyvsp[(1) - (2)].ps).sym); ;} - break; - case 179: + +/* Line 1455 of yacc.c */ #line 589 "camp.y" - { (yyval.e) = new binaryExp((yyvsp[(1) - (4)].ps).pos, (yyvsp[(2) - (4)].e), (yyvsp[(1) - (4)].ps).sym, (yyvsp[(4) - (4)].e)); ;} + { (yyval.e) = new unaryExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), (yyvsp[(1) - (2)].ps).sym); ;} break; case 180: -#line 593 "camp.y" - { (yyval.s) = new emptyStm((yyvsp[(1) - (1)].pos)); ;} + +/* Line 1455 of yacc.c */ +#line 591 "camp.y" + { (yyval.e) = new binaryExp((yyvsp[(1) - (4)].ps).pos, (yyvsp[(2) - (4)].e), (yyvsp[(1) - (4)].ps).sym, (yyvsp[(4) - (4)].e)); ;} break; case 181: -#line 594 "camp.y" - { (yyval.s) = (yyvsp[(1) - (1)].s); ;} + +/* Line 1455 of yacc.c */ +#line 595 "camp.y" + { (yyval.s) = new emptyStm((yyvsp[(1) - (1)].pos)); ;} break; case 182: -#line 595 "camp.y" - { (yyval.s) = (yyvsp[(1) - (2)].s); ;} + +/* Line 1455 of yacc.c */ +#line 596 "camp.y" + { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; case 183: + +/* Line 1455 of yacc.c */ #line 597 "camp.y" - { (yyval.s) = new ifStm((yyvsp[(1) - (5)].pos), (yyvsp[(3) - (5)].e), (yyvsp[(5) - (5)].s)); ;} + { (yyval.s) = (yyvsp[(1) - (2)].s); ;} break; case 184: + +/* Line 1455 of yacc.c */ #line 599 "camp.y" - { (yyval.s) = new ifStm((yyvsp[(1) - (7)].pos), (yyvsp[(3) - (7)].e), (yyvsp[(5) - (7)].s), (yyvsp[(7) - (7)].s)); ;} + { (yyval.s) = new ifStm((yyvsp[(1) - (5)].pos), (yyvsp[(3) - (5)].e), (yyvsp[(5) - (5)].s)); ;} break; case 185: + +/* Line 1455 of yacc.c */ #line 601 "camp.y" - { (yyval.s) = new whileStm((yyvsp[(1) - (5)].pos), (yyvsp[(3) - (5)].e), (yyvsp[(5) - (5)].s)); ;} + { (yyval.s) = new ifStm((yyvsp[(1) - (7)].pos), (yyvsp[(3) - (7)].e), (yyvsp[(5) - (7)].s), (yyvsp[(7) - (7)].s)); ;} break; case 186: + +/* Line 1455 of yacc.c */ #line 603 "camp.y" - { (yyval.s) = new doStm((yyvsp[(1) - (7)].pos), (yyvsp[(2) - (7)].s), (yyvsp[(5) - (7)].e)); ;} + { (yyval.s) = new whileStm((yyvsp[(1) - (5)].pos), (yyvsp[(3) - (5)].e), (yyvsp[(5) - (5)].s)); ;} break; case 187: + +/* Line 1455 of yacc.c */ #line 605 "camp.y" - { (yyval.s) = new forStm((yyvsp[(1) - (9)].pos), (yyvsp[(3) - (9)].run), (yyvsp[(5) - (9)].e), (yyvsp[(7) - (9)].sel), (yyvsp[(9) - (9)].s)); ;} + { (yyval.s) = new doStm((yyvsp[(1) - (7)].pos), (yyvsp[(2) - (7)].s), (yyvsp[(5) - (7)].e)); ;} break; case 188: + +/* Line 1455 of yacc.c */ #line 607 "camp.y" - { (yyval.s) = new extendedForStm((yyvsp[(1) - (8)].pos), (yyvsp[(3) - (8)].t), (yyvsp[(4) - (8)].ps).sym, (yyvsp[(6) - (8)].e), (yyvsp[(8) - (8)].s)); ;} + { (yyval.s) = new forStm((yyvsp[(1) - (9)].pos), (yyvsp[(3) - (9)].run), (yyvsp[(5) - (9)].e), (yyvsp[(7) - (9)].sel), (yyvsp[(9) - (9)].s)); ;} break; case 189: -#line 608 "camp.y" - { (yyval.s) = new breakStm((yyvsp[(1) - (2)].pos)); ;} + +/* Line 1455 of yacc.c */ +#line 609 "camp.y" + { (yyval.s) = new extendedForStm((yyvsp[(1) - (8)].pos), (yyvsp[(3) - (8)].t), (yyvsp[(4) - (8)].ps).sym, (yyvsp[(6) - (8)].e), (yyvsp[(8) - (8)].s)); ;} break; case 190: -#line 609 "camp.y" - { (yyval.s) = new continueStm((yyvsp[(1) - (2)].pos)); ;} + +/* Line 1455 of yacc.c */ +#line 610 "camp.y" + { (yyval.s) = new breakStm((yyvsp[(1) - (2)].pos)); ;} break; case 191: -#line 610 "camp.y" - { (yyval.s) = new returnStm((yyvsp[(1) - (2)].pos)); ;} + +/* Line 1455 of yacc.c */ +#line 611 "camp.y" + { (yyval.s) = new continueStm((yyvsp[(1) - (2)].pos)); ;} break; case 192: -#line 611 "camp.y" - { (yyval.s) = new returnStm((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 612 "camp.y" + { (yyval.s) = new returnStm((yyvsp[(1) - (2)].pos)); ;} break; case 193: -#line 615 "camp.y" - { (yyval.s) = new expStm((yyvsp[(1) - (1)].e)->getPos(), (yyvsp[(1) - (1)].e)); ;} + +/* Line 1455 of yacc.c */ +#line 613 "camp.y" + { (yyval.s) = new returnStm((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].e)); ;} break; case 194: -#line 619 "camp.y" - { (yyval.s) = new blockStm((yyvsp[(1) - (1)].b)->getPos(), (yyvsp[(1) - (1)].b)); ;} + +/* Line 1455 of yacc.c */ +#line 617 "camp.y" + { (yyval.s) = new expStm((yyvsp[(1) - (1)].e)->getPos(), (yyvsp[(1) - (1)].e)); ;} break; case 195: -#line 623 "camp.y" - { (yyval.run) = 0; ;} + +/* Line 1455 of yacc.c */ +#line 621 "camp.y" + { (yyval.s) = new blockStm((yyvsp[(1) - (1)].b)->getPos(), (yyvsp[(1) - (1)].b)); ;} break; case 196: -#line 624 "camp.y" - { (yyval.run) = (yyvsp[(1) - (1)].sel); ;} + +/* Line 1455 of yacc.c */ +#line 625 "camp.y" + { (yyval.run) = 0; ;} break; case 197: -#line 625 "camp.y" - { (yyval.run) = (yyvsp[(1) - (1)].vd); ;} + +/* Line 1455 of yacc.c */ +#line 626 "camp.y" + { (yyval.run) = (yyvsp[(1) - (1)].sel); ;} break; case 198: -#line 629 "camp.y" - { (yyval.e) = 0; ;} + +/* Line 1455 of yacc.c */ +#line 627 "camp.y" + { (yyval.run) = (yyvsp[(1) - (1)].vd); ;} break; case 199: -#line 630 "camp.y" - { (yyval.e) = (yyvsp[(1) - (1)].e); ;} + +/* Line 1455 of yacc.c */ +#line 631 "camp.y" + { (yyval.e) = 0; ;} break; case 200: -#line 634 "camp.y" - { (yyval.sel) = 0; ;} + +/* Line 1455 of yacc.c */ +#line 632 "camp.y" + { (yyval.e) = (yyvsp[(1) - (1)].e); ;} break; case 201: -#line 635 "camp.y" - { (yyval.sel) = (yyvsp[(1) - (1)].sel); ;} + +/* Line 1455 of yacc.c */ +#line 636 "camp.y" + { (yyval.sel) = 0; ;} break; case 202: -#line 639 "camp.y" - { (yyval.sel) = new stmExpList((yyvsp[(1) - (1)].s)->getPos()); (yyval.sel)->add((yyvsp[(1) - (1)].s)); ;} + +/* Line 1455 of yacc.c */ +#line 637 "camp.y" + { (yyval.sel) = (yyvsp[(1) - (1)].sel); ;} break; case 203: + +/* Line 1455 of yacc.c */ #line 641 "camp.y" + { (yyval.sel) = new stmExpList((yyvsp[(1) - (1)].s)->getPos()); (yyval.sel)->add((yyvsp[(1) - (1)].s)); ;} + break; + + case 204: + +/* Line 1455 of yacc.c */ +#line 643 "camp.y" { (yyval.sel) = (yyvsp[(1) - (3)].sel); (yyval.sel)->add((yyvsp[(3) - (3)].s)); ;} break; -/* Line 1267 of yacc.c. */ -#line 3303 "camp.tab.c" + +/* Line 1455 of yacc.c */ +#line 3687 "camp.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -3310,7 +3694,6 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -3375,7 +3758,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -3392,7 +3775,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -3449,9 +3832,6 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -3476,7 +3856,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -3487,7 +3867,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered diff --git a/Build/source/utils/asymptote/camp.tab.h b/Build/source/utils/asymptote/camp.tab.h index a6a8b4464e9..bf0b8a9ce50 100644 --- a/Build/source/utils/asymptote/camp.tab.h +++ b/Build/source/utils/asymptote/camp.tab.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -102,76 +102,16 @@ EXP_IN_PARENS_RULE = 318 }; #endif -/* Tokens. */ -#define ID 258 -#define ADD 259 -#define SUBTRACT 260 -#define TIMES 261 -#define DIVIDE 262 -#define MOD 263 -#define EXPONENT 264 -#define DOTS 265 -#define COLONS 266 -#define DASHES 267 -#define INCR 268 -#define LONGDASH 269 -#define CONTROLS 270 -#define TENSION 271 -#define ATLEAST 272 -#define CURL 273 -#define COR 274 -#define CAND 275 -#define BAR 276 -#define AMPERSAND 277 -#define EQ 278 -#define NEQ 279 -#define LT 280 -#define LE 281 -#define GT 282 -#define GE 283 -#define CARETS 284 -#define LOGNOT 285 -#define OPERATOR 286 -#define STRING 287 -#define LOOSE 288 -#define ASSIGN 289 -#define DIRTAG 290 -#define JOIN_PREC 291 -#define AND 292 -#define ELLIPSIS 293 -#define ACCESS 294 -#define UNRAVEL 295 -#define IMPORT 296 -#define INCLUDE 297 -#define FROM 298 -#define QUOTE 299 -#define STRUCT 300 -#define TYPEDEF 301 -#define NEW 302 -#define IF 303 -#define ELSE 304 -#define WHILE 305 -#define DO 306 -#define FOR 307 -#define BREAK 308 -#define CONTINUE 309 -#define RETURN_ 310 -#define THIS 311 -#define EXPLICIT 312 -#define GARBAGE 313 -#define LIT 314 -#define PERM 315 -#define MODIFIER 316 -#define UNARY 317 -#define EXP_IN_PARENS_RULE 318 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 46 "camp.y" { + +/* Line 1676 of yacc.c */ +#line 46 "camp.y" + position pos; bool boo; struct { @@ -215,14 +155,17 @@ typedef union YYSTYPE //absyntax::funheader *fh; absyntax::formal *fl; absyntax::formals *fls; -} -/* Line 1489 of yacc.c. */ -#line 221 "camp.tab.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 163 "camp.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE yylval; + diff --git a/Build/source/utils/asymptote/camp.y b/Build/source/utils/asymptote/camp.y index f257812b068..a3b199ebd61 100644 --- a/Build/source/utils/asymptote/camp.y +++ b/Build/source/utils/asymptote/camp.y @@ -192,6 +192,8 @@ bareblock: name: ID { $$ = new simpleName($1.pos, $1.sym); } | name '.' ID { $$ = new qualifiedName($2, $1, $3.sym); } +| '%' { $$ = new simpleName($1.pos, + symbol::trans("operator answer")); } ; runnable: diff --git a/Build/source/utils/asymptote/common.h b/Build/source/utils/asymptote/common.h index 347e7cd1b8d..16b9d57d567 100644 --- a/Build/source/utils/asymptote/common.h +++ b/Build/source/utils/asymptote/common.h @@ -10,12 +10,19 @@ #include <iostream> #include <climits> +#ifdef __CYGWIN__ +#undef LONG_LONG_MAX +#define LONG_LONG_MAX __LONG_LONG_MAX__ +#undef LONG_LONG_MIN +#define LONG_LONG_MIN (-LONG_LONG_MAX-1) +#endif + #ifdef HAVE_CONFIG_H #include "config.h" #endif -#if defined(HAVE_LIBGLU) && defined(HAVE_LIBGLUT) -#define HAVE_LIBGL +#if defined(HAVE_LIBGL) && defined(HAVE_LIBGLU) && defined(HAVE_LIBGLUT) +#define HAVE_GL #endif #ifdef HAVE_LIBPTHREAD diff --git a/Build/source/utils/asymptote/config.h.in b/Build/source/utils/asymptote/config.h.in index e5036c57291..490f137e7bf 100644 --- a/Build/source/utils/asymptote/config.h.in +++ b/Build/source/utils/asymptote/config.h.in @@ -45,6 +45,9 @@ /* Define to 1 if you have the `fftw3' library (-lfftw3). */ #undef HAVE_LIBFFTW3 +/* Define to 1 if you have the `GL' library (-lGL). */ +#undef HAVE_LIBGL + /* Define to 1 if you have the `GLU' library (-lGLU). */ #undef HAVE_LIBGLU diff --git a/Build/source/utils/asymptote/configure b/Build/source/utils/asymptote/configure index e8552fac8df..6e9d0c7fa67 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.88. +# Generated by GNU Autoconf 2.63 for Asymptote 1.93. # # 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.88' -PACKAGE_STRING='Asymptote 1.88' +PACKAGE_VERSION='1.93' +PACKAGE_STRING='Asymptote 1.93' PACKAGE_BUGREPORT='http://sourceforge.net/projects/asymptote' # Factoring default headers for most tests. @@ -1294,7 +1294,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Asymptote 1.88 to adapt to many kinds of systems. +\`configure' configures Asymptote 1.93 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1355,7 +1355,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Asymptote 1.88:";; + short | recursive ) echo "Configuration of Asymptote 1.93:";; esac cat <<\_ACEOF @@ -1465,7 +1465,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Asymptote configure 1.88 +Asymptote configure 1.93 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1479,7 +1479,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Asymptote $as_me 1.88, which was +It was created by Asymptote $as_me 1.93, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -4023,7 +4023,7 @@ fi test -n "$TEXI2DVI" && break done -test -n "$TEXI2DVI" || TEXI2DVI="echo texi2dvi is missing! Please put http://asymptote.sourceforge.net/asymptote.pdf in the doc directory; exit -1;" +test -n "$TEXI2DVI" || TEXI2DVI="echo texi2dvi is missing! Please put http://asymptote.sourceforge.net/asymptote.pdf in the doc directory and touch doc/asymptote.pdf; exit 1;" @@ -6725,7 +6725,7 @@ fi ;; *) GCDIR=$ac_cv_use_gc - GCOPTIONS="--disable-shared " + GCOPTIONS="--disable-shared --enable-large-config" { $as_echo "$as_me:$LINENO: enabling local $GCNAME $GCDIR" >&5 $as_echo "$as_me: enabling local $GCNAME $GCDIR" >&6;} GCLIB="\$(GC)/.libs/libgc.a" @@ -8798,10 +8798,155 @@ cat >>confdefs.h <<\_ACEOF #define HAVE_LIBGLUT 1 _ACEOF - LIBS=$LIBS"-lfreeglut -lopengl32 " + LIBS=$LIBS"-lfreeglut " else - { $as_echo "$as_me:$LINENO: *** Could not find freeglut: will compile without OpenGL support ***" >&5 -$as_echo "$as_me: *** Could not find freeglut: will compile without OpenGL support ***" >&6;} + { $as_echo "$as_me:$LINENO: *** Could not find libfreeglut: will compile without OpenGL support ***" >&5 +$as_echo "$as_me: *** Could not find libfreeglut: will compile without OpenGL support ***" >&6;} +fi + + + if test "${ac_cv_header_GL_gl_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for GL/gl.h" >&5 +$as_echo_n "checking for GL/gl.h... " >&6; } +if test "${ac_cv_header_GL_gl_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_GL_gl_h" >&5 +$as_echo "$ac_cv_header_GL_gl_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking GL/gl.h usability" >&5 +$as_echo_n "checking GL/gl.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <GL/gl.h> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +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_compile") 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_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking GL/gl.h presence" >&5 +$as_echo_n "checking GL/gl.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <GL/gl.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +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_cpp conftest.$ac_ext") 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); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: GL/gl.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: GL/gl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: GL/gl.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: GL/gl.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: GL/gl.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: GL/gl.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: GL/gl.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: GL/gl.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: GL/gl.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: GL/gl.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: GL/gl.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: GL/gl.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: GL/gl.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: GL/gl.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: GL/gl.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: GL/gl.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------------------------------- ## +## Report this to http://sourceforge.net/projects/asymptote ## +## -------------------------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for GL/gl.h" >&5 +$as_echo_n "checking for GL/gl.h... " >&6; } +if test "${ac_cv_header_GL_gl_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_header_GL_gl_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_GL_gl_h" >&5 +$as_echo "$ac_cv_header_GL_gl_h" >&6; } + +fi +if test "x$ac_cv_header_GL_gl_h" = x""yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBGL 1 +_ACEOF + + LIBS=$LIBS"-lopengl32 " +else + { $as_echo "$as_me:$LINENO: *** Could not find libopengl32: will compile without OpenGL support ***" >&5 +$as_echo "$as_me: *** Could not find libopengl32: will compile without OpenGL support ***" >&6;} fi @@ -8882,7 +9027,289 @@ $as_echo "$as_me: *** Could not find libglu32: will compile without OpenGL suppo fi ;; - darwin*) if test "${ac_cv_header_GLUT_glut_h+set}" = set; then + darwin*) if test "${ac_cv_header_OpenGL_gl_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for OpenGL/gl.h" >&5 +$as_echo_n "checking for OpenGL/gl.h... " >&6; } +if test "${ac_cv_header_OpenGL_gl_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_OpenGL_gl_h" >&5 +$as_echo "$ac_cv_header_OpenGL_gl_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking OpenGL/gl.h usability" >&5 +$as_echo_n "checking OpenGL/gl.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <OpenGL/gl.h> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +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_compile") 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_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking OpenGL/gl.h presence" >&5 +$as_echo_n "checking OpenGL/gl.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <OpenGL/gl.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +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_cpp conftest.$ac_ext") 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); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/gl.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: OpenGL/gl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/gl.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: OpenGL/gl.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/gl.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: OpenGL/gl.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/gl.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: OpenGL/gl.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/gl.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: OpenGL/gl.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/gl.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: OpenGL/gl.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/gl.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: OpenGL/gl.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/gl.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: OpenGL/gl.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------------------------------- ## +## Report this to http://sourceforge.net/projects/asymptote ## +## -------------------------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for OpenGL/gl.h" >&5 +$as_echo_n "checking for OpenGL/gl.h... " >&6; } +if test "${ac_cv_header_OpenGL_gl_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_header_OpenGL_gl_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_OpenGL_gl_h" >&5 +$as_echo "$ac_cv_header_OpenGL_gl_h" >&6; } + +fi +if test "x$ac_cv_header_OpenGL_gl_h" = x""yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBGL 1 +_ACEOF + +fi + + + if test "${ac_cv_header_OpenGL_glu_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for OpenGL/glu.h" >&5 +$as_echo_n "checking for OpenGL/glu.h... " >&6; } +if test "${ac_cv_header_OpenGL_glu_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_OpenGL_glu_h" >&5 +$as_echo "$ac_cv_header_OpenGL_glu_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking OpenGL/glu.h usability" >&5 +$as_echo_n "checking OpenGL/glu.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <OpenGL/glu.h> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +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_compile") 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_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking OpenGL/glu.h presence" >&5 +$as_echo_n "checking OpenGL/glu.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <OpenGL/glu.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +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_cpp conftest.$ac_ext") 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); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/glu.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: OpenGL/glu.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/glu.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: OpenGL/glu.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/glu.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: OpenGL/glu.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/glu.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: OpenGL/glu.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/glu.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: OpenGL/glu.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/glu.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: OpenGL/glu.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/glu.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: OpenGL/glu.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: OpenGL/glu.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: OpenGL/glu.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## -------------------------------------------------------- ## +## Report this to http://sourceforge.net/projects/asymptote ## +## -------------------------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for OpenGL/glu.h" >&5 +$as_echo_n "checking for OpenGL/glu.h... " >&6; } +if test "${ac_cv_header_OpenGL_glu_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_header_OpenGL_glu_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_OpenGL_glu_h" >&5 +$as_echo "$ac_cv_header_OpenGL_glu_h" >&6; } + +fi +if test "x$ac_cv_header_OpenGL_glu_h" = x""yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBGLU 1 +_ACEOF + +fi + + + if test "${ac_cv_header_GLUT_glut_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for GLUT/glut.h" >&5 $as_echo_n "checking for GLUT/glut.h... " >&6; } if test "${ac_cv_header_GLUT_glut_h+set}" = set; then @@ -9020,11 +9447,6 @@ cat >>confdefs.h <<\_ACEOF #define HAVE_LIBGLUT 1 _ACEOF - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBGLU 1 -_ACEOF - cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9244,6 +9666,81 @@ else $as_echo "$as_me: *** Could not find libGLU: will compile without OpenGL support ***" >&6;} fi + +{ $as_echo "$as_me:$LINENO: checking for glDepthMask in -lGL" >&5 +$as_echo_n "checking for glDepthMask in -lGL... " >&6; } +if test "${ac_cv_lib_GL_glDepthMask+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lGL $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 glDepthMask (); +int +main () +{ +return glDepthMask (); + ; + 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_GL_glDepthMask=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_GL_glDepthMask=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_GL_glDepthMask" >&5 +$as_echo "$ac_cv_lib_GL_glDepthMask" >&6; } +if test "x$ac_cv_lib_GL_glDepthMask" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGL 1 +_ACEOF + + LIBS="-lGL $LIBS" + +fi + esac fi @@ -11522,7 +12019,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.88, which was +This file was extended by Asymptote $as_me 1.93, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11581,7 +12078,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -Asymptote config.status 1.88 +Asymptote config.status 1.93 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 0801123a961..d8bc1bd75c7 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.88],[http://sourceforge.net/projects/asymptote]) +AC_INIT([Asymptote],[1.93],[http://sourceforge.net/projects/asymptote]) VERSION=$PACKAGE_VERSION AC_SUBST(VERSION) @@ -51,7 +51,7 @@ fi ]) AC_CHECK_PROGS(TEXI2DVI,[texi2dvi texi2dvi4a2ps], -[echo texi2dvi is missing! Please put http://asymptote.sourceforge.net/asymptote.pdf in the doc directory; exit -1;]) +[echo texi2dvi is missing! Please put http://asymptote.sourceforge.net/asymptote.pdf in the doc directory and touch doc/asymptote.pdf; exit 1;]) AC_SUBST(TEXI2DVI) @@ -162,7 +162,7 @@ if test "x$ac_cv_use_gc" != "xno" ; then ;; *) GCDIR=$ac_cv_use_gc - GCOPTIONS="--disable-shared " + GCOPTIONS="--disable-shared --enable-large-config" AC_MSG_NOTICE([enabling local $GCNAME $GCDIR]) GCLIB="\$(GC)/.libs/libgc.a" INCL="-I\$(GC)/include" @@ -252,7 +252,7 @@ AC_ARG_ENABLE(gsl, if test "x$enable_gsl" != "xno"; then AC_CHECK_HEADER(gsl/gsl_sf.h, AC_CHECK_LIB([gsl], gsl_sf_debye_6, [AC_DEFINE(HAVE_LIBGSL, 1, - [Define to 1 if you have the `gsl' library (-lgsl). ]) LIBS=$LIBS"-lgsl -lgslcblas "], + [Define to 1 if you have the `gsl' library (-lgsl).]) LIBS=$LIBS"-lgsl -lgslcblas "], AC_MSG_NOTICE([*** Could not find libgsl: will compile without optional special functions. ***]),[-lgslcblas]), AC_MSG_NOTICE([*** Header file gsl_sf.h not found: will compile without optional special functions. ***])) fi @@ -275,17 +275,26 @@ case "$OSTYPE" in cygwin) AC_CHECK_HEADER(GL/glut.h, [AC_DEFINE(HAVE_LIBGLUT, 1, [Define if you have the `freeglut' library (-lfreeglut).]) - LIBS=$LIBS"-lfreeglut -lopengl32 "], - AC_MSG_NOTICE([*** Could not find freeglut: will compile without OpenGL support ***])) + LIBS=$LIBS"-lfreeglut "], + AC_MSG_NOTICE([*** Could not find libfreeglut: will compile without OpenGL support ***])) + AC_CHECK_HEADER(GL/gl.h, + [AC_DEFINE(HAVE_LIBGL, 1, + [Define if you have the `opengl32' library (-lopengl32).]) + LIBS=$LIBS"-lopengl32 "], + AC_MSG_NOTICE([*** Could not find libopengl32: will compile without OpenGL support ***])) AC_CHECK_LIB([GLU], [gluNewNurbsRenderer],[AC_DEFINE(HAVE_LIBGLU, 1, - [Define to 1 if you have the `glu32' library (-lglu32). ]) LIBS=$LIBS"-lglu32 "], + [Define to 1 if you have the `glu32' library (-lglu32).]) LIBS=$LIBS"-lglu32 "], AC_MSG_NOTICE([*** Could not find libglu32: will compile without OpenGL support ***])) ;; - darwin*) AC_CHECK_HEADER(GLUT/glut.h, + darwin*) AC_CHECK_HEADER(OpenGL/gl.h, + [AC_DEFINE(HAVE_LIBGL, 1, + [Define if you have the `OpenGL' library.])]) + AC_CHECK_HEADER(OpenGL/glu.h, + [AC_DEFINE(HAVE_LIBGLU, 1, + [Define if you have the `GLU' library.])]) + AC_CHECK_HEADER(GLUT/glut.h, [AC_DEFINE(HAVE_LIBGLUT, 1, - [Define if you have the `glut' library (-lglut).]) - AC_DEFINE(HAVE_LIBGLU, 1, - [Define to 1 if you have the 'GLU' library. ]) + [Define if you have the `GLUT' library.]) AC_COMPILE_IFELSE(AC_LANG_PROGRAM([ #include <OpenGL/gl.h> #include <OpenGL/glu.h> @@ -303,6 +312,7 @@ void f(void) { AC_MSG_NOTICE([*** Could not find libglut: will compile without OpenGL support ***])) AC_CHECK_LIB([GLU], [gluNewNurbsRenderer],, AC_MSG_NOTICE([*** Could not find libGLU: will compile without OpenGL support ***])) + AC_CHECK_LIB([GL], [glDepthMask]) esac fi diff --git a/Build/source/utils/asymptote/doc/FAQ/install-sh b/Build/source/utils/asymptote/doc/FAQ/install-sh index 3f83ce9b555..6781b987bdb 100755 --- a/Build/source/utils/asymptote/doc/FAQ/install-sh +++ b/Build/source/utils/asymptote/doc/FAQ/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2010-02-06.18; # UTC +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 @@ -200,11 +200,7 @@ if test $# -eq 0; then fi if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 + trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. diff --git a/Build/source/utils/asymptote/doc/asy.1 b/Build/source/utils/asymptote/doc/asy.1 index ea02a81a622..e5ff5977db3 100644 --- a/Build/source/utils/asymptote/doc/asy.1 +++ b/Build/source/utils/asymptote/doc/asy.1 @@ -109,9 +109,6 @@ Show summary of options; command-line only. .B \-historylines n Retain n lines of history [1000]. .TP -.B \-hyperrefOptions str -LaTeX hyperref package options [setpagesize=false,unicode]. -.TP .B \-iconify Iconify rendering window [false]. .TP @@ -220,6 +217,9 @@ Scroll standard output n lines at a time [0]. .B \-spinstep deg/sec Spin speed [60]. .TP +.B \-svgemulation +Emulate unimplemented SVG shading [false]. +.TP .B \-tabcompletion Interactive prompt auto-completion [true]. .TP diff --git a/Build/source/utils/asymptote/doc/asymptote.sty b/Build/source/utils/asymptote/doc/asymptote.sty index ee4de194f36..4dc89de1e52 100644 --- a/Build/source/utils/asymptote/doc/asymptote.sty +++ b/Build/source/utils/asymptote/doc/asymptote.sty @@ -3,7 +3,7 @@ %%% Modified by John Bowman %%% Adapted from comment.sty (Under GPL v2+) -\ProvidesPackage{asymptote}[2009/08/15 v1.10 Asymptote style file for LaTeX] +\ProvidesPackage{asymptote}[2010/04/15 v1.12 Asymptote style file for LaTeX] \RequirePackage{keyval} \RequirePackage{ifthen} \newif\ifASYinline @@ -51,13 +51,13 @@ \fi \fi \ifx\XeTeXversion\undefined -\else -\ASYPDFtrue -\immediate\write\AsyStream{settings.texcommand="xelatex";}% -\fi \ifASYPDF \immediate\write\AsyStream{settings.tex="pdflatex";}% \fi +\else +\immediate\write\AsyStream{settings.tex="xelatex";}% +\ASYPDFtrue +\fi \ifASYinline \immediate\write\AsyStream{settings.inlinetex=true;}% @@ -267,6 +267,26 @@ \fi% } +% Work around bug in dvips.def: allow spaces in file names. +\def\Ginclude@eps#1{% + \message{<#1>}% + \bgroup + \def\@tempa{!}% + \dimen@\Gin@req@width + \dimen@ii.1bp% + \divide\dimen@\dimen@ii + \@tempdima\Gin@req@height + \divide\@tempdima\dimen@ii + \special{PSfile=#1\space + llx=\Gin@llx\space + lly=\Gin@lly\space + urx=\Gin@urx\space + ury=\Gin@ury\space + \ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\space\fi + \ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\space\fi + \ifGin@clip clip\fi}% + \egroup} + \def\Asymptote{{\tt Asymptote}} %%% Local Variables: diff --git a/Build/source/utils/asymptote/doc/asymptote.texi b/Build/source/utils/asymptote/doc/asymptote.texi index dcb39303f9b..409cf49447e 100644 --- a/Build/source/utils/asymptote/doc/asymptote.texi +++ b/Build/source/utils/asymptote/doc/asymptote.texi @@ -484,7 +484,7 @@ configuration variables @code{paperwidth} and @code{paperheight}. @cindex @code{texpath} @cindex @code{texcommand} @cindex @code{dvips} -@cindex @code{dvisvg} +@cindex @code{dvisvgm} @cindex @code{convert} @cindex @code{display} @cindex @code{animate} @@ -494,7 +494,7 @@ The following configuration variables normally do not require adjustment: texpath texcommand dvips -dvisvg +dvisvgm convert display animate @@ -592,12 +592,12 @@ If your graphics card supports multisampling, we recommend using version (@code{MacOS X} users can skip this step since @code{Asymptote} is configured to use the native glut library on that platform). Download @quotation -@url{http://prdownloads.sourceforge.net/freeglut/freeglut-2.6.0-rc1.tar.gz} +@url{http://prdownloads.sourceforge.net/freeglut/freeglut-2.6.0.tar.gz} @end quotation @noindent and type (as the root user): @verbatim -tar -zxf freeglut-2.6.0-rc1.tar.gz +tar -zxf freeglut-2.6.0.tar.gz cd freeglut-2.6.0 ./configure --prefix=/usr make install @@ -1335,7 +1335,8 @@ void tensorshade(picture pic=currentpicture, path g, bool stroke=false, One can also smoothly shade the regions between consecutive paths of a sequence using a given array of pens: @verbatim -void draw(picture pic=currentpicture, path[] g, pen[] p); +void draw(picture pic=currentpicture, pen fillrule=currentpen, path[] g, + pen[] p); @end verbatim @noindent Illustrations of tensor product and Coons shading are provided in the @@ -2058,9 +2059,10 @@ string pairs @{@code{before},@code{after}@} to the corresponding string @code{after}; @cindex @code{split} -@item string[] split(string s, string delimiter=" ") +@item string[] split(string s, string delimiter="") returns an array of strings obtained by splitting @code{s} into substrings -delimited by @code{delimiter}; +delimited by @code{delimiter} (an empty delimiter signifies a space, +but with duplicate delimiters discarded); @anchor{format} @item string format(string s, int n) @@ -2138,14 +2140,19 @@ time(seconds()-24*60*60); @end verbatim @cindex @code{abort} -@item void abort(string s) +@item void abort(string s="") aborts execution (with a non-zero return code in batch mode); if string @code{s} is nonempty, a diagnostic message constructed from the source file, line number, and @code{s} is printed; +@cindex @code{assert} +@item void assert(bool b, string s="") +aborts execution with an error message constructed from @code{s} if +@code{b=false}; + @cindex @code{exit} @item void exit() -exits with a zero error return code in batch mode; +exits (with a zero error return code in batch mode); @cindex @code{sleep} @item void sleep(int seconds) @@ -2394,8 +2401,7 @@ paths @code{p} and @code{q} as a sorted array of real arrays of length 2 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, - real fuzz=-1); +@item real[] intersections(path p, explicit pair a, explicit pair b, real fuzz=-1); 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 @@ -2712,6 +2718,10 @@ the routine @verbatim pen rgb(string s); @end verbatim +@noindent +A pen can be converted to a hexidecimal string with +@cindex @code{hex} +@item string hex(pen p); Various shades and mixtures of the grayscale primary colors @code{black} and @code{white}, @acronym{RGB} primary colors @@ -2761,14 +2771,14 @@ write(q.h,q.s,q.v); // 180 0.5 0.75 @end verbatim @item Line types are specified with the function -@code{pen linetype(string s, real offset=0, bool scale=true, bool adjust=true)}, +@code{pen linetype(real[] a, real offset=0, bool scale=true, bool adjust=true)}, @cindex @code{solid} @cindex @code{dashed} @cindex @code{dotted} @cindex @code{longdashed} @cindex @code{dashdotted} @cindex @code{longdashdotted} -where @code{s} is a string of integer or real numbers separated by spaces. +where @code{a} is an array of real array numbers. The optional parameter @code{offset} specifies where in the pattern to begin. The first number specifies how far (if @code{scale} is @code{true}, in units of the pen line width; otherwise in @@ -2778,12 +2788,12 @@ specifies how far to draw with the pen off, and so on. If adjusted by @code{Asymptote} to fit the arclength of the path. Here are the predefined line types: @verbatim -pen solid=linetype(""); -pen dotted=linetype("0 4"); -pen dashed=linetype("8 8"); -pen longdashed=linetype("24 8"); -pen dashdotted=linetype("8 8 0 8"); -pen longdashdotted=linetype("24 8 0 8"); +pen solid=linetype(new real[]); +pen dotted=linetype(new real[] {0,4}); +pen dashed=linetype(new real[] {8,8}); +pen longdashed=linetype(new real[] {24,8}); +pen dashdotted=linetype(new real[] {8,8,0,8}); +pen longdashdotted=linetype(new real[] {24,8,0,8}); pen Dotted=dotted+1.0; pen Dotted(pen p=currentpen) {return dotted+2*linewidth(p);} @end verbatim @@ -2798,7 +2808,7 @@ The default line type is @code{solid}; this may be changed with @cindex @code{scale} @cindex @code{adjust} The line type of a pen can be determined with the functions -@code{string linetype(pen p=currentpen)}, +@code{real[] linetype(pen p=currentpen)}, @code{real offset(pen p)}, @code{bool scale(pen p)}, and @code{bool adjust(pen p)}. @@ -3492,7 +3502,7 @@ void add(picture dest=currentpicture, frame src, pair position, bool above=true); @end verbatim -The optional @code{align} argument in the last three forms specifies a +The optional @code{align} argument in the last form specifies a direction to use for aligning the frame, in a manner analogous to the @code{align} argument of @code{label} (@pxref{label}). However, one key difference is that when @code{align} is not specified, labels are @@ -3619,11 +3629,11 @@ as a single literal comment character. @anchor{cd} @cindex @code{cd} @cindex directory -If the @code{-globalwrite} (or @code{-nosafe}) option is enabled, one can -change the current working directory to the contents of the string -@code{s} with the function @code{string cd(string s)}, which returns the -new working directory. If @code{string s} is empty, the path is reset to -the value it had at program startup. +One can change the current working directory for read operations to +the contents of the string @code{s} with the function @code{string +cd(string s)}, which returns the new working directory. If +@code{string s} is empty, the path is reset to the value it had at +program startup. @cindex @code{getc} When reading pairs, the enclosing parenthesis are optional. @@ -3710,7 +3720,7 @@ Alternatively, a file may also be opened with @code{binput} or @code{boutput} to read or write double precision reals and single precision integers in the native (nonportable) machine binary format. The virtual member functions -@code{file singlereal(bool b=false)} and @code{file singleint(bool b=true)} +@code{file singlereal(bool b=true)} and @code{file singleint(bool b=true)} be used to change the precision of real and integer I/O operations, respectively, for an @acronym{XDR} or binary file @code{f}. Similarly, the function @code{file signedint(bool b=true)} @@ -4277,8 +4287,12 @@ for nonintegral built-in arithmetic types @code{T}. If @code{a} and @cindex @code{OR} @cindex @code{XOR} @cindex @code{NOT} +@cindex @code{CLZ} +@cindex @code{CTZ} @code{Asymptote} also defines bitwise functions @code{int AND(int,int)}, -@code{int OR(int,int)}, @code{int XOR(int,int)}, and @code{int NOT(int)}. +@code{int OR(int,int)}, @code{int XOR(int,int)}, @code{int NOT(int)}, +@code{int CLZ(int)} (count leading zeros), and @code{int CTZ(int)} +(count trailing zeros). @node Self & prefix operators @subsection Self & prefix operators @@ -4752,8 +4766,8 @@ real(real) functions @code{sin}, @code{cos}, @code{tan}, @code{asin}, @code{acosh}, @code{atanh}, @code{sqrt}, @code{cbrt}, @code{fabs}, @code{expm1}, @code{log1p}, as well as the identity function @code{identity}. @code{Asymptote} also defines the order @code{n} Bessel functions of -the first kind @code{J(int n, real)} and second kind -@code{Y(int n, real)}, as well as the gamma function @code{gamma}, +the first kind @code{Jn(int n, real)} and second kind +@code{Yn(int n, real)}, as well as the gamma function @code{gamma}, the error function @code{erf}, and the complementary error function @code{erfc}. The standard real(real, real) functions @code{atan2}, @code{hypot}, @code{fmod}, @code{remainder} are also included. @@ -5099,15 +5113,15 @@ element, and otherwise the index corresponding to the left-hand @cindex @code{copy} @item T[] copy(T[] a) -returns a deep copy of the array @code{a}; +returns a copy of the array @code{a}; @cindex @code{copy} @item T[][] copy(T[][] a) -returns a deep copy of the array @code{a}; +returns a copy of the array @code{a}; @cindex @code{copy} @item T[][][] copy(T[][][] a) -returns a deep copy of the array @code{a}; +returns a copy of the array @code{a}; @cindex @code{concat} @item T[] concat(... T[][] a) @@ -5278,7 +5292,7 @@ roots are listed separately. @cindex @code{quadraticroots} @item @code{pair[] quadraticroots(explicit pair a, explicit pair b, explicit pair c);} -This numerically robust solver returns the two complex roots of the +This numerically robust solver returns the complex roots of the quadratic equation @math{ax^2+bx+c=0}. @cindex @code{cubicroots} @@ -5526,7 +5540,7 @@ int[] b=(int []) a; write(stdout,b); // Outputs 2,-3 @end verbatim -@cindex operator cast +@cindex @code{operator cast} Casting to user-defined types is also possible using @code{operator cast}: @verbatim struct rpair { @@ -5560,7 +5574,7 @@ real convert(int x) {return x*100;} real operator cast(int x)=convert; @end verbatim -@cindex operator ecast +@cindex @code{operator ecast} Explicit casts are implemented similarly, with @code{operator ecast}. @node Import @@ -5932,7 +5946,7 @@ need to remove the files @code{latexusage-*}, @code{latexusage_.pre}, and One can specify @code{width}, @code{height}, @code{viewportwidth}, @code{viewportheight}, and @code{attach} @code{keyval}-style options to the @code{asy} environment. -The current version (1.10) of @code{asymptote.sty} supports the +The current version of @code{asymptote.sty} supports the embedding of 3D @acronym{PRC} files, either inline or, using the @code{attach} option with the @code{attachfile2} (or older @code{attachfile}) @code{LaTeX} package, @@ -6572,6 +6586,15 @@ picture @code{pic} of the function @code{f} on the interval [@code{a},@code{b}], sampling at @code{n} evenly spaced points, with the given interpolation type. +@item +@verbatim +guide polargraph(picture pic=currentpicture, real[] r, real[] theta, + interpolate join=operator--); +@end verbatim +Returns a polar-coordinate graph using the scaling information for +picture @code{pic} of the elements of the arrays (@code{r},@code{theta}), +using the given interpolation type. + @end itemize @verbatim @@ -6721,8 +6744,13 @@ an optional pen used to draw the minor ticks. @end table -For convenience, the predefined tickmodifier @code{OmitTick(... real[] x)} -tickmodifier can be used to remove specific auto-generated ticks and +@cindex @code{OmitTick} +@cindex @code{OmitTickInterval} +@cindex @code{OmitTickIntervals} +For convenience, the predefined tickmodifiers @code{OmitTick(... real[] x)}, +@code{OmitTickInterval(real a, real b)}, and +@code{OmitTickIntervals(real[] a, real[] b)} +can be used to remove specific auto-generated ticks and their labels. The @code{OmitFormat(string s=defaultformat ... real[] x)} ticklabel can be used to remove specific tick labels but not the corresponding ticks. The tickmodifier @code{NoZero} is an abbreviation for @@ -6749,12 +6777,14 @@ ticks LeftTicks(Label format="", ticklabel ticklabel=null, @verbatim void yaxis(picture pic=currentpicture, Label L="", axis axis=XZero, real ymin=-infinity, real ymax=infinity, pen p=currentpen, - ticks ticks=NoTicks, arrowbar arrow=None, bool above=false); + ticks ticks=NoTicks, arrowbar arrow=None, bool above=false, + bool autorotate=true); @end verbatim Draw a @math{y} axis on picture @code{pic} from @math{y}=@code{ymin} to @math{y}=@code{ymax} using pen @code{p}, optionally labelling it with -Label @code{L}. The relative location of the label (a real number from +a Label @code{L} that is autorotated unless @code{autorotate=false}. +The relative location of the label (a real number from [0,1]) defaults to 1 (@pxref{Label}). An infinite value of @code{ymin} or @code{ymax} specifies that the corresponding axis limit will be automatically determined from the picture limits. @@ -7503,9 +7533,9 @@ draw(surface((0,0)--E+2N--2E--E+N..0.2E..cycle),red); @cindex @code{bezulate} Planar Bezier surfaces patches are constructed using Orest Shardt's @code{bezulate} routine, which decomposes (possibly nonsimply -connected) regions bounded by nonselfintersecting cyclic paths -(according to the @code{zerowinding} fill rule) into subregions -bounded by cyclic paths of length @code{4} or less. +connected) regions bounded (according to the @code{zerowinding} fill rule) +by simple cyclic paths (intersecting only at the endpoints) +into subregions bounded by cyclic paths of length @code{4} or less. @cindex @code{thin} @cindex @code{thick} @@ -7604,6 +7634,7 @@ The keyboard shortcuts are: @cindex @code{maxtile} @cindex @code{glOptions} @cindex @code{iconic} +@cindex @code{black stripes} @item Render the scene to a specified rasterized format @code{outformat} at the resolution of @code{n} pixels per @code{bp}, as specified by the setting @code{render=n}. A negative value of @code{n} is interpreted @@ -7614,9 +7645,12 @@ resolution; this can be disabled by setting @code{antialias=1}. High resolution rendering is done by tiling the image. If your graphics card allows it, the rendering can be made more efficient by increasing the maximum tile size @code{maxtile} beyond the screen -dimensions (indicated by @code{maxtile=(0,0)}. The tile size is also -limited by the setting @code{maxviewport}, which restricts the maximum -width and height of the viewport. On @code{UNIX} systems some graphics +dimensions (indicated by @code{maxtile=(0,0)}. If your video card +generates unwanted black stripes in the output, try setting the +horizontal and vertical components of @code{maxtiles} to something +less than your screen dimensions. The tile size is also limited by the +setting @code{maxviewport}, which restricts the maximum width and +height of the viewport. On @code{UNIX} systems some graphics drivers support batch mode (@code{-noV}) rendering in an iconified window; this can be enabled with the setting @code{iconify=true}. Some (broken) @code{UNIX} graphics drivers may require the command line setting @@ -7880,8 +7914,9 @@ triple invert(pair dir, triple v, projection P=currentprojection). @end verbatim @cindex @code{transform3} +@cindex @code{identity4} Three-dimensional objects may be transformed with one of the following -built-in transform3 types: +built-in transform3 types (the identity transformation is @code{identity4}): @table @code @item shift(triple v) @@ -7904,23 +7939,49 @@ scales by @code{s} in the @math{x}, @math{y}, and @math{z} directions; scales by @code{x} in the @math{x} direction, by @code{y} in the @math{y} direction, and by @code{z} in the @math{z} direction; +@cindex @code{rotate} @item rotate(real angle, triple v) rotates by @code{angle} in degrees about an axis @code{v} through the origin; @item rotate(real angle, triple u, triple v) rotates by @code{angle} in degrees about the axis @code{u--v}; @item reflect(triple u, triple v, triple w) reflects about the plane through @code{u}, @code{v}, and @code{w}. +@cindex @code{XY} @end table +When not multiplied on the left by a transform3, three-dimensional +@TeX{} Labels are drawn as Bezier surfaces directly on the projection plane: +@cindex @code{label} +@verbatim +void label(picture pic=currentpicture, Label L, triple position, + align align=NoAlign, pen p=currentpen, + light light=nolight, string name=L.s, + interaction interaction= + settings.autobillboard ? Billboard : Embedded) +@end verbatim +@noindent +@cindex @code{Billboard} +@cindex @code{Embedded} +The optional @code{name} parameter is used as a prefix for naming the label +patches in the @acronym{PRC} model tree. +The default interaction is @code{Billboard}, which means that labels +are rotated interactively so that they always lie on the projection plane. +The interaction @code{Embedded} means that the label interacts as a +normal @code{3D} surface, as illustrated in the example @code{billboard.asy}. @cindex @code{transform} -Three-dimensional @TeX{} Labels, which are by default drawn as -Bezier surfaces directly on the projection plane, can be transformed -from the @code{XY} plane by any of the above transforms or mapped to a -specified two-dimensional plane with the transform3 types @code{XY}, -@code{YZ}, @code{ZX}, @code{YX}, @code{ZY}, @code{ZX}. There are also -modified versions of these transforms that take an optional argument -@code{projection P=currentprojection} that rotate and/or flip the -label so that it is more readable from the initial viewpoint. +@cindex @code{XY} +@cindex @code{YZ} +@cindex @code{ZX} +@cindex @code{YX} +@cindex @code{ZY} +@cindex @code{ZX} +Alternatively, a label can be transformed from the @code{XY} plane by an +explicit transform3 or mapped to a specified two-dimensional plane with +the predefined transform3 types @code{XY}, @code{YZ}, @code{ZX}, @code{YX}, +@code{ZY}, @code{ZX}. There are also modified versions of these +transforms that take an optional argument @code{projection +P=currentprojection} that rotate and/or flip the label so that it is +more readable from the initial viewpoint. @cindex @code{planeproject} A transform3 that projects in the direction @code{dir} onto the plane @@ -8427,7 +8488,17 @@ block rectangle(object body, pair center=(0,0), real minheight=minblockheight); @end verbatim -@item diamond-shaped flowchart block: +@item parallelogram block: +@cindex @code{parallelogram} +@verbatim +block parallelogram(object body, pair center=(0,0), + pen fillpen=invisible, pen drawpen=currentpen, + real dx=3, real slope=2, + real minwidth=minblockwidth, + real minheight=minblockheight); +@end verbatim + +@item diamond-shaped block: @cindex @code{diamond} @verbatim block diamond(object body, pair center=(0,0), @@ -8437,7 +8508,7 @@ block diamond(object body, pair center=(0,0), real minheight=minblockheight); @end verbatim -@item circular flowchart block: +@item circular block: @cindex @code{circle} @verbatim block circle(object body, pair center=(0,0), pen fillpen=invisible, @@ -8445,7 +8516,7 @@ block circle(object body, pair center=(0,0), pen fillpen=invisible, real mindiameter=mincirclediameter); @end verbatim -@item rectangular flowchart block with rounded corners: +@item rectangular block with rounded corners: @cindex @code{roundrectangle} @verbatim block roundrectangle(object body, pair center=(0,0), @@ -8454,7 +8525,7 @@ block roundrectangle(object body, pair center=(0,0), real minheight=minblockheight); @end verbatim -@item rectangular flowchart block with beveled edges: +@item rectangular block with beveled edges: @cindex @code{bevel} @verbatim block bevel(object body, pair center=(0,0), pen fillpen=invisible, @@ -8477,7 +8548,8 @@ The entries in @code{dir} identify whether successive segments between the pairs specified by @code{point} should be drawn in the @code{Horizontal} or @code{Vertical} direction. -Here is a simple flowchart example: +Here is a simple flowchart example (see also the example +@code{controlsystem.asy}): @verbatiminclude flowchartdemo.asy @sp 1 @@ -8487,36 +8559,36 @@ Here is a simple flowchart example: @section @code{contour} @cindex @code{contour} This package draws contour lines. -To construct contours corresponding to the values in an array @code{c} -for a function @code{f} on @code{box(a,b)}, use +To construct contours corresponding to the values in a real array @code{c} +for a function @code{f} on @code{box(a,b)}, use the routine @verbatim guide[][] contour(real f(real, real), pair a, pair b, real[] c, int nx=ngraph, int ny=nx, - interpolate join=operator --); + interpolate join=operator --, int subsample=1); @end verbatim @noindent The integers @code{nx} and @code{ny} define the resolution. The default resolution, @code{ngraph x ngraph} (here @code{ngraph} -defaults to @code{100}), can be increased for greater accuracy. The -default interpolation operator is @code{operator --} (linear). Spline +defaults to @code{100}) can be increased for greater accuracy. +The default interpolation operator is @code{operator --} (linear). Spline interpolation (@code{operator ..}) may produce smoother contours but it can also lead to overshooting. +The @code{subsample} parameter indicates the number of interior points +that should be used to sample contours within each @code{1 x 1} box; +the default value of @code{1} is usually sufficient. To construct contours for an array of data values on a uniform two-dimensional lattice on @code{box(a,b)}, use @verbatim -guide[][] contour(real[][] f, real[][] midpoint=new real[][], - pair a, pair b, real[] c, - interpolate join=operator --); +guide[][] contour(real[][] f, pair a, pair b, real[] c, + interpolate join=operator --, int subsample=1); @end verbatim To construct contours for an array of data values on a nonoverlapping -regular mesh specified by the two-dimensional array @code{z}, optionally -specifying the values of @code{f} at the mesh midpoints, use +regular mesh specified by the two-dimensional array @code{z}, @verbatim -guide[][] contour(pair[][] z, real[][] f, - real[][] midpoint=new real[][], real[] c, - interpolate join=operator --); +guide[][] contour(pair[][] z, real[][] f, real[] c, + interpolate join=operator --, int subsample=1); @end verbatim @noindent @@ -8524,16 +8596,16 @@ To construct contours for an array of values @code{f} specified at irregularly positioned points @code{z}, use the routine @verbatim guide[][] contour(pair[] z, real[] f, real[] c, - interpolate join=operator --); + interpolate join=operator --, int subsample=1); @end verbatim @noindent The contours themselves can be drawn with one of the routines @verbatim void draw(picture pic=currentpicture, Label[] L=new Label[], - guide[][] g, pen p=currentpen) + guide[][] g, pen p=currentpen); void draw(picture pic=currentpicture, Label[] L=new Label[], - guide[][] g, pen[] p) + guide[][] g, pen[] p); @end verbatim The following simple example draws the contour at value @code{1} @@ -8682,15 +8754,18 @@ interactiveMask=true; Command-line options override these defaults. Most configuration variables may also be changed at runtime. @cindex @code{dvipsOptions} +@cindex @code{hyperrefOptions} @cindex @code{convertOptions} @cindex @code{gsOptions} @cindex @code{psviewerOptions} @cindex @code{pdfviewerOptions} @cindex @code{glOptions} -The advanced configuration variables @code{dvipsOptions}, @code{convertOptions}, -@code{gsOptions}, @code{psviewerOptions}, @code{pdfviewerOptions}, and -@code{glOptions} allow specialized options to be passed as a string to -the respective applications or libraries. +The advanced configuration variables @code{dvipsOptions}, +@code{hyperrefOptions}, @code{convertOptions}, @code{gsOptions}, +@code{psviewerOptions}, @code{pdfviewerOptions}, and @code{glOptions} +allow specialized options to be passed as a string to the respective +applications or libraries. The default value of @code{hyperrefOptions} +is @code{setpagesize=false,unicode,pdfborder=0 0 0}. If you insert @verbatim @@ -8713,21 +8788,29 @@ at the beginning of the configuration file, it can contain arbitrary @cindex @code{pdflatex} @cindex @code{xelatex} @cindex @code{context} +@cindex @code{EPS} +@cindex @code{PDF} +@cindex @code{SVG} @anchor{convert} The default output format is @acronym{EPS} for the (default) @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 -controlled by the parameter @code{antialias}, which by default -specifies a sampling width of 2 pixels. -@code{Asymptote} can produce any output format supported +(or @code{outformat} setting). To produce @acronym{SVG} output, +first install @code{dvisvgm} (version 0.8.7 or later) from +@url{http://dvisvgm.sourceforge.net/down.html} and be sure to use the +@code{latex} or @code{tex} tex engine. + +@code{Asymptote} can also produce any output format supported by the @code{ImageMagick} @code{convert} program (version 6.3.5 or later recommended; an @code{Invalid Parameter} error message indicates that the @code{MSDOS} utility @code{convert} is being used instead of the one that comes with @code{ImageMagick}). -To give specific options to @code{convert}, use the +The optional setting @code{-render n} requests +an output resolution of @code{n} pixels per @code{bp}. Antialiasing is +controlled by the parameter @code{antialias}, which by default +specifies a sampling width of 2 pixels. +To give other options to @code{convert}, use the @code{convertOptions} setting or call convert manually. This example emulates how @code{Asymptote} produces antialiased @code{tiff} output at one pixel per @code{bp}: @@ -8818,9 +8901,33 @@ interactive input lines by a semicolon is inhibited. Multiline mode is useful for cutting and pasting @code{Asymptote} code directly into the interactive input buffer. +@cindex @code{%} Interactive mode can be conveniently used as a calculator: expressions entered at the interactive prompt (for which a corresponding @code{write} function exists) are automatically evaluated and written to @code{stdout}. +If the expression is non-writable, its type signature will be printed out +instead. In either case, the expression can be referred to using the symbol +@code{%} in the next line input at the prompt. For example: +@verbatim +> 2+3 +5 +> %*4 +20 +> 1/% +0.05 +> sin(%) +0.0499791692706783 +> currentpicture +<picture currentpicture> +> %.size(200,0) +> +@end verbatim + +@cindex @code{operator answer} +The @code{%} symbol, when used as a variable, is shorthand for the identifier +@code{operator answer}, which is set by the prompt after each written +expression evaluation. + The following special commands are supported only in interactive mode and must be entered immediately after the prompt: @@ -8931,15 +9038,15 @@ this requires @code{Python 2.6.2} and the @code{Python Imaging Library}: @url{http://www.python.org/ftp/python/2.6.2/python-2.6.2.msi} @end quotation @quotation -@url{http://effbot.org/downloads/PIL-1.1.7b1.win32-py2.6.exe}. +@url{http://effbot.org/media/downloads/PIL-1.1.7.win32-py2.6.exe}. @end quotation @noindent On @code{UNIX} systems, place -@url{http://effbot.org/downloads/Imaging-1.1.7b1.tar.gz} in the +@url{http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz} in the @code{Asymptote} source directory, and type (as the root user): @verbatim -tar -zxf Imaging-1.1.7b1.tar.gz -cd Imaging-1.1.7b1 +tar -zxf Imaging-1.1.7.tar.gz +cd Imaging-1.1.7 python setup.py install @end verbatim @@ -9292,9 +9399,9 @@ Melenchuk, Martin Wiebusch, and Stefan Knorr. @c LocalWords: usleep currentpatterns trailingzero Orest Shardt DefaultHead @c LocalWords: SimpleHead HookHead TeXHead multipage NURBS inlinemovie dxmax @c LocalWords: simpson NoBox truesize autoscale shadestroke recurses mintimes -@c LocalWords: nonoverlapping texengine maxtimes maxheight pdb TEXMFCONFIG +@c LocalWords: nonoverlapping texengine maxtimes maxheight pdb TEXMFCONFIG Jn @c LocalWords: piecewisestraight unitrand graphmarkers antialias nolight newl -@c LocalWords: Delaunay Shewchuk convertOptions APPDATA pdfreload tempFile +@c LocalWords: Delaunay Shewchuk convertOptions APPDATA pdfreload tempFile Yn @c LocalWords: pdfreloadOptions deferred OpenGL Phong Blinn renderer unitbox @c LocalWords: bezulate Shardt's rasterized viewport unitdisk unitplane devel @c LocalWords: unitcylinder unitcone solidcone unitfrustum unitsphere nslices @@ -9306,17 +9413,19 @@ Melenchuk, Martin Wiebusch, and Stefan Knorr. @c LocalWords: hstretch vstretch roundbox nonconvex miterlimit basealigin cmd @c LocalWords: maxviewport maxtile antialiased sphericalharmonic attachfile @c LocalWords: vertexshading smoothelevation glOptions iconified iconify kate -@c LocalWords: psviewerOptions pdfviewerOptions viewportmargin asyattach +@c LocalWords: psviewerOptions pdfviewerOptions viewportmargin asyattach SVG @c LocalWords: multisampling autogen multisample coloredpath relstep flowdir @c LocalWords: colortype coloredSegments coloredNodes trefoilknot scaledgraph @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 shader floatingdisk TopView -@c LocalWords: functionshading nonselfintersecting maxlength LeftView odetest +@c LocalWords: functionshading maxlength LeftView odetest @c LocalWords: vectorfieldsphere RightView FrontView BackView BottomView @c LocalWords: addViews outprefix addAllViews xsplinetype ysplinetype rotateX @c LocalWords: usplinetype vsplinetype leftbutton middlebutton rightbutton @c LocalWords: rotateY rotateZ wheelup zoomin wheeldown zoomout TeXLive @c LocalWords: viewportshift signedint signedness psview multiplatform nowarn @c LocalWords: singlereal singleint writeoverloaded tubegranularity dvisvg +@c LocalWords: bigdiagonal autobillboard dvisvgm maxtiles hyperrefOptions +@c LocalWords: setpagesize pdfborder controlsystem diff --git a/Build/source/utils/asymptote/doc/extra/intro.asy b/Build/source/utils/asymptote/doc/extra/intro.asy index f19f51b286d..4234b8cee8e 100644 --- a/Build/source/utils/asymptote/doc/extra/intro.asy +++ b/Build/source/utils/asymptote/doc/extra/intro.asy @@ -73,7 +73,6 @@ item("cyclic path:"); asyfilecode("square"); - title("Scaling to a Given Size"); item("{\tt PostScript} units are often inconvenient."); @@ -88,8 +87,10 @@ asyfigure("square"); item("One can also specify the size in {\tt cm}:"); -asyfilecode("bigsquare"); - +asycode(" +size(3cm,3cm); +draw(unitsquare); +"); title("Labels"); diff --git a/Build/source/utils/asymptote/doc/flowchartdemo.asy b/Build/source/utils/asymptote/doc/flowchartdemo.asy index def70d0dd0f..796e357a5ff 100644 --- a/Build/source/utils/asymptote/doc/flowchartdemo.asy +++ b/Build/source/utils/asymptote/doc/flowchartdemo.asy @@ -17,14 +17,11 @@ draw(block4); draw(block5); add(new void(picture pic, transform t) { - draw(pic,path(new pair[]{block1.right(t),block2.top(t)},Horizontal), - Arrow,PenMargin); - draw(pic,Label("Yes",0.5,NW),path(new pair[]{block2.left(t),block3.top(t)}, - Horizontal),Arrow,PenMargin); - draw(pic,Label("No",0.5,NE),path(new pair[]{block2.right(t),block4.top(t)}, - Horizontal),Arrow,PenMargin); - draw(pic,path(new pair[]{block3.bottom(t),block5.left(t)},Vertical), - Arrow,PenMargin); - draw(pic,path(new pair[]{block4.bottom(t),block5.right(t)},Vertical), - Arrow,PenMargin); + blockconnector operator --=blockconnector(pic,t); + // draw(pic,block1.right(t)--block2.top(t)); + block1--Right--Down--Arrow--block2; + block2--Label("Yes",0.5,NW)--Left--Down--Arrow--block3; + block2--Right--Label("No",0.5,NE)--Down--Arrow--block4; + block4--Down--Left--Arrow--block5; + block3--Down--Right--Arrow--block5; }); diff --git a/Build/source/utils/asymptote/doc/image.asy b/Build/source/utils/asymptote/doc/image.asy index 3270c06e31e..37a2cf60172 100644 --- a/Build/source/utils/asymptote/doc/image.asy +++ b/Build/source/utils/asymptote/doc/image.asy @@ -19,4 +19,3 @@ bounds range=image(v,(0,0),(1,1),Palette); palette(bar,"$A$",range,(0,0),(0.5cm,8cm),Right,Palette, PaletteTicks("$%+#.1f$")); add(bar.fit(),point(E),30E); - diff --git a/Build/source/utils/asymptote/doc/imagecontour.asy b/Build/source/utils/asymptote/doc/imagecontour.asy index 25fdb3f6ed4..6b5eb455cad 100644 --- a/Build/source/utils/asymptote/doc/imagecontour.asy +++ b/Build/source/utils/asymptote/doc/imagecontour.asy @@ -18,8 +18,6 @@ pen Tickpen=black; pen tickpen=gray+0.5*linewidth(currentpen); pen[] Palette=BWRainbow(); -scale(false); - bounds range=image(f,Automatic,a,b,N,Palette); // Major contours diff --git a/Build/source/utils/asymptote/doc/install-sh b/Build/source/utils/asymptote/doc/install-sh index 3f83ce9b555..6781b987bdb 100755 --- a/Build/source/utils/asymptote/doc/install-sh +++ b/Build/source/utils/asymptote/doc/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2010-02-06.18; # UTC +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 @@ -200,11 +200,7 @@ if test $# -eq 0; then fi if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 + trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. diff --git a/Build/source/utils/asymptote/doc/irregularcontour.asy b/Build/source/utils/asymptote/doc/irregularcontour.asy index b72ddd0e08b..70b38ae15e7 100644 --- a/Build/source/utils/asymptote/doc/irregularcontour.asy +++ b/Build/source/utils/asymptote/doc/irregularcontour.asy @@ -4,13 +4,15 @@ size(200); int n=100; -pair[] points=new pair[n]; -real[] values=new real[n]; - real f(real a, real b) {return a^2+b^2;} +srand(1); + real r() {return 1.1*(rand()/randMax*2-1);} +pair[] points=new pair[n]; +real[] values=new real[n]; + for(int i=0; i < n; ++i) { points[i]=(r(),r()); values[i]=f(points[i].x,points[i].y); diff --git a/Build/source/utils/asymptote/doc/options b/Build/source/utils/asymptote/doc/options index a92d06501e5..468d23d8087 100644 --- a/Build/source/utils/asymptote/doc/options +++ b/Build/source/utils/asymptote/doc/options @@ -30,7 +30,6 @@ Options (negate by replacing - with -no): -gray Convert all colors to grayscale [false] -h,-help Show summary of options; command-line only -historylines n Retain n lines of history [1000] --hyperrefOptions str LaTeX hyperref package options [setpagesize=false,unicode] -iconify Iconify rendering window [false] -inlineimage Generate inline embedded image [false] -inlinetex Generate inline TeX code [false] @@ -67,6 +66,7 @@ Options (negate by replacing - with -no): -safe Disable system call [true] -scroll n Scroll standard output n lines at a time [0] -spinstep deg/sec Spin speed [60] +-svgemulation Emulate unimplemented SVG shading [false] -tabcompletion Interactive prompt auto-completion [true] -tex engine latex|pdflatex|xelatex|tex|pdftex|context|none [latex] -thick Render thick 3D lines [true] diff --git a/Build/source/utils/asymptote/drawclipbegin.h b/Build/source/utils/asymptote/drawclipbegin.h index cba0acc9a15..ffdcf449e63 100644 --- a/Build/source/utils/asymptote/drawclipbegin.h +++ b/Build/source/utils/asymptote/drawclipbegin.h @@ -29,6 +29,8 @@ public: virtual ~drawClipBegin() {} + bool beginclip() {return true;} + void bounds(bbox& b, iopipestream& iopipe, boxvector& vbox, bboxlist& bboxstack) { bboxstack.push_back(b); @@ -40,6 +42,8 @@ public: bool begingroup() {return true;} + bool svg() {return true;} + void save(bool b) { gsave=b; } @@ -47,10 +51,10 @@ public: bool draw(psfile *out) { if(gsave) out->gsave(); if(empty()) return true; - - writepath(out); + out->beginclip(); + writepath(out,false); if(stroke) strokepath(out); - out->clip(pentype); + out->endclip(pentype); return true; } @@ -58,26 +62,16 @@ public: if(gsave) out->gsave(); if(empty()) return true; - if(out->toplevel()) { - out->verbatim(settings::beginpicture(out->texengine)); - if(!settings::context(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->verbatim(")"); - } - out->verbatimline("%"); - } + if(out->toplevel()) + out->beginpicture(bpath); + out->begingroup(); out->beginspecial(); out->beginraw(); writeshiftedpath(out); if(stroke) strokepath(out); - out->clip(pentype); + out->endclip(pentype); out->endraw(); out->endspecial(); diff --git a/Build/source/utils/asymptote/drawclipend.h b/Build/source/utils/asymptote/drawclipend.h index 4b2d3260f2c..e86842d3d11 100644 --- a/Build/source/utils/asymptote/drawclipend.h +++ b/Build/source/utils/asymptote/drawclipend.h @@ -35,6 +35,8 @@ public: bool endgroup() {return true;} + bool svg() {return true;} + void save(bool b) { grestore=b; if(partner) partner->save(b); @@ -47,13 +49,10 @@ public: bool write(texfile *out, const bbox& bpath) { out->endgroup(); - if(out->toplevel()) { - out->verbatimline(settings::endpicture(out->texengine)); - out->verbatim("\\kern"); - double width=bpath.right-bpath.left; - out->write(-width*ps2tex); - out->verbatimline("pt%"); - } + + if(out->toplevel()) + out->endpicture(bpath); + if(grestore) out->grestore(); return true; } diff --git a/Build/source/utils/asymptote/drawelement.h b/Build/source/utils/asymptote/drawelement.h index bdc7d2b020e..44e739b74e9 100644 --- a/Build/source/utils/asymptote/drawelement.h +++ b/Build/source/utils/asymptote/drawelement.h @@ -19,6 +19,11 @@ #include "prcfile.h" #include "glrender.h" +namespace run { +extern double *copyArrayC(const vm::array *a, size_t dim, + GCPlacement placement); +} + namespace camp { enum Entity {LINE=0,CURVE,SURFACE,BILLBOARD_SURFACE,nENTITY}; @@ -107,14 +112,22 @@ public: virtual void bounds(bbox3&) {} // Compute bounds on ratio (x,y)/z for 3d picture (not cached). - virtual void ratio(pair &b, double (*m)(double, double), bool &first){} + virtual void ratio(pair &b, double (*m)(double, double), double fuzz, + bool &first){} virtual bool islabel() {return false;} - + virtual bool islayer() {return false;} virtual bool is3D() {return false;} + +// Implement element as raw SVG code? + virtual bool svg() {return false;} + +// Implement SVG element as png image? + virtual bool svgpng() {return false;} + virtual bool beginclip() {return false;} virtual bool endclip() {return false;} virtual bool begingroup() {return false;} @@ -181,6 +194,10 @@ public: out->write(p); } + virtual void writeclippath(psfile *out, bool newpath=true) { + out->writeclip(p,newpath); + } + virtual void writeshiftedpath(texfile *out) { out->writeshifted(p); } @@ -221,16 +238,12 @@ public: virtual void penTranslate(psfile *out) { - transform t=pentype.getTransform(); - if (!t.isIdentity()) - out->translate(shiftpair(t)); + out->translate(shiftpair(pentype.getTransform())); } virtual void penConcat(psfile *out) { - transform t=pentype.getTransform(); - if (!t.isIdentity()) - out->concat(shiftless(t)); + out->concat(shiftless(pentype.getTransform())); } virtual void penRestore(psfile *out) @@ -292,9 +305,16 @@ public: b += bpath; } - void writepath(psfile *out) { - for(size_t i=0; i < size; i++) - out->write(vm::read<path>(P,i),i == 0); + void writepath(psfile *out, bool newpath=true) { + if(size > 0) out->write(vm::read<path>(P,0),newpath); + for(size_t i=1; i < size; i++) + out->write(vm::read<path>(P,i),false); + } + + void writeclippath(psfile *out, bool newpath=true) { + if(size > 0) out->writeclip(vm::read<path>(P,0),newpath); + for(size_t i=1; i < size; i++) + out->writeclip(vm::read<path>(P,i),false); } void writeshiftedpath(texfile *out) { diff --git a/Build/source/utils/asymptote/drawfill.cc b/Build/source/utils/asymptote/drawfill.cc index 4ebe07b4eb2..0353ae2c405 100644 --- a/Build/source/utils/asymptote/drawfill.cc +++ b/Build/source/utils/asymptote/drawfill.cc @@ -57,7 +57,7 @@ drawElement *drawFill::transformed(const transform& t) drawElement *drawLatticeShade::transformed(const transform& t) { - return new drawLatticeShade(transpath(t),stroke,pentype,pens); + return new drawLatticeShade(transpath(t),stroke,pentype,pens,t*T); } drawElement *drawAxialShade::transformed(const transform& t) @@ -136,7 +136,7 @@ bool drawFunctionShade::write(texfile *out, const bbox& box) out->beginraw(); writeshiftedpath(out); if(stroke) strokepath(out); - out->clip(pentype); + out->endclip(pentype); out->verbatimline("/Sh sh"); out->endraw(); out->endspecial(); diff --git a/Build/source/utils/asymptote/drawfill.h b/Build/source/utils/asymptote/drawfill.h index 14666d1df5f..9f152d45a57 100644 --- a/Build/source/utils/asymptote/drawfill.h +++ b/Build/source/utils/asymptote/drawfill.h @@ -26,9 +26,15 @@ public: if(!stroke && !cyclic()) noncyclic(); } + bool svg() {return true;} + + // dvisvgm doesn't yet support SVG patterns. + bool svgpng() {return pentype.fillpattern() != "";} + virtual ~drawFill() {} - bool draw(psfile *out); + virtual bool draw(psfile *out); + virtual void palette(psfile *out) { penSave(out); penTranslate(out); @@ -54,29 +60,53 @@ public: else drawSuperPathPenBase::bounds(b,iopipe,vbox,bboxstack); } + // Shading in SVG is incomplete and not supported at all by dvisvgm. + bool svgpng() {return true;} + + virtual void beginshade(psfile *out)=0; virtual void shade(psfile *out)=0; - void fill(psfile *out) { + + bool draw(psfile *out) { + if(pentype.invisible() || empty()) return true; + + palette(out); + beginshade(out); + writeclippath(out); if(stroke) strokepath(out); - out->clip(pentype.Fillrule()); + out->endpsclip(pentype.Fillrule()); shade(out); out->grestore(); + return true; } }; class drawLatticeShade : public drawShade { protected: vm::array pens; + const transform T; public: drawLatticeShade(const vm::array& src, bool stroke, pen pentype, - const vm::array& pens) - : drawShade(src,stroke,pentype), pens(pens) {} + const vm::array& pens, const camp::transform& T=identity) + : drawShade(src,stroke,pentype), pens(pens), T(T) {} void palette(psfile *out) { out->gsave(); } + void beginshade(psfile *out) { + out->beginlatticeshade(pens,bpath); + } + void shade(psfile *out) { - out->latticeshade(pens,bpath); + bbox b; + for(size_t i=0; i < size; i++) { + path p=vm::read<path>(P,i).transformed(inverse(T)); + if(stroke) + drawPathPenBase::strokebounds(b,p); + else + b += p.bounds(); + } + out->latticeshade(pens,T*matrix(b.Min(),b.Max())); } drawElement *transformed(const transform& t); @@ -93,8 +123,14 @@ public: pair a, pen penb, pair b) : drawShade(src,stroke,pentype), a(a), penb(penb), b(b) {} + bool svgpng() {return false;} + void palette(psfile *out); + void beginshade(psfile *out) { + out->begingradientshade(true,colorspace,pentype,a,0,penb,b,0); + } + void shade(psfile *out) { out->gradientshade(true,colorspace,pentype,a,0,penb,b,0); } @@ -111,6 +147,12 @@ public: pen pentype, pair a, double ra, pen penb, pair b, double rb) : drawAxialShade(src,stroke,pentype,a,penb,b), ra(ra), rb(rb) {} + bool svgpng() {return ra > 0.0;} + + void beginshade(psfile *out) { + out->begingradientshade(false,colorspace,pentype,a,ra,penb,b,rb); + } + void shade(psfile *out) { out->gradientshade(false,colorspace,pentype,a,ra,penb,b,rb); } @@ -128,12 +170,18 @@ public: : drawShade(src,stroke,pentype), pens(pens), vertices(vertices), edges(edges) {} + bool svgpng() {return !settings::getSetting<bool>("svgemulation");} + void palette(psfile *out) { out->gsave(); } + void beginshade(psfile *out) { + out->begingouraudshade(pens,vertices,edges); + } + void shade(psfile *out) { - out->gouraudshade(pens,vertices,edges); + out->gouraudshade(pentype,pens,vertices,edges); } drawElement *transformed(const transform& t); @@ -148,12 +196,20 @@ public: const vm::array& boundaries, const vm::array& z) : drawShade(src,stroke,pentype), pens(pens), boundaries(boundaries), z(z) {} + bool svgpng() { + return pens.size() > 1 || !settings::getSetting<bool>("svgemulation"); + } + void palette(psfile *out) { out->gsave(); } + void beginshade(psfile *out) { + out->begintensorshade(pens,boundaries,z); + } + void shade(psfile *out) { - out->tensorshade(pens,boundaries,z); + out->tensorshade(pentype,pens,boundaries,z); } drawElement *transformed(const transform& t); diff --git a/Build/source/utils/asymptote/drawgroup.h b/Build/source/utils/asymptote/drawgroup.h index 50aa7610aac..53b689c8ae6 100644 --- a/Build/source/utils/asymptote/drawgroup.h +++ b/Build/source/utils/asymptote/drawgroup.h @@ -21,7 +21,7 @@ public: bool begingroup() {return true;} - bool write(prcfile *out) { + bool write(prcfile *out, unsigned int *, vm::array *, vm::array *) { out->begingroup(name.c_str()); return true; } @@ -36,7 +36,7 @@ public: bool endgroup() {return true;} - bool write(prcfile *out) { + bool write(prcfile *out, unsigned int *, vm::array *, vm::array *) { out->endgroup(); return true; } diff --git a/Build/source/utils/asymptote/drawimage.h b/Build/source/utils/asymptote/drawimage.h index a0f2aff2b09..1f2c28175a0 100644 --- a/Build/source/utils/asymptote/drawimage.h +++ b/Build/source/utils/asymptote/drawimage.h @@ -10,7 +10,6 @@ #include "drawelement.h" #include "array.h" -#include "pen.h" namespace camp { @@ -62,6 +61,9 @@ public: return true; } + bool svg() {return true;} + bool svgpng() {return true;} + drawElement *transformed(const transform& T) { return new drawImage(image,palette,T*t,antialias,type); } diff --git a/Build/source/utils/asymptote/drawlabel.h b/Build/source/utils/asymptote/drawlabel.h index 100a544ea00..253184008d3 100644 --- a/Build/source/utils/asymptote/drawlabel.h +++ b/Build/source/utils/asymptote/drawlabel.h @@ -69,6 +69,9 @@ public: virtual ~drawLabelPath() {} + bool svg() {return true;} + bool svgpng() {return true;} + void bounds(bbox& b, iopipestream& tex, boxvector&, bboxlist&); bool write(texfile *out, const bbox&); diff --git a/Build/source/utils/asymptote/drawpath.cc b/Build/source/utils/asymptote/drawpath.cc index c1d2c85efc0..9332ead8939 100644 --- a/Build/source/utils/asymptote/drawpath.cc +++ b/Build/source/utils/asymptote/drawpath.cc @@ -13,27 +13,30 @@ #include "psfile.h" #include "util.h" -namespace camp { +using vm::array; +using vm::read; +namespace camp { -double PatternLength(double arclength, const std::vector<double>& pat, +double PatternLength(double arclength, const array& pat, bool cyclic, double penwidth) { double sum=0.0; size_t n=pat.size(); for(unsigned i=0; i < n; i ++) - sum += pat[i]*penwidth; + sum += read<double>(pat,i)*penwidth; if(sum == 0.0) return 0.0; if(n % 2 == 1) sum *= 2.0; // On/off pattern repeats after 2 cycles. + double pat0=read<double>(pat,0); // Fix bounding box resolution problem. Example: // asy -f pdf testlinetype; gv -scale -2 testlinetype.pdf - if(!cyclic && pat[0] == 0) sum += 1.0e-3*penwidth; + if(!cyclic && pat0 == 0) sum += 1.0e-3*penwidth; - double terminator=(cyclic && arclength >= 0.5*sum) ? 0.0 : pat[0]*penwidth; + double terminator=(cyclic && arclength >= 0.5*sum) ? 0.0 : pat0*penwidth; int ncycle=(int)((arclength-terminator)/sum+0.5); return (ncycle >= 1 || terminator >= 0.75*arclength) ? @@ -44,43 +47,20 @@ pen adjustdash(pen& p, double arclength, bool cyclic) { pen q=p; // Adjust dash sizes to fit arclength; also compensate for linewidth. - string stroke=q.stroke(); - - if(!stroke.empty()) { - double penwidth=q.linetype().scale ? q.width() : 1.0; - double factor=penwidth; + const LineType *linetype=q.linetype(); + size_t n=linetype->pattern.size(); - std::vector<double> pat; + if(n > 0) { + double penwidth=linetype->scale ? q.width() : 1.0; + double factor=penwidth; - istringstream ibuf(stroke); - double l; - while(ibuf >> l) { - if(l < 0) l=0; - pat.push_back(l); + if(linetype->adjust && arclength) { + double denom=PatternLength(arclength,linetype->pattern,cyclic,penwidth); + if(denom != 0.0) factor *= arclength/denom; } - - size_t n=pat.size(); - if(q.linetype().adjust) { - if(arclength) { - if(n == 0) return q; - - double denom=PatternLength(arclength,pat,cyclic,penwidth); - if(denom != 0.0) factor *= arclength/denom; - } - } - - factor=max(factor,0.1); - - ostringstream buf; - buf.setf(std::ios::fixed); - if(n > 0) { - for(size_t i=0; i < n-1; i++) - buf << pat[i]*factor << " "; - buf << pat[n-1]*factor; - } - q.setstroke(buf.str()); - q.setoffset(q.linetype().offset*factor); + if(factor != 1.0) + q.adjust(max(factor,0.1)); } return q; } @@ -147,19 +127,22 @@ bool drawPath::draw(psfile *out) if (n == 0 || pentype.invisible()) return true; - pen pen0=adjustdash(pentype,p.arclength(),p.cyclic()); + pen q=adjustdash(pentype,p.arclength(),p.cyclic()); penSave(out); penTranslate(out); - out->write(p); + if(n > 1) + out->write(p); + else + out->dot(p,q); penConcat(out); - - out->setpen(pen0); - out->stroke(); - + out->setpen(q); + + out->stroke(q,n == 1); + penRestore(out); return true; diff --git a/Build/source/utils/asymptote/drawpath.h b/Build/source/utils/asymptote/drawpath.h index c18ed3d628a..fe519a7258d 100644 --- a/Build/source/utils/asymptote/drawpath.h +++ b/Build/source/utils/asymptote/drawpath.h @@ -23,6 +23,8 @@ public: strokebounds(b,p); } + bool svg() {return true;} + bool draw(psfile *out); drawElement *transformed(const transform& t); diff --git a/Build/source/utils/asymptote/drawpath3.cc b/Build/source/utils/asymptote/drawpath3.cc index 41a280d2f25..77d1d6aced9 100644 --- a/Build/source/utils/asymptote/drawpath3.cc +++ b/Build/source/utils/asymptote/drawpath3.cc @@ -24,10 +24,10 @@ bool drawPath3::write(prcfile *out, unsigned int *count, array *, array *) else buf << name; - controls=new Triple[n+1]; + controls=new(UseGC) Triple[n+1]; for(Int i=0; i <= n; ++i) store(controls[i],g.point(i)); - out->add(new PRCline(out,n+1,controls,color,scale3D,name.c_str())); + out->add(new PRCline(out,n+1,controls,color,scale3D,buf.str().c_str())); } else { if(name == "") buf << "curve-" << count[CURVE]++; @@ -35,7 +35,7 @@ bool drawPath3::write(prcfile *out, unsigned int *count, array *, array *) buf << name; int m=3*n+1; - controls=new Triple[m]; + controls=new(UseGC) Triple[m]; store(controls[0],g.point((Int) 0)); store(controls[1],g.postcontrol((Int) 0)); size_t k=1; @@ -46,7 +46,7 @@ bool drawPath3::write(prcfile *out, unsigned int *count, array *, array *) } store(controls[++k],g.precontrol((Int) n)); store(controls[++k],g.point((Int) n)); - out->add(new PRCBezierCurve(out,3,m,controls,color,name)); + out->add(new PRCBezierCurve(out,3,m,controls,color,buf.str())); } return true; } @@ -54,7 +54,7 @@ bool drawPath3::write(prcfile *out, unsigned int *count, array *, array *) void drawPath3::render(GLUnurbs *nurb, double, const triple&, const triple&, double, bool transparent) { -#ifdef HAVE_LIBGL +#ifdef HAVE_GL Int n=g.length(); if(n == 0 || invisible || ((color.A < 1.0) ^ transparent)) return; @@ -101,4 +101,132 @@ drawElement *drawPath3::transformed(const array& t) return new drawPath3(t,this); } +bool drawNurbsPath3::write(prcfile *out, unsigned int *count, array *index, + array *origin) +{ + ostringstream buf; + if(name == "") + buf << "curve-" << count[CURVE]++; + else + buf << name; + + if(invisible) + return true; + + out->add(new PRCcurve(out,degree,n,controls,knots,color,scale3D, + weights != NULL,weights,buf.str().c_str())); + + return true; +} + +// Approximate bounds by bounding box of control polyhedron. +void drawNurbsPath3::bounds(bbox3& b) +{ + double *v=controls[0]; + double x=v[0]; + double y=v[1]; + double z=v[2]; + double X=x; + double Y=y; + double Z=z; + for(size_t i=1; i < n; ++i) { + double *v=controls[i]; + double vx=v[0]; + x=min(x,vx); + X=max(X,vx); + double vy=v[1]; + y=min(y,vy); + Y=max(Y,vy); + double vz=v[2]; + z=min(z,vz); + Z=max(Z,vz); + } + + Min=triple(x,y,z); + Max=triple(X,Y,Z); + b.add(Min); + b.add(Max); +} + +drawElement *drawNurbsPath3::transformed(const array& t) +{ + return new drawNurbsPath3(t,this); +} + +void drawNurbsPath3::ratio(pair &b, double (*m)(double, double), double, + bool &first) +{ + if(first) { + first=false; + double *ci=controls[0]; + triple v=triple(ci[0],ci[1],ci[2]); + b=pair(xratio(v),yratio(v)); + } + + double x=b.getx(); + double y=b.gety(); + for(size_t i=0; i < n; ++i) { + double *ci=controls[i]; + triple v=triple(ci[0],ci[1],ci[2]); + x=m(x,xratio(v)); + y=m(y,yratio(v)); + } + b=pair(x,y); +} + +void drawNurbsPath3::displacement() +{ +#ifdef HAVE_GL + size_t nknots=degree+n+1; + if(Controls == NULL) { + Controls=new(UseGC) GLfloat[(weights ? 4 : 3)*n]; + Knots=new(UseGC) GLfloat[nknots]; + } + if(weights) + for(size_t i=0; i < n; ++i) + store(Controls+4*i,controls[i],weights[i]); + else + for(size_t i=0; i < n; ++i) + store(Controls+3*i,controls[i]); + + for(size_t i=0; i < nknots; ++i) + Knots[i]=knots[i]; +#endif +} + +void drawNurbsPath3::render(GLUnurbs *nurb, double, const triple&, + const triple&, double, bool transparent) +{ +#ifdef HAVE_GL + if(invisible || ((color.A < 1.0) ^ transparent)) + return; + + GLfloat Diffuse[]={0.0,0.0,0.0,color.A}; + glMaterialfv(GL_FRONT,GL_DIFFUSE,Diffuse); + + static GLfloat Black[]={0.0,0.0,0.0,1.0}; + glMaterialfv(GL_FRONT,GL_AMBIENT,Black); + + GLfloat Emissive[]={color.R,color.G,color.B,color.A}; + glMaterialfv(GL_FRONT,GL_EMISSION,Emissive); + + glMaterialfv(GL_FRONT,GL_SPECULAR,Black); + + glMaterialf(GL_FRONT,GL_SHININESS,128.0); + + if(weights) + gluNurbsCallback(nurb,GLU_NURBS_VERTEX,(_GLUfuncptr) glVertex4fv); + else gluNurbsCallback(nurb,GLU_NURBS_VERTEX,(_GLUfuncptr) glVertex3fv); + + gluBeginCurve(nurb); + int order=degree+1; + gluNurbsCurve(nurb,order+n,Knots,weights ? 4 : 3,Controls,order, + weights ? GL_MAP1_VERTEX_4 : GL_MAP1_VERTEX_3); + gluEndCurve(nurb); + + if(weights) + gluNurbsCallback(nurb,GLU_NURBS_VERTEX,(_GLUfuncptr) glVertex3fv); +#endif +} + } //namespace camp diff --git a/Build/source/utils/asymptote/drawpath3.h b/Build/source/utils/asymptote/drawpath3.h index d956e49e243..1285e7656da 100644 --- a/Build/source/utils/asymptote/drawpath3.h +++ b/Build/source/utils/asymptote/drawpath3.h @@ -22,7 +22,7 @@ protected: Triple *controls; string name; public: - drawPath3(path3 g, const pen&p, const string& name) : + drawPath3(path3 g, const pen& p, const string& name) : g(g), straight(g.piecewisestraight()), color(rgba(p)), invisible(p.invisible()), Min(g.min()), Max(g.max()), controls(NULL), name(name) {} @@ -32,9 +32,7 @@ public: invisible(s->invisible), Min(g.min()), Max(g.max()), controls(NULL), name(s->name) {} - virtual ~drawPath3() { - if(controls) delete controls; - } + virtual ~drawPath3() {} bool is3D() {return true;} @@ -43,7 +41,7 @@ public: B.add(Max); } - void ratio(pair &b, double (*m)(double, double), bool &first) { + void ratio(pair &b, double (*m)(double, double), double, bool &first) { pair z=g.ratio(m); if(first) { b=z; @@ -60,6 +58,111 @@ public: drawElement *transformed(const vm::array& t); }; +class drawNurbsPath3 : public drawElement { +protected: + size_t degree; + size_t n; + Triple *controls; + double *weights; + double *knots; + RGBAColour color; + bool invisible; + string name; + triple Min,Max; + +#ifdef HAVE_GL + GLfloat *Controls; + GLfloat *Knots; +#endif + +public: + drawNurbsPath3(const vm::array& g, const vm::array* knot, + const vm::array* weight, const pen& p, const string& name) : + color(rgba(p)), invisible(p.invisible()), name(name) { + size_t weightsize=checkArray(weight); + + string wrongsize="Inconsistent NURBS data"; + n=checkArray(&g); + + if(n == 0 || (weightsize != 0 && weightsize != n)) + reportError(wrongsize); + + controls=new(UseGC) Triple[n]; + + size_t k=0; + for(size_t i=0; i < n; ++i) + store(controls[k++],vm::read<triple>(g,i)); + + if(weightsize > 0) { + size_t k=0; + weights=new(UseGC) double[n]; + for(size_t i=0; i < n; ++i) + weights[k++]=vm::read<double>(weight,i); + } else weights=NULL; + + size_t nknots=checkArray(knot); + + if(nknots <= n+1 || nknots > 2*n) + reportError(wrongsize); + + degree=nknots-n-1; + + knots=run::copyArrayC(knot,0,NoGC); + +#ifdef HAVE_GL + Controls=NULL; +#endif + } + + drawNurbsPath3(const vm::array& t, const drawNurbsPath3 *s) : + degree(s->degree), n(s->n), color(s->color), invisible(s->invisible), + name(s->name) { + controls=new(UseGC) Triple[n]; + + for(size_t i=0; i < n; ++i) { + const double *c=s->controls[i]; + triple v=run::operator *(t,triple(c[0],c[1],c[2])); + controls[i][0]=v.getx(); + controls[i][1]=v.gety(); + controls[i][2]=v.getz(); + } + + if(s->weights) { + weights=new(UseGC) double[n]; + for(size_t i=0; i < n; ++i) + weights[i]=s->weights[i]; + } else weights=NULL; + + size_t nknots=degree+n+1; + knots=new(UseGC) double[nknots]; + + for(size_t i=0; i < nknots; ++i) + knots[i]=s->knots[i]; + +#ifdef HAVE_GL + Controls=NULL; +#endif + } + + bool is3D() {return true;} + + void bounds(bbox3& b); + + virtual ~drawNurbsPath3() {} + + bool write(prcfile *out, unsigned int *count, vm::array *index, + vm::array *origin); + + void displacement(); + void ratio(pair &b, double (*m)(double, double), double fuzz, bool &first); + + void render(GLUnurbs *nurb, double size2, + const triple& Min, const triple& Max, + double perspective, bool transparent); + + drawElement *transformed(const vm::array& t); +}; + } #endif diff --git a/Build/source/utils/asymptote/drawsurface.cc b/Build/source/utils/asymptote/drawsurface.cc index 61c661821a2..a19406a714f 100644 --- a/Build/source/utils/asymptote/drawsurface.cc +++ b/Build/source/utils/asymptote/drawsurface.cc @@ -14,7 +14,7 @@ const triple drawSurface::zero; using vm::array; -#ifdef HAVE_LIBGL +#ifdef HAVE_GL void storecolor(GLfloat *colors, int i, const vm::array &pens, int j) { pen p=vm::read<camp::pen>(pens,j); @@ -104,7 +104,8 @@ void drawSurface::bounds(bbox3& b) b.add(Max); } -void drawSurface::ratio(pair &b, double (*m)(double, double), bool &first) +void drawSurface::ratio(pair &b, double (*m)(double, double), double fuzz, + bool &first) { if(straight) { if(first) { @@ -136,7 +137,6 @@ void drawSurface::ratio(pair &b, double (*m)(double, double), bool &first) first=false; } - double fuzz=sqrtFuzz*run::norm(c3,16); b=pair(bound(c3,m,xratio,b.getx(),fuzz),bound(c3,m,yratio,b.gety(),fuzz)); } } @@ -154,11 +154,10 @@ bool drawSurface::write(prcfile *out, unsigned int *count, array *index, buf << name; if(interaction == BILLBOARD) { - triple Center=center*scale3D; size_t n=origin->size(); - if(n == 0 || Center != vm::read<triple>(origin,n-1)) { - origin->push(Center); + if(n == 0 || center != vm::read<triple>(origin,n-1)) { + origin->push(center); ++n; } @@ -205,7 +204,7 @@ inline triple displacement(const Triple& z0, const Triple& c0, void drawSurface::displacement() { -#ifdef HAVE_LIBGL +#ifdef HAVE_GL if(normal != zero) { d=zero; @@ -239,7 +238,7 @@ inline double fraction(const triple& d, const triple& size) fraction(d.getz(),size.getz())); } -#ifdef HAVE_LIBGL +#ifdef HAVE_GL struct billboard { triple u,v,w; @@ -272,7 +271,7 @@ void drawSurface::render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, double perspective, bool transparent) { -#ifdef HAVE_LIBGL +#ifdef HAVE_GL if(invisible || ((colors ? colors[3]+colors[7]+colors[11]+colors[15] < 4.0 : diffuse.A < 1.0) ^ transparent)) return; double s; @@ -456,9 +455,9 @@ bool drawNurbs::write(prcfile *out, unsigned int *count, array *index, return true; PRCMaterial m(ambient,diffuse,emissive,specular,opacity,PRCshininess); - out->add(new PRCsurface(out,udegree,vdegree,nu,nv,controls,uknots,vknots, - m,scale3D,weights != NULL,weights,granularity, - name.c_str())); + out->add(new PRCsurface(out,udegree,vdegree,nu,nv,controls, + uknots,vknots,m,scale3D,weights != NULL, + weights,granularity,buf.str().c_str())); return true; } @@ -466,51 +465,27 @@ bool drawNurbs::write(prcfile *out, unsigned int *count, array *index, // Approximate bounds by bounding box of control polyhedron. void drawNurbs::bounds(bbox3& b) { - double x,y,z; - double X,Y,Z; size_t n=nu*nv; double *v=controls[0]; - if(weights == NULL) { - x=v[0]; - y=v[1]; - z=v[2]; - X=x; - Y=y; - Z=z; - for(size_t i=1; i < n; ++i) { - double *v=controls[i]; - double vx=v[0]; - x=min(x,vx); - X=max(X,vx); - double vy=v[1]; - y=min(y,vy); - Y=max(Y,vy); - double vz=v[2]; - z=min(z,vz); - Z=max(Z,vz); - } - } else { - double w=weights[0]; - x=v[0]/w; - y=v[1]/w; - z=v[2]/w; - X=x; - Y=y; - Z=z; - for(size_t i=1; i < n; ++i) { - double *v=controls[i]; - double w=weights[i]; - double vx=v[0]/w; - x=min(x,vx); - X=max(X,vx); - double vy=v[1]/w; - y=min(y,vy); - Y=max(Y,vy); - double vz=v[2]/w; - z=min(z,vz); - Z=max(Z,vz); - } + double x=v[0]; + double y=v[1]; + double z=v[2]; + double X=x; + double Y=y; + double Z=z; + for(size_t i=1; i < n; ++i) { + double *v=controls[i]; + double vx=v[0]; + x=min(x,vx); + X=max(X,vx); + double vy=v[1]; + y=min(y,vy); + Y=max(Y,vy); + double vz=v[2]; + z=min(z,vz); + Z=max(Z,vz); } + Min=triple(x,y,z); Max=triple(X,Y,Z); b.add(Min); @@ -522,7 +497,7 @@ drawElement *drawNurbs::transformed(const array& t) return new drawNurbs(t,this); } -void drawNurbs::ratio(pair &b, double (*m)(double, double), bool &first) +void drawNurbs::ratio(pair &b, double (*m)(double, double), double, bool &first) { size_t n=nu*nv; if(first) { @@ -545,21 +520,27 @@ void drawNurbs::ratio(pair &b, double (*m)(double, double), bool &first) void drawNurbs::displacement() { -#ifdef HAVE_LIBGL +#ifdef HAVE_GL size_t n=nu*nv; - size_t stride=weights == NULL ? 3 : 4; - for(size_t i=0; i < n; ++i) - store(Controls+stride*i,controls[i]); + size_t nuknots=udegree+nu+1; + size_t nvknots=vdegree+nv+1; + + if(Controls == NULL) { + Controls=new(UseGC) GLfloat[(weights ? 4 : 3)*n]; + uKnots=new(UseGC) GLfloat[nuknots]; + vKnots=new(UseGC) GLfloat[nvknots]; + } - if(weights != NULL) + if(weights) for(size_t i=0; i < n; ++i) - Controls[4*i+3]=weights[i]; - - size_t nuknotsm1=udegree+nu; - size_t nvknotsm1=vdegree+nv; - for(size_t i=0; i <= nuknotsm1; ++i) + store(Controls+4*i,controls[i],weights[i]); + else + for(size_t i=0; i < n; ++i) + store(Controls+3*i,controls[i]); + + for(size_t i=0; i < nuknots; ++i) uKnots[i]=uknots[i]; - for(size_t i=0; i <= nvknotsm1; ++i) + for(size_t i=0; i < nvknots; ++i) vKnots[i]=vknots[i]; #endif } @@ -568,7 +549,7 @@ void drawNurbs::render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, double perspective, bool transparent) { -#ifdef HAVE_LIBGL +#ifdef HAVE_GL if(invisible || ((colors ? colors[3]+colors[7]+colors[11]+colors[15] < 4.0 : diffuse.A < 1.0) ^ transparent)) return; @@ -656,10 +637,10 @@ void drawNurbs::render(GLUnurbs *nurb, double size2, gluBeginSurface(nurb); int uorder=udegree+1; int vorder=vdegree+1; - size_t stride=weights == NULL ? 3 : 4; + size_t stride=weights ? 4 : 3; gluNurbsSurface(nurb,uorder+nu,uKnots,vorder+nv,vKnots,stride*nv,stride, Controls,uorder,vorder, - weights == NULL ? GL_MAP2_VERTEX_3 : GL_MAP2_VERTEX_4); + weights ? GL_MAP2_VERTEX_4 : GL_MAP2_VERTEX_3); if(colors) { static GLfloat linear[]={0.0,0.0,1.0,1.0}; gluNurbsSurface(nurb,4,linear,4,linear,8,4,colors,2,2,GL_MAP2_COLOR_4); diff --git a/Build/source/utils/asymptote/drawsurface.h b/Build/source/utils/asymptote/drawsurface.h index c498c469068..8e9fa28827a 100644 --- a/Build/source/utils/asymptote/drawsurface.h +++ b/Build/source/utils/asymptote/drawsurface.h @@ -12,15 +12,11 @@ #include "arrayop.h" #include "path3.h" -namespace run { -extern double *copyArrayC(const array *a, size_t dim); -} - namespace camp { enum Interaction {EMBEDDED=0,BILLBOARD}; -#ifdef HAVE_LIBGL +#ifdef HAVE_GL void storecolor(GLfloat *colors, int i, const vm::array &pens, int j); #endif @@ -46,7 +42,7 @@ protected: triple Min,Max; -#ifdef HAVE_LIBGL +#ifdef HAVE_GL GLfloat *colors; triple d; // Maximum deviation of surface from a quadrilateral. triple dperp; @@ -81,7 +77,7 @@ public: if(!havenormal || !straight) { size_t k=0; - controls=new Triple[16]; + controls=new(UseGC) Triple[16]; for(size_t i=0; i < 4; ++i) { vm::array *gi=vm::read<vm::array*>(g,i); if(checkArray(gi) != 4) @@ -99,11 +95,11 @@ public: emissive=rgba(vm::read<camp::pen>(p,2)); specular=rgba(vm::read<camp::pen>(p,3)); -#ifdef HAVE_LIBGL +#ifdef HAVE_GL int size=checkArray(&pens); if(size > 0) { if(size != 4) reportError(wrongsize); - colors=new GLfloat[16]; + colors=new(UseGC) GLfloat[16]; storecolor(colors,0,pens,0); storecolor(colors,8,pens,1); storecolor(colors,12,pens,2); @@ -125,7 +121,7 @@ public: } if(s->controls) { - controls=new Triple[16]; + controls=new(UseGC) Triple[16]; for(size_t i=0; i < 16; ++i) { const double *c=s->controls[i]; store(controls[i],run::operator *(t,triple(c[0],c[1],c[2]))); @@ -135,9 +131,9 @@ public: center=run::operator *(t,s->center); normal=run::multshiftless(t,s->normal); -#ifdef HAVE_LIBGL +#ifdef HAVE_GL if(s->colors) { - colors=new GLfloat[16]; + colors=new(UseGC) GLfloat[16]; for(int i=0; i < 16; ++i) colors[i]=s->colors[i]; } else colors=NULL; @@ -148,17 +144,9 @@ public: void bounds(bbox3& b); - void ratio(pair &b, double (*m)(double, double), bool &first); + void ratio(pair &b, double (*m)(double, double), double fuzz, bool &first); - virtual ~drawSurface() { - if(controls) - delete[] controls; - -#ifdef HAVE_LIBGL - if(colors) - delete[] colors; -#endif - } + virtual ~drawSurface() {} bool write(prcfile *out, unsigned int *count, vm::array *index, vm::array *origin); @@ -192,7 +180,7 @@ protected: triple Min,Max; -#ifdef HAVE_LIBGL +#ifdef HAVE_GL GLfloat *colors; GLfloat *Controls; GLfloat *uKnots; @@ -218,7 +206,7 @@ public: nv=checkArray(g0); size_t n=nu*nv; - controls=new Triple[n]; + controls=new(UseGC) Triple[n]; size_t k=0; for(size_t i=0; i < nu; ++i) { @@ -231,15 +219,13 @@ public: if(weightsize > 0) { size_t k=0; - weights=new double[n]; + weights=new(UseGC) double[n]; for(size_t i=0; i < nu; ++i) { vm::array *weighti=vm::read<vm::array*>(weight,i); if(checkArray(weighti) != nv) reportError(wrongsize); - for(size_t j=0; j < nv; ++j) { - weights[k]=vm::read<double>(weighti,j); - ++k; - } + for(size_t j=0; j < nv; ++j) + weights[k++]=vm::read<double>(weighti,j); } } else weights=NULL; @@ -252,8 +238,8 @@ public: udegree=nuknots-nu-1; vdegree=nvknots-nv-1; - uknots=run::copyArrayC(uknot,0); - vknots=run::copyArrayC(vknot,0); + uknots=run::copyArrayC(uknot,0,NoGC); + vknots=run::copyArrayC(vknot,0,NoGC); pen surfacepen=vm::read<camp::pen>(p,0); invisible=surfacepen.invisible(); @@ -262,14 +248,12 @@ public: ambient=rgba(vm::read<camp::pen>(p,1)); emissive=rgba(vm::read<camp::pen>(p,2)); specular=rgba(vm::read<camp::pen>(p,3)); -#ifdef HAVE_LIBGL - uKnots=new GLfloat[nuknots]; - vKnots=new GLfloat[nvknots]; - Controls=new GLfloat[(weights ? 4 : 3)*n]; +#ifdef HAVE_GL + Controls=NULL; int size=checkArray(&pens); if(size > 0) { - colors=new GLfloat[16]; + colors=new(UseGC) GLfloat[16]; if(size != 4) reportError(wrongsize); storecolor(colors,0,pens,0); storecolor(colors,8,pens,1); @@ -288,7 +272,7 @@ public: name(s->name) { size_t n=nu*nv; - controls=new double[n][3]; + controls=new(UseGC) Triple[n]; for(size_t i=0; i < n; ++i) { const double *c=s->controls[i]; @@ -299,15 +283,15 @@ public: } if(s->weights) { - weights=new double[n]; + weights=new(UseGC) double[n]; for(size_t i=0; i < n; ++i) weights[i]=s->weights[i]; } else weights=NULL; size_t nuknots=udegree+nu+1; size_t nvknots=vdegree+nv+1; - uknots=new double[nuknots]; - vknots=new double[nvknots]; + uknots=new(UseGC) double[nuknots]; + vknots=new(UseGC) double[nvknots]; for(size_t i=0; i < nuknots; ++i) uknots[i]=s->uknots[i]; @@ -315,13 +299,10 @@ public: for(size_t i=0; i < nvknots; ++i) vknots[i]=s->vknots[i]; -#ifdef HAVE_LIBGL - uKnots=new GLfloat[nuknots]; - vKnots=new GLfloat[nvknots]; - Controls=new GLfloat[(weights ? 4 : 3)*n]; - +#ifdef HAVE_GL + Controls=NULL; if(s->colors) { - colors=new GLfloat[16]; + colors=new(UseGC) GLfloat[16]; for(int i=0; i < 16; ++i) colors[i]=s->colors[i]; } else colors=NULL; @@ -332,26 +313,13 @@ public: void bounds(bbox3& b); - virtual ~drawNurbs() { - delete[] vknots; - delete[] uknots; - if(weights) - delete[] weights; - delete[] controls; -#ifdef HAVE_LIBGL - if(colors) - delete[] colors; - delete[] Controls; - delete[] vKnots; - delete[] uKnots; -#endif - } + virtual ~drawNurbs() {} bool write(prcfile *out, unsigned int *count, vm::array *index, vm::array *origin); void displacement(); - void ratio(pair &b, double (*m)(double, double), bool &first); + void ratio(pair &b, double (*m)(double, double), double, bool &first); void render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, diff --git a/Build/source/utils/asymptote/drawverbatim.h b/Build/source/utils/asymptote/drawverbatim.h index 24c5be45d14..186dc544422 100644 --- a/Build/source/utils/asymptote/drawverbatim.h +++ b/Build/source/utils/asymptote/drawverbatim.h @@ -18,20 +18,26 @@ class drawVerbatim : public drawElement { private: Language language; string text; - bool havebounds; + bool userbounds; pair min,max; + bool havebounds; public: drawVerbatim(Language language, const string& text) : - language(language), text(text), havebounds(false) {} + language(language), text(text), userbounds(false), havebounds(false) {} drawVerbatim(Language language, const string& text, pair min, pair max) : - language(language), text(text), havebounds(true), min(min), max(max) {} + language(language), text(text), userbounds(true), min(min), max(max), + havebounds(false) {} virtual ~drawVerbatim() {} - void bounds(bbox& b, iopipestream&, boxvector&, bboxlist&) { - if(havebounds) { + void bounds(bbox& b, iopipestream& tex, boxvector&, bboxlist&) { + if(havebounds) return; + havebounds=true; + if(language == TeX) + tex << text << "%" << newl; + if(userbounds) { b += min; b += max; } diff --git a/Build/source/utils/asymptote/entry.cc b/Build/source/utils/asymptote/entry.cc index 99869abb87a..22f973d914f 100644 --- a/Build/source/utils/asymptote/entry.cc +++ b/Build/source/utils/asymptote/entry.cc @@ -181,19 +181,6 @@ void venv::list(record *module) flush(cout); } -varEntry *venv::lookInTopScope(symbol *name, ty *t) -{ - scope_t &scope = scopes.front(); - for (scope_iterator p = scope.lower_bound(name); - p != scope.upper_bound(name); - ++p) { - if (name == p->first && - equivalent(t, p->second->getType(), name->special)) - return p->second; - } - return 0; -} - ty *venv::getType(symbol *name) { types::overloaded set; diff --git a/Build/source/utils/asymptote/entry.h b/Build/source/utils/asymptote/entry.h index c4ad2bef451..5d02a9c61f2 100644 --- a/Build/source/utils/asymptote/entry.h +++ b/Build/source/utils/asymptote/entry.h @@ -208,10 +208,6 @@ public: // Look for a function that exactly matches the type given. varEntry *lookByType(symbol *name, ty *t); - // Checks if a function was added in the top scope as two identical - // functions cannot be defined in one scope. - varEntry *lookInTopScope(symbol *name, ty *t); - // Return the type of the variable, if name is overloaded, return an // overloaded type. ty *getType(symbol *name); @@ -336,15 +332,6 @@ public: bool add(symbol *src, symbol *dest, venv& source, varEntry *qualifier, coder &c); - bool lookInTopScope(key k) { - return scopes.top().find(k)!=scopes.top().end(); - } - - // Look for a function that exactly matches the type given. - bool lookInTopScope(symbol *name, ty *t) { - return lookInTopScope(key(name, t)); - } - varEntry *lookByType(key k) { keymap::const_iterator p=all.find(k); return p!=all.end() ? p->second->v : 0; diff --git a/Build/source/utils/asymptote/errortest.asy b/Build/source/utils/asymptote/errortest.asy new file mode 100644 index 00000000000..500a3972e1f --- /dev/null +++ b/Build/source/utils/asymptote/errortest.asy @@ -0,0 +1,415 @@ +/***** + * errortest.asy + * Andy Hammerlindl 2003/08/08 + * + * This struct attempts to trigger every error message reportable by the + * compiler to ensure that errors are being reported properly. + *****/ + +// name.cc +{ + // line 33 + x.y = 5; +} +{ + // line 50 + int x = z; +} +{ + // line 67 + x = 5; +} +{ + // line 84 - unreachable +} +{ + // line 95 + x y1; + x y2(); + x y3(int); + int y4(x); + struct m { + x y1; + x y2(); + x y3(int); + int y4(x); + } +} +{ + // line 130 + int x; + x.y = 4; +} +{ + // line 156 + struct m { + int x,y; + } + m.u.v = 5; +} +{ + // line 186 + struct m { + int x,y; + } + int x = m.z; +} +{ + // line 217 + struct m { + int x,y; + } + m.z = 5; +} +{ + // line 249 - unreachable +} +{ + // line 272 - not testable without typedef +} +{ + // line 283 + struct m { + int x,y; + } + m.u v; + struct mm { + m.u v; + } +} + +// exp.h +{ + // line 109 + 5 = 4; +} +{ + // line 136 + int f, f(); + f; + struct m { int f, f(); } + m.f; +} + +// exp.cc +{ + // line 40 + int x = {}; + int y = {4, 5, 6}; +} +{ + // line 110 + int f(), f(int); + f.m = 5; +} +{ + // line 122 + int x; + x.m = 5; +} +{ + // line 147 + struct point { + int x,y; + } + point p; + int x = p.z; +} +{ + // line 157 + struct point { + int x, y; + } + point p; + p.z; +} +{ + // line 163 + struct point { + int f(), f(int); + } + point p; + p.f; +} +{ + // line 204 + struct point { + int x, y; + } + point p; + p.z = 5; +} +{ + // line 229 - unreachable +} +{ + // lines 261 and 275 - wait for subscript to be fully implemented. +} +{ + // line 515 + void f(int), f(int, int); + f(); + f("Hello?"); +} +{ + // line 520 - not yet testable (need int->float casting or the like) +} +{ + // line 525 + void f(int); + f(); +} +{ + // line 649 + struct point { + int x,y; + } + point p; + p = +p; +} +{ + // line 1359 + int x, f(); + (true) ? x : f; +} +{ + // line 1359 + int a, a(), b, b(); + (true) ? a : b; +} +{ + // line 1581 + int x, f(); + x = f; +} +{ + // line 1586 + int a, a(), b, b(); + a = b; +} + +// newexp.cc +{ + // line 34 + int f() = new int () { + int x = 5; + }; +} +{ + // line 64 + int x = new int; +} +{ + // line 72 + struct a { + struct b { + } + } + + new a.b; +} + +// stm.cc +{ + // line 86 + 5; +} +{ + // line 246 + break; +} +{ + // line 261 + continue; +} +{ + // line 282 + void f() { + return 17; + } +} +{ + // line 288 + int f() { + return; + } +} + +// dec.cc +{ + // line 378 + int f() { + int x = 5; + } + int g() { + if (true) + return 7; + } +} + +// env.h +{ + // line 99 + struct m {} + struct m {} +} +{ + // line 109 + int f() { + return 1; + } + int f() { + return 2; + } + + int x = 1; + int x = 2; + + struct m { + int f() { + return 1; + } + int f() { + return 2; + } + + int x = 1; + int x = 2; + } +} + +// env.cc +{ + // line 107 - currently unreachable as no built-ins are currently used + // in records. +} +{ + // line 140 + // Assuming there is a built-in function void abort(string): + void f(string); + abort = f; +} +{ + // line 168 - currently unreachable as no built-in functions are + // currently used in records. +} +{ + // line 222 + int x = "Hello"; +} + +// Test permissions. +{ + struct A { + private int x=4; + restricted int y=5; + + private void f() {} + restricted void g() {} + } + + A a; + a.x; + a.x = 4; + a.x += 5; + a.y = 6; + a.y += 7; + + a.f; + a.f(); + a.f = new void() {}; + a.g = new void() {}; +} +{ + struct A { + private int x=4; + private void f() {} + } + + A a; + from a unravel x; + from a unravel f; +} +{ + struct A { + restricted int y=5; + restricted void g() {} + } + + A a; + from a unravel y,g; + y = 6; + y += 7; + + g = new void() {}; +} +{ + struct A { + private typedef int T; + } + A.T x; + A.T x=4; + int y=2; + A.T x=y; + A.T x=17+3*y; +} +{ + struct A { + private typedef int T; + } + from A unravel T; +} +{ + struct A { + private typedef int T; + } + A a; + a.T x; + a.T x=4; + int y=2; + a.T x=y; + a.T x=17+3*y; +} +{ + struct A { + private typedef int T; + } + A a; + from a unravel T; +} + +// Read-only settings +// Ensure that the safe and globalwrite options can't be modified inside the +// code. +{ + access settings; + settings.safe=false; + settings.safe=true; + settings.globalwrite=false; + settings.globalwrite=true; +} +{ + from settings access safe, globalwrite; + safe=false; + safe=true; + globalwrite=false; + globalwrite=true; +} +{ + from settings access safe as x, globalwrite as y; + x=false; + x=true; + y=false; + y=true; +} +{ + import settings; + settings.safe=false; + settings.safe=true; + settings.globalwrite=false; + settings.globalwrite=true; + safe=false; + safe=true; + globalwrite=false; + globalwrite=true; +} diff --git a/Build/source/utils/asymptote/examples/1overx.asy b/Build/source/utils/asymptote/examples/1overx.asy new file mode 100644 index 00000000000..5d9775d44dc --- /dev/null +++ b/Build/source/utils/asymptote/examples/1overx.asy @@ -0,0 +1,17 @@ +import graph; +size(200,IgnoreAspect); + +real f(real x) {return 1/x;}; + +bool3 branch(real x) +{ + static int lastsign=0; + if(x == 0) return false; + int sign=sgn(x); + bool b=lastsign == 0 || sign == lastsign; + lastsign=sign; + return b ? true : default; +} + +draw(graph(f,-1,1,branch)); +axes("$x$","$y$",red); diff --git a/Build/source/utils/asymptote/examples/Klein.asy b/Build/source/utils/asymptote/examples/Klein.asy index 4c8089dd86a..0d31c495f01 100644 --- a/Build/source/utils/asymptote/examples/Klein.asy +++ b/Build/source/utils/asymptote/examples/Klein.asy @@ -39,6 +39,6 @@ draw(surface(xscale(0.26)*yscale(0.1)*rotate(90)*hi,s,4.9,1.4,h,bottom=false)); draw(s.uequals(0),blue+dashed); draw(s.uequals(pi),blue+dashed); -currentpicture.add(new void(frame f, transform3 t, picture pic, projection P) { +add(new void(frame f, transform3 t, picture pic, projection P) { draw(f,invert(box(min(f,P),max(f,P)),P)); }); diff --git a/Build/source/utils/asymptote/examples/NURBScurve.asy b/Build/source/utils/asymptote/examples/NURBScurve.asy new file mode 100644 index 00000000000..b3b8c393b9e --- /dev/null +++ b/Build/source/utils/asymptote/examples/NURBScurve.asy @@ -0,0 +1,33 @@ +import three; + +size(10cm); + +currentprojection=perspective(50,80,50); + +// Nonrational curve: +// udegree=3, nu=6; +real[] knot={0,0,0,0,0.4,0.6,1,1,1,1}; + +triple[] P={ + (-31.2061,12.001,6.45082), + (-31.3952,14.7353,6.53707), + (-31.5909,21.277,6.70051), + (-31.4284,25.4933,6.76745), + (-31.5413,30.3485,6.68777), + (-31.4896,32.2839,6.58385), + }; + +draw(P,knot,green); + +// Rational Bezier curve: +// udegree=3, nu=4; +real[] knot={0,0,0,0,1,1,1,1}; +path3 g=scale3(20)*(X{Y}..{-X}Y); +triple[] P={point(g,0),postcontrol(g,0),precontrol(g,1),point(g,1)}; + +// Optional weights: +real[] weights=array(P.length,1.0); +weights[2]=5; + +draw(P,knot,weights,red); + diff --git a/Build/source/utils/asymptote/examples/NURBSsphere.asy b/Build/source/utils/asymptote/examples/NURBSsphere.asy new file mode 100644 index 00000000000..d7f0e77321d --- /dev/null +++ b/Build/source/utils/asymptote/examples/NURBSsphere.asy @@ -0,0 +1,32 @@ +import three; +size(400); + +currentprojection=perspective(5,4,2,autoadjust=false); + +real[] uknot={0,0,0,1,1,2,2,3,3,4,4,4}; + +real[] vknot={0,0,0,1,1,2,2,2}; + +triple[][] P={{(0,0,1),(1,0,1),(1,0,0),(1,0,-1),(0,0,-1)}, + {(0,0,1),(1,1,1),(1,1,0),(1,1,-1),(0,0,-1)}, + {(0,0,1),(0,1,1),(0,1,0),(0,1,-1),(0,0,-1)}, + {(0,0,1),(-1,1,1),(-1,1,0),(-1,1,-1),(0,0,-1)}, + {(0,0,1),(-1,0,1),(-1,0,0),(-1,0,-1),(0,0,-1)}, + {(0,0,1),(-1,-1,1),(-1,-1,0),(-1,-1,-1),(0,0,-1)}, + {(0,0,1),(0,-1,1),(0,-1,0),(0,-1,-1),(0,0,-1)}, + {(0,0,1),(1,-1,1),(1,-1,0),(1,-1,-1),(0,0,-1)}, + {(0,0,1),(1,0,1),(1,0,0),(1,0,-1),(0,0,-1)}}; + +real[][] weights={ + {1,1,2,1,1}, + {1,1,2,1,1}, + {2,2,4,2,2}, + {1,1,2,1,1}, + {1,1,2,1,1}, + {1,1,2,1,1}, + {2,2,4,2,2}, + {1,1,2,1,1}, + {1,1,2,1,1} +}; + +draw(P,uknot,vknot,weights,yellow); diff --git a/Build/source/utils/asymptote/examples/NURBSsurface.asy b/Build/source/utils/asymptote/examples/NURBSsurface.asy index 3fcea79dbbd..878fd956393 100644 --- a/Build/source/utils/asymptote/examples/NURBSsurface.asy +++ b/Build/source/utils/asymptote/examples/NURBSsurface.asy @@ -2,7 +2,7 @@ import three; size(10cm); -currentprojection=perspective(40,40,50); +currentprojection=perspective(50,80,50); // Nonrational surface: // udegree=3, vdegree=3, nu=5, nv=6; @@ -56,6 +56,6 @@ triple[][] P=scale3(20)*octant1.P; // Optional weights: real[][] weights=array(P.length,array(P[0].length,1.0)); -weights[1][2]=0.5; +weights[0][2]=5.0; draw(P,uknot,vknot,weights,blue); diff --git a/Build/source/utils/asymptote/examples/SierpinskiGasket.asy b/Build/source/utils/asymptote/examples/SierpinskiGasket.asy new file mode 100644 index 00000000000..57251735db8 --- /dev/null +++ b/Build/source/utils/asymptote/examples/SierpinskiGasket.asy @@ -0,0 +1,31 @@ +size(200); +import palette; +import three; +currentprojection=perspective(8,2,1); + +triple[] M={(0,0,1),1/3*(sqrt(8),0,-1), + 1/3*((sqrt(8))*Cos(120),(sqrt(8))*Sin(120),-1), + 1/3*((sqrt(8))*Cos(240),(sqrt(8))*Sin(240),-1)}; + +int level=5; + +surface s; + +void recur(triple p, real u, int l) { + if(l < level) + for(triple V : M) + recur(p+u*V,u/2,l+1); + else + for(triple V : M) { + s.append(surface((p+u*(V+M[0]))--(p+u*(V+M[1]))--(p+u*(V+M[2]))--cycle)); + s.append(surface((p+u*(V+M[0]))--(p+u*(V+M[2]))--(p+u*(V+M[3]))--cycle)); + s.append(surface((p+u*(V+M[0]))--(p+u*(V+M[3]))--(p+u*(V+M[1]))--cycle)); + s.append(surface((p+u*(V+M[3]))--(p+u*(V+M[2]))--(p+u*(V+M[1]))--cycle)); + } +} + +recur(O,0.5,1); + +s.colors(palette(s.map(zpart),Rainbow())); + +draw(s); diff --git a/Build/source/utils/asymptote/examples/SierpinskiSponge.asy b/Build/source/utils/asymptote/examples/SierpinskiSponge.asy new file mode 100644 index 00000000000..209c3d182ed --- /dev/null +++ b/Build/source/utils/asymptote/examples/SierpinskiSponge.asy @@ -0,0 +1,42 @@ +size(200); +import palette; +import three; + +triple[] M={ + (-1,-1,-1),(0,-1,-1),(1,-1,-1),(1,0,-1), + (1,1,-1),(0,1,-1),(-1,1,-1),(-1,0,-1), + (-1,-1,0),(1,-1,0),(1,1,0),(-1,1,0), + (-1,-1,1),(0,-1,1),(1,-1,1),(1,0,1), + (1,1,1),(0,1,1),(-1,1,1),(-1,0,1) +}; + +triple[] K={ + (1,-1,-1),(1,0,-1),(1,1,-1),(1,1,0), + (1,1,1),(1,0,1),(1,-1,1),(1,-1,0), + (0,0,-1),(0,0,1),(0,-1,0),(0,1,0) +}; + +surface s; + +void recur(triple p, real u, int level) { + if(level > 1 ) + for(triple V : M) + recur(p+u*V,u/3,level-1); + else + for(triple V : K) { + transform3 T=shift(p)*scale3(u)*shift(V)*scale3(0.5); + surface t=T*surface((1,-1,-1)--(1,1,-1)--(1,1,1)--(1,-1,1)--cycle); + s.append(t); + s.append(scale3(-1)*t); + } +} + +recur((0,0,0),1/3,3); + +surface sf; +sf.append(s); +sf.append(rotate(90,Y)*s); +sf.append(rotate(90,Z)*s); +sf.colors(palette(sf.map(abs),Rainbow())); + +draw(sf); diff --git a/Build/source/utils/asymptote/examples/alignbox.asy b/Build/source/utils/asymptote/examples/alignbox.asy index 8f216c6a10c..67083b1e2e0 100644 --- a/Build/source/utils/asymptote/examples/alignbox.asy +++ b/Build/source/utils/asymptote/examples/alignbox.asy @@ -4,6 +4,6 @@ object left=align(object("$x^2$",ellipse,margin),W); add(left); object right=align(object("$\sin x$",ellipse,margin),4E); add(right); -currentpicture.add(new void(frame f, transform t) { +add(new void(frame f, transform t) { draw(f,point(left,NE,t)--point(right,W,t)); }); diff --git a/Build/source/utils/asymptote/examples/animations/inlinemovie.tex b/Build/source/utils/asymptote/examples/animations/inlinemovie.tex index 3fa61b6673b..f3d9f5b0893 100644 --- a/Build/source/utils/asymptote/examples/animations/inlinemovie.tex +++ b/Build/source/utils/asymptote/examples/animations/inlinemovie.tex @@ -26,7 +26,7 @@ for(int i=0; i < 10; ++i) { label(A.pdf("controls",delay=50,keep=!settings.inlinetex)); \end{asy} %Uncomment the following line when not using the [inline] package option: -%\ASYanimategraphics[controls,loop]{20}{movie1}{}{} +%\ASYanimategraphics[controls]{50}{movie1}{}{} \end{center} And here is another one, clickable but without the control panel: @@ -45,7 +45,7 @@ for(int i=0; i < 10; ++i) { label(A.pdf(keep=!settings.inlinetex)); \end{asy} %Uncomment the following line when not using the [inline] package option: -%\ASYanimategraphics[controls,loop]{10}{movie2}{}{} +%\ASYanimategraphics[controls]{10}{movie2}{}{} \end{center} \end{document} diff --git a/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex b/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex index 4cd9cce3150..46779e85b28 100644 --- a/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex +++ b/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex @@ -6,9 +6,9 @@ Here is an inline 3D PDF movie, generated with the commands \begin{verbatim} -pdflatex inlinemovie -asy inlinemovie -pdflatex inlinemovie +pdflatex inlinemovie3 +asy inlinemovie3 +pdflatex inlinemovie3 \end{verbatim} \begin{center} diff --git a/Build/source/utils/asymptote/examples/clockarray.asy b/Build/source/utils/asymptote/examples/clockarray.asy new file mode 100644 index 00000000000..be7fd899a0e --- /dev/null +++ b/Build/source/utils/asymptote/examples/clockarray.asy @@ -0,0 +1,39 @@ +int nx=3; +int ny=4; +real xmargin=1cm; +real ymargin=xmargin; + +size(settings.paperwidth,settings.paperheight); + +picture pic; +real width=settings.paperwidth/nx-xmargin; +real height=settings.paperheight/ny-ymargin; +if(width <= 0 || height <= 0) abort("margin too big"); +size(pic,width,height); + +pen p=linewidth(0.5mm); +draw(pic,unitcircle,p); + +real h=0.08; +real m=0.05; + +for(int hour=1; hour <= 12; ++hour) { + pair z=dir((12-hour+3)*30); + label(pic,string(hour),z,z); + draw(pic,z--(1-h)*z,p); +} + +for(int minutes=0; minutes < 60; ++minutes) { + pair z=dir(6*minutes); + draw(pic,z--(1-m)*z); +} + +dot(pic,(0,0)); + +frame f=pic.fit(); +pair size=size(f)+(xmargin,ymargin); + +for(int i=0; i < nx; ++i) + for(int j=0; j < ny; ++j) + add(shift(realmult(size,(i,j)))*f); + diff --git a/Build/source/utils/asymptote/examples/controlsystem.asy b/Build/source/utils/asymptote/examples/controlsystem.asy index 0829bc90d51..bfd8336f1f6 100644 --- a/Build/source/utils/asymptote/examples/controlsystem.asy +++ b/Build/source/utils/asymptote/examples/controlsystem.asy @@ -15,25 +15,11 @@ draw(sum1); draw(junction1); add(new void(picture pic, transform t) { - draw(pic,Label("$u$",0.5,N),path(new pair[]{t*(0,0),sum1.left(t)}, - Horizontal),Arrow,PenMargin); + blockconnector operator --=blockconnector(pic,t); + + block(0,0)--Label("$u$",align=N)--Arrow--sum1--Arrow--delay--Arrow-- + system--junction1--Label("$y$",align=N)--Arrow--block(1,0); - draw(pic,path(new pair[]{sum1.right(t),delay.left(t)},Horizontal),Arrow, - PenMargin); - label(pic,"-",sum1.bottom(t),ESE); - - draw(pic,path(new pair[]{delay.right(t),system.left(t)},Horizontal),Arrow, - PenMargin); - - draw(pic,path(new pair[]{system.right(t),junction1.left(t)},Horizontal), - PenMargin); - - draw(pic,Label("$y$",0.5,N),path(new pair[]{junction1.right(t),t*(0.9,0)}, - Horizontal),Arrow,PenMargin); - - draw(pic,path(new pair[]{junction1.bottom(t),controller.right(t)},Vertical), - Arrow,PenMargin); - - draw(pic,path(new pair[]{controller.left(t),sum1.bottom(t)},Horizontal), - Arrow,PenMargin); + junction1--Down--Left--Arrow--controller--Left--Up-- + Label("$-$",position=3,align=ESE)--Arrow--sum1; }); diff --git a/Build/source/utils/asymptote/examples/cos3.asy b/Build/source/utils/asymptote/examples/cos3.asy new file mode 100644 index 00000000000..fa9c8f49550 --- /dev/null +++ b/Build/source/utils/asymptote/examples/cos3.asy @@ -0,0 +1,25 @@ +import graph3; +import palette; + +size(12cm,IgnoreAspect); +currentprojection=orthographic(1,-2,1); + +real f(pair z) {return abs(cos(z));} + +real Arg(triple v) +{ + return degrees(cos((v.x,v.y)),warn=false); +} + +surface s=surface(f,(-pi,-2),(pi,2),20,Spline); + +s.colors(palette(s.map(Arg),Wheel())); +draw(s); + +real xmin=point((-1,-1,-1)).x; +real xmax=point((1,1,1)).x; +draw((xmin,0,0)--(xmax,0,0),dashed); + +xaxis3("$\mathop{\rm Re} z$",Bounds,InTicks); +yaxis3("$\mathop{\rm Im} z$",Bounds,InTicks(beginlabel=false)); +zaxis3("$|\cos(z)|$",Bounds,InTicks); diff --git a/Build/source/utils/asymptote/examples/cyclohexane.asy b/Build/source/utils/asymptote/examples/cyclohexane.asy index d0121d8ea7e..8e1ff466b9d 100644 --- a/Build/source/utils/asymptote/examples/cyclohexane.asy +++ b/Build/source/utils/asymptote/examples/cyclohexane.asy @@ -1,61 +1,66 @@ import three; -currentprojection = perspective(300,-650,500); - -surface carbon = scale3(70)*unitsphere; // 70 pm -surface hydrogen = scale3(25)*unitsphere; // 25 pm - -real alpha = 90+aSin(1/3); - -real CCbond = 156; // 156 pm -real CHbond = 110; // 110 pm - -triple c1 = (0,0,0); -triple h1 = c1+CHbond*Z; -triple c2 = rotate(alpha,c1,c1+Y)*(CCbond*Z); -triple h2 = rotate(120,c1,c2)*h1; -triple h3 = c2-CHbond*Z; -triple h4 = rotate(120,c2,c1)*h3; - -triple c3 = rotate(120,c2,h3)*c1; -triple h5 = c3+CHbond*Z; -triple h6 = rotate(-120,c3,c2)*h5; - -triple c4 = rotate(-120,c3,h5)*c2; -triple h7 = c4-CHbond*Z; -triple h8 = rotate(120,c4,c3)*h7; - -triple c5 = rotate(120,c4,h7)*c3; -triple h9 = c5+CHbond*Z; -triple h10 = rotate(-120,c5,c4)*h9; - -triple c6 = rotate(-120,c5,h9)*c4; -triple h11 = c6-CHbond*Z; -triple h12 = rotate(120,c6,c5)*h11; - -draw(shift(c1)*carbon,black); -draw(shift(c2)*carbon,black); -draw(shift(c3)*carbon,black); -draw(shift(c4)*carbon,black); -draw(shift(c5)*carbon,black); -draw(shift(c6)*carbon,black); - - -draw(shift(h1)*hydrogen,lightgray); -draw(shift(h2)*hydrogen,lightgray); -draw(shift(h3)*hydrogen,lightgray); -draw(shift(h4)*hydrogen,lightgray); -draw(shift(h5)*hydrogen,lightgray); -draw(shift(h6)*hydrogen,lightgray); -draw(shift(h7)*hydrogen,lightgray); -draw(shift(h8)*hydrogen,lightgray); -draw(shift(h9)*hydrogen,lightgray); -draw(shift(h10)*hydrogen,lightgray); -draw(shift(h11)*hydrogen,lightgray); -draw(shift(h12)*hydrogen,lightgray); - - -pen thick = linewidth(10); +currentprojection=perspective(300,-650,500); +currentlight.background=palecyan; + +surface carbon=scale3(70)*unitsphere; // 70 pm +surface hydrogen=scale3(25)*unitsphere; // 25 pm + +real alpha=90+aSin(1/3); + +real CCbond=156; // 156 pm +real CHbond=110; // 110 pm + +triple c1=(0,0,0); +triple h1=c1+CHbond*Z; +triple c2=rotate(alpha,c1,c1+Y)*(CCbond*Z); +triple h2=rotate(120,c1,c2)*h1; +triple h3=c2-CHbond*Z; +triple h4=rotate(120,c2,c1)*h3; + +triple c3=rotate(120,c2,h3)*c1; +triple h5=c3+CHbond*Z; +triple h6=rotate(-120,c3,c2)*h5; + +triple c4=rotate(-120,c3,h5)*c2; +triple h7=c4-CHbond*Z; +triple h8=rotate(120,c4,c3)*h7; + +triple c5=rotate(120,c4,h7)*c3; +triple h9=c5+CHbond*Z; +triple h10=rotate(-120,c5,c4)*h9; + +triple c6=rotate(-120,c5,h9)*c4; +triple h11=c6-CHbond*Z; +triple h12=rotate(120,c6,c5)*h11; + +pen Black=gray(0.4); + +draw(shift(c1)*carbon,Black); +draw(shift(c2)*carbon,Black); +draw(shift(c3)*carbon,Black); +draw(shift(c4)*carbon,Black); +draw(shift(c5)*carbon,Black); +draw(shift(c6)*carbon,Black); + + +material White=material(diffusepen=gray(0.4),emissivepen=gray(0.6)); + +draw(shift(h1)*hydrogen,White); +draw(shift(h2)*hydrogen,White); +draw(shift(h3)*hydrogen,White); +draw(shift(h4)*hydrogen,White); +draw(shift(h5)*hydrogen,White); +draw(shift(h6)*hydrogen,White); +draw(shift(h7)*hydrogen,White); +draw(shift(h8)*hydrogen,White); +draw(shift(h9)*hydrogen,White); +draw(shift(h10)*hydrogen,White); +draw(shift(h11)*hydrogen,White); +draw(shift(h12)*hydrogen,White); + + +pen thick=linewidth(10); draw(c1--c2--c3--c4--c5--c6--cycle,thick); diff --git a/Build/source/utils/asymptote/examples/exp3.asy b/Build/source/utils/asymptote/examples/exp3.asy new file mode 100644 index 00000000000..e7508a29297 --- /dev/null +++ b/Build/source/utils/asymptote/examples/exp3.asy @@ -0,0 +1,25 @@ +import graph3; +import palette; + +size(12cm,IgnoreAspect); +currentprojection=orthographic(1,-2,1); + +real f(pair z) {return abs(exp(z));} + +real Arg(triple v) +{ + return degrees(exp((v.x,v.y)),warn=false); +} + +surface s=surface(f,(-2,-pi),(2,pi),20,Spline); + +s.colors(palette(s.map(Arg),Wheel())); +draw(s); + +real xmin=point((-1,-1,-1)).x; +real xmax=point((1,1,1)).x; +draw((xmin,0,0)--(xmax,0,0),dashed); + +xaxis3("$\mathop{\rm Re} z$",Bounds,InTicks); +yaxis3("$\mathop{\rm Im} z$",Bounds,InTicks(beginlabel=false)); +zaxis3("$|\exp(z)|$",Bounds,InTicks); diff --git a/Build/source/utils/asymptote/examples/fequlogo.asy b/Build/source/utils/asymptote/examples/fequlogo.asy index 29cae0be720..e53e1831419 100644 --- a/Build/source/utils/asymptote/examples/fequlogo.asy +++ b/Build/source/utils/asymptote/examples/fequlogo.asy @@ -33,7 +33,7 @@ real h=0.0125; draw(surface(rotate(2)*xscale(0.32)*yscale(0.6)*lo,s,-pi/4-1.5*pi/20,0.5,h)); draw(surface(rotate(0)*xscale(-0.45)*yscale(0.3)*hi,s,0.8*pi,0.25,h),blue); -currentpicture.add(new void(frame f, transform3 t, picture pic, projection P) { +add(new void(frame f, transform3 t, picture pic, projection P) { draw(f,surface(invert(box(min(f,P),max(f,P)),min3(f),P), new pen[] {orange,red,yellow,brown})); } diff --git a/Build/source/utils/asymptote/examples/fillcontour.asy b/Build/source/utils/asymptote/examples/fillcontour.asy index 1b93e002fff..311192fb7f8 100644 --- a/Build/source/utils/asymptote/examples/fillcontour.asy +++ b/Build/source/utils/asymptote/examples/fillcontour.asy @@ -5,7 +5,7 @@ import contour; size(12cm,IgnoreAspect); pair a=(pi/2,0); -pair b=(1.5*pi+epsilon,2pi); +pair b=(3pi/2,2pi); real f(real x, real y) {return cos(x)*sin(y);} diff --git a/Build/source/utils/asymptote/examples/gamma3.asy b/Build/source/utils/asymptote/examples/gamma3.asy index 1e400152a93..e7fdde015e0 100644 --- a/Build/source/utils/asymptote/examples/gamma3.asy +++ b/Build/source/utils/asymptote/examples/gamma3.asy @@ -24,6 +24,10 @@ real Arg(triple v) s.colors(palette(s.map(Arg),Wheel())); draw(s); +real xmin=point((-1,-1,-1)).x; +real xmax=point((1,1,1)).x; +draw((xmin,0,0)--(xmax,0,0),dashed); + xaxis3("$\mathop{\rm Re} z$",Bounds,InTicks); yaxis3("$\mathop{\rm Im} z$",Bounds,InTicks(beginlabel=false)); zaxis3("$|\Gamma(z)|$",Bounds,InTicks); diff --git a/Build/source/utils/asymptote/examples/label3.asy b/Build/source/utils/asymptote/examples/label3.asy index fdf8d512e39..f8d5e07049f 100644 --- a/Build/source/utils/asymptote/examples/label3.asy +++ b/Build/source/utils/asymptote/examples/label3.asy @@ -1,7 +1,7 @@ import three; -currentprojection=perspective(1,1,1,up=Y); +currentprojection=perspective(0,0,1,up=Y); label(scale(4)*"$\displaystyle\int_{-\infty}^{+\infty} e^{-\alpha x^2}\,dx= -\sqrt{\frac{\pi}{\alpha}}$",O,blue); +\sqrt{\frac{\pi}{\alpha}}$",O,blue,Embedded); diff --git a/Build/source/utils/asymptote/examples/labelbox.asy b/Build/source/utils/asymptote/examples/labelbox.asy index cd61a9da69c..38153b856e5 100644 --- a/Build/source/utils/asymptote/examples/labelbox.asy +++ b/Build/source/utils/asymptote/examples/labelbox.asy @@ -3,9 +3,9 @@ real margin=2mm; pair z1=(0,1); pair z0=(0,0); -object label1=draw("small box",box,z1,margin); -object label0=draw("LARGE ELLIPSE",ellipse,z0,margin); +object Box=draw("small box",box,z1,margin); +object Ellipse=draw("LARGE ELLIPSE",ellipse,z0,margin); add(new void(frame f, transform t) { - draw(f,point(label1,SW,t){SW}..{SW}point(label0,NNE,t)); + draw(f,point(Box,SW,t){SW}..{SW}point(Ellipse,NNE,t)); }); diff --git a/Build/source/utils/asymptote/examples/logo3.asy b/Build/source/utils/asymptote/examples/logo3.asy index 932efaca410..93b5a331e9e 100644 --- a/Build/source/utils/asymptote/examples/logo3.asy +++ b/Build/source/utils/asymptote/examples/logo3.asy @@ -2,32 +2,40 @@ import three; size(560,320,IgnoreAspect); size3(140,80,15); -currentprojection=perspective(-3,20,10,up=Y); +currentprojection=perspective(-2,20,10,up=Y); currentlight=White; -path[] outline; - real a=-0.4; real b=0.95; real y1=-5; real y2=-3y1/2; path A=(a,0){dir(10)}::{dir(89.5)}(0,y2); -outline.push(A); -outline.push((0,y1){dir(88.3)}::{dir(20)}(b,0)); +path B=(0,y1){dir(88.3)}::{dir(20)}(b,0); real c=0.5*a; pair z=(0,2.5); -path[] text = shift(0,2)*scale(0.01,0.15)* +transform t=scale(1,15); +transform T=inverse(scale(t.yy,t.xx)); +path[] g=shift(0,1.979)*scale(0.01)*t* texpath(Label("{\it symptote}",z,0.25*E+0.169S,fontsize(24pt))); -outline.append(text); pair w=(0,1.7); -outline.push(intersectionpoint(A,w-1--w)--w); -outline.push((0,y1)--(0,y2)); -outline.push((a,0)--(b,0)); +pair u=intersectionpoint(A,w-1--w); + +real h=0.25*linewidth(); +real hy=(T*(h,h)).x; +g.push(t*((a,hy)--(b,hy)..(b+hy,0)..(b,-hy)--(a,-hy)..(a-hy,0)..cycle)); +g.push(T*((h,y1)--(h,y2)..(0,y2+h)..(-h,y2)--(-h,y1)..(0,y1-h)..cycle)); +g.push(shift(0,w.y)*t*((u.x,hy)--(w.x,hy)..(w.x+hy,0)..(w.x,-hy)--(u.x,-hy)..(u.x-hy,0)..cycle)); +real f=0.75; +g.push(point(A,0)--shift(-f*hy,f*h)*A--point(A,1)--shift(f*hy,-f*h)*reverse(A)--cycle); +g.push(point(B,0)--shift(f*hy,-f*h)*B--point(B,1)--shift(-f*hy,f*h)*reverse(B)--cycle); -for(path p : outline) - draw(extrude(p,-0.1Z),material(lightgray,shininess=1.0)); +triple H=-0.1Z; +material m=material(lightgray,shininess=1.0); -draw(path3(outline),red+linewidth(0)); +for(path p : g) + draw(extrude(p,H),m); -draw(surface(text),red,nolight); +surface s=surface(g); +draw(s,red,nolight); +draw(shift(H)*s,m); diff --git a/Build/source/utils/asymptote/examples/odetest.asy b/Build/source/utils/asymptote/examples/odetest.asy index 68a7a2eca67..69f8ea3fd07 100644 --- a/Build/source/utils/asymptote/examples/odetest.asy +++ b/Build/source/utils/asymptote/examples/odetest.asy @@ -8,7 +8,7 @@ write(); write("system integration test"); real[] f(real t, real[] x) {return new real[] {x[1],1.5*x[0]^2};} write(integrate(new real[] {4,-8},f,0,1,n=100,dynamic=true,tolmin=0.0002, - tolmax=0.0004,RK3BS,verbose=true)); + tolmax=0.0004,RK3BS,verbose=false)); write(); write("simultaneous newton test"); @@ -29,16 +29,15 @@ real[] initial(real[] x) { } real[] discrepancy(real[] x) { - write("Error: ",x[0]-1); - return new real[] {x[0]-1}; + real error=x[0]-1; + write("Error: ",error); + return new real[] {error}; } -write(solveBVP(f,0,1,n=10,initial,discrepancy,guess=new real[] {-30},RK4, - iterations=10)); +real[] w0=solveBVP(f,0,1,n=10,dynamic=true,tolmin=0.0002,tolmax=0.0004,RK3BS, + initial,discrepancy,guess=new real[] {-30},iterations=10); +write(w0); write(); -write(solveBVP(f,0,1,n=100,initial,discrepancy,guess=new real[] {-30},RK4, - iterations=10)); -write(); -write(solveBVP(f,0,1,n=10000,initial,discrepancy,guess=new real[] {-30},RK4, - iterations=10)); +write(integrate(w0,f,0,1,n=10,dynamic=true,tolmin=0.0002,tolmax=0.0004,RK3BS, + verbose=false)); write(); diff --git a/Build/source/utils/asymptote/examples/polardatagraph.asy b/Build/source/utils/asymptote/examples/polardatagraph.asy new file mode 100644 index 00000000000..6bd646e8aa4 --- /dev/null +++ b/Build/source/utils/asymptote/examples/polardatagraph.asy @@ -0,0 +1,17 @@ +import graph; + +size(100); + +int n=30; +real minRadius=0.2; +real angles[]=uniform(0,2pi,n); +angles.delete(angles.length-1); + +real[] r=new real[n]; +for(int i=0; i < n; ++i) + r[i]=unitrand()*(1-minRadius)+minRadius; + +interpolate join=operator ..(operator tension(10,true)); +draw(join(polargraph(r,angles,join),cycle),dot(red)); + + diff --git a/Build/source/utils/asymptote/examples/poster.asy b/Build/source/utils/asymptote/examples/poster.asy index cfe4ad855e3..cbcefc4bf69 100644 --- a/Build/source/utils/asymptote/examples/poster.asy +++ b/Build/source/utils/asymptote/examples/poster.asy @@ -3,6 +3,7 @@ import slide; import graph; defaultpen(deepblue); +pagenumberpen=invisible; real f(real x) {return (x != 0) ? x*sin(1/x) : 0;} pair F(real x) {return (x,f(x));} @@ -28,5 +29,5 @@ for graduate students, by graduate students.",fontsize(32pt)); label("Registration and abstract submission online.",(0,-0.5)); -label("\tt http://www.pims.math.ca/science/2006/06yrc/",point(SW),NE, +label("\tt http://www.pims.math.ca/science/2006/06yrc/",point(SW),2NE, black+fontsize(18pt)); diff --git a/Build/source/utils/asymptote/examples/ring.asy b/Build/source/utils/asymptote/examples/ring.asy index 54e0e25d489..6963d42d23f 100644 --- a/Build/source/utils/asymptote/examples/ring.asy +++ b/Build/source/utils/asymptote/examples/ring.asy @@ -1,5 +1,5 @@ size(0,100); path unitcircle=E..N..W..S..cycle; path g=scale(2)*unitcircle; +label("$a \le r \le b$"); radialshade(unitcircle^^g,yellow+evenodd,(0,0),1.0,yellow+brown,(0,0),2); - diff --git a/Build/source/utils/asymptote/examples/sin3.asy b/Build/source/utils/asymptote/examples/sin3.asy new file mode 100644 index 00000000000..d35cd271808 --- /dev/null +++ b/Build/source/utils/asymptote/examples/sin3.asy @@ -0,0 +1,25 @@ +import graph3; +import palette; + +size(12cm,IgnoreAspect); +currentprojection=orthographic(1,-2,1); + +real f(pair z) {return abs(sin(z));} + +real Arg(triple v) +{ + return degrees(sin((v.x,v.y)),warn=false); +} + +surface s=surface(f,(-pi,-2),(pi,2),20,Spline); + +s.colors(palette(s.map(Arg),Wheel())); +draw(s); + +real xmin=point((-1,-1,-1)).x; +real xmax=point((1,1,1)).x; +draw((xmin,0,0)--(xmax,0,0),dashed); + +xaxis3("$\mathop{\rm Re} z$",Bounds,InTicks); +yaxis3("$\mathop{\rm Im} z$",Bounds,InTicks(beginlabel=false)); +zaxis3("$|\sin(z)|$",Bounds,InTicks); diff --git a/Build/source/utils/asymptote/examples/strokepath.asy b/Build/source/utils/asymptote/examples/strokepath.asy index ee18b1c9bfe..c857150ec58 100644 --- a/Build/source/utils/asymptote/examples/strokepath.asy +++ b/Build/source/utils/asymptote/examples/strokepath.asy @@ -10,7 +10,7 @@ shipped=false; size(400); // Equivalent to draw(g,p): -currentpicture.add(new void(frame f, transform t) { +add(new void(frame f, transform t) { fill(f,strokepath(t*g,p),red); }); currentpicture.addPath(g,p); diff --git a/Build/source/utils/asymptote/examples/tensor.asy b/Build/source/utils/asymptote/examples/tensor.asy index aa633c4087b..19b1e087658 100644 --- a/Build/source/utils/asymptote/examples/tensor.asy +++ b/Build/source/utils/asymptote/examples/tensor.asy @@ -1,6 +1,5 @@ size(200); -//pen[][] p={{red,green,blue,cyan},{green,blue,rgb(black),magenta}}; pen[][] p={{red,green,blue,cyan},{blue,green,magenta,rgb(black)}}; path G=(0,0){dir(-120)}..(1,0)..(1,1)..(0,1)..cycle; path[] g={G,subpath(G,2,1)..(2,0)..(2,1)..cycle}; diff --git a/Build/source/utils/asymptote/examples/transparency.asy b/Build/source/utils/asymptote/examples/transparency.asy index 02196a02ee9..36e741d294d 100644 --- a/Build/source/utils/asymptote/examples/transparency.asy +++ b/Build/source/utils/asymptote/examples/transparency.asy @@ -1,6 +1,7 @@ size(0,150); -settings.outformat="pdf"; +if(settings.outformat == "") + settings.outformat="pdf"; begingroup(); fill(shift(1.5dir(120))*unitcircle,green+opacity(0.75)); diff --git a/Build/source/utils/asymptote/examples/triceratops.asy b/Build/source/utils/asymptote/examples/triceratops.asy index e640a6b37f9..a9e6e93cd52 100644 --- a/Build/source/utils/asymptote/examples/triceratops.asy +++ b/Build/source/utils/asymptote/examples/triceratops.asy @@ -4,6 +4,6 @@ size(15cm); currentprojection=orthographic(0,2,5,up=Y); // A compressed version of the required data file may be obtained from: -// http://www.cs.technion.ac.il/~irit/data/Viewpoint/galleon.obj.gz +// http://www.cs.technion.ac.il/~irit/data/Viewpoint/triceratops.obj.gz draw(obj("triceratops.obj",brown)); diff --git a/Build/source/utils/asymptote/examples/venn3.asy b/Build/source/utils/asymptote/examples/venn3.asy new file mode 100644 index 00000000000..6118fab6e9a --- /dev/null +++ b/Build/source/utils/asymptote/examples/venn3.asy @@ -0,0 +1,50 @@ +size(0,150); + +pen colour1=red; +pen colour2=green; +pen colour3=blue; + +real r=sqrt(3); + +pair z0=(0,0); +pair z1=(-1,0); +pair z2=(1,0); +pair z3=(0,r); + +path c1=circle(z1,r); +path c2=circle(z2,r); +path c3=circle(z3,r); + +fill(c1,colour1); +fill(c2,colour2); +fill(c3,colour3); + +picture intersection12; +fill(intersection12,c1,colour1+colour2); +clip(intersection12,c2); + +picture intersection13; +fill(intersection13,c1,colour1+colour3); +clip(intersection13,c3); + +picture intersection23; +fill(intersection23,c2,colour2+colour3); +clip(intersection23,c3); + +picture intersection123; +fill(intersection123,c1,colour1+colour2+colour3); +clip(intersection123,c2); +clip(intersection123,c3); + +add(intersection12); +add(intersection13); +add(intersection23); +add(intersection123); + +draw(c1); +draw(c2); +draw(c3); + +label("$A$",z1); +label("$B$",z2); +label("$C$",z3); diff --git a/Build/source/utils/asymptote/examples/washer.asy b/Build/source/utils/asymptote/examples/washer.asy new file mode 100644 index 00000000000..083039e55a3 --- /dev/null +++ b/Build/source/utils/asymptote/examples/washer.asy @@ -0,0 +1,13 @@ +import three; +size(10cm); + +path3[] p=reverse(unitcircle3)^^scale3(0.5)*unitcircle3; +path[] g=reverse(unitcircle)^^scale(0.5)*unitcircle; +triple H=-0.4Z; + +draw(surface(p,planar=true)); +draw(surface(shift(H)*p,planar=true)); +material m=material(lightgray,shininess=1.0); +for(path pp : g) + draw(extrude(pp,H),m); + diff --git a/Build/source/utils/asymptote/examples/worksheet.asy b/Build/source/utils/asymptote/examples/worksheet.asy index b3aa2dba8a0..f26797acabb 100644 --- a/Build/source/utils/asymptote/examples/worksheet.asy +++ b/Build/source/utils/asymptote/examples/worksheet.asy @@ -22,7 +22,7 @@ z += step; for(int i=1; i <= 14; ++i) { draw(pic,z--z+length); z += step; - draw(pic,z--z+length,dashed); + draw(pic,z--z+length,dashed+gray); z += step; void label(int i) { label(pic,string(i)+".",z,0.2NE,fontsize(0.8*1.5*2*height*mm)+gray); @@ -41,5 +41,8 @@ draw(pic,z--z+length); add(pic.fit(),(0,0),W); add(pic.fit(),(0,0),E); +newpage(); +add(pic.fit(),(0,0),W); +add(pic.fit(),(0,0),E); diff --git a/Build/source/utils/asymptote/examples/xsin1x.asy b/Build/source/utils/asymptote/examples/xsin1x.asy index e419ba19a69..cf394efb1a6 100644 --- a/Build/source/utils/asymptote/examples/xsin1x.asy +++ b/Build/source/utils/asymptote/examples/xsin1x.asy @@ -14,5 +14,11 @@ size(pic,50,IgnoreAspect); xaxis(pic,red); yaxis(pic,red); draw(pic,graph(pic,f,-0.1/pi,0.1/pi,1000)); -attach(bbox(pic,blue),point(N+0.85W),10SE); + +add(new void(frame f, transform t) { + frame G=shift(point(f,N+0.85W))*align(bbox(pic,blue),10SE); + add(f,G); + draw(f,t*box(min(pic,user=true),max(pic,user=true)),blue); + draw(f,point(G,E)--t*point(pic,W),blue); + }); diff --git a/Build/source/utils/asymptote/exp.h b/Build/source/utils/asymptote/exp.h index ad6cd3afa3b..3e9eca84ba8 100644 --- a/Build/source/utils/asymptote/exp.h +++ b/Build/source/utils/asymptote/exp.h @@ -191,6 +191,9 @@ public: nameExp(position pos, symbol *id) : exp(pos), value(new simpleName(pos, id)) {} + nameExp(position pos, string s) + : exp(pos), value(new simpleName(pos, symbol::trans(s))) {} + void prettyprint(ostream &out, Int indent); symbol *getName() diff --git a/Build/source/utils/asymptote/fftw++.h b/Build/source/utils/asymptote/fftw++.h index 62f8281e278..a622516b5a6 100644 --- a/Build/source/utils/asymptote/fftw++.h +++ b/Build/source/utils/asymptote/fftw++.h @@ -1,5 +1,5 @@ /* Fast Fourier transform C++ header class for the FFTW3 Library - Copyright (C) 2004 John C. Bowman, University of Alberta + Copyright (C) 2004-10 John C. Bowman, University of Alberta This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -18,18 +18,37 @@ #ifndef __fftwpp_h__ #define __fftwpp_h__ 1 -#define __FFTWPP_H_VERSION__ 1.04 +#define __FFTWPP_H_VERSION__ 1.05 #include <cstdlib> #include <fstream> #include <iostream> #include <fftw3.h> +#include <cerrno> #ifndef __Complex_h__ #include <complex> typedef std::complex<double> Complex; #endif +#ifndef M_PI +#define M_PI acos(-1.0) +#endif + +#ifndef HAVE_POSIX_MEMALIGN + +#ifdef __GLIBC_PREREQ +#if __GLIBC_PREREQ(2,3) +#define HAVE_POSIX_MEMALIGN +#endif +#else +#ifdef _POSIX_SOURCE +#define HAVE_POSIX_MEMALIGN +#endif +#endif + +#endif + #ifdef __Array_h__ using Array::array1; using Array::array2; @@ -38,48 +57,96 @@ using Array::array3; static array1<Complex> NULL1; static array2<Complex> NULL2; static array3<Complex> NULL3; + +#else + +#ifdef HAVE_POSIX_MEMALIGN +#ifdef _AIX +extern "C" int posix_memalign(void **memptr, size_t alignment, size_t size); #endif +#else +// Adapted from FFTW aligned malloc/free. Assumes that malloc is at least +// sizeof(void*)-aligned. Allocated memory must be freed with free0. +inline int posix_memalign0(void **memptr, size_t alignment, size_t size) +{ + if(alignment % sizeof (void *) != 0 || (alignment & (alignment - 1)) != 0) + return EINVAL; + void *p0=malloc(size+alignment); + if(!p0) return ENOMEM; + void *p=(void *)(((size_t) p0+alignment)&~(alignment-1)); + *((void **) p-1)=p0; + *memptr=p; + return 0; +} -inline Complex *FFTWComplex(size_t size) +inline void free0(void *p) { - static const size_t offset = sizeof(size_t)/sizeof(Complex)+ - (sizeof(size_t) % sizeof(Complex) > 0); - void *alloc=fftw_malloc((size+offset)*sizeof(Complex)); - if(size && !alloc) std::cerr << std::endl << "Memory limits exceeded" - << std::endl; - *(size_t *) alloc=size; - Complex*p=(Complex *)alloc+offset; - for(size_t i=0; i < size; i++) new(p+i) Complex; - return p; + if(p) free(*((void **) p-1)); } +#endif -inline double *FFTWdouble(size_t size) +template<class T> +inline void newAlign(T *&v, size_t len, size_t align) { - static const size_t offset = sizeof(size_t)/sizeof(Complex)+ - (sizeof(size_t) % sizeof(Complex) > 0); - void *alloc=fftw_malloc(size*sizeof(double)+offset*sizeof(Complex)); - if(size && !alloc) std::cerr << std::endl << "Memory limits exceeded" - << std::endl; - *(size_t *) alloc=size; - double*p=(double*)((Complex *)alloc+offset); - for(size_t i=0; i < size; i++) new(p+i) double; - return p; + void *mem=NULL; + const char *invalid="Invalid alignment requested"; + const char *nomem="Memory limits exceeded"; +#ifdef HAVE_POSIX_MEMALIGN + int rc=posix_memalign(&mem,align,len*sizeof(T)); +#else + int rc=posix_memalign0(&mem,align,len*sizeof(T)); +#endif + if(rc == EINVAL) std::cerr << invalid << std::endl; + if(rc == ENOMEM) std::cerr << nomem << std::endl; + v=(T *) mem; + for(size_t i=0; i < len; i++) new(v+i) T; } template<class T> -inline void FFTWdelete(T *p) +inline void deleteAlign(T *v, size_t len) +{ + for(size_t i=len-1; i > 0; i--) v[i].~T(); + v[0].~T(); +#ifdef HAVE_POSIX_MEMALIGN + free(v); +#else + free0(v); +#endif +} + +#endif + +inline Complex *ComplexAlign(size_t size) +{ + Complex *v; + newAlign(v,size,sizeof(Complex)); + return v; +} + +inline double *doubleAlign(size_t size) { - static const size_t offset = sizeof(size_t)/sizeof(Complex)+ - (sizeof(size_t) % sizeof(Complex) > 0); - void *alloc=(Complex *)p-offset; - size_t size=*(size_t *) alloc; - for(size_t i=size-1; i > 0; i--) ((T *) p)[i].~T(); - ((T *) p)[0].~T(); - fftw_free(alloc); + double *v; + newAlign(v,size,sizeof(Complex)); + return v; } +template<class T> +inline void deleteAlign(T *p) +{ +#ifdef HAVE_POSIX_MEMALIGN + free(p); +#else + free0(p); +#endif +} + +// Obsolete names: +#define FFTWComplex ComplexAlign +#define FFTWdouble doubleAlign +#define FFTWdelete deleteAlign + inline void fftwpp_export_wisdom(void (*emitter)(char c, std::ofstream& s), - std::ofstream& s) + std::ofstream& s) { fftw_export_wisdom((void (*) (char, void *)) emitter,(void *) &s); } @@ -104,12 +171,6 @@ protected: fftw_plan plan; bool inplace; - static unsigned int effort; - static bool Wise; - static const char *WisdomName; - static std::ifstream ifWisdom; - static std::ofstream ofWisdom; - unsigned int Dist(unsigned int n, unsigned int stride, unsigned int dist) { return dist ? dist : ((stride == 1) ? n : 1); } @@ -122,37 +183,91 @@ protected: return realsize(n,in,(Complex *) out); } - // Shift the Fourier origin to (nx/2,0) - void Shift(Complex *data, unsigned int nx, unsigned int ny) { + static std::ifstream ifWisdom; + static std::ofstream ofWisdom; + static bool Wise; + +public: + // Shift the Fourier origin to (nx/2,0) for even nx. + static void Shift(Complex *data, unsigned int nx, unsigned int ny, + int sign=0) { const unsigned int nyp=ny/2+1; Complex *pstop=data+nx*nyp; - int pinc=2*nyp; - for(Complex *p=data+nyp; p < pstop; p += pinc) { - //#pragma ivdep - for(unsigned int j=0; j < nyp; j++) p[j]=-p[j]; + if(nx % 2 == 0) { + int pinc=2*nyp; + for(Complex *p=data+nyp; p < pstop; p += pinc) { + //#pragma ivdep + for(unsigned int j=0; j < nyp; j++) p[j]=-p[j]; + } + } else { + if(sign) { + unsigned int c=nx/2; + int pinc=nyp; + double arg=2.0*M_PI*c/nx; + Complex zeta(cos(arg),sign*sin(arg)); + Complex zetak=zeta; + for(Complex *p=data+nyp; p < pstop; p += pinc) { + //#pragma ivdep + for(unsigned int j=0; j < nyp; j++) p[j] *= zetak; + zetak *= zeta; + } + } else { + std::cerr << "Shift for odd nx must be signed and interleaved" + << std::endl; + exit(1); + } } } - // Shift the Fourier origin to (nx/2,ny/2,0) - void Shift(Complex *data, unsigned int nx, unsigned int ny, - unsigned int nz) { + // Shift the Fourier origin to (nx/2,ny/2,0). + static void Shift(Complex *data, unsigned int nx, unsigned int ny, + unsigned int nz, int sign=0) { const unsigned int nzp=nz/2+1; const unsigned int nyzp=ny*nzp; - const unsigned int pinc=2*nzp; - Complex *p,*pstop; - p=pstop=data; - for(unsigned i=0; i < nx; i++) { - if(i % 2) p -= nzp; - else p += nzp; - pstop += nyzp; - for(; p < pstop; p += pinc) { - //#pragma ivdep - for(unsigned int k=0; k < nzp; k++) p[k]=-p[k]; + if(nx % 2 == 0 && ny % 2 == 0) { + const unsigned int pinc=2*nzp; + Complex *p,*pstop; + p=pstop=data; + for(unsigned i=0; i < nx; i++) { + if(i % 2) p -= nzp; + else p += nzp; + pstop += nyzp; + for(; p < pstop; p += pinc) { + //#pragma ivdep + for(unsigned int k=0; k < nzp; k++) p[k]=-p[k]; + } + } + } else { + if(sign) { + unsigned int cx=nx/2; + unsigned int cy=ny/2; + double twopi=2.0*M_PI; + double argx=twopi*cx/nx; + Complex zetax(cos(argx),sign*sin(argx)); + double argy=twopi*cy/ny; + Complex zetay(cos(argy),sign*sin(argy)); + Complex zetak(1.0,0.0); + for(unsigned i=0; i < nx; i++) { + Complex *datai=data+nyzp*i; + for(unsigned j=0; j < ny; j++) { + //#pragma ivdep + Complex *dataij=datai+nzp*j; + for(unsigned int k=0; k < nzp; k++) dataij[k] *= zetak; + zetak *= zetay; + } + zetak *= zetax; + } + } else { + std::cerr << "Shift for odd nx or ny must be signed and interleaved" + << std::endl; + exit(1); } } } -public: + static unsigned int effort; + static const char *WisdomName; + fftw(unsigned int size, int sign, unsigned int n=0) : size(size), sign(sign), norm(1.0/(n ? n : size)), shift(false), plan(NULL) {} @@ -170,7 +285,7 @@ public: void Setup(Complex *in, Complex *out=NULL) { if(!Wise) LoadWisdom(); bool alloc=!in; - if(alloc) in=FFTWComplex(size); + if(alloc) in=ComplexAlign(size); #ifndef NO_CHECK_ALIGN CheckAlign(in,"constructor input"); if(out) CheckAlign(out,"constructor output"); @@ -185,7 +300,7 @@ public: exit(1); } - if(alloc) FFTWdelete(in); + if(alloc) deleteAlign(in,size); SaveWisdom(); } @@ -218,7 +333,7 @@ public: if(!out) out=in; #endif if(inplace ^ (out == in)) { - std::cerr << "ERROR: fft constructor and call must be either both in place or out of place" << std::endl; + std::cerr << "ERROR: fft constructor and call must be both in place or both out of place" << std::endl; exit(1); } } @@ -391,7 +506,7 @@ public: // Compute the complex Fourier transform of n real values, using phase sign -1. // Before calling fft(), the array in must be allocated as double[n] and // the array out must be allocated as Complex[n/2+1]. The arrays in and out -// may coincide, in which case they must both be allocated as Complex[n/2+1]. +// may coincide, allocated as Complex[n/2+1]. // // Out-of-place usage: // @@ -438,9 +553,9 @@ public: // phase sign +1. // Before calling fft(), the array in must be allocated as Complex[n/2+1] // and the array out must be allocated as double[n]. The arrays in and out -// may coincide, in which case they must both be allocated as Complex[n/2+1]. +// may coincide, allocated as Complex[n/2+1]. // -// Out-of-place usage: +// Out-of-place usage (input destroyed): // // crfft1d Backward(n,in,out); // Backward.fft(in,out); @@ -483,8 +598,8 @@ public: // Compute the real Fourier transform of m real vectors, each of length n, // using phase sign -1. Before calling fft(), the array in must be // allocated as double[m*n] and the array out must be allocated as -// Complex[m*(n/2+1)]. The arrays in and out may coincide, in which case -// they must both be allocated as Complex[m*(n/2+1)]. +// Complex[m*(n/2+1)]. The arrays in and out may coincide, +// allocated as Complex[m*(n/2+1)]. // // Out-of-place usage: // @@ -539,10 +654,10 @@ public: // length n/2+1, corresponding to the non-negative parts of the frequency // spectra, using phase sign +1. Before calling fft(), the array in must be // allocated as Complex[m*(n/2+1)] and the array out must be allocated as -// double[m*n]. The arrays in and out may coincide, in which case they -// must both be allocated as Complex[m*(n/2+1)]. +// double[m*n]. The arrays in and out may coincide, +// allocated as Complex[m*(n/2+1)]. // -// Out-of-place usage: +// Out-of-place usage (input destroyed): // // mcrfft1d Backward(n,m,stride,dist,in,out); // Backward.fft(in,out); @@ -565,11 +680,6 @@ class mcrfft1d : public fftw { unsigned int dist; public: mcrfft1d(unsigned int nx, unsigned int m=1, unsigned int stride=1, - unsigned int dist=0, Complex *in=NULL) - : fftw(nx/2*stride+(m-1)*Dist(nx,stride,dist)+1,1,nx), - nx(nx), m(m), stride(stride), dist(Dist(nx,stride,dist)) {Setup(in);} - - mcrfft1d(unsigned int nx, unsigned int m=1, unsigned int stride=1, unsigned int dist=0, Complex *in=NULL, double *out=NULL) : fftw((realsize(nx,in,out)-1)*stride+(m-1)*Dist(nx,stride,dist)+1,1,nx), nx(nx), m(m), stride(stride), dist(Dist(nx,stride,dist)) {Setup(in,out);} @@ -640,8 +750,7 @@ public: // values, using phase sign -1. // Before calling fft(), the array in must be allocated as double[nx*ny] and // the array out must be allocated as Complex[nx*(ny/2+1)]. The arrays in -// and out may coincide, in which case they must both be allocated as -// Complex[nx*(ny/2+1)]. +// and out may coincide, allocated as Complex[nx*(ny/2+1)]. // // Out-of-place usage: // @@ -695,10 +804,10 @@ public: // half-plane ky >= 0, using phase sign +1. // Before calling fft(), the array in must be allocated as // Complex[nx*(ny+1)/2] and the array out must be allocated as -// double[nx*ny]. The arrays in and out may coincide, in which case they -// must both be allocated as Complex[nx*(ny/2+1)]. +// double[nx*ny]. The arrays in and out may coincide, +// allocated as Complex[nx*(ny/2+1)]. // -// Out-of-place usage: +// Out-of-place usage (input destroyed): // // crfft2d Backward(nx,ny,in,out); // Backward.fft(in,out); // Origin of Fourier domain at (0,0) @@ -798,8 +907,7 @@ public: // nx times ny times nz real values, using phase sign -1. // Before calling fft(), the array in must be allocated as double[nx*ny*nz] // and the array out must be allocated as Complex[nx*ny*(nz/2+1)]. The -// arrays in and out may coincide, in which case they must both be allocated as -// Complex[nx*ny*(nz/2+1)]. +// arrays in and out may coincide, allocated as Complex[nx*ny*(nz/2+1)]. // // Out-of-place usage: // @@ -856,10 +964,10 @@ public: // half-plane kz >= 0, using phase sign +1. // Before calling fft(), the array in must be allocated as // Complex[nx*ny*(nz+1)/2] and the array out must be allocated as -// double[nx*ny*nz]. The arrays in and out may coincide, in which case they -// must both be allocated as Complex[nx*ny*(nz/2+1)]. +// double[nx*ny*nz]. The arrays in and out may coincide, +// allocated as Complex[nx*ny*(nz/2+1)]. // -// Out-of-place usage: +// Out-of-place usage (input destroyed): // // crfft3d Backward(nx,ny,nz,in,out); // Backward.fft(in,out); // Origin of Fourier domain at (0,0) diff --git a/Build/source/utils/asymptote/fileio.h b/Build/source/utils/asymptote/fileio.h index f7757b17437..6cc87c4ca0d 100644 --- a/Build/source/utils/asymptote/fileio.h +++ b/Build/source/utils/asymptote/fileio.h @@ -259,15 +259,16 @@ public: reportError("Cannot open standard input in binary mode"); stream=&cin; } else { + if(mode & std::ios::out) + name=outpath(name); stream=fstream=new std::fstream(name.c_str(),mode); if(mode & std::ios::out) { - checkLocal(name); if(error()) { delete fstream; std::ofstream f(name.c_str()); f.close(); + stream=fstream=new std::fstream(name.c_str(),mode); } - stream=fstream=new std::fstream(name.c_str(),mode); } index=processData().ifile.add(fstream); if(check) Check(); @@ -367,7 +368,7 @@ public: reportError("Cannot open standard output in binary mode"); stream=&cout; } else { - checkLocal(name); + name=outpath(name); stream=fstream=new std::ofstream(name.c_str(),mode | std::ios::trunc); index=processData().ofile.add(fstream); Check(); @@ -647,7 +648,7 @@ public: oxfile(const string& name) : file(name,true,XOUTPUT), fstream(NULL) {} void open() { - fstream=new xdr::oxstream((checkLocal(name),name.c_str()),xdr::xios::trunc); + fstream=new xdr::oxstream(outpath(name).c_str(),xdr::xios::trunc); index=processData().oxfile.add(fstream); Check(); } diff --git a/Build/source/utils/asymptote/glrender.cc b/Build/source/utils/asymptote/glrender.cc index e2b5c094ed3..41c2f66c0c9 100644 --- a/Build/source/utils/asymptote/glrender.cc +++ b/Build/source/utils/asymptote/glrender.cc @@ -11,7 +11,7 @@ #include "common.h" -#ifdef HAVE_LIBGL +#ifdef HAVE_GL // For CYGWIN #ifndef FGAPI @@ -323,18 +323,15 @@ void drawscene(double Width, double Height) double size2=hypot(Width,Height); - glEnable(GL_BLEND); // Render opaque objects Picture->render(nurb,size2,m,M,perspective,false); // Enable transparency - glEnable(GL_BLEND); glDepthMask(GL_FALSE); // Render transparent objects Picture->render(nurb,size2,m,M,perspective,true); glDepthMask(GL_TRUE); - glDisable(GL_BLEND); } // Return x divided by y rounded up to the nearest integer. @@ -397,6 +394,7 @@ void Export() outOfMemory(); } setProjection(); + glutPostRedisplay(); #ifdef HAVE_LIBPTHREAD if(glthread && readyAfterExport) { @@ -628,7 +626,7 @@ void display() lastframetime=tv; double milliseconds=1000.0*(delay-seconds); if(milliseconds > 0) - glutTimerFunc(milliseconds,nextframe,0); + glutTimerFunc((int) (milliseconds+0.5),nextframe,0); else nextframe(0); } #endif @@ -1326,7 +1324,9 @@ void glrender(const string& prefix, const picture *pic, const string& format, if(maxWidth <= 0) maxWidth=max(maxHeight,2); if(maxHeight <= 0) maxHeight=max(maxWidth,2); if(screenWidth <= 0) screenWidth=maxWidth; + else screenWidth=min(screenWidth,maxWidth); if(screenHeight <= 0) screenHeight=maxHeight; + else screenHeight=min(screenHeight,maxHeight); oWidth=width; oHeight=height; @@ -1354,8 +1354,8 @@ void glrender(const string& prefix, const picture *pic, const string& format, setosize(); if(View && settings::verbose > 1) - cout << "Rendering " << prefix << " as " << Width << "x" << Height - << " image" << endl; + cout << "Rendering " << stripDir(prefix) << " as " + << Width << "x" << Height << " image" << endl; } #ifdef HAVE_LIBPTHREAD @@ -1462,9 +1462,12 @@ void glrender(const string& prefix, const picture *pic, const string& format, setosize(); } + glEnable(GL_BLEND); glEnable(GL_DEPTH_TEST); glEnable(GL_MAP1_VERTEX_3); + glEnable(GL_MAP1_VERTEX_4); glEnable(GL_MAP2_VERTEX_3); + glEnable(GL_MAP2_VERTEX_4); glEnable(GL_MAP2_COLOR_4); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); diff --git a/Build/source/utils/asymptote/glrender.h b/Build/source/utils/asymptote/glrender.h index 5854b92f3ab..7d37e3dfdb2 100644 --- a/Build/source/utils/asymptote/glrender.h +++ b/Build/source/utils/asymptote/glrender.h @@ -9,7 +9,7 @@ #include "common.h" #include "triple.h" -#ifdef HAVE_LIBGL +#ifdef HAVE_GL #include <csignal> @@ -46,6 +46,15 @@ inline void store(GLfloat *control, const camp::triple& v) control[1]=v.gety(); control[2]=v.getz(); } + +inline void store(GLfloat *control, const triple& v, double weight) +{ + control[0]=v.getx()*weight; + control[1]=v.gety()*weight; + control[2]=v.getz()*weight; + control[3]=weight; +} + } namespace gl { diff --git a/Build/source/utils/asymptote/install-sh b/Build/source/utils/asymptote/install-sh index 3f83ce9b555..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=2010-02-06.18; # UTC +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 @@ -200,11 +200,7 @@ if test $# -eq 0; then fi if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 + trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. diff --git a/Build/source/utils/asymptote/interact.cc b/Build/source/utils/asymptote/interact.cc index f038a3153d3..f185fbe6559 100644 --- a/Build/source/utils/asymptote/interact.cc +++ b/Build/source/utils/asymptote/interact.cc @@ -84,7 +84,6 @@ void pre_readline() { #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) if(tty) { - run::init_readline(getSetting<bool>("tabcompletion")); Readline=readline; } else #endif @@ -96,6 +95,7 @@ void init_interactive() #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) if(tty) { init_completion(); + run::init_readline(getSetting<bool>("tabcompletion")); read_history(historyname.c_str()); } #endif diff --git a/Build/source/utils/asymptote/lex.yy.cc b/Build/source/utils/asymptote/lex.yy.cc index 3b82bfa9671..3cbf4000837 100644 --- a/Build/source/utils/asymptote/lex.yy.cc +++ b/Build/source/utils/asymptote/lex.yy.cc @@ -1085,7 +1085,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) /* %endif */ /* %if-c++-only C++ definition */ /* %endif */ diff --git a/Build/source/utils/asymptote/main.cc b/Build/source/utils/asymptote/main.cc index 003ea5670fc..b17d4583564 100644 --- a/Build/source/utils/asymptote/main.cc +++ b/Build/source/utils/asymptote/main.cc @@ -27,6 +27,10 @@ #include "common.h" +#ifdef __CYGWIN__ +#define NOMINMAX +#endif + #ifdef HAVE_LIBSIGSEGV #include <sigsegv.h> #endif @@ -61,7 +65,7 @@ int sigsegv_handler (void *, int emergency) { if(!emergency) return 0; // Really a stack overflow em.runtime(vm::getPos()); -#ifdef HAVE_LIBGL +#ifdef HAVE_GL if(gl::glthread) cerr << "Stack overflow or segmentation fault: rerun with -nothreads" << endl; @@ -169,7 +173,7 @@ int main(int argc, char *argv[]) } Args args(argc,argv); -#ifdef HAVE_LIBGL +#ifdef HAVE_GL gl::glthread=getSetting<bool>("threads"); #ifdef HAVE_LIBPTHREAD diff --git a/Build/source/utils/asymptote/memory.h b/Build/source/utils/asymptote/memory.h index 63c5291b130..70c36422ffe 100644 --- a/Build/source/utils/asymptote/memory.h +++ b/Build/source/utils/asymptote/memory.h @@ -18,7 +18,7 @@ #ifndef __GNUC_PREREQ #define __GNUC_PREREQ(maj, min) (0) # endif -#if __GNUC_PREREQ(4,3) +#if __GNUC_PREREQ(4,3) || defined(__CYGWIN__) #include <tr1/unordered_map> #define EXT std::tr1 #else diff --git a/Build/source/utils/asymptote/patches/README b/Build/source/utils/asymptote/patches/README index 6b21edce8f4..d0bf81e8bc1 100644 --- a/Build/source/utils/asymptote/patches/README +++ b/Build/source/utils/asymptote/patches/README @@ -14,9 +14,6 @@ prototype in the file gc6.8/include/gc.h (version 6.8). The file gc-7.0nomem.patch avoids segmentation faults with gc-7.0 on out-of-memory errors. -The file freeglut-cygwin.patch allows version 2.6.0-rc1 of freeglut.dll -to be built under CYGWIN. - The file movie15_dvipdfmx.patch brings the xelatex/dvipdfmx-enhanced version of movie15.sty available at http://cvs.ktug.or.kr/viewcvs/dvipdfmx/contrib/latex/movie15.sty.sample?revision=1.1 diff --git a/Build/source/utils/asymptote/patches/freeglut-cygwin.patch b/Build/source/utils/asymptote/patches/freeglut-cygwin.patch deleted file mode 100644 index d6f5629fdd9..00000000000 --- a/Build/source/utils/asymptote/patches/freeglut-cygwin.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ru freeglut-2.6.0/configure freeglut-2.6.0J/configure ---- freeglut-2.6.0/configure 2009-04-20 20:53:07.000000000 -0700 -+++ freeglut-2.6.0J/configure 2009-06-22 06:49:17.640625000 -0700 -@@ -21289,7 +21289,7 @@ - LIBXXF86VM= - LIBXI= - VERSION_INFO= -- EXPORT_FLAGS="-DFREEGLUT_EXPORTS" -+ EXPORT_FLAGS="-DFREEGLUT_EXPORTS -D_WIN32" - else - GL_LIBS="-lGL -lXext -lX11" - { echo "$as_me:$LINENO: checking for XF86VidModeSwitchToMode in -lXxf86vm" >&5 diff --git a/Build/source/utils/asymptote/path.cc b/Build/source/utils/asymptote/path.cc index 5f1eb4094a0..e531e207b80 100644 --- a/Build/source/utils/asymptote/path.cc +++ b/Build/source/utils/asymptote/path.cc @@ -19,8 +19,8 @@ namespace camp { -const double BigFuzz=10000.0*DBL_EPSILON; const double Fuzz=1000.0*DBL_EPSILON; +const double BigFuzz=10.0*Fuzz; const double Fuzz2=Fuzz*Fuzz; const double sqrtFuzz=sqrt(Fuzz); const double fuzzFactor=10.0; @@ -77,8 +77,7 @@ quadraticroots::quadraticroots(double a, double b, double c) if(x > -1.0) { distinct=quadraticroots::TWO; roots=2; - double sqrtm1=sqrt1pxm1(x); - double r2=factor*sqrtm1; + double r2=factor*sqrt1pxm1(x); double r1=-r2-2.0*factor; if(r1 <= r2) { t1=r1; @@ -117,9 +116,7 @@ Quadraticroots::Quadraticroots(pair a, pair b, pair c) z2=-z1; } else { pair factor=0.5*b/a; - pair x=-2.0*c/(b*factor); - pair sqrtm1=sqrt1pxm1(x); - z1=factor*sqrtm1; + z1=factor*sqrt1pxm1(-2.0*c/(b*factor)); z2=-z1-2.0*factor; } } diff --git a/Build/source/utils/asymptote/path.h b/Build/source/utils/asymptote/path.h index bf7d1aa676a..858f94fd13b 100644 --- a/Build/source/utils/asymptote/path.h +++ b/Build/source/utils/asymptote/path.h @@ -68,8 +68,8 @@ struct solvedKnot : public gc { } }; -extern const double BigFuzz; extern const double Fuzz; +extern const double BigFuzz; extern const double Fuzz2; extern const double sqrtFuzz; extern const double fuzzFactor; diff --git a/Build/source/utils/asymptote/path3.cc b/Build/source/utils/asymptote/path3.cc index 581e86db3c3..5f995637b6a 100644 --- a/Build/source/utils/asymptote/path3.cc +++ b/Build/source/utils/asymptote/path3.cc @@ -352,6 +352,7 @@ double bound(triple z0, triple c0, triple c1, triple z1, pair path3::ratio(double (*m)(double, double)) const { + double fuzz=sqrtFuzz*(max()-min()).length(); checkEmpty3(n); triple v=point((Int) 0); @@ -367,9 +368,6 @@ pair path3::ratio(double (*m)(double, double)) const triple c0=postcontrol(i); triple c1=precontrol(i+1); triple z1=point(i+1); - double fuzz=sqrtFuzz*camp::max(camp::max(camp::max(z0.length(), - c0.length()), - c1.length()),z1.length()); B=pair(bound(z0,c0,c1,z1,m,xratio,B.getx(),fuzz), bound(z0,c0,c1,z1,m,yratio,B.gety(),fuzz)); } diff --git a/Build/source/utils/asymptote/path3.h b/Build/source/utils/asymptote/path3.h index de4b5489ad5..893d1df0aba 100644 --- a/Build/source/utils/asymptote/path3.h +++ b/Build/source/utils/asymptote/path3.h @@ -92,6 +92,14 @@ public: box(p.box) {} + path3 unstraighten() const + { + path3 P=path3(*this); + for(int i=0; i < n; ++i) + P.nodes[i].straight=false; + return P; + } + virtual ~path3() { } diff --git a/Build/source/utils/asymptote/pen.h b/Build/source/utils/asymptote/pen.h index ea7f49be4fe..4ba01d62891 100644 --- a/Build/source/utils/asymptote/pen.h +++ b/Build/source/utils/asymptote/pen.h @@ -7,11 +7,14 @@ #ifndef PEN_H #define PEN_H +#include <iomanip> + #include "transform.h" #include "settings.h" #include "bbox.h" #include "common.h" #include "path.h" +#include "array.h" namespace camp { @@ -39,6 +42,7 @@ static const struct setoverwrite_t {} setoverwrite={}; static const struct initialpen_t {} initialpen={}; static const struct resolvepen_t {} resolvepen={}; +static const string PSCap[]={"butt","round","square"}; static const string Cap[]={"square","round","extended"}; static const string Join[]={"miter","round","bevel"}; const Int nCap=sizeof(Cap)/sizeof(string); @@ -68,22 +72,57 @@ const unsigned nColorSpace=sizeof(ColorDeviceSuffix)/sizeof(string); class LineType { public: - string pattern; // The string for the PostScript style line pattern. + vm::array pattern; // Array of PostScript style line pattern entries. double offset; // The offset in the pattern at which to start drawing. bool scale; // Scale the line type values by the pen width? bool adjust; // Adjust the line type values to fit the arclength? + bool isdefault; + + LineType(vm::array pattern, double offset, bool scale, bool adjust) : + pattern(pattern), offset(offset), scale(scale), adjust(adjust), + isdefault(false) {} - LineType(string pattern, double offset, bool scale, bool adjust) : - pattern(pattern), offset(offset), scale(scale), adjust(adjust) {} + LineType() : offset(0.0), scale(true), adjust(true), isdefault(true) {} + + void Scale(double factor) { + size_t n=pattern.size(); + for(size_t i=0; i < n; i++) + pattern[i]=vm::read<double>(pattern,i)*factor; + offset *= factor; + } }; -static const LineType DEFLINE("default",0,true,true); +static const LineType DEFLINE; -inline bool operator == (LineType a, LineType b) { - return a.pattern == b.pattern && a.offset == b.offset && - a.scale == b.scale && a.adjust == b.adjust; +inline bool operator == (const vm::array& a, const vm::array& b) +{ + size_t asize=a.size(); + size_t bsize=b.size(); + if(asize != bsize) return false; + for(size_t i=0; i < asize; ++i) + if(vm::read<double>(a,i) != vm::read<double>(b,i)) return false; + return true; +} + +inline bool operator == (const LineType& a, const LineType& b) +{ + return a.pattern == b.pattern && a.offset == b.offset && a.scale == b.scale + && a.adjust == b.adjust; } +inline ostream& operator << (ostream& out, const vm::array& a) +{ + out << "["; + size_t n=a.size(); + if(n > 0) { + out << vm::read<double>(a,0); + for(size_t i=1; i < n; ++i) + out << " " << vm::read<double>(a,i); + } + out << "]"; + return out; +} + class Transparency { public: @@ -108,6 +147,16 @@ const Int nBlendMode=sizeof(BlendMode)/sizeof(string); static const transform nullTransform=transform(0.0,0.0,0.0,0.0,0.0,0.0); +// Map [0,1] to [0,255] +inline unsigned int byte(double r) +{ + if(r < 0.0) r=0.0; + else if(r > 1.0) r=1.0; + int a=(int)(256.0*r); + if(a == 256) a=255; + return a; +} + class pen; pen& defaultpen(); @@ -352,7 +401,7 @@ public: // Construct one pen from another, resolving defaults pen(resolvepen_t, const pen& p) : - line(LineType(p.stroke(),p.line.offset,p.line.scale,p.line.adjust)), + line(LineType(p.line.pattern,p.line.offset,p.line.scale,p.line.adjust)), linewidth(p.width()), P(p.Path()), font(p.Font()), fontsize(p.size()), lineskip(p.Lineskip()), color(p.colorspace()), @@ -363,8 +412,8 @@ public: overwrite(p.Overwrite()), t(p.getTransform()) {} static pen initialpen() { - return pen(LineType("",0,true,true),0.5,nullpath,"",12.0*tex2ps, - 12.0*1.2*tex2ps,GRAYSCALE, + return pen(LineType(vm::array(0),0.0,true,true),0.5,nullpath,"", + 12.0*tex2ps,12.0*1.2*tex2ps,GRAYSCALE, 0.0,0.0,0.0,0.0,"",ZEROWINDING,NOBASEALIGN, DEFTRANSP,1,1,10.0,ALLOW,identity); } @@ -419,15 +468,17 @@ public: return lineskip == 0.0 ? defaultpen().lineskip : lineskip; } - string stroke() const { - return line == DEFLINE ? defaultpen().line.pattern : line.pattern; + const LineType *linetype() const { + return line.isdefault ? &defaultpen().line : &line; } - LineType linetype() const { - return line == DEFLINE ? defaultpen().line : line; + void adjust(double factor) { + if(line.isdefault) + line=defaultpen().line; + line.Scale(factor); } - void setstroke(const string& s) {line.pattern=s;} + void setstroke(const vm::array& s) {line.pattern=s;} void setoffset(const double& offset) {line.offset=offset;} string fillpattern() const { @@ -484,6 +535,35 @@ public: return color == DEFCOLOR ? defaultpen().color : color; } + string hex() const { + int n=ColorComponents[colorspace()]; + ostringstream buf; + buf.setf(std::ios::hex,std::ios::basefield); + buf.fill('0'); + + switch(n) { + case 0: + break; + case 1: + buf << std::setw(2) << byte(gray()); + break; + case 3: + buf << std::setw(2) << byte(red()) + << std::setw(2) << byte(green()) + << std::setw(2) << byte(blue()); + break; + case 4: + buf << std::setw(2) << byte(cyan()) + << std::setw(2) << byte(magenta()) + << std::setw(2) << byte(yellow()) + << std::setw(2) << byte(black()); + break; + default: + break; + } + return buf.str(); + } + bool invisible() const {return colorspace() == INVISIBLE;} bool grayscale() const {return colorspace() == GRAYSCALE;} @@ -574,6 +654,14 @@ public: transparency=p.transparency; } + void setfont(const pen& p) { + font=p.font; + } + + void setfillrule(const pen& p) { + fillrule=p.fillrule; + } + void convert() { if(settings::gray || settings::bw) { if(rgb()) rgbtogrey(); @@ -703,7 +791,7 @@ public: } } - return pen(q.line == DEFLINE ? p.line : q.line, + return pen(q.line.isdefault ? p.line : q.line, q.linewidth == DEFWIDTH ? p.linewidth : q.linewidth, q.P.empty() ? p.P : q.P, q.font.empty() ? p.font : q.font, @@ -756,7 +844,7 @@ public: } friend bool operator == (const pen& p, const pen& q) { - return p.linetype() == q.linetype() + return *(p.linetype()) == *(q.linetype()) && p.width() == q.width() && p.Path() == q.Path() && p.Font() == q.Font() @@ -784,10 +872,10 @@ public: friend ostream& operator << (ostream& out, const pen& p) { out << "("; - if(p.line == DEFLINE) - out << p.line.pattern; + if(p.line.isdefault) + out << "default"; else - out << "[" << p.line.pattern << "]"; + out << p.line.pattern; if(p.line.offset) out << p.line.offset; if(!p.line.scale) diff --git a/Build/source/utils/asymptote/picture.cc b/Build/source/utils/asymptote/picture.cc index b8bbbfb34f6..536a91ef3f6 100644 --- a/Build/source/utils/asymptote/picture.cc +++ b/Build/source/utils/asymptote/picture.cc @@ -12,6 +12,8 @@ #include "settings.h" #include "interact.h" #include "drawverbatim.h" +#include "drawlabel.h" +#include "drawlayer.h" using std::ifstream; using std::ofstream; @@ -53,11 +55,6 @@ picture::~picture() { } -bool picture::epsformat,picture::pdfformat, picture::svgformat; -bool picture::xobject, picture::pdf; -bool picture::Labels; -double picture::paperWidth,picture::paperHeight; - void picture::enclose(drawElement *begin, drawElement *end) { assert(begin); @@ -65,6 +62,7 @@ void picture::enclose(drawElement *begin, drawElement *end) nodes.push_front(begin); lastnumber=0; lastnumber3=0; + for(nodelist::iterator p=nodes.begin(); p != nodes.end(); ++p) { assert(*p); if((*p)->islayer()) { @@ -197,9 +195,11 @@ pair picture::ratio(double (*m)(double, double)) { bool first=true; pair b; + bbox3 B=bounds3(); + double fuzz=sqrtFuzz*(B.Max()-B.Min()).length(); for(nodelist::const_iterator p=nodes.begin(); p != nodes.end(); ++p) { assert(*p); - (*p)->ratio(b,m,first); + (*p)->ratio(b,m,fuzz,first); } return b; } @@ -240,7 +240,7 @@ void texinit() cmd.push_back(texput); } else { if(!dir.empty()) - cmd.push_back("-output-directory="+dir); + cmd.push_back("-output-directory="+dir.substr(0,dir.length()-1)); cmd.push_back("\\scrollmode"); } @@ -266,7 +266,7 @@ int opentex(const string& texname, const string& prefix) } else { string dir=stripFile(texname); if(!dir.empty()) - cmd.push_back("-output-directory="+dir); + cmd.push_back("-output-directory="+dir.substr(0,dir.length()-1)); cmd.push_back("\\nonstopmode\\input"); cmd.push_back(stripDir(texname)); } @@ -286,9 +286,10 @@ int opentex(const string& texname, const string& prefix) bool picture::texprocess(const string& texname, const string& outname, - const string& prefix, const pair& bboxshift) + const string& prefix, const pair& bboxshift, + bool svgformat) { - int status=0; + int status=1; ifstream outfile; outfile.open(texname.c_str()); @@ -297,89 +298,101 @@ bool picture::texprocess(const string& texname, const string& outname, if(outfile) { outfile.close(); - if(opentex(texname,prefix)) return false; - + status=opentex(texname,prefix); string texengine=getSetting<string>("tex"); - string dviname=auxname(prefix,"dvi"); - mem::vector<string> cmd; - - if(svgformat) { - cmd.push_back(getSetting<string>("dvisvgm")); - cmd.push_back("-n"); - cmd.push_back("--verbosity=3"); - push_split(cmd,getSetting<string>("dvisvgmOptions")); - cmd.push_back("-o"+outname); - cmd.push_back(dviname); - status=System(cmd,0,true,"dvisvgm"); - if(status != 0) return false; - if(!keep) - unlink(dviname.c_str()); - } else { - if(!pdf) { - string psname=auxname(prefix,"ps"); - double height=b.top-b.bottom+1.0; - // Magic dvips offsets: - double hoffset=-128.4; - double vertical=height; - if(!latex(texengine)) vertical += 2.0; - double voffset=(vertical < 13.0) ? -137.8+vertical : -124.8; - - hoffset += b.left+bboxshift.getx(); - voffset += paperHeight-height-b.bottom-bboxshift.gety(); + if(status == 0) { + string dviname=auxname(prefix,"dvi"); + mem::vector<string> cmd; - string dvipsrc=getSetting<string>("dir"); - if(dvipsrc.empty()) dvipsrc=systemDir; - dvipsrc += dirsep+"nopapersize.ps"; - setenv("DVIPSRC",dvipsrc.c_str(),1); - string papertype=getSetting<string>("papertype") == "letter" ? - "letterSize" : "a4size"; - cmd.push_back(getSetting<string>("dvips")); - cmd.push_back("-R"); - cmd.push_back("-Pdownload35"); - cmd.push_back("-D600"); - cmd.push_back("-O"+String(hoffset)+"bp,"+String(voffset)+"bp"); - cmd.push_back("-T"+String(paperWidth)+"bp,"+String(paperHeight)+"bp"); - push_split(cmd,getSetting<string>("dvipsOptions")); - cmd.push_back("-t"+papertype); - if(verbose <= 1) cmd.push_back("-q"); - cmd.push_back("-o"+psname); + if(svgformat) { + cmd.push_back(getSetting<string>("dvisvgm")); + cmd.push_back("-n"); + cmd.push_back("--verbosity=3"); + push_split(cmd,getSetting<string>("dvisvgmOptions")); + cmd.push_back("-o"+outname); + ostringstream buf; + bbox B=b; + B.shift(bboxshift+pair(1.99*cm,1.9*cm)); + buf << "--bbox=" + << B.left << "bp " + << B.bottom << "bp " + << B.right << "bp " + << B.top << "bp"; + cmd.push_back(buf.str()); cmd.push_back(dviname); - status=System(cmd,0,true,"dvips"); - if(status != 0) return false; + status=System(cmd,0,true,"dvisvgm"); + if(!keep) + unlink(dviname.c_str()); + } else { + if(!settings::pdf(texengine)) { + string psname=auxname(prefix,"ps"); + double height=b.top-b.bottom+1.0; - ifstream fin(psname.c_str()); - psfile fout(outname,false); + // Magic dvips offsets: + double hoffset=-128.4; + double vertical=height; + if(!latex(texengine)) vertical += 2.0; + double voffset=(vertical < 13.0) ? -137.8+vertical : -124.8; + double paperHeight=getSetting<double>("paperheight"); + + hoffset += b.left+bboxshift.getx(); + voffset += paperHeight-height-b.bottom-bboxshift.gety(); - string s; - bool first=true; - transform t=shift(bboxshift)*T; - bool shift=!t.isIdentity(); - string beginspecial="TeXDict begin @defspecial"; - string endspecial="@fedspecial end"; - while(getline(fin,s)) { - if(s.find("%%DocumentPaperSizes:") == 0) continue; - if(s.find("%!PS-Adobe-") == 0) { - fout.header(); - } else if(first && s.find("%%BoundingBox:") == 0) { - bbox box=b; - box.shift(bboxshift); - if(verbose > 2) BoundingBox(cout,box); - fout.BoundingBox(box); - first=false; - } else if(shift && s.find(beginspecial) == 0) { - fout.verbatimline(s); - fout.gsave(); - fout.concat(t); - } else if(shift && s.find(endspecial) == 0) { - fout.grestore(); - fout.verbatimline(s); - } else - fout.verbatimline(s); - } - if(!keep) { - unlink(dviname.c_str()); - unlink(psname.c_str()); + string dvipsrc=getSetting<string>("dir"); + if(dvipsrc.empty()) dvipsrc=systemDir; + dvipsrc += dirsep+"nopapersize.ps"; + setenv("DVIPSRC",dvipsrc.c_str(),1); + string papertype=getSetting<string>("papertype") == "letter" ? + "letterSize" : "a4size"; + cmd.push_back(getSetting<string>("dvips")); + cmd.push_back("-R"); + cmd.push_back("-Pdownload35"); + cmd.push_back("-D600"); + cmd.push_back("-O"+String(hoffset)+"bp,"+String(voffset)+"bp"); + cmd.push_back("-T"+String(getSetting<double>("paperwidth"))+"bp,"+ + String(paperHeight)+"bp"); + push_split(cmd,getSetting<string>("dvipsOptions")); + cmd.push_back("-t"+papertype); + if(verbose <= 1) cmd.push_back("-q"); + cmd.push_back("-o"+psname); + cmd.push_back(dviname); + status=System(cmd,0,true,"dvips"); + if(status == 0) { + ifstream fin(psname.c_str()); + psfile fout(outname,false); + + string s; + bool first=true; + transform t=shift(bboxshift)*T; + bool shift=!t.isIdentity(); + string beginspecial="TeXDict begin @defspecial"; + string endspecial="@fedspecial end"; + while(getline(fin,s)) { + if(s.find("%%DocumentPaperSizes:") == 0) continue; + if(s.find("%!PS-Adobe-") == 0) { + fout.header(); + } else if(first && s.find("%%BoundingBox:") == 0) { + bbox box=b; + box.shift(bboxshift); + if(verbose > 2) BoundingBox(cout,box); + fout.BoundingBox(box); + first=false; + } else if(shift && s.find(beginspecial) == 0) { + fout.verbatimline(s); + fout.gsave(); + fout.concat(t); + } else if(shift && s.find(endspecial) == 0) { + fout.grestore(); + fout.verbatimline(s); + } else + fout.verbatimline(s); + } + } + if(!keep) { + unlink(dviname.c_str()); + unlink(psname.c_str()); + } } } } @@ -421,8 +434,8 @@ int picture::epstopdf(const string& epsname, const string& pdfname) cmd.push_back("-dSAFER"); if(!getSetting<bool>("autorotate")) cmd.push_back("-dAutoRotatePages=/None"); - cmd.push_back("-g"+String(max(ceil(paperWidth),1.0))+"x"+ - String(max(ceil(paperHeight),1.0))); + cmd.push_back("-g"+String(max(ceil(getSetting<double>("paperwidth")),1.0)) + +"x"+String(max(ceil(getSetting<double>("paperheight")),1.0))); cmd.push_back("-dDEVICEWIDTHPOINTS="+String(max(b.right-b.left,3.0))); cmd.push_back("-dDEVICEHEIGHTPOINTS="+String(max(b.top-b.bottom,3.0))); push_split(cmd,getSetting<string>("gsOptions")); @@ -474,38 +487,57 @@ bool picture::reloadPDF(const string& Viewer, const string& outname) const bool picture::postprocess(const string& prename, const string& outname, const string& outputformat, double magnification, - bool wait, bool view) + bool wait, bool view, bool pdftex, bool svgformat) { static mem::map<CONST string,int> pids; int status=0; + bool epsformat=outputformat == "eps"; + bool pdfformat=(settings::pdf(getSetting<string>("tex")) + && outputformat == "") || outputformat == "pdf"; - if((pdf && Labels) || !epsformat) { + if(pdftex || !epsformat) { if(pdfformat) { - if(pdf && Labels) { + if(pdftex) { status=rename(prename.c_str(),outname.c_str()); if(status != 0) reportError("Cannot rename "+prename+" to "+outname); } else status=epstopdf(prename,outname); - } else if(!svgformat) { + } else { mem::vector<string> cmd; double render=fabs(getSetting<double>("render")); if(render == 0) render=1.0; - double expand=getSetting<Int>("antialias"); - if(expand < 2.0) expand=1.0; - double res=expand*render*72.0; - cmd.push_back(getSetting<string>("convert")); - cmd.push_back("-alpha"); - cmd.push_back("Off"); - cmd.push_back("-density"); - cmd.push_back(String(res)+"x"+String(res)); - if(expand == 1.0) - cmd.push_back("+antialias"); - cmd.push_back("-geometry"); - cmd.push_back(String(100.0/expand)+"%x"); - push_split(cmd,getSetting<string>("convertOptions")); - cmd.push_back(nativeformat()+":"+prename); - cmd.push_back(outputformat+":"+outname); - status=System(cmd,0,true,"convert"); + double res=render*72.0; + Int antialias=getSetting<Int>("antialias"); + if(outputformat == "png" && antialias == 2) { + cmd.push_back(getSetting<string>("gs")); + cmd.push_back("-q"); + cmd.push_back("-dNOPAUSE"); + cmd.push_back("-dBATCH"); + cmd.push_back("-sDEVICE=pngalpha"); + cmd.push_back("-dEPSCrop"); + if(safe) + cmd.push_back("-dSAFER"); + cmd.push_back("-r"+String(res)+"x"+String(res)); + push_split(cmd,getSetting<string>("gsOptions")); + cmd.push_back("-sOutputFile="+outname); + cmd.push_back(prename); + status=System(cmd,0,true,"gs","Ghostscript"); + } else if(!svgformat) { + double expand=antialias; + if(expand < 2.0) expand=1.0; + res *= expand; + cmd.push_back(getSetting<string>("convert")); + cmd.push_back("-density"); + cmd.push_back(String(res)+"x"+String(res)); + if(expand == 1.0) + cmd.push_back("+antialias"); + push_split(cmd,getSetting<string>("convertOptions")); + cmd.push_back("-geometry"); + cmd.push_back(String(100.0/expand)+"%x"); + cmd.push_back(nativeformat()+":"+prename); + cmd.push_back(outputformat+":"+outname); + status=System(cmd,0,true,"convert"); + } } if(!getSetting<bool>("keep")) unlink(prename.c_str()); } @@ -583,34 +615,28 @@ bool picture::shipout(picture *preamble, const string& Prefix, { b=bounds(); - bool TeXmode=getSetting<bool>("inlinetex") && - getSetting<string>("tex") != "none"; - string texengine=getSetting<string>("tex"); - pdf=settings::pdf(texengine); + bool usetex=texengine != "none"; + bool TeXmode=getSetting<bool>("inlinetex") && usetex; + bool pdf=settings::pdf(texengine); bool standardout=Prefix == "-"; - string prefix=standardout ? "out" : Prefix; + string prefix=standardout ? standardprefix : Prefix; string preformat=nativeformat(); string outputformat=format.empty() ? defaultformat() : format; - epsformat=outputformat == "eps"; - pdfformat=outputformat == "pdf"; - svgformat=outputformat == "svg" && !pdf && + bool epsformat=outputformat == "eps"; + bool pdfformat=pdf || outputformat == "pdf"; + bool svgformat=outputformat == "svg" && !pdf && usetex && (!have3D() || getSetting<double>("render") == 0.0); - xobject=magnification > 0; + bool xobject=magnification > 0; string outname=Outname(prefix,outputformat,standardout); string epsname=epsformat ? (standardout ? "" : outname) : auxname(prefix,"eps"); - Labels=labels || TeXmode || svgformat; + bool Labels=labels || TeXmode; - if(Labels) - spaceToUnderscore(prefix); - string prename=((epsformat && !pdf) || !Labels) ? epsname : - auxname(prefix,preformat); - - if((b.empty && !Labels)) { // Output a null file + if(b.empty && !Labels) { // Output a null file bbox b; b.left=b.bottom=0; b.right=b.top=xobject ? 18 : 1; @@ -618,11 +644,18 @@ bool picture::shipout(picture *preamble, const string& Prefix, out.prologue(b); out.epilogue(); out.close(); - return postprocess(epsname,outname,outputformat,1.0,wait,view); + return postprocess(epsname,outname,outputformat,1.0,wait,view,false,false); } + Labels |= svgformat; + + if(Labels) + prefix=cleanpath(prefix); + + string prename=((epsformat && !pdf) || !Labels) ? epsname : + auxname(prefix,preformat); + if(xobject) { - // Work around half-pixel bounding box bug in Ghostscript pngalpha driver double fuzz=0.5/magnification; b.top += fuzz; b.right += fuzz; @@ -631,19 +664,19 @@ bool picture::shipout(picture *preamble, const string& Prefix, SetPageDimensions(); - paperWidth=getSetting<double>("paperwidth"); - paperHeight=getSetting<double>("paperheight"); string origin=getSetting<string>("align"); - - pair bboxshift=(origin == "Z" && !pdfformat) ? + + pair bboxshift=(origin == "Z" && epsformat) ? pair(0.0,0.0) : pair(-b.left,-b.bottom); - if(!pdfformat) { + if(epsformat) { bboxshift += getSetting<pair>("offset"); if(origin != "Z" && origin != "B") { - double yexcess=max(paperHeight-(b.top-b.bottom+1.0),0.0); + double yexcess=max(getSetting<double>("paperheight")- + (b.top-b.bottom+1.0),0.0); if(origin == "T") bboxshift += pair(0.0,yexcess); else { - double xexcess=max(paperWidth-(b.right-b.left+1.0),0.0); + double xexcess=max(getSetting<double>("paperwidth")- + (b.right-b.left+1.0),0.0); bboxshift += pair(0.5*xexcess,0.5*yexcess); } } @@ -656,18 +689,22 @@ bool picture::shipout(picture *preamble, const string& Prefix, if(Labels) { texname=auxname(prefix,"tex"); - tex=new texfile(texname,b); + tex=svgformat ? new svgtexfile(texname,b) : new texfile(texname,b); tex->prologue(); } nodelist::iterator layerp=nodes.begin(); nodelist::iterator p=layerp; unsigned layer=0; - mem::list<string> psnameStack; + mem::list<string> files; bbox bshift=b; transparency=false; + int svgcount=0; + + typedef mem::list<drawElement *> clipstack; + clipstack begin; while(p != nodes.end()) { string psname,pdfname; @@ -680,8 +717,8 @@ bool picture::shipout(picture *preamble, const string& Prefix, psname=epsname; bshift.shift(bboxshift); } - psnameStack.push_back(psname); - if(pdf) psnameStack.push_back(pdfname); + files.push_back(psname); + if(pdf) files.push_back(pdfname); psfile out(psname,pdfformat); out.prologue(bshift); @@ -705,10 +742,80 @@ bool picture::shipout(picture *preamble, const string& Prefix, out.resetpen(); bool postscript=false; + drawLabel *L=NULL; + + if(svgformat) + for(nodelist::const_iterator r=begin.begin(); r != begin.end(); ++r) + (*r)->draw(&out); + for(; p != nodes.end(); ++p) { assert(*p); if(Labels && (*p)->islayer()) break; - postscript |= (*p)->draw(&out); + + if(svgformat && (*p)->svg()) { + picture *f=(*p)->svgpng() ? new picture : NULL; + nodelist::const_iterator q=layerp; + for(;;) { + if((*q)->beginclip()) + begin.push_back(*q); + else if((*q)->endclip()) { + if(begin.size() < 1) + reportError("endclip without matching beginclip"); + begin.pop_back(); + } + if(q == p) break; + ++q; + } + + if(f) { + for(nodelist::const_iterator r=begin.begin(); r != begin.end(); ++r) + f->append(*r); + + f->append(*(q++)); + } + + while(q != nodes.end() && !(*q)->islayer()) ++q; + + clipstack end; + + for(nodelist::const_iterator r=--q;; --r) { + if((*r)->beginclip() && end.size() >= 1) + end.pop_back(); + else if((*r)->endclip()) + end.push_back(*r); + if(r == p) break; + } + + for(nodelist::reverse_iterator r=end.rbegin(); r != end.rend(); + ++r) { + (*r)->draw(&out); + if(f) + f->append(*r); + } + + if(f) { + ostringstream buf; + buf << prefix << "_" << svgcount; + ++svgcount; + string pngname=buildname(buf.str(),"png"); + f->shipout(preamble,buf.str(),"png",0.0,false,false); + pair m=f->bounds().Min(); + pair M=f->bounds().Max(); + delete f; + + pair size=M-m; + ostringstream cmd; + cmd << "\\special{dvisvgm:img " << size.getx()*ps2tex << " " + << size.gety()*ps2tex << " " << pngname << "}"; + static pen P; + static pair zero; + L=new drawLabel(cmd.str(),"",identity,pair(m.getx(),M.gety()),zero,P); + texinit(); + L->bounds(b_cached,processData().tex,labelbounds,bboxstack); + postscript=true; + } + break; + } else postscript |= (*p)->draw(&out); } if(Labels) { @@ -731,8 +838,16 @@ bool picture::shipout(picture *preamble, const string& Prefix, if(status) { for (p=layerp; p != nodes.end(); ++p) { assert(*p); - (*p)->write(tex,b); - if((*p)->islayer()) { + bool islayer=(*p)->islayer(); + if(svgformat && (*p)->svg()) { + islayer=true; + if((*p)->svgpng()) + L->write(tex,b); + else + (*p)->draw(tex); + } else + (*p)->write(tex,b); + if(islayer) { tex->endlayer(); layerp=++p; layer++; @@ -753,11 +868,11 @@ bool picture::shipout(picture *preamble, const string& Prefix, tex->epilogue(); if(context) prefix=stripDir(prefix); status=texprocess(texname,svgformat ? outname : prename,prefix, - bboxshift); + bboxshift,svgformat); delete tex; if(!getSetting<bool>("keep")) { - for(mem::list<string>::iterator p=psnameStack.begin(); - p != psnameStack.end(); ++p) + for(mem::list<string>::iterator p=files.begin(); p != files.end(); + ++p) unlink(p->c_str()); } } @@ -768,7 +883,7 @@ bool picture::shipout(picture *preamble, const string& Prefix, } else { if(context) prename=stripDir(prename); status=postprocess(prename,outname,outputformat,magnification,wait, - view); + view,pdf && Labels,svgformat); } } } @@ -816,7 +931,7 @@ Communicate com; void glrenderWrapper() { -#ifdef HAVE_LIBGL +#ifdef HAVE_GL #ifdef HAVE_LIBPTHREAD wait(initSignal,initLock); endwait(initSignal,initLock); @@ -837,7 +952,7 @@ bool picture::shipout3(const string& prefix, const string& format, { if(getSetting<bool>("interrupt")) return true; -#ifdef HAVE_LIBGL +#ifdef HAVE_GL bounds3(); for(nodelist::const_iterator p=nodes.begin(); p != nodes.end(); ++p) { @@ -917,13 +1032,6 @@ bool picture::shipout3(const string& prefix, const string& format, pthread_cond_wait(&readySignal,&readyLock); pthread_mutex_unlock(&readyLock); } - if(!glthread || (Wait && !animating)) { - delete[] specular; - delete[] ambient; - delete[] diffuse; - delete[] lights; - } - return true; #endif #else diff --git a/Build/source/utils/asymptote/picture.h b/Build/source/utils/asymptote/picture.h index a0fc352b641..98774728f69 100644 --- a/Build/source/utils/asymptote/picture.h +++ b/Build/source/utils/asymptote/picture.h @@ -27,10 +27,6 @@ private: boxvector labelbounds; bboxlist bboxstack; bool transparency; - - static bool epsformat,pdfformat,svgformat,xobject,pdf,Labels; - static double paperWidth,paperHeight; - public: bbox3 b3; // 3D bounding box @@ -72,11 +68,11 @@ public: int epstopdf(const string& epsname, const string& pdfname); bool texprocess(const string& texname, const string& tempname, - const string& prefix, const pair& bboxshift); + const string& prefix, const pair& bboxshift, bool svgformat); bool postprocess(const string& prename, const string& outname, const string& outputformat, double magnification, - bool wait, bool view); + bool wait, bool view, bool pdftex, bool svgformat); // Ship the picture out to PostScript & TeX files. bool shipout(picture* preamble, const string& prefix, diff --git a/Build/source/utils/asymptote/prc/PRCTools/bitData.cc b/Build/source/utils/asymptote/prc/PRCTools/bitData.cc index 19274a8b4b7..9fba0eb0b19 100644 --- a/Build/source/utils/asymptote/prc/PRCTools/bitData.cc +++ b/Build/source/utils/asymptote/prc/PRCTools/bitData.cc @@ -188,14 +188,14 @@ double BitByBitData::readDouble() b4 |= readBit(); } -#if defined(WORDS_LITTLE_ENDIAN) - *(reinterpret_cast<unsigned char*>(&value)+6) |= b4; - unsigned char *lastByte = reinterpret_cast<unsigned char*>(&value)+0; - unsigned char *currentByte = reinterpret_cast<unsigned char*>(&value)+5; -#elif defined(WORDS_BIG_ENDIAN) +#ifdef WORDS_BIGENDIAN *(reinterpret_cast<unsigned char*>(&value)+1) |= b4; unsigned char *lastByte = reinterpret_cast<unsigned char*>(&value)+7; unsigned char *currentByte = reinterpret_cast<unsigned char*>(&value)+2; +#else + *(reinterpret_cast<unsigned char*>(&value)+6) |= b4; + unsigned char *lastByte = reinterpret_cast<unsigned char*>(&value)+0; + unsigned char *currentByte = reinterpret_cast<unsigned char*>(&value)+5; #endif for(;MOREBYTE(currentByte,lastByte); NEXTBYTE(currentByte)) diff --git a/Build/source/utils/asymptote/prc/oPRCFile.cc b/Build/source/utils/asymptote/prc/oPRCFile.cc index d472092b9dc..73c7ef32efe 100644 --- a/Build/source/utils/asymptote/prc/oPRCFile.cc +++ b/Build/source/utils/asymptote/prc/oPRCFile.cc @@ -153,8 +153,10 @@ void PRCcurve::writeTopologicalContext(PRCbitStream &out) // control points for(uint32_t i = 0; i < numberOfControlPoints; ++i) { - out << controlPoints[i][0]*scale << controlPoints[i][1]*scale - << controlPoints[i][2]*scale; + double Scale=scale; + if(isRational) Scale *= weights[i]; + out << controlPoints[i][0]*Scale << controlPoints[i][1]*Scale + << controlPoints[i][2]*Scale; if(isRational) out << weights[i]; } @@ -246,8 +248,10 @@ void PRCsurface::writeTopologicalContext(PRCbitStream &out) // control points for(uint32_t i = 0; i < numberOfControlPointsU*numberOfControlPointsV; ++i) { - out << controlPoints[i][0]*scale << controlPoints[i][1]*scale - << controlPoints[i][2]*scale; + double Scale=scale; + if(isRational) Scale *= weights[i]; + out << controlPoints[i][0]*Scale << controlPoints[i][1]*Scale + << controlPoints[i][2]*Scale; if(isRational) out << weights[i]; } diff --git a/Build/source/utils/asymptote/prc/oPRCFile.h b/Build/source/utils/asymptote/prc/oPRCFile.h index ddddd043b4d..2ee01ddcba4 100644 --- a/Build/source/utils/asymptote/prc/oPRCFile.h +++ b/Build/source/utils/asymptote/prc/oPRCFile.h @@ -360,14 +360,16 @@ class oPRCFile { public: oPRCFile(std::ostream &os, uint32_t n=1) : - number_of_file_structures(n), - fileStructures(new PRCFileStructure*[n]),modelFile(this), - fout(NULL),output(os) {} + number_of_file_structures(n), + fileStructures(new PRCFileStructure*[n]),modelFile(this), + fout(NULL),output(os) {} oPRCFile(const std::string &name, uint32_t n=1) : - number_of_file_structures(n), - fileStructures(new PRCFileStructure*[n]),modelFile(this), - fout(new std::ofstream(name.c_str())),output(*fout) {} + number_of_file_structures(n), + fileStructures(new PRCFileStructure*[n]),modelFile(this), + fout(new std::ofstream(name.c_str(), + std::ios::out|std::ios::binary|std::ios::trunc)), + output(*fout) {} ~oPRCFile() { diff --git a/Build/source/utils/asymptote/psfile.cc b/Build/source/utils/asymptote/psfile.cc index 4605758de67..659f7e09057 100644 --- a/Build/source/utils/asymptote/psfile.cc +++ b/Build/source/utils/asymptote/psfile.cc @@ -221,28 +221,26 @@ void psfile::setpen(pen p) else setcolor(p); // Defer dynamic linewidth until stroke time in case currentmatrix changes. - if(p.width() != lastpen.width()) { + if(p.width() != lastpen.width()) *out << p.width() << (pdfformat ? " setlinewidth" : " Setlinewidth") << newl; - } - if(p.cap() != lastpen.cap()) { + if(p.cap() != lastpen.cap()) *out << p.cap() << " setlinecap" << newl; - } - if(p.join() != lastpen.join()) { + if(p.join() != lastpen.join()) *out << p.join() << " setlinejoin" << newl; - } - if(p.miter() != lastpen.miter()) { + if(p.miter() != lastpen.miter()) *out << p.miter() << " setmiterlimit" << newl; - } - - if(p.stroke() != lastpen.stroke() || - p.linetype().offset != lastpen.linetype().offset) { + + const LineType *linetype=p.linetype(); + const LineType *lastlinetype=lastpen.linetype(); + + if(!(linetype->pattern == lastlinetype->pattern) || + linetype->offset != lastlinetype->offset) { out->setf(std::ios::fixed); - *out << "[" << p.stroke() << "] " << std::setprecision(6) - << p.linetype().offset << " setdash" << newl; + *out << linetype->pattern << " " << linetype->offset << " setdash" << newl; out->unsetf(std::ios::fixed); } @@ -286,7 +284,7 @@ void psfile::write(path p, bool newPath) } } -void psfile::latticeshade(const vm::array& a, const bbox& b) +void psfile::latticeshade(const vm::array& a, const transform& t) { checkLevel(); size_t n=a.size(); @@ -303,8 +301,7 @@ void psfile::latticeshade(const vm::array& a, const bbox& b) *out << "<< /ShadingType 1" << newl << "/Matrix "; - - write(matrix(b.Min(),b.Max())); + write(t); *out << newl; *out << "/ColorSpace /Device" << ColorDeviceSuffix[colorspace] << newl << "/Function" << newl @@ -323,7 +320,6 @@ void psfile::latticeshade(const vm::array& a, const bbox& b) *out << "/Size [" << m << " " << n << "]" << newl << "/DataSource <" << newl; - beginHex(); for(size_t i=n; i > 0;) { array *ai=read<array *>(a,--i); checkArray(ai); @@ -334,12 +330,12 @@ void psfile::latticeshade(const vm::array& a, const bbox& b) p->convert(); if(!p->promote(colorspace)) reportError(inconsistent); - writeHex(p,ncomponents); + *out << p->hex() << newl; } } - endHex(); - - *out << ">>" << newl + + *out << ">" << newl + << ">>" << newl << ">>" << newl << "shfill" << newl; } @@ -350,6 +346,8 @@ void psfile::gradientshade(bool axial, ColorSpace colorspace, const pen& penb, const pair& b, double rb) { checkLevel(); + endclip(pena); + setopacity(pena); checkColorSpace(colorspace); @@ -377,10 +375,13 @@ void psfile::gradientshade(bool axial, ColorSpace colorspace, << "shfill" << newl; } -void psfile::gouraudshade(const array& pens, const array& vertices, +void psfile::gouraudshade(const pen& pentype, + const array& pens, const array& vertices, const array& edges) { checkLevel(); + endclip(pentype); + size_t size=pens.size(); if(size == 0) return; @@ -417,10 +418,12 @@ void psfile::vertexpen(array *pi, int j, ColorSpace colorspace) } // Tensor-product patch shading -void psfile::tensorshade(const array& pens, const array& boundaries, - const array& z) +void psfile::tensorshade(const pen& pentype, const array& pens, + const array& boundaries, const array& z) { checkLevel(); + endclip(pentype); + size_t size=pens.size(); if(size == 0) return; size_t nz=z.size(); @@ -483,15 +486,6 @@ void psfile::tensorshade(const array& pens, const array& boundaries, << "shfill" << newl; } -inline unsigned char byte(double r) // Map [0,1] to [0,255] -{ - if(r < 0.0) r=0.0; - else if(r > 1.0) r=1.0; - int a=(int)(256.0*r); - if(a == 256) a=255; - return a; -} - void psfile::write(pen *p, size_t ncomponents) { switch(ncomponents) { @@ -515,32 +509,6 @@ void psfile::write(pen *p, size_t ncomponents) } } -void psfile::writeHex(pen *p, size_t ncomponents) -{ - switch(ncomponents) { - case 0: - break; - case 1: - write2(byte(p->gray())); - writenewl(); - break; - case 3: - write2(byte(p->red())); - write2(byte(p->green())); - write2(byte(p->blue())); - writenewl(); - break; - case 4: - write2(byte(p->cyan())); - write2(byte(p->magenta())); - write2(byte(p->yellow())); - write2(byte(p->black())); - writenewl(); - default: - break; - } -} - string filter() { return settings::getSetting<Int>("level") >= 3 ? diff --git a/Build/source/utils/asymptote/psfile.h b/Build/source/utils/asymptote/psfile.h index c9c5126e442..1cc4e18ebaf 100644 --- a/Build/source/utils/asymptote/psfile.h +++ b/Build/source/utils/asymptote/psfile.h @@ -94,15 +94,18 @@ public: }; class psfile { +protected: + mem::stack<pen> pens; + +public: + string filename; bool pdfformat; // Is final output format PDF? bool pdf; // Output direct PDF? bool transparency; // Is transparency used? unsigned char *buffer; size_t count; - mem::stack<pen> pens; - - void writeHex(pen *p, size_t ncomponents); + void write(pen *p, size_t ncomponents); void writefromRGB(unsigned char r, unsigned char g, unsigned char b, ColorSpace colorspace, size_t ncomponents); @@ -111,17 +114,6 @@ class psfile { void dealias(unsigned char *a, size_t width, size_t height, size_t n, bool convertrgb=false, ColorSpace colorspace=DEFCOLOR); - void beginHex() { - out->setf(std::ios::hex,std::ios::basefield); - out->fill('0'); - } - - void endHex() { - out->setf(std::ios::dec,std::ios::basefield); - out->fill(); - *out << ">" << endl; - } - void beginImage(size_t n) { buffer=new unsigned char[n]; count=0; @@ -140,10 +132,6 @@ class psfile { buffer[count++]=n; } - void write2(unsigned n) { - *out << std::setw(2) << n; - } - protected: pen lastpen; std::ostream *out; @@ -153,7 +141,7 @@ public: psfile() {pdf=settings::pdf(settings::getSetting<string>("tex"));} - ~psfile(); + virtual ~psfile(); void BoundingBox(const bbox& box) { camp::BoundingBox(*out,box); @@ -197,50 +185,58 @@ public: void setcolor(const pen& p, const string& begin, const string& end); void setopacity(const pen& p); - void setpen(pen p); + virtual void setpen(pen p); void write(const pen& p); void write(path p, bool newPath=true); - void newpath() { + virtual void writeclip(path p, bool newPath=true) { + write(p,newPath); + } + + virtual void dot(path p, pen, bool newPath=true) { + write(p,newPath); + } + + virtual void newpath() { if(!pdf) *out << "newpath"; } - void moveto(pair z) { + virtual void moveto(pair z) { write(z); if(pdf) *out << " m" << newl; else *out << " moveto" << newl; } - void lineto(pair z) { + virtual void lineto(pair z) { write(z); if(pdf) *out << " l" << newl; else *out << " lineto" << newl; } - void curveto(pair zp, pair zm, pair z1) { + virtual void curveto(pair zp, pair zm, pair z1) { write(zp); write(zm); write(z1); if(pdf) *out << " c" << newl; else *out << " curveto" << newl; } - void closepath() { + virtual void closepath() { if(pdf) *out << "h" << newl; else *out << "closepath" << newl; } - void stroke() { + virtual void stroke(const pen &p, bool dot=false) { if(pdf) *out << "S" << newl; else *out << "stroke" << newl; } - void strokepath() { + virtual void strokepath() { if(pdf) reportError("PDF does not support strokepath"); else *out << "strokepath" << newl; } - void fill(const pen &p) { + virtual void fill(const pen &p) { if(p.evenodd()) { if(pdf) *out << "f*" << newl; else *out << "eofill" << newl; @@ -250,7 +246,11 @@ public: } } - void clip(const pen &p) { + virtual void beginclip() { + newpath(); + } + + virtual void endclip(const pen &p) { if(p.evenodd()) { if(pdf) *out << "W* n" << newl; else *out << "eoclip" << newl; @@ -260,22 +260,36 @@ public: } } + virtual void endpsclip(const pen &p) {endclip(p);} + void checkLevel() { int n=settings::getSetting<Int>("level"); if(n < 3) reportError("PostScript shading requires -level 3"); } - void latticeshade(const vm::array& a, const bbox& b); + virtual void beginlatticeshade(const vm::array& a, const bbox& b) {} + virtual void latticeshade(const vm::array& a, const transform& t); + + virtual void begingradientshade(bool axial, ColorSpace colorspace, + const pen& pena, const pair& a, double ra, + const pen& penb, const pair& b, double rb) {} + + virtual void gradientshade(bool axial, ColorSpace colorspace, + const pen& pena, const pair& a, double ra, + const pen& penb, const pair& b, double rb); - void gradientshade(bool axial, ColorSpace colorspace, - const pen& pena, const pair& a, double ra, - const pen& penb, const pair& b, double rb); + virtual void begingouraudshade(const vm::array& pens, + const vm::array& vertices, + const vm::array& edges) {} + virtual void gouraudshade(const pen& pentype, const vm::array& pens, + const vm::array& vertices, const vm::array& edges); - void gouraudshade(const vm::array& pens, const vm::array& vertices, - const vm::array& edges); - void tensorshade(const vm::array& pens, const vm::array& boundaries, - const vm::array& z); + virtual void begintensorshade(const vm::array& pens, + const vm::array& boundaries, + const vm::array& z) {} + virtual void tensorshade(const pen& pentype, const vm::array& pens, + const vm::array& boundaries, const vm::array& z); void vertexpen(vm::array *pi, int j, ColorSpace colorspace); @@ -285,14 +299,14 @@ public: void image(const vm::array& a, bool antialias); void rawimage(unsigned char *a, size_t width, size_t height, bool antialias); - void gsave(bool tex=false) { + virtual void gsave(bool tex=false) { if(pdf) *out << "q"; else *out << "gsave"; if(!tex) *out << newl; pens.push(lastpen); } - void grestore(bool tex=false) { + virtual void grestore(bool tex=false) { if(pens.size() < 1) reportError("grestore without matching gsave"); lastpen=pens.top(); @@ -302,7 +316,8 @@ public: if(!tex) *out << newl; } - void translate(pair z) { + virtual void translate(pair z) { + if(z == pair(0.0,0.0)) return; if(pdf) *out << " 1 0 0 1 " << newl; write(z); if(pdf) *out << " cm" << newl; @@ -310,7 +325,7 @@ public: } // Multiply on a transform to the transformation matrix. - void concat(transform t) { + virtual void concat(transform t) { if(t.isIdentity()) return; write(t); if(pdf) *out << " cm" << newl; diff --git a/Build/source/utils/asymptote/runarray.cc b/Build/source/utils/asymptote/runarray.cc index 0413af229b5..b7c06461911 100644 --- a/Build/source/utils/asymptote/runarray.cc +++ b/Build/source/utils/asymptote/runarray.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); @@ -172,10 +174,11 @@ inline size_t checkdimension(const array *a, size_t dim) return size; } -double *copyArrayC(const array *a, size_t dim) +double *copyArrayC(const array *a, size_t dim, GCPlacement placement) { size_t size=checkdimension(a,dim); - double *c=new double[size]; + double *c=(placement == NoGC) ? new double [size] : + new(placement) double[size]; for(size_t i=0; i < size; i++) c[i]=read<double>(a,i); return c; @@ -226,7 +229,8 @@ array *copyArray3(array *a) return c; } -double *copyArray2C(const array *a, bool square, size_t dim2) +double *copyArray2C(const array *a, bool square, size_t dim2, + GCPlacement placement) { size_t n=checkArray(a); size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); @@ -236,7 +240,7 @@ double *copyArray2C(const array *a, bool square, size_t dim2) error(buf); } - double *c=new double[n*m]; + double *c=(placement == NoGC) ? new double [n*m] : new(placement) double[n*m]; for(size_t i=0; i < n; i++) { array *ai=read<array*>(a,i); size_t aisize=checkArray(ai); @@ -274,7 +278,8 @@ triple *copyTripleArray2C(const array *a, bool square, size_t dim2) return c; } -double *copyTripleArray2Components(array *a, bool square, size_t dim2) +double *copyTripleArray2Components(array *a, bool square, size_t dim2, + GCPlacement placement) { size_t n=checkArray(a); size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); @@ -285,7 +290,8 @@ double *copyTripleArray2Components(array *a, bool square, size_t dim2) } size_t nm=n*m; - double *cx=new double[3*nm]; + double *cx=(placement == NoGC) ? new double [3*nm] : + new(placement) double[3*nm]; double *cy=cx+nm; double *cz=cx+2*nm; for(size_t i=0; i < n; i++) { @@ -519,10 +525,10 @@ void integeroverflow(size_t i) namespace run { // Create an empty array. -#line 475 "runarray.in" +#line 479 "runarray.in" void emptyArray(stack *Stack) { -#line 476 "runarray.in" +#line 480 "runarray.in" {Stack->push<array*>(new array(0)); return;} } @@ -531,11 +537,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 485 "runarray.in" +#line 489 "runarray.in" void newDeepArray(stack *Stack) { Int depth=vm::pop<Int>(Stack); -#line 486 "runarray.in" +#line 490 "runarray.in" assert(depth > 0); Int *dims = new Int[depth]; @@ -554,11 +560,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 505 "runarray.in" +#line 509 "runarray.in" void newInitializedArray(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 506 "runarray.in" +#line 510 "runarray.in" assert(n >= 0); array *a = new array(n); @@ -571,12 +577,12 @@ void newInitializedArray(stack *Stack) // Similar to newInitializedArray, but after the n elements, append another // array to it. -#line 519 "runarray.in" +#line 523 "runarray.in" void newAppendedArray(stack *Stack) { Int n=vm::pop<Int>(Stack); array* tail=vm::pop<array*>(Stack); -#line 520 "runarray.in" +#line 524 "runarray.in" assert(n >= 0); array *a = new array(n); @@ -591,13 +597,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 535 "runarray.in" +#line 539 "runarray.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 536 "runarray.in" +#line 540 "runarray.in" if(n < 0) error("cannot create a negative length array"); if(depth < 0) error("cannot copy to a negative depth"); @@ -605,12 +611,12 @@ void newDuplicateArray(stack *Stack) } // Read an element from an array. Checks for initialization & bounds. -#line 544 "runarray.in" +#line 548 "runarray.in" void arrayRead(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 545 "runarray.in" +#line 549 "runarray.in" item& i=arrayRead(a,n); if (i.empty()) { ostringstream buf; @@ -621,50 +627,50 @@ void arrayRead(stack *Stack) } // Slice a substring from an array. -#line 556 "runarray.in" +#line 560 "runarray.in" void arraySliceRead(stack *Stack) { Int right=vm::pop<Int>(Stack); Int left=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 557 "runarray.in" +#line 561 "runarray.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 564 "runarray.in" +#line 568 "runarray.in" void arraySliceReadToEnd(stack *Stack) { Int left=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 565 "runarray.in" +#line 569 "runarray.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 572 "runarray.in" +#line 576 "runarray.in" void arrayArrayRead(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 573 "runarray.in" +#line 577 "runarray.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 580 "runarray.in" +#line 584 "runarray.in" void arrayWrite(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); item value=vm::pop(Stack); -#line 581 "runarray.in" +#line 585 "runarray.in" size_t len=checkArray(a); bool cyclic=a->cyclic(); if(cyclic && len > 0) n=imod(n,len); @@ -678,27 +684,27 @@ void arrayWrite(stack *Stack) {Stack->push(value); return;} } -#line 595 "runarray.in" +#line 599 "runarray.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 596 "runarray.in" +#line 600 "runarray.in" checkArray(src); checkArray(dest); dest->setSlice(left, right, src); {Stack->push<array*>(src); return;} } -#line 603 "runarray.in" +#line 607 "runarray.in" void arraySliceWriteToEnd(stack *Stack) { Int left=vm::pop<Int>(Stack); array * dest=vm::pop<array *>(Stack); array * src=vm::pop<array *>(Stack); -#line 604 "runarray.in" +#line 608 "runarray.in" checkArray(src); size_t len=checkArray(dest); dest->setSlice(left, (Int) len, src); @@ -706,20 +712,20 @@ void arraySliceWriteToEnd(stack *Stack) } // Returns the length of an array. -#line 612 "runarray.in" +#line 616 "runarray.in" void arrayLength(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 613 "runarray.in" +#line 617 "runarray.in" {Stack->push<Int>((Int) checkArray(a)); return;} } // Returns an array of integers representing the keys of the array. -#line 618 "runarray.in" +#line 622 "runarray.in" void arrayKeys(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 619 "runarray.in" +#line 623 "runarray.in" size_t size=checkArray(a); array *keys=new array(); @@ -733,33 +739,33 @@ void arrayKeys(stack *Stack) } // Return the cyclic flag for an array. -#line 633 "runarray.in" +#line 637 "runarray.in" void arrayCyclicFlag(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 634 "runarray.in" +#line 638 "runarray.in" checkArray(a); {Stack->push<bool>(a->cyclic()); return;} } -#line 639 "runarray.in" +#line 643 "runarray.in" void arraySetCyclicFlag(stack *Stack) { array * a=vm::pop<array *>(Stack); bool b=vm::pop<bool>(Stack); -#line 640 "runarray.in" +#line 644 "runarray.in" checkArray(a); a->cyclic(b); {Stack->push<bool>(b); return;} } // Check to see if an array element is initialized. -#line 647 "runarray.in" +#line 651 "runarray.in" void arrayInitializedHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); Int n=vm::pop<Int>(Stack); -#line 648 "runarray.in" +#line 652 "runarray.in" size_t len=checkArray(a); bool cyclic=a->cyclic(); if(cyclic && len > 0) n=imod(n,len); @@ -769,62 +775,62 @@ void arrayInitializedHelper(stack *Stack) } // Returns the initialize method for an array. -#line 658 "runarray.in" +#line 662 "runarray.in" void arrayInitialized(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 659 "runarray.in" +#line 663 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayInitializedHelper),a)); return;} } // The helper function for the cyclic method that sets the cyclic flag. -#line 664 "runarray.in" +#line 668 "runarray.in" void arrayCyclicHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); bool b=vm::pop<bool>(Stack); -#line 665 "runarray.in" +#line 669 "runarray.in" checkArray(a); a->cyclic(b); } // Set the cyclic flag for an array. -#line 671 "runarray.in" +#line 675 "runarray.in" void arrayCyclic(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 672 "runarray.in" +#line 676 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayCyclicHelper),a)); return;} } // The helper function for the push method that does the actual operation. -#line 677 "runarray.in" +#line 681 "runarray.in" void arrayPushHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); item x=vm::pop(Stack); -#line 678 "runarray.in" +#line 682 "runarray.in" checkArray(a); a->push(x); {Stack->push(x); return;} } // Returns the push method for an array. -#line 685 "runarray.in" +#line 689 "runarray.in" void arrayPush(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 686 "runarray.in" +#line 690 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayPushHelper),a)); return;} } // The helper function for the append method that appends b to a. -#line 691 "runarray.in" +#line 695 "runarray.in" void arrayAppendHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); array * b=vm::pop<array *>(Stack); -#line 692 "runarray.in" +#line 696 "runarray.in" checkArray(a); size_t size=checkArray(b); for(size_t i=0; i < size; i++) @@ -832,20 +838,20 @@ void arrayAppendHelper(stack *Stack) } // Returns the append method for an array. -#line 700 "runarray.in" +#line 704 "runarray.in" void arrayAppend(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 701 "runarray.in" +#line 705 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayAppendHelper),a)); return;} } // The helper function for the pop method. -#line 706 "runarray.in" +#line 710 "runarray.in" void arrayPopHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 707 "runarray.in" +#line 711 "runarray.in" size_t asize=checkArray(a); if(asize == 0) error("cannot pop element from empty array"); @@ -853,22 +859,22 @@ void arrayPopHelper(stack *Stack) } // Returns the pop method for an array. -#line 715 "runarray.in" +#line 719 "runarray.in" void arrayPop(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 716 "runarray.in" +#line 720 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayPopHelper),a)); return;} } // The helper function for the insert method. -#line 721 "runarray.in" +#line 725 "runarray.in" void arrayInsertHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); array * x=vm::pop<array *>(Stack); Int i=vm::pop<Int>(Stack); -#line 722 "runarray.in" +#line 726 "runarray.in" size_t asize=checkArray(a); checkArray(x); if(a->cyclic() && asize > 0) i=imod(i,asize); @@ -878,39 +884,39 @@ void arrayInsertHelper(stack *Stack) } // Returns the insert method for an array. -#line 732 "runarray.in" +#line 736 "runarray.in" void arrayInsert(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 733 "runarray.in" +#line 737 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayInsertHelper),a)); return;} } // Returns the delete method for an array. -#line 738 "runarray.in" +#line 742 "runarray.in" void arrayDelete(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 739 "runarray.in" +#line 743 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayDeleteHelper),a)); return;} } -#line 743 "runarray.in" +#line 747 "runarray.in" void arrayAlias(stack *Stack) { array * b=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 744 "runarray.in" +#line 748 "runarray.in" {Stack->push<bool>(a==b); return;} } // Return array formed by indexing array a with elements of integer array b -#line 749 "runarray.in" +#line 753 "runarray.in" void arrayIntArray(stack *Stack) { array * b=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 750 "runarray.in" +#line 754 "runarray.in" size_t asize=checkArray(a); size_t bsize=checkArray(b); array *r=new array(bsize); @@ -928,13 +934,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 768 "runarray.in" +#line 772 "runarray.in" // Intarray* complement(Intarray *a, Int n); void gen_runarray31(stack *Stack) { Int n=vm::pop<Int>(Stack); Intarray * a=vm::pop<Intarray *>(Stack); -#line 769 "runarray.in" +#line 773 "runarray.in" size_t asize=checkArray(a); array *r=new array(0); bool *keep=new bool[n]; @@ -951,12 +957,12 @@ void gen_runarray31(stack *Stack) } // Generate the sequence {f(i) : i=0,1,...n-1} given a function f and integer n -#line 786 "runarray.in" +#line 790 "runarray.in" void arraySequence(stack *Stack) { Int n=vm::pop<Int>(Stack); callable * f=vm::pop<callable *>(Stack); -#line 787 "runarray.in" +#line 791 "runarray.in" if(n < 0) n=0; array *a=new array(n); for(Int i=0; i < n; ++i) { @@ -968,12 +974,12 @@ void arraySequence(stack *Stack) } // Return the array {0,1,...n-1} -#line 799 "runarray.in" +#line 803 "runarray.in" // Intarray* sequence(Int n); void gen_runarray33(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 800 "runarray.in" +#line 804 "runarray.in" if(n < 0) n=0; array *a=new array(n); for(Int i=0; i < n; ++i) { @@ -983,12 +989,12 @@ void gen_runarray33(stack *Stack) } // Apply a function to each element of an array -#line 810 "runarray.in" +#line 814 "runarray.in" void arrayFunction(stack *Stack) { array * a=vm::pop<array *>(Stack); callable * f=vm::pop<callable *>(Stack); -#line 811 "runarray.in" +#line 815 "runarray.in" size_t size=checkArray(a); array *b=new array(size); for(size_t i=0; i < size; ++i) { @@ -999,12 +1005,12 @@ void arrayFunction(stack *Stack) {Stack->push<array*>(b); return;} } -#line 822 "runarray.in" +#line 826 "runarray.in" void arraySort(stack *Stack) { callable * f=vm::pop<callable *>(Stack); array * a=vm::pop<array *>(Stack); -#line 823 "runarray.in" +#line 827 "runarray.in" array *c=copyArray(a); compareFunc=f; FuncStack=Stack; @@ -1012,12 +1018,12 @@ void arraySort(stack *Stack) {Stack->push<array*>(c); return;} } -#line 831 "runarray.in" +#line 835 "runarray.in" // bool all(boolarray *a); void gen_runarray36(stack *Stack) { boolarray * a=vm::pop<boolarray *>(Stack); -#line 832 "runarray.in" +#line 836 "runarray.in" size_t size=checkArray(a); bool c=true; for(size_t i=0; i < size; i++) @@ -1025,12 +1031,12 @@ void gen_runarray36(stack *Stack) {Stack->push<bool>(c); return;} } -#line 840 "runarray.in" +#line 844 "runarray.in" // boolarray* !(boolarray* a); void gen_runarray37(stack *Stack) { boolarray* a=vm::pop<boolarray*>(Stack); -#line 841 "runarray.in" +#line 845 "runarray.in" size_t size=checkArray(a); array *c=new array(size); for(size_t i=0; i < size; i++) @@ -1038,12 +1044,12 @@ void gen_runarray37(stack *Stack) {Stack->push<boolarray*>(c); return;} } -#line 849 "runarray.in" +#line 853 "runarray.in" // Int sum(boolarray *a); void gen_runarray38(stack *Stack) { boolarray * a=vm::pop<boolarray *>(Stack); -#line 850 "runarray.in" +#line 854 "runarray.in" size_t size=checkArray(a); Int sum=0; for(size_t i=0; i < size; i++) @@ -1051,19 +1057,19 @@ void gen_runarray38(stack *Stack) {Stack->push<Int>(sum); return;} } -#line 858 "runarray.in" +#line 862 "runarray.in" void arrayCopy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 859 "runarray.in" +#line 863 "runarray.in" {Stack->push<array*>(copyArray(a)); return;} } -#line 863 "runarray.in" +#line 867 "runarray.in" void arrayConcat(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 864 "runarray.in" +#line 868 "runarray.in" // a is an array of arrays to be concatenated together. // The signature is // T[] concat(... T[][] a); @@ -1090,27 +1096,27 @@ void arrayConcat(stack *Stack) {Stack->push<array*>(result); return;} } -#line 891 "runarray.in" +#line 895 "runarray.in" void array2Copy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 892 "runarray.in" +#line 896 "runarray.in" {Stack->push<array*>(copyArray2(a)); return;} } -#line 896 "runarray.in" +#line 900 "runarray.in" void array3Copy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 897 "runarray.in" +#line 901 "runarray.in" {Stack->push<array*>(copyArray3(a)); return;} } -#line 901 "runarray.in" +#line 905 "runarray.in" void array2Transpose(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 902 "runarray.in" +#line 906 "runarray.in" size_t asize=checkArray(a); array *c=new array(0); for(size_t i=0; i < asize; i++) { @@ -1137,12 +1143,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 929 "runarray.in" +#line 933 "runarray.in" void array3Transpose(stack *Stack) { array * perm=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 930 "runarray.in" +#line 934 "runarray.in" const size_t DIM=3; if(checkArray(perm) != DIM) { @@ -1226,13 +1232,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 1014 "runarray.in" +#line 1018 "runarray.in" // Int find(boolarray *a, Int n=1); void gen_runarray45(stack *Stack) { Int n=vm::pop<Int>(Stack,1); boolarray * a=vm::pop<boolarray *>(Stack); -#line 1015 "runarray.in" +#line 1019 "runarray.in" size_t size=checkArray(a); Int j=-1; if(n > 0) @@ -1250,13 +1256,13 @@ void gen_runarray45(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 1033 "runarray.in" +#line 1037 "runarray.in" void arrayConditional(stack *Stack) { array * c=vm::pop<array *>(Stack); array * b=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 1034 "runarray.in" +#line 1038 "runarray.in" size_t size=checkArray(a); array *r=new array(size); if(b && c) { @@ -1280,21 +1286,21 @@ void arrayConditional(stack *Stack) } // Return an n x n identity matrix. -#line 1058 "runarray.in" +#line 1062 "runarray.in" // realarray2* identity(Int n); void gen_runarray47(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 1059 "runarray.in" +#line 1063 "runarray.in" {Stack->push<realarray2*>(Identity(n)); return;} } // Return the diagonal matrix with diagonal entries given by a. -#line 1064 "runarray.in" +#line 1068 "runarray.in" void diagonal(stack *Stack) { realarray * a=vm::pop<realarray *>(Stack); -#line 1065 "runarray.in" +#line 1069 "runarray.in" size_t n=checkArray(a); array *c=new array(n); for(size_t i=0; i < n; ++i) { @@ -1310,12 +1316,12 @@ void diagonal(stack *Stack) } // Return the inverse of an n x n matrix a using Gauss-Jordan elimination. -#line 1081 "runarray.in" +#line 1085 "runarray.in" // realarray2* inverse(realarray2 *a); void gen_runarray49(stack *Stack) { realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1082 "runarray.in" +#line 1086 "runarray.in" a=copyArray2(a); size_t n=checkArray(a); checkSquare(a); @@ -1408,14 +1414,14 @@ void gen_runarray49(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 1175 "runarray.in" +#line 1179 "runarray.in" // realarray* solve(realarray2 *a, realarray *b, bool warn=true); void gen_runarray50(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); realarray * b=vm::pop<realarray *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1176 "runarray.in" +#line 1180 "runarray.in" size_t n=checkArray(a); if(n == 0) {Stack->push<realarray*>(new array(0)); return;} @@ -1465,14 +1471,14 @@ void gen_runarray50(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 1226 "runarray.in" +#line 1230 "runarray.in" // realarray2* solve(realarray2 *a, realarray2 *b, bool warn=true); void gen_runarray51(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); realarray2 * b=vm::pop<realarray2 *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1227 "runarray.in" +#line 1231 "runarray.in" size_t n=checkArray(a); if(n == 0) {Stack->push<realarray2*>(new array(0)); return;} @@ -1533,12 +1539,12 @@ void gen_runarray51(stack *Stack) } // Compute the determinant of an n x n matrix. -#line 1288 "runarray.in" +#line 1292 "runarray.in" // real determinant(realarray2 *a); void gen_runarray52(stack *Stack) { realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1289 "runarray.in" +#line 1293 "runarray.in" real *A=copyArray2C(a); size_t n=checkArray(a); @@ -1552,13 +1558,13 @@ void gen_runarray52(stack *Stack) {Stack->push<real>(det); return;} } -#line 1303 "runarray.in" +#line 1307 "runarray.in" // realarray* *(realarray2 *a, realarray *b); void gen_runarray53(stack *Stack) { realarray * b=vm::pop<realarray *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1304 "runarray.in" +#line 1308 "runarray.in" size_t n=checkArray(a); size_t m=checkArray(b); array *c=new array(n); @@ -1575,13 +1581,13 @@ void gen_runarray53(stack *Stack) {Stack->push<realarray*>(c); return;} } -#line 1321 "runarray.in" +#line 1325 "runarray.in" // realarray* *(realarray *a, realarray2 *b); void gen_runarray54(stack *Stack) { realarray2 * b=vm::pop<realarray2 *>(Stack); realarray * a=vm::pop<realarray *>(Stack); -#line 1322 "runarray.in" +#line 1326 "runarray.in" size_t n=checkArray(a); if(n != checkArray(b)) error(incommensurate); real *A=copyArrayC(a); @@ -1608,13 +1614,13 @@ void gen_runarray54(stack *Stack) {Stack->push<realarray*>(c); return;} } -#line 1349 "runarray.in" +#line 1353 "runarray.in" // realarray2* *(realarray2 *a, realarray2 *b); void gen_runarray55(stack *Stack) { realarray2 * b=vm::pop<realarray2 *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1350 "runarray.in" +#line 1354 "runarray.in" size_t n=checkArray(a); size_t nb=checkArray(b); @@ -1648,23 +1654,23 @@ void gen_runarray55(stack *Stack) {Stack->push<realarray2*>(c); return;} } -#line 1384 "runarray.in" +#line 1388 "runarray.in" // triple *(realarray2 *t, triple v); void gen_runarray56(stack *Stack) { triple v=vm::pop<triple>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); -#line 1385 "runarray.in" +#line 1389 "runarray.in" {Stack->push<triple>(*t*v); return;} } -#line 1389 "runarray.in" +#line 1393 "runarray.in" // pair project(triple v, realarray2 *t); void gen_runarray57(stack *Stack) { realarray2 * t=vm::pop<realarray2 *>(Stack); triple v=vm::pop<triple>(Stack); -#line 1390 "runarray.in" +#line 1394 "runarray.in" size_t n=checkArray(t); if(n != 4) error(incommensurate); array *t0=read<array*>(t,0); @@ -1689,13 +1695,13 @@ void gen_runarray57(stack *Stack) } // Compute the dot product of vectors a and b. -#line 1415 "runarray.in" +#line 1419 "runarray.in" // real dot(realarray *a, realarray *b); void gen_runarray58(stack *Stack) { realarray * b=vm::pop<realarray *>(Stack); realarray * a=vm::pop<realarray *>(Stack); -#line 1416 "runarray.in" +#line 1420 "runarray.in" size_t n=checkArrays(a,b); real sum=0.0; for(size_t i=0; i < n; ++i) @@ -1710,7 +1716,7 @@ void gen_runarray58(stack *Stack) // [ a[2] b[2] c[2] ] // [ ... ] // [ c[n-1] a[n-1] b[n-1] ] -#line 1431 "runarray.in" +#line 1435 "runarray.in" // realarray* tridiagonal(realarray *a, realarray *b, realarray *c, realarray *f); void gen_runarray59(stack *Stack) { @@ -1718,7 +1724,7 @@ void gen_runarray59(stack *Stack) realarray * c=vm::pop<realarray *>(Stack); realarray * b=vm::pop<realarray *>(Stack); realarray * a=vm::pop<realarray *>(Stack); -#line 1432 "runarray.in" +#line 1436 "runarray.in" size_t n=checkArrays(a,b); checkEqual(n,checkArray(c)); checkEqual(n,checkArray(f)); @@ -1815,7 +1821,7 @@ void gen_runarray59(stack *Stack) } // Root solve by Newton-Raphson -#line 1529 "runarray.in" +#line 1533 "runarray.in" // real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x, bool verbose=false); void gen_runarray60(stack *Stack) { @@ -1824,7 +1830,7 @@ void gen_runarray60(stack *Stack) callableReal * fprime=vm::pop<callableReal *>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); Int iterations=vm::pop<Int>(Stack,100); -#line 1531 "runarray.in" +#line 1535 "runarray.in" static const real fuzz=1000.0*DBL_EPSILON; Int i=0; size_t oldPrec=0; @@ -1870,7 +1876,7 @@ void gen_runarray60(stack *Stack) // Root solve by Newton-Raphson bisection // cf. routine rtsafe (Press et al., Numerical Recipes, 1991). -#line 1577 "runarray.in" +#line 1581 "runarray.in" // real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x1, real x2, bool verbose=false); void gen_runarray61(stack *Stack) { @@ -1880,7 +1886,7 @@ void gen_runarray61(stack *Stack) callableReal * fprime=vm::pop<callableReal *>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); Int iterations=vm::pop<Int>(Stack,100); -#line 1579 "runarray.in" +#line 1583 "runarray.in" static const real fuzz=1000.0*DBL_EPSILON; size_t oldPrec=0; if(verbose) @@ -1958,7 +1964,7 @@ void gen_runarray61(stack *Stack) {Stack->push<real>((j == iterations) ? DBL_MAX : x); return;} } -#line 1657 "runarray.in" +#line 1661 "runarray.in" // real simpson(callableReal *f, real a, real b, real acc=DBL_EPSILON, real dxmax=0); void gen_runarray62(stack *Stack) { @@ -1967,9 +1973,9 @@ void gen_runarray62(stack *Stack) real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); -#line 1659 "runarray.in" +#line 1663 "runarray.in" real integral; - if(dxmax == 0) dxmax=b-a; + if(dxmax <= 0) dxmax=fabs(b-a); Func=f; FuncStack=Stack; if(!simpson(integral,wrapFunction,a,b,acc,dxmax)) @@ -1978,17 +1984,18 @@ void gen_runarray62(stack *Stack) } // Compute the fast Fourier transform of a pair array -#line 1670 "runarray.in" -void pairArrayFFT(stack *Stack) +#line 1674 "runarray.in" +// pairarray* fft(pairarray *a, Int sign=1); +void gen_runarray63(stack *Stack) { Int sign=vm::pop<Int>(Stack,1); pairarray * a=vm::pop<pairarray *>(Stack); -#line 1671 "runarray.in" +#line 1675 "runarray.in" unsigned n=(unsigned) checkArray(a); #ifdef HAVE_LIBFFTW3 array *c=new array(n); if(n) { - Complex *f=FFTWComplex(n); + Complex *f=ComplexAlign(n); fft1d Forward(n,intcast(sign),f); for(size_t i=0; i < n; i++) { @@ -2001,22 +2008,23 @@ void pairArrayFFT(stack *Stack) Complex z=f[i]; (*c)[i]=pair(z.real(),z.imag()); } - FFTWdelete(f); + deleteAlign(f); } #else unused(&n); unused(&sign); array *c=new array(0); + error("Please install fftw3, run ./configure, and recompile"); #endif // HAVE_LIBFFTW3 {Stack->push<pairarray*>(c); return;} } -#line 1699 "runarray.in" +#line 1704 "runarray.in" // Intarray2* triangulate(pairarray *z); void gen_runarray64(stack *Stack) { pairarray * z=vm::pop<pairarray *>(Stack); -#line 1700 "runarray.in" +#line 1705 "runarray.in" size_t nv=checkArray(z); // Call robust version of Gilles Dumoulin's port of Paul Bourke's // triangulation code. @@ -2050,12 +2058,12 @@ void gen_runarray64(stack *Stack) {Stack->push<Intarray2*>(t); return;} } -#line 1734 "runarray.in" +#line 1739 "runarray.in" // real norm(realarray *a); void gen_runarray65(stack *Stack) { realarray * a=vm::pop<realarray *>(Stack); -#line 1735 "runarray.in" +#line 1740 "runarray.in" size_t n=checkArray(a); real M=0.0; for(size_t i=0; i < n; ++i) { @@ -2065,12 +2073,12 @@ void gen_runarray65(stack *Stack) {Stack->push<real>(M); return;} } -#line 1745 "runarray.in" +#line 1750 "runarray.in" // real norm(realarray2 *a); void gen_runarray66(stack *Stack) { realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1746 "runarray.in" +#line 1751 "runarray.in" size_t n=checkArray(a); real M=0.0; for(size_t i=0; i < n; ++i) { @@ -2084,12 +2092,12 @@ void gen_runarray66(stack *Stack) {Stack->push<real>(M); return;} } -#line 1760 "runarray.in" +#line 1765 "runarray.in" // real norm(triplearray2 *a); void gen_runarray67(stack *Stack) { triplearray2 * a=vm::pop<triplearray2 *>(Stack); -#line 1761 "runarray.in" +#line 1766 "runarray.in" size_t n=checkArray(a); real M=0.0; for(size_t i=0; i < n; ++i) { @@ -2103,12 +2111,12 @@ void gen_runarray67(stack *Stack) {Stack->push<real>(sqrt(M)); return;} } -#line 1775 "runarray.in" +#line 1780 "runarray.in" // real change2(triplearray2 *a); void gen_runarray68(stack *Stack) { triplearray2 * a=vm::pop<triplearray2 *>(Stack); -#line 1776 "runarray.in" +#line 1781 "runarray.in" size_t n=checkArray(a); if(n == 0) {Stack->push<real>(0.0); return;} @@ -2129,13 +2137,13 @@ void gen_runarray68(stack *Stack) {Stack->push<real>(M); return;} } -#line 1797 "runarray.in" +#line 1802 "runarray.in" // triple minbezier(triplearray2 *P, triple b); void gen_runarray69(stack *Stack) { triple b=vm::pop<triple>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1798 "runarray.in" +#line 1803 "runarray.in" real *A=copyTripleArray2Components(P,true,4); b=triple(bound(A,::min,b.getx(),sqrtFuzz*norm(A,16)), bound(A+16,::min,b.gety(),sqrtFuzz*norm(A+16,16)), @@ -2144,13 +2152,13 @@ void gen_runarray69(stack *Stack) {Stack->push<triple>(b); return;} } -#line 1807 "runarray.in" +#line 1812 "runarray.in" // triple maxbezier(triplearray2 *P, triple b); void gen_runarray70(stack *Stack) { triple b=vm::pop<triple>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1808 "runarray.in" +#line 1813 "runarray.in" real *A=copyTripleArray2Components(P,true,4); b=triple(bound(A,::max,b.getx(),sqrtFuzz*norm(A,16)), bound(A+16,::max,b.gety(),sqrtFuzz*norm(A+16,16)), @@ -2159,13 +2167,13 @@ void gen_runarray70(stack *Stack) {Stack->push<triple>(b); return;} } -#line 1817 "runarray.in" +#line 1822 "runarray.in" // pair minratio(triplearray2 *P, pair b); void gen_runarray71(stack *Stack) { pair b=vm::pop<pair>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1818 "runarray.in" +#line 1823 "runarray.in" triple *A=copyTripleArray2C(P,true,4); real fuzz=sqrtFuzz*norm(A,16); b=pair(bound(A,::min,xratio,b.getx(),fuzz), @@ -2174,13 +2182,13 @@ void gen_runarray71(stack *Stack) {Stack->push<pair>(b); return;} } -#line 1827 "runarray.in" +#line 1832 "runarray.in" // pair maxratio(triplearray2 *P, pair b); void gen_runarray72(stack *Stack) { pair b=vm::pop<pair>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1828 "runarray.in" +#line 1833 "runarray.in" triple *A=copyTripleArray2C(P,true,4); real fuzz=sqrtFuzz*norm(A,16); b=pair(bound(A,::max,xratio,b.getx(),fuzz), @@ -2189,12 +2197,12 @@ void gen_runarray72(stack *Stack) {Stack->push<pair>(b); return;} } -#line 1837 "runarray.in" +#line 1842 "runarray.in" // realarray* _projection(); void gen_runarray73(stack *Stack) { -#line 1838 "runarray.in" -#ifdef HAVE_LIBGL +#line 1843 "runarray.in" +#ifdef HAVE_GL array *a=new array(14); gl::projection P=gl::camera(); size_t k=0; @@ -2230,153 +2238,153 @@ namespace trans { void gen_runarray_venv(venv &ve) { -#line 474 "runarray.in" +#line 478 "runarray.in" REGISTER_BLTIN(run::emptyArray,"emptyArray"); -#line 480 "runarray.in" +#line 484 "runarray.in" REGISTER_BLTIN(run::newDeepArray,"newDeepArray"); -#line 502 "runarray.in" +#line 506 "runarray.in" REGISTER_BLTIN(run::newInitializedArray,"newInitializedArray"); -#line 517 "runarray.in" +#line 521 "runarray.in" REGISTER_BLTIN(run::newAppendedArray,"newAppendedArray"); -#line 533 "runarray.in" +#line 537 "runarray.in" REGISTER_BLTIN(run::newDuplicateArray,"newDuplicateArray"); -#line 543 "runarray.in" +#line 547 "runarray.in" REGISTER_BLTIN(run::arrayRead,"arrayRead"); -#line 555 "runarray.in" +#line 559 "runarray.in" REGISTER_BLTIN(run::arraySliceRead,"arraySliceRead"); -#line 562 "runarray.in" +#line 566 "runarray.in" REGISTER_BLTIN(run::arraySliceReadToEnd,"arraySliceReadToEnd"); -#line 570 "runarray.in" +#line 574 "runarray.in" REGISTER_BLTIN(run::arrayArrayRead,"arrayArrayRead"); -#line 579 "runarray.in" +#line 583 "runarray.in" REGISTER_BLTIN(run::arrayWrite,"arrayWrite"); -#line 595 "runarray.in" +#line 599 "runarray.in" REGISTER_BLTIN(run::arraySliceWrite,"arraySliceWrite"); -#line 603 "runarray.in" +#line 607 "runarray.in" REGISTER_BLTIN(run::arraySliceWriteToEnd,"arraySliceWriteToEnd"); -#line 611 "runarray.in" +#line 615 "runarray.in" REGISTER_BLTIN(run::arrayLength,"arrayLength"); -#line 617 "runarray.in" +#line 621 "runarray.in" REGISTER_BLTIN(run::arrayKeys,"arrayKeys"); -#line 632 "runarray.in" +#line 636 "runarray.in" REGISTER_BLTIN(run::arrayCyclicFlag,"arrayCyclicFlag"); -#line 639 "runarray.in" +#line 643 "runarray.in" REGISTER_BLTIN(run::arraySetCyclicFlag,"arraySetCyclicFlag"); -#line 646 "runarray.in" +#line 650 "runarray.in" REGISTER_BLTIN(run::arrayInitializedHelper,"arrayInitializedHelper"); -#line 657 "runarray.in" +#line 661 "runarray.in" REGISTER_BLTIN(run::arrayInitialized,"arrayInitialized"); -#line 663 "runarray.in" +#line 667 "runarray.in" REGISTER_BLTIN(run::arrayCyclicHelper,"arrayCyclicHelper"); -#line 670 "runarray.in" +#line 674 "runarray.in" REGISTER_BLTIN(run::arrayCyclic,"arrayCyclic"); -#line 676 "runarray.in" +#line 680 "runarray.in" REGISTER_BLTIN(run::arrayPushHelper,"arrayPushHelper"); -#line 684 "runarray.in" +#line 688 "runarray.in" REGISTER_BLTIN(run::arrayPush,"arrayPush"); -#line 690 "runarray.in" +#line 694 "runarray.in" REGISTER_BLTIN(run::arrayAppendHelper,"arrayAppendHelper"); -#line 699 "runarray.in" +#line 703 "runarray.in" REGISTER_BLTIN(run::arrayAppend,"arrayAppend"); -#line 705 "runarray.in" +#line 709 "runarray.in" REGISTER_BLTIN(run::arrayPopHelper,"arrayPopHelper"); -#line 714 "runarray.in" +#line 718 "runarray.in" REGISTER_BLTIN(run::arrayPop,"arrayPop"); -#line 720 "runarray.in" +#line 724 "runarray.in" REGISTER_BLTIN(run::arrayInsertHelper,"arrayInsertHelper"); -#line 731 "runarray.in" +#line 735 "runarray.in" REGISTER_BLTIN(run::arrayInsert,"arrayInsert"); -#line 737 "runarray.in" +#line 741 "runarray.in" REGISTER_BLTIN(run::arrayDelete,"arrayDelete"); -#line 743 "runarray.in" +#line 747 "runarray.in" REGISTER_BLTIN(run::arrayAlias,"arrayAlias"); -#line 748 "runarray.in" +#line 752 "runarray.in" REGISTER_BLTIN(run::arrayIntArray,"arrayIntArray"); -#line 766 "runarray.in" +#line 770 "runarray.in" addFunc(ve, run::gen_runarray31, IntArray(), "complement", formal(IntArray(), "a", false, false), formal(primInt(), "n", false, false)); -#line 785 "runarray.in" +#line 789 "runarray.in" REGISTER_BLTIN(run::arraySequence,"arraySequence"); -#line 798 "runarray.in" +#line 802 "runarray.in" addFunc(ve, run::gen_runarray33, IntArray(), "sequence", formal(primInt(), "n", false, false)); -#line 809 "runarray.in" +#line 813 "runarray.in" REGISTER_BLTIN(run::arrayFunction,"arrayFunction"); -#line 822 "runarray.in" +#line 826 "runarray.in" REGISTER_BLTIN(run::arraySort,"arraySort"); -#line 831 "runarray.in" +#line 835 "runarray.in" addFunc(ve, run::gen_runarray36, primBoolean(), "all", formal(booleanArray(), "a", false, false)); -#line 840 "runarray.in" +#line 844 "runarray.in" addFunc(ve, run::gen_runarray37, booleanArray(), "!", formal(booleanArray(), "a", false, false)); -#line 849 "runarray.in" +#line 853 "runarray.in" addFunc(ve, run::gen_runarray38, primInt(), "sum", formal(booleanArray(), "a", false, false)); -#line 858 "runarray.in" +#line 862 "runarray.in" REGISTER_BLTIN(run::arrayCopy,"arrayCopy"); -#line 863 "runarray.in" +#line 867 "runarray.in" REGISTER_BLTIN(run::arrayConcat,"arrayConcat"); -#line 891 "runarray.in" +#line 895 "runarray.in" REGISTER_BLTIN(run::array2Copy,"array2Copy"); -#line 896 "runarray.in" +#line 900 "runarray.in" REGISTER_BLTIN(run::array3Copy,"array3Copy"); -#line 901 "runarray.in" +#line 905 "runarray.in" REGISTER_BLTIN(run::array2Transpose,"array2Transpose"); -#line 925 "runarray.in" +#line 929 "runarray.in" REGISTER_BLTIN(run::array3Transpose,"array3Transpose"); -#line 1012 "runarray.in" +#line 1016 "runarray.in" addFunc(ve, run::gen_runarray45, primInt(), "find", formal(booleanArray(), "a", false, false), formal(primInt(), "n", true, false)); -#line 1031 "runarray.in" +#line 1035 "runarray.in" REGISTER_BLTIN(run::arrayConditional,"arrayConditional"); -#line 1057 "runarray.in" +#line 1061 "runarray.in" addFunc(ve, run::gen_runarray47, realArray2(), "identity", formal(primInt(), "n", false, false)); -#line 1063 "runarray.in" +#line 1067 "runarray.in" REGISTER_BLTIN(run::diagonal,"diagonal"); -#line 1080 "runarray.in" +#line 1084 "runarray.in" addFunc(ve, run::gen_runarray49, realArray2(), "inverse", formal(realArray2(), "a", false, false)); -#line 1172 "runarray.in" +#line 1176 "runarray.in" addFunc(ve, run::gen_runarray50, realArray(), "solve", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false), formal(primBoolean(), "warn", true, false)); -#line 1223 "runarray.in" +#line 1227 "runarray.in" addFunc(ve, run::gen_runarray51, realArray2(), "solve", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false), formal(primBoolean(), "warn", true, false)); -#line 1287 "runarray.in" +#line 1291 "runarray.in" addFunc(ve, run::gen_runarray52, primReal(), "determinant", formal(realArray2(), "a", false, false)); -#line 1303 "runarray.in" +#line 1307 "runarray.in" addFunc(ve, run::gen_runarray53, realArray(), "*", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false)); -#line 1321 "runarray.in" +#line 1325 "runarray.in" addFunc(ve, run::gen_runarray54, realArray(), "*", formal(realArray(), "a", false, false), formal(realArray2(), "b", false, false)); -#line 1349 "runarray.in" +#line 1353 "runarray.in" addFunc(ve, run::gen_runarray55, realArray2(), "*", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false)); -#line 1384 "runarray.in" +#line 1388 "runarray.in" addFunc(ve, run::gen_runarray56, primTriple(), "*", formal(realArray2(), "t", false, false), formal(primTriple(), "v", false, false)); -#line 1389 "runarray.in" +#line 1393 "runarray.in" addFunc(ve, run::gen_runarray57, primPair(), "project", formal(primTriple(), "v", false, false), formal(realArray2(), "t", false, false)); -#line 1414 "runarray.in" +#line 1418 "runarray.in" addFunc(ve, run::gen_runarray58, primReal(), "dot", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false)); -#line 1424 "runarray.in" +#line 1428 "runarray.in" addFunc(ve, run::gen_runarray59, realArray(), "tridiagonal", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false), formal(realArray(), "c", false, false), formal(realArray(), "f", false, false)); -#line 1528 "runarray.in" +#line 1532 "runarray.in" addFunc(ve, run::gen_runarray60, 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 1575 "runarray.in" +#line 1579 "runarray.in" addFunc(ve, run::gen_runarray61, 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 1657 "runarray.in" +#line 1661 "runarray.in" addFunc(ve, run::gen_runarray62, 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 1669 "runarray.in" - REGISTER_BLTIN(run::pairArrayFFT,"pairArrayFFT"); -#line 1699 "runarray.in" +#line 1673 "runarray.in" + addFunc(ve, run::gen_runarray63, pairArray(), "fft", formal(pairArray(), "a", false, false), formal(primInt(), "sign", true, false)); +#line 1704 "runarray.in" addFunc(ve, run::gen_runarray64, IntArray2(), "triangulate", formal(pairArray(), "z", false, false)); -#line 1734 "runarray.in" +#line 1739 "runarray.in" addFunc(ve, run::gen_runarray65, primReal(), "norm", formal(realArray(), "a", false, false)); -#line 1745 "runarray.in" +#line 1750 "runarray.in" addFunc(ve, run::gen_runarray66, primReal(), "norm", formal(realArray2(), "a", false, false)); -#line 1760 "runarray.in" +#line 1765 "runarray.in" addFunc(ve, run::gen_runarray67, primReal(), "norm", formal(tripleArray2(), "a", false, false)); -#line 1775 "runarray.in" +#line 1780 "runarray.in" addFunc(ve, run::gen_runarray68, primReal(), "change2", formal(tripleArray2(), "a", false, false)); -#line 1797 "runarray.in" +#line 1802 "runarray.in" addFunc(ve, run::gen_runarray69, primTriple(), "minbezier", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false)); -#line 1807 "runarray.in" +#line 1812 "runarray.in" addFunc(ve, run::gen_runarray70, primTriple(), "maxbezier", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false)); -#line 1817 "runarray.in" +#line 1822 "runarray.in" addFunc(ve, run::gen_runarray71, primPair(), "minratio", formal(tripleArray2(), "p", false, false), formal(primPair(), "b", false, false)); -#line 1827 "runarray.in" +#line 1832 "runarray.in" addFunc(ve, run::gen_runarray72, primPair(), "maxratio", formal(tripleArray2(), "p", false, false), formal(primPair(), "b", false, false)); -#line 1837 "runarray.in" +#line 1842 "runarray.in" addFunc(ve, run::gen_runarray73, realArray(), "_projection"); } diff --git a/Build/source/utils/asymptote/runarray.h b/Build/source/utils/asymptote/runarray.h index 35776b242a5..82b61cf0dea 100644 --- a/Build/source/utils/asymptote/runarray.h +++ b/Build/source/utils/asymptote/runarray.h @@ -45,7 +45,6 @@ void array2Transpose(vm::stack *); void array3Transpose(vm::stack *); void arrayConditional(vm::stack *); void diagonal(vm::stack *); -void pairArrayFFT(vm::stack *); } #endif // runarray_H diff --git a/Build/source/utils/asymptote/runarray.in b/Build/source/utils/asymptote/runarray.in index 6916a0450bb..ac7c6ed6781 100644 --- a/Build/source/utils/asymptote/runarray.in +++ b/Build/source/utils/asymptote/runarray.in @@ -127,10 +127,11 @@ inline size_t checkdimension(const array *a, size_t dim) return size; } -double *copyArrayC(const array *a, size_t dim) +double *copyArrayC(const array *a, size_t dim, GCPlacement placement) { size_t size=checkdimension(a,dim); - double *c=new double[size]; + double *c=(placement == NoGC) ? new double [size] : + new(placement) double[size]; for(size_t i=0; i < size; i++) c[i]=read<double>(a,i); return c; @@ -181,7 +182,8 @@ array *copyArray3(array *a) return c; } -double *copyArray2C(const array *a, bool square, size_t dim2) +double *copyArray2C(const array *a, bool square, size_t dim2, + GCPlacement placement) { size_t n=checkArray(a); size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); @@ -191,7 +193,7 @@ double *copyArray2C(const array *a, bool square, size_t dim2) error(buf); } - double *c=new double[n*m]; + double *c=(placement == NoGC) ? new double [n*m] : new(placement) double[n*m]; for(size_t i=0; i < n; i++) { array *ai=read<array*>(a,i); size_t aisize=checkArray(ai); @@ -229,7 +231,8 @@ triple *copyTripleArray2C(const array *a, bool square, size_t dim2) return c; } -double *copyTripleArray2Components(array *a, bool square, size_t dim2) +double *copyTripleArray2Components(array *a, bool square, size_t dim2, + GCPlacement placement) { size_t n=checkArray(a); size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0)); @@ -240,7 +243,8 @@ double *copyTripleArray2Components(array *a, bool square, size_t dim2) } size_t nm=n*m; - double *cx=new double[3*nm]; + double *cx=(placement == NoGC) ? new double [3*nm] : + new(placement) double[3*nm]; double *cy=cx+nm; double *cz=cx+2*nm; for(size_t i=0; i < n; i++) { @@ -1658,7 +1662,7 @@ real simpson(callableReal *f, real a, real b, real acc=DBL_EPSILON, real dxmax=0) { real integral; - if(dxmax == 0) dxmax=b-a; + if(dxmax <= 0) dxmax=fabs(b-a); Func=f; FuncStack=Stack; if(!simpson(integral,wrapFunction,a,b,acc,dxmax)) @@ -1667,13 +1671,13 @@ real simpson(callableReal *f, real a, real b, real acc=DBL_EPSILON, } // Compute the fast Fourier transform of a pair array -pairarray* :pairArrayFFT(pairarray *a, Int sign=1) +pairarray* fft(pairarray *a, Int sign=1) { unsigned n=(unsigned) checkArray(a); #ifdef HAVE_LIBFFTW3 array *c=new array(n); if(n) { - Complex *f=FFTWComplex(n); + Complex *f=ComplexAlign(n); fft1d Forward(n,intcast(sign),f); for(size_t i=0; i < n; i++) { @@ -1686,12 +1690,13 @@ pairarray* :pairArrayFFT(pairarray *a, Int sign=1) Complex z=f[i]; (*c)[i]=pair(z.real(),z.imag()); } - FFTWdelete(f); + deleteAlign(f); } #else unused(&n); unused(&sign); array *c=new array(0); + error("Please install fftw3, run ./configure, and recompile"); #endif // HAVE_LIBFFTW3 return c; } @@ -1836,7 +1841,7 @@ pair maxratio(triplearray2 *P, pair b) realarray *_projection() { -#ifdef HAVE_LIBGL +#ifdef HAVE_GL array *a=new array(14); gl::projection P=gl::camera(); size_t k=0; diff --git a/Build/source/utils/asymptote/runbacktrace.cc b/Build/source/utils/asymptote/runbacktrace.cc index 55b1ad30003..7e25c6be058 100644 --- a/Build/source/utils/asymptote/runbacktrace.cc +++ b/Build/source/utils/asymptote/runbacktrace.cc @@ -50,12 +50,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); diff --git a/Build/source/utils/asymptote/runfile.cc b/Build/source/utils/asymptote/runfile.cc index 78afa6d0d85..c82d772eb4e 100644 --- a/Build/source/utils/asymptote/runfile.cc +++ b/Build/source/utils/asymptote/runfile.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); @@ -560,31 +562,31 @@ void readSet(stack *Stack) // Delete file named s. #line 330 "runfile.in" -// Int delete(string *s); +// Int delete(string s); void gen_runfile45(stack *Stack) { - string * s=vm::pop<string *>(Stack); + string s=vm::pop<string>(Stack); #line 331 "runfile.in" - checkLocal(*s); - Int rc=unlink(s->c_str()); + s=outpath(s); + Int rc=unlink(s.c_str()); if(rc == 0 && verbose > 0) - cout << "Deleted " << *s << endl; + cout << "Deleted " << s << endl; {Stack->push<Int>(rc); return;} } // Rename file "from" to file "to". #line 340 "runfile.in" -// Int rename(string *from, string *to); +// Int rename(string from, string to); void gen_runfile46(stack *Stack) { - string * to=vm::pop<string *>(Stack); - string * from=vm::pop<string *>(Stack); + string to=vm::pop<string>(Stack); + string from=vm::pop<string>(Stack); #line 341 "runfile.in" - checkLocal(*from); - checkLocal(*to); - Int rc=rename(from->c_str(),to->c_str()); + from=outpath(from); + to=outpath(to); + Int rc=rename(from.c_str(),to.c_str()); if(rc == 0 && verbose > 0) - cout << "Renamed " << *from << " to " << *to << endl; + cout << "Renamed " << from << " to " << to << endl; {Stack->push<Int>(rc); return;} } @@ -685,9 +687,9 @@ void gen_runfile_venv(venv &ve) #line 324 "runfile.in" REGISTER_BLTIN(run::readSet,"readSet"); #line 329 "runfile.in" - addFunc(ve, run::gen_runfile45, primInt(), "delete", formal(primString(), "s", false, false)); + addFunc(ve, run::gen_runfile45, primInt(), "delete", formal(primString() , "s", false, false)); #line 339 "runfile.in" - addFunc(ve, run::gen_runfile46, primInt(), "rename", formal(primString(), "from", false, false), formal(primString(), "to", false, false)); + addFunc(ve, run::gen_runfile46, primInt(), "rename", formal(primString() , "from", false, false), formal(primString() , "to", false, false)); } } // namespace trans diff --git a/Build/source/utils/asymptote/runfile.in b/Build/source/utils/asymptote/runfile.in index fa85c86e182..872eb6fae4f 100644 --- a/Build/source/utils/asymptote/runfile.in +++ b/Build/source/utils/asymptote/runfile.in @@ -327,22 +327,22 @@ callable* :readSet(file *f) } // Delete file named s. -Int delete(string *s) +Int delete(string s) { - checkLocal(*s); - Int rc=unlink(s->c_str()); + s=outpath(s); + Int rc=unlink(s.c_str()); if(rc == 0 && verbose > 0) - cout << "Deleted " << *s << endl; + cout << "Deleted " << s << endl; return rc; } // Rename file "from" to file "to". -Int rename(string *from, string *to) +Int rename(string from, string to) { - checkLocal(*from); - checkLocal(*to); - Int rc=rename(from->c_str(),to->c_str()); + from=outpath(from); + to=outpath(to); + Int rc=rename(from.c_str(),to.c_str()); if(rc == 0 && verbose > 0) - cout << "Renamed " << *from << " to " << *to << endl; + cout << "Renamed " << from << " to " << to << endl; return rc; } diff --git a/Build/source/utils/asymptote/runhistory.cc b/Build/source/utils/asymptote/runhistory.cc index a19b809e702..8bf35726c8c 100644 --- a/Build/source/utils/asymptote/runhistory.cc +++ b/Build/source/utils/asymptote/runhistory.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); @@ -125,24 +127,9 @@ namespace run { extern string emptystring; #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) -int readline_startup_hook() -{ -#ifdef __CYGWIN__ - rl_set_key("\\M-[3~",rl_delete,rl_get_keymap()); - rl_set_key("\\M-[2~",rl_overwrite_mode,rl_get_keymap()); -#endif - return 0; -} void init_readline(bool tabcompletion) { - static bool first=true; - if(first) { - first=false; -#ifdef __CYGWIN__ - rl_startup_hook=readline_startup_hook; -#endif - } rl_bind_key('\t',tabcompletion ? rl_complete : rl_insert); } #endif @@ -169,13 +156,13 @@ void cleanup() namespace run { // Return the last n lines of the history named name. -#line 117 "runhistory.in" +#line 102 "runhistory.in" // stringarray* history(string name, Int n=1); void gen_runhistory0(stack *Stack) { Int n=vm::pop<Int>(Stack,1); string name=vm::pop<string>(Stack); -#line 118 "runhistory.in" +#line 103 "runhistory.in" #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) bool newhistory=historyMap.find(name) == historyMap.end(); @@ -207,12 +194,12 @@ void gen_runhistory0(stack *Stack) } // Return the last n lines of the interactive history. -#line 150 "runhistory.in" +#line 135 "runhistory.in" // stringarray* history(Int n=0); void gen_runhistory1(stack *Stack) { Int n=vm::pop<Int>(Stack,0); -#line 151 "runhistory.in" +#line 136 "runhistory.in" #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) {Stack->push<stringarray*>(get_history(n)); return;} #else @@ -223,14 +210,14 @@ void gen_runhistory1(stack *Stack) // Prompt for a string using prompt, the GNU readline library, and a // local history named name. -#line 162 "runhistory.in" +#line 147 "runhistory.in" // string readline(string prompt=emptystring, string name=emptystring, bool tabcompletion=false); void gen_runhistory2(stack *Stack) { bool tabcompletion=vm::pop<bool>(Stack,false); string name=vm::pop<string>(Stack,emptystring); string prompt=vm::pop<string>(Stack,emptystring); -#line 164 "runhistory.in" +#line 149 "runhistory.in" if(!(isatty(STDIN_FILENO) || getSetting<bool>("interactive"))) {Stack->push<string>(emptystring); return;} #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) @@ -272,14 +259,14 @@ void gen_runhistory2(stack *Stack) // Save a string in a local history named name. // If store=true, store the local history in the file historyfilename(name). -#line 206 "runhistory.in" +#line 191 "runhistory.in" // void saveline(string name, string value, bool store=true); void gen_runhistory3(stack *Stack) { bool store=vm::pop<bool>(Stack,true); string value=vm::pop<string>(Stack); string name=vm::pop<string>(Stack); -#line 207 "runhistory.in" +#line 192 "runhistory.in" #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) store_history(&history_save); bool newhistory=historyMap.find(name) == historyMap.end(); @@ -312,13 +299,13 @@ namespace trans { void gen_runhistory_venv(venv &ve) { -#line 116 "runhistory.in" +#line 101 "runhistory.in" addFunc(ve, run::gen_runhistory0, stringArray(), "history", formal(primString() , "name", false, false), formal(primInt(), "n", true, false)); -#line 149 "runhistory.in" +#line 134 "runhistory.in" addFunc(ve, run::gen_runhistory1, stringArray(), "history", formal(primInt(), "n", true, false)); -#line 160 "runhistory.in" +#line 145 "runhistory.in" addFunc(ve, run::gen_runhistory2, primString() , "readline", formal(primString() , "prompt", true, false), formal(primString() , "name", true, false), formal(primBoolean(), "tabcompletion", true, false)); -#line 204 "runhistory.in" +#line 189 "runhistory.in" addFunc(ve, run::gen_runhistory3, primVoid(), "saveline", formal(primString() , "name", false, false), formal(primString() , "value", false, false), formal(primBoolean(), "store", true, false)); } diff --git a/Build/source/utils/asymptote/runhistory.in b/Build/source/utils/asymptote/runhistory.in index 69bbffcd069..51fd99cb8c5 100644 --- a/Build/source/utils/asymptote/runhistory.in +++ b/Build/source/utils/asymptote/runhistory.in @@ -72,24 +72,9 @@ namespace run { extern string emptystring; #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) -int readline_startup_hook() -{ -#ifdef __CYGWIN__ - rl_set_key("\\M-[3~",rl_delete,rl_get_keymap()); - rl_set_key("\\M-[2~",rl_overwrite_mode,rl_get_keymap()); -#endif - return 0; -} void init_readline(bool tabcompletion) { - static bool first=true; - if(first) { - first=false; -#ifdef __CYGWIN__ - rl_startup_hook=readline_startup_hook; -#endif - } rl_bind_key('\t',tabcompletion ? rl_complete : rl_insert); } #endif diff --git a/Build/source/utils/asymptote/runlabel.cc b/Build/source/utils/asymptote/runlabel.cc index c6953b97d8a..f3edc8243e2 100644 --- a/Build/source/utils/asymptote/runlabel.cc +++ b/Build/source/utils/asymptote/runlabel.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); @@ -283,8 +285,7 @@ void gen_runlabel3(stack *Stack) array *P=new array(0); if(s->empty()) {Stack->push<patharray*>(P); return;} - string prefix=outname(); - spaceToUnderscore(prefix); + string prefix=cleanpath(outname()); string psname=auxname(prefix,"ps"); string texname=auxname(prefix,"tex"); string dviname=auxname(prefix,"dvi"); @@ -376,18 +377,17 @@ void gen_runlabel3(stack *Stack) {Stack->push<patharray*>(pdf ? readpath(psname,keep,0.1) : readpath(psname,keep,0.12,-1.0)); return;} } -#line 305 "runlabel.in" +#line 304 "runlabel.in" // patharray* textpath(string *s, pen p=CURRENTPEN); void gen_runlabel4(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); string * s=vm::pop<string *>(Stack); -#line 306 "runlabel.in" +#line 305 "runlabel.in" array *P=new array(0); if(s->empty()) {Stack->push<patharray*>(P); return;} - string prefix=outname(); - spaceToUnderscore(prefix); + string prefix=cleanpath(outname()); string outputname=auxname(prefix,getSetting<string>("textoutformat")); string textname=auxname(prefix,getSetting<string>("textextension")); @@ -452,18 +452,17 @@ void gen_runlabel4(stack *Stack) {Stack->push<patharray*>(readpath(psname,keep,0.1)); return;} } -#line 376 "runlabel.in" +#line 374 "runlabel.in" // patharray* _strokepath(path g, pen p=CURRENTPEN); void gen_runlabel5(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); path g=vm::pop<path>(Stack); -#line 377 "runlabel.in" +#line 375 "runlabel.in" array *P=new array(0); if(g.size() == 0) {Stack->push<patharray*>(P); return;} - string prefix=outname(); - spaceToUnderscore(prefix); + string prefix=cleanpath(outname()); string psname=auxname(prefix,"ps"); bbox b; psfile ps(psname,false); @@ -475,7 +474,7 @@ void gen_runlabel5(stack *Stack) ps.setpen(p); ps.write(g); ps.strokepath(); - ps.stroke(); + ps.stroke(p); ps.verbatimline("(M) "+currentpoint); ps.epilogue(); ps.close(); @@ -496,9 +495,9 @@ void gen_runlabel_venv(venv &ve) addFunc(ve, run::gen_runlabel2, realArray(), "texsize", formal(primString(), "s", false, false), formal(primPen(), "p", true, false)); #line 207 "runlabel.in" addFunc(ve, run::gen_runlabel3, pathArray() , "_texpath", formal(primString(), "s", false, false), formal(primPen(), "p", true, false)); -#line 305 "runlabel.in" +#line 304 "runlabel.in" addFunc(ve, run::gen_runlabel4, pathArray() , "textpath", formal(primString(), "s", false, false), formal(primPen(), "p", true, false)); -#line 376 "runlabel.in" +#line 374 "runlabel.in" addFunc(ve, run::gen_runlabel5, pathArray() , "_strokepath", formal(primPath(), "g", false, false), formal(primPen(), "p", true, false)); } diff --git a/Build/source/utils/asymptote/runlabel.in b/Build/source/utils/asymptote/runlabel.in index fde2c42a031..e15a995649b 100644 --- a/Build/source/utils/asymptote/runlabel.in +++ b/Build/source/utils/asymptote/runlabel.in @@ -209,8 +209,7 @@ patharray *_texpath(string *s, pen p=CURRENTPEN) array *P=new array(0); if(s->empty()) return P; - string prefix=outname(); - spaceToUnderscore(prefix); + string prefix=cleanpath(outname()); string psname=auxname(prefix,"ps"); string texname=auxname(prefix,"tex"); string dviname=auxname(prefix,"dvi"); @@ -307,8 +306,7 @@ patharray *textpath(string *s, pen p=CURRENTPEN) array *P=new array(0); if(s->empty()) return P; - string prefix=outname(); - spaceToUnderscore(prefix); + string prefix=cleanpath(outname()); string outputname=auxname(prefix,getSetting<string>("textoutformat")); string textname=auxname(prefix,getSetting<string>("textextension")); @@ -378,8 +376,7 @@ patharray *_strokepath(path g, pen p=CURRENTPEN) array *P=new array(0); if(g.size() == 0) return P; - string prefix=outname(); - spaceToUnderscore(prefix); + string prefix=cleanpath(outname()); string psname=auxname(prefix,"ps"); bbox b; psfile ps(psname,false); @@ -391,7 +388,7 @@ patharray *_strokepath(path g, pen p=CURRENTPEN) ps.setpen(p); ps.write(g); ps.strokepath(); - ps.stroke(); + ps.stroke(p); ps.verbatimline("(M) "+currentpoint); ps.epilogue(); ps.close(); diff --git a/Build/source/utils/asymptote/runmath.cc b/Build/source/utils/asymptote/runmath.cc index 445f426f891..e11edb3455d 100644 --- a/Build/source/utils/asymptote/runmath.cc +++ b/Build/source/utils/asymptote/runmath.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); @@ -288,7 +290,7 @@ void gen_runmath17(stack *Stack) } #line 158 "runmath.in" -// real J(Int n, real x); +// real Jn(Int n, real x); void gen_runmath18(stack *Stack) { real x=vm::pop<real>(Stack); @@ -298,7 +300,7 @@ void gen_runmath18(stack *Stack) } #line 163 "runmath.in" -// real Y(Int n, real x); +// real Yn(Int n, real x); void gen_runmath19(stack *Stack) { real x=vm::pop<real>(Stack); @@ -501,6 +503,52 @@ void gen_runmath36(stack *Stack) {Stack->push<Int>(~a); return;} } +#line 283 "runmath.in" +// Int CLZ(Int a); +void gen_runmath37(stack *Stack) +{ + Int a=vm::pop<Int>(Stack); +#line 284 "runmath.in" + if((unsignedInt) a > 0xFFFFFFFF) {Stack->push<Int>(-1); return;} +#ifdef __GNUC__ + {Stack->push<Int>(__builtin_clz(a)); return;} +#else +// find the log base 2 of a 32-bit integer + static const int MultiplyDeBruijnBitPosition[32] = { + 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, + 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 + }; + + a |= a >> 1; // first round down to one less than a power of 2 + a |= a >> 2; + a |= a >> 4; + a |= a >> 8; + a |= a >> 16; + + {Stack->push<Int>(31-MultiplyDeBruijnBitPosition[(unsignedInt)(a * 0x07C4ACDDU) >> 27]); return;} +#endif +} + +#line 305 "runmath.in" +// Int CTZ(Int a); +void gen_runmath38(stack *Stack) +{ + Int a=vm::pop<Int>(Stack); +#line 306 "runmath.in" + if((unsignedInt) a > 0xFFFFFFFF) {Stack->push<Int>(-1); return;} +#ifdef __GNUC__ + {Stack->push<Int>(__builtin_ctz(a)); return;} +#else + // find the number of trailing zeros in a 32-bit number + static const int MultiplyDeBruijnBitPosition[32] = { + 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, + 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 + }; + {Stack->push<Int>(MultiplyDeBruijnBitPosition[((unsignedInt)((a & -a) * 0x077CB531U)) + >> 27]); return;} +#endif +} + } // namespace run namespace trans { @@ -544,9 +592,9 @@ void gen_runmath_venv(venv &ve) #line 153 "runmath.in" addFunc(ve, run::gen_runmath17, primReal(), "remainder", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); #line 158 "runmath.in" - addFunc(ve, run::gen_runmath18, primReal(), "J", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false)); + addFunc(ve, run::gen_runmath18, primReal(), "Jn", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false)); #line 163 "runmath.in" - addFunc(ve, run::gen_runmath19, primReal(), "Y", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false)); + addFunc(ve, run::gen_runmath19, primReal(), "Yn", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false)); #line 168 "runmath.in" addFunc(ve, run::gen_runmath20, primReal(), "erf", formal(primReal(), "x", false, false)); #line 173 "runmath.in" @@ -581,6 +629,10 @@ void gen_runmath_venv(venv &ve) addFunc(ve, run::gen_runmath35, primInt(), "XOR", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false)); #line 278 "runmath.in" addFunc(ve, run::gen_runmath36, primInt(), "NOT", formal(primInt(), "a", false, false)); +#line 283 "runmath.in" + addFunc(ve, run::gen_runmath37, primInt(), "CLZ", formal(primInt(), "a", false, false)); +#line 305 "runmath.in" + addFunc(ve, run::gen_runmath38, primInt(), "CTZ", formal(primInt(), "a", false, false)); } } // namespace trans diff --git a/Build/source/utils/asymptote/runmath.in b/Build/source/utils/asymptote/runmath.in index c31761aeb90..7b6e9e29579 100644 --- a/Build/source/utils/asymptote/runmath.in +++ b/Build/source/utils/asymptote/runmath.in @@ -155,12 +155,12 @@ real remainder(real x, real y) return remainder(x,y); } -real J(Int n, real x) +real Jn(Int n, real x) { return jn(n,x); } -real Y(Int n, real x) +real Yn(Int n, real x) { return yn(n,x); } @@ -279,3 +279,41 @@ Int NOT(Int a) { return ~a; } + +Int CLZ(Int a) +{ + if((unsignedInt) a > 0xFFFFFFFF) return -1; +#ifdef __GNUC__ + return __builtin_clz(a); +#else +// find the log base 2 of a 32-bit integer + static const int MultiplyDeBruijnBitPosition[32] = { + 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, + 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 + }; + + a |= a >> 1; // first round down to one less than a power of 2 + a |= a >> 2; + a |= a >> 4; + a |= a >> 8; + a |= a >> 16; + + return 31-MultiplyDeBruijnBitPosition[(unsignedInt)(a * 0x07C4ACDDU) >> 27]; +#endif +} + +Int CTZ(Int a) +{ + if((unsignedInt) a > 0xFFFFFFFF) return -1; +#ifdef __GNUC__ + return __builtin_ctz(a); +#else + // find the number of trailing zeros in a 32-bit number + static const int MultiplyDeBruijnBitPosition[32] = { + 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, + 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 + }; + return MultiplyDeBruijnBitPosition[((unsignedInt)((a & -a) * 0x077CB531U)) + >> 27]; +#endif +} diff --git a/Build/source/utils/asymptote/runpair.cc b/Build/source/utils/asymptote/runpair.cc index 80bbcd1e436..c4e98e1b763 100644 --- a/Build/source/utils/asymptote/runpair.cc +++ b/Build/source/utils/asymptote/runpair.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); diff --git a/Build/source/utils/asymptote/runpath.cc b/Build/source/utils/asymptote/runpath.cc index 8cee25db54a..22ed3438f32 100644 --- a/Build/source/utils/asymptote/runpath.cc +++ b/Build/source/utils/asymptote/runpath.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); diff --git a/Build/source/utils/asymptote/runpath3d.cc b/Build/source/utils/asymptote/runpath3d.cc index 893651a49d6..671b3e67019 100644 --- a/Build/source/utils/asymptote/runpath3d.cc +++ b/Build/source/utils/asymptote/runpath3d.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); @@ -337,15 +339,24 @@ void gen_runpath3d21(stack *Stack) {Stack->push<bool>(p.straight(t)); return;} } +#line 175 "runpath3d.in" +// path3 unstraighten(path3 p); +void gen_runpath3d22(stack *Stack) +{ + path3 p=vm::pop<path3>(Stack); +#line 176 "runpath3d.in" + {Stack->push<path3>(p.unstraighten()); return;} +} + // Return the maximum perpendicular deviation of segment i of path3 g // from a straight line. -#line 177 "runpath3d.in" +#line 182 "runpath3d.in" // real straightness(path3 p, Int t); -void gen_runpath3d22(stack *Stack) +void gen_runpath3d23(stack *Stack) { Int t=vm::pop<Int>(Stack); path3 p=vm::pop<path3>(Stack); -#line 178 "runpath3d.in" +#line 183 "runpath3d.in" if(p.straight(t)) {Stack->push<real>(0); return;} triple z0=p.point(t); triple u=unit(p.point(t+1)-z0); @@ -355,55 +366,55 @@ void gen_runpath3d22(stack *Stack) // Return the maximum perpendicular deviation of z0..controls c0 and c1..z1 // from a straight line. -#line 188 "runpath3d.in" +#line 193 "runpath3d.in" // real straightness(triple z0, triple c0, triple c1, triple z1); -void gen_runpath3d23(stack *Stack) +void gen_runpath3d24(stack *Stack) { triple z1=vm::pop<triple>(Stack); triple c1=vm::pop<triple>(Stack); triple c0=vm::pop<triple>(Stack); triple z0=vm::pop<triple>(Stack); -#line 189 "runpath3d.in" +#line 194 "runpath3d.in" triple u=unit(z1-z0); {Stack->push<real>(::max(length(perp(c0-z0,u)),length(perp(c1-z0,u)))); return;} } -#line 194 "runpath3d.in" +#line 199 "runpath3d.in" // bool piecewisestraight(path3 p); -void gen_runpath3d24(stack *Stack) +void gen_runpath3d25(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 195 "runpath3d.in" +#line 200 "runpath3d.in" {Stack->push<bool>(p.piecewisestraight()); return;} } -#line 199 "runpath3d.in" +#line 204 "runpath3d.in" // real arclength(path3 p); -void gen_runpath3d25(stack *Stack) +void gen_runpath3d26(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 200 "runpath3d.in" +#line 205 "runpath3d.in" {Stack->push<real>(p.arclength()); return;} } -#line 204 "runpath3d.in" +#line 209 "runpath3d.in" // real arctime(path3 p, real dval); -void gen_runpath3d26(stack *Stack) +void gen_runpath3d27(stack *Stack) { real dval=vm::pop<real>(Stack); path3 p=vm::pop<path3>(Stack); -#line 205 "runpath3d.in" +#line 210 "runpath3d.in" {Stack->push<real>(p.arctime(dval)); return;} } -#line 209 "runpath3d.in" +#line 214 "runpath3d.in" // realarray* intersect(path3 p, path3 q, real fuzz=-1); -void gen_runpath3d27(stack *Stack) +void gen_runpath3d28(stack *Stack) { real fuzz=vm::pop<real>(Stack,-1); path3 q=vm::pop<path3>(Stack); path3 p=vm::pop<path3>(Stack); -#line 210 "runpath3d.in" +#line 215 "runpath3d.in" bool exact=fuzz <= 0.0; if(fuzz < 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), @@ -420,14 +431,14 @@ void gen_runpath3d27(stack *Stack) {Stack->push<realarray*>(new array(0)); return;} } -#line 227 "runpath3d.in" +#line 232 "runpath3d.in" // realarray2* intersections(path3 p, path3 q, real fuzz=-1); -void gen_runpath3d28(stack *Stack) +void gen_runpath3d29(stack *Stack) { real fuzz=vm::pop<real>(Stack,-1); path3 q=vm::pop<path3>(Stack); path3 p=vm::pop<path3>(Stack); -#line 228 "runpath3d.in" +#line 233 "runpath3d.in" bool exact=fuzz <= 0.0; if(fuzz < 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), @@ -459,14 +470,14 @@ void gen_runpath3d28(stack *Stack) {Stack->push<realarray2*>(V); return;} } -#line 260 "runpath3d.in" +#line 265 "runpath3d.in" // realarray2* intersections(path3 p, triplearray2 *P, real fuzz=-1); -void gen_runpath3d29(stack *Stack) +void gen_runpath3d30(stack *Stack) { real fuzz=vm::pop<real>(Stack,-1); triplearray2 * P=vm::pop<triplearray2 *>(Stack); path3 p=vm::pop<path3>(Stack); -#line 261 "runpath3d.in" +#line 266 "runpath3d.in" triple *A=copyTripleArray2C(P,true,4); if(fuzz <= 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())), norm(A,16)); @@ -485,49 +496,49 @@ void gen_runpath3d29(stack *Stack) {Stack->push<realarray2*>(W); return;} // Sorting will done in asy. } -#line 280 "runpath3d.in" +#line 285 "runpath3d.in" // Int size(path3 p); -void gen_runpath3d30(stack *Stack) +void gen_runpath3d31(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 281 "runpath3d.in" +#line 286 "runpath3d.in" {Stack->push<Int>(p.size()); return;} } -#line 285 "runpath3d.in" +#line 290 "runpath3d.in" // path3 &(path3 p, path3 q); -void gen_runpath3d31(stack *Stack) +void gen_runpath3d32(stack *Stack) { path3 q=vm::pop<path3>(Stack); path3 p=vm::pop<path3>(Stack); -#line 286 "runpath3d.in" +#line 291 "runpath3d.in" {Stack->push<path3>(camp::concat(p,q)); return;} } -#line 290 "runpath3d.in" +#line 295 "runpath3d.in" // triple min(path3 p); -void gen_runpath3d32(stack *Stack) +void gen_runpath3d33(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 291 "runpath3d.in" +#line 296 "runpath3d.in" {Stack->push<triple>(p.min()); return;} } -#line 295 "runpath3d.in" +#line 300 "runpath3d.in" // triple max(path3 p); -void gen_runpath3d33(stack *Stack) +void gen_runpath3d34(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 296 "runpath3d.in" +#line 301 "runpath3d.in" {Stack->push<triple>(p.max()); return;} } -#line 300 "runpath3d.in" +#line 305 "runpath3d.in" // realarray* mintimes(path3 p); -void gen_runpath3d34(stack *Stack) +void gen_runpath3d35(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 301 "runpath3d.in" +#line 306 "runpath3d.in" array *V=new array(3); triple v=p.mintimes(); (*V)[0]=v.getx(); @@ -536,12 +547,12 @@ void gen_runpath3d34(stack *Stack) {Stack->push<realarray*>(V); return;} } -#line 310 "runpath3d.in" +#line 315 "runpath3d.in" // realarray* maxtimes(path3 p); -void gen_runpath3d35(stack *Stack) +void gen_runpath3d36(stack *Stack) { path3 p=vm::pop<path3>(Stack); -#line 311 "runpath3d.in" +#line 316 "runpath3d.in" array *V=new array(3); triple v=p.maxtimes(); (*V)[0]=v.getx(); @@ -550,31 +561,31 @@ void gen_runpath3d35(stack *Stack) {Stack->push<realarray*>(V); return;} } -#line 320 "runpath3d.in" +#line 325 "runpath3d.in" // path3 *(realarray2 *t, path3 g); -void gen_runpath3d36(stack *Stack) +void gen_runpath3d37(stack *Stack) { path3 g=vm::pop<path3>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); -#line 321 "runpath3d.in" +#line 326 "runpath3d.in" {Stack->push<path3>(transformed(*t,g)); return;} } -#line 325 "runpath3d.in" +#line 330 "runpath3d.in" // pair minratio(path3 g); -void gen_runpath3d37(stack *Stack) +void gen_runpath3d38(stack *Stack) { path3 g=vm::pop<path3>(Stack); -#line 326 "runpath3d.in" +#line 331 "runpath3d.in" {Stack->push<pair>(g.ratio(::min)); return;} } -#line 330 "runpath3d.in" +#line 335 "runpath3d.in" // pair maxratio(path3 g); -void gen_runpath3d38(stack *Stack) +void gen_runpath3d39(stack *Stack) { path3 g=vm::pop<path3>(Stack); -#line 331 "runpath3d.in" +#line 336 "runpath3d.in" {Stack->push<pair>(g.ratio(::max)); return;} } @@ -629,39 +640,41 @@ void gen_runpath3d_venv(venv &ve) #line 170 "runpath3d.in" addFunc(ve, run::gen_runpath3d21, primBoolean(), "straight", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false)); #line 175 "runpath3d.in" - addFunc(ve, run::gen_runpath3d22, primReal(), "straightness", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false)); -#line 186 "runpath3d.in" - addFunc(ve, run::gen_runpath3d23, primReal(), "straightness", formal(primTriple(), "z0", false, false), formal(primTriple(), "c0", false, false), formal(primTriple(), "c1", false, false), formal(primTriple(), "z1", false, false)); -#line 194 "runpath3d.in" - addFunc(ve, run::gen_runpath3d24, primBoolean(), "piecewisestraight", formal(primPath3(), "p", false, false)); + addFunc(ve, run::gen_runpath3d22, primPath3(), "unstraighten", formal(primPath3(), "p", false, false)); +#line 180 "runpath3d.in" + addFunc(ve, run::gen_runpath3d23, primReal(), "straightness", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false)); +#line 191 "runpath3d.in" + addFunc(ve, run::gen_runpath3d24, primReal(), "straightness", formal(primTriple(), "z0", false, false), formal(primTriple(), "c0", false, false), formal(primTriple(), "c1", false, false), formal(primTriple(), "z1", false, false)); #line 199 "runpath3d.in" - addFunc(ve, run::gen_runpath3d25, primReal(), "arclength", formal(primPath3(), "p", false, false)); + addFunc(ve, run::gen_runpath3d25, primBoolean(), "piecewisestraight", formal(primPath3(), "p", false, false)); #line 204 "runpath3d.in" - addFunc(ve, run::gen_runpath3d26, primReal(), "arctime", formal(primPath3(), "p", false, false), formal(primReal(), "dval", false, false)); + addFunc(ve, run::gen_runpath3d26, primReal(), "arclength", formal(primPath3(), "p", false, false)); #line 209 "runpath3d.in" - addFunc(ve, run::gen_runpath3d27, realArray(), "intersect", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false), formal(primReal(), "fuzz", true, false)); -#line 227 "runpath3d.in" - addFunc(ve, run::gen_runpath3d28, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false), formal(primReal(), "fuzz", true, false)); -#line 260 "runpath3d.in" - addFunc(ve, run::gen_runpath3d29, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(tripleArray2(), "p", false, false), formal(primReal(), "fuzz", true, false)); -#line 280 "runpath3d.in" - addFunc(ve, run::gen_runpath3d30, primInt(), "size", formal(primPath3(), "p", false, false)); + addFunc(ve, run::gen_runpath3d27, primReal(), "arctime", formal(primPath3(), "p", false, false), formal(primReal(), "dval", false, false)); +#line 214 "runpath3d.in" + addFunc(ve, run::gen_runpath3d28, realArray(), "intersect", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false), formal(primReal(), "fuzz", true, false)); +#line 232 "runpath3d.in" + addFunc(ve, run::gen_runpath3d29, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false), formal(primReal(), "fuzz", true, false)); +#line 265 "runpath3d.in" + addFunc(ve, run::gen_runpath3d30, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(tripleArray2(), "p", false, false), formal(primReal(), "fuzz", true, false)); #line 285 "runpath3d.in" - addFunc(ve, run::gen_runpath3d31, primPath3(), "&", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false)); + addFunc(ve, run::gen_runpath3d31, primInt(), "size", formal(primPath3(), "p", false, false)); #line 290 "runpath3d.in" - addFunc(ve, run::gen_runpath3d32, primTriple(), "min", formal(primPath3(), "p", false, false)); + addFunc(ve, run::gen_runpath3d32, primPath3(), "&", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false)); #line 295 "runpath3d.in" - addFunc(ve, run::gen_runpath3d33, primTriple(), "max", formal(primPath3(), "p", false, false)); + addFunc(ve, run::gen_runpath3d33, primTriple(), "min", formal(primPath3(), "p", false, false)); #line 300 "runpath3d.in" - addFunc(ve, run::gen_runpath3d34, realArray(), "mintimes", formal(primPath3(), "p", false, false)); -#line 310 "runpath3d.in" - addFunc(ve, run::gen_runpath3d35, realArray(), "maxtimes", formal(primPath3(), "p", false, false)); -#line 320 "runpath3d.in" - addFunc(ve, run::gen_runpath3d36, primPath3(), "*", formal(realArray2(), "t", false, false), formal(primPath3(), "g", false, false)); + addFunc(ve, run::gen_runpath3d34, primTriple(), "max", formal(primPath3(), "p", false, false)); +#line 305 "runpath3d.in" + addFunc(ve, run::gen_runpath3d35, realArray(), "mintimes", formal(primPath3(), "p", false, false)); +#line 315 "runpath3d.in" + addFunc(ve, run::gen_runpath3d36, realArray(), "maxtimes", formal(primPath3(), "p", false, false)); #line 325 "runpath3d.in" - addFunc(ve, run::gen_runpath3d37, primPair(), "minratio", formal(primPath3(), "g", false, false)); + addFunc(ve, run::gen_runpath3d37, primPath3(), "*", formal(realArray2(), "t", false, false), formal(primPath3(), "g", false, false)); #line 330 "runpath3d.in" - addFunc(ve, run::gen_runpath3d38, primPair(), "maxratio", formal(primPath3(), "g", false, false)); + addFunc(ve, run::gen_runpath3d38, primPair(), "minratio", formal(primPath3(), "g", false, false)); +#line 335 "runpath3d.in" + addFunc(ve, run::gen_runpath3d39, primPair(), "maxratio", formal(primPath3(), "g", false, false)); } } // namespace trans diff --git a/Build/source/utils/asymptote/runpath3d.in b/Build/source/utils/asymptote/runpath3d.in index 31c3bbb64e3..9f95c58cc7d 100644 --- a/Build/source/utils/asymptote/runpath3d.in +++ b/Build/source/utils/asymptote/runpath3d.in @@ -172,6 +172,11 @@ bool straight(path3 p, Int t) return p.straight(t); } +path3 unstraighten(path3 p) +{ + return p.unstraighten(); +} + // Return the maximum perpendicular deviation of segment i of path3 g // from a straight line. real straightness(path3 p, Int t) diff --git a/Build/source/utils/asymptote/runpicture.cc b/Build/source/utils/asymptote/runpicture.cc index d5a4bae574a..5998d6ec4fd 100644 --- a/Build/source/utils/asymptote/runpicture.cc +++ b/Build/source/utils/asymptote/runpicture.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); @@ -173,47 +175,59 @@ void gen_runpicture4(stack *Stack) } #line 117 "runpicture.in" -// void _draw(picture *f, path g, pen p); +// pair size(picture *f); void gen_runpicture5(stack *Stack) { + picture * f=vm::pop<picture *>(Stack); +#line 118 "runpicture.in" + bbox b=f->bounds(); + {Stack->push<pair>(b.Max()-b.Min()); return;} +} + +#line 123 "runpicture.in" +// void _draw(picture *f, path g, pen p); +void gen_runpicture6(stack *Stack) +{ pen p=vm::pop<pen>(Stack); path g=vm::pop<path>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 118 "runpicture.in" +#line 124 "runpicture.in" f->append(new drawPath(g,p)); } -#line 122 "runpicture.in" +#line 128 "runpicture.in" // void fill(picture *f, patharray *g, pen p=CURRENTPEN, bool copy=true); -void gen_runpicture6(stack *Stack) +void gen_runpicture7(stack *Stack) { bool copy=vm::pop<bool>(Stack,true); pen p=vm::pop<pen>(Stack,CURRENTPEN); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 123 "runpicture.in" +#line 129 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawFill(*copyarray(g),false,p)); } -#line 128 "runpicture.in" -// void latticeshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray2 *p, bool copy=true); -void gen_runpicture7(stack *Stack) +#line 134 "runpicture.in" +// void latticeshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray2 *p, transform t=identity, bool copy=true); +void gen_runpicture8(stack *Stack) { bool copy=vm::pop<bool>(Stack,true); + transform t=vm::pop<transform>(Stack,identity); penarray2 * p=vm::pop<penarray2 *>(Stack); pen fillrule=vm::pop<pen>(Stack,CURRENTPEN); bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 130 "runpicture.in" +#line 137 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; - f->append(new drawLatticeShade(*copyarray(g),stroke,fillrule,*copyarray(p))); + f->append(new drawLatticeShade(*copyarray(g),stroke,fillrule,*copyarray(p), + t)); } -#line 135 "runpicture.in" +#line 143 "runpicture.in" // void axialshade(picture *f, patharray *g, bool stroke=false, pen pena, pair a, pen penb, pair b, bool copy=true); -void gen_runpicture8(stack *Stack) +void gen_runpicture9(stack *Stack) { bool copy=vm::pop<bool>(Stack,true); pair b=vm::pop<pair>(Stack); @@ -223,14 +237,14 @@ void gen_runpicture8(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 137 "runpicture.in" +#line 145 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawAxialShade(*copyarray(g),stroke,pena,a,penb,b)); } -#line 142 "runpicture.in" +#line 150 "runpicture.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 gen_runpicture9(stack *Stack) +void gen_runpicture10(stack *Stack) { bool copy=vm::pop<bool>(Stack,true); real rb=vm::pop<real>(Stack); @@ -242,14 +256,14 @@ void gen_runpicture9(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 144 "runpicture.in" +#line 152 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawRadialShade(*copyarray(g),stroke,pena,a,ra,penb,b,rb)); } -#line 149 "runpicture.in" +#line 157 "runpicture.in" // void gouraudshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray *p, pairarray *z, Intarray *edges, bool copy=true); -void gen_runpicture10(stack *Stack) +void gen_runpicture11(stack *Stack) { bool copy=vm::pop<bool>(Stack,true); Intarray * edges=vm::pop<Intarray *>(Stack); @@ -259,7 +273,7 @@ void gen_runpicture10(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 152 "runpicture.in" +#line 160 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; checkArrays(p,z); checkArrays(z,edges); @@ -267,9 +281,9 @@ void gen_runpicture10(stack *Stack) *copyarray(z),*copyarray(edges))); } -#line 160 "runpicture.in" +#line 168 "runpicture.in" // void gouraudshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray *p, Intarray *edges, bool copy=true); -void gen_runpicture11(stack *Stack) +void gen_runpicture12(stack *Stack) { bool copy=vm::pop<bool>(Stack,true); Intarray * edges=vm::pop<Intarray *>(Stack); @@ -278,7 +292,7 @@ void gen_runpicture11(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 163 "runpicture.in" +#line 171 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; size_t n=checkArrays(p,edges); size_t m=checkArray(g); @@ -299,9 +313,9 @@ void gen_runpicture11(stack *Stack) *z,*copyarray(edges))); } -#line 184 "runpicture.in" +#line 192 "runpicture.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 gen_runpicture12(stack *Stack) +void gen_runpicture13(stack *Stack) { bool copy=vm::pop<bool>(Stack,true); pairarray2 * z=vm::pop<pairarray2 *>(Stack,emptyarray); @@ -311,7 +325,7 @@ void gen_runpicture12(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 187 "runpicture.in" +#line 195 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; array *(*copyarray2)(array *a)=copy ? copyArray2: nop; if(b == NULL) b=g; @@ -323,9 +337,9 @@ void gen_runpicture12(stack *Stack) *copyarray(b),*copyarray2(z))); } -#line 199 "runpicture.in" +#line 207 "runpicture.in" // void functionshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, string shader=emptystring, bool copy=true); -void gen_runpicture13(stack *Stack) +void gen_runpicture14(stack *Stack) { bool copy=vm::pop<bool>(Stack,true); string shader=vm::pop<string>(Stack,emptystring); @@ -333,177 +347,177 @@ void gen_runpicture13(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 202 "runpicture.in" +#line 210 "runpicture.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 209 "runpicture.in" +#line 217 "runpicture.in" // void clip(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, bool copy=true); -void gen_runpicture14(stack *Stack) +void gen_runpicture15(stack *Stack) { bool copy=vm::pop<bool>(Stack,true); pen fillrule=vm::pop<pen>(Stack,CURRENTPEN); bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 211 "runpicture.in" +#line 219 "runpicture.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 217 "runpicture.in" +#line 225 "runpicture.in" // void beginclip(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, bool copy=true); -void gen_runpicture15(stack *Stack) +void gen_runpicture16(stack *Stack) { bool copy=vm::pop<bool>(Stack,true); pen fillrule=vm::pop<pen>(Stack,CURRENTPEN); bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 219 "runpicture.in" +#line 227 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawClipBegin(*copyarray(g),stroke,fillrule,false)); } -#line 224 "runpicture.in" +#line 232 "runpicture.in" // void endclip(picture *f); -void gen_runpicture16(stack *Stack) +void gen_runpicture17(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 225 "runpicture.in" +#line 233 "runpicture.in" f->append(new drawClipEnd(false)); } -#line 229 "runpicture.in" +#line 237 "runpicture.in" // void gsave(picture *f); -void gen_runpicture17(stack *Stack) +void gen_runpicture18(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 230 "runpicture.in" +#line 238 "runpicture.in" f->append(new drawGsave()); } -#line 234 "runpicture.in" +#line 242 "runpicture.in" // void grestore(picture *f); -void gen_runpicture18(stack *Stack) +void gen_runpicture19(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 235 "runpicture.in" +#line 243 "runpicture.in" f->append(new drawGrestore()); } -#line 239 "runpicture.in" +#line 247 "runpicture.in" // void begingroup(picture *f, string name=emptystring); -void gen_runpicture19(stack *Stack) +void gen_runpicture20(stack *Stack) { string name=vm::pop<string>(Stack,emptystring); picture * f=vm::pop<picture *>(Stack); -#line 240 "runpicture.in" +#line 248 "runpicture.in" f->append(new drawBegin(name)); } -#line 244 "runpicture.in" +#line 252 "runpicture.in" // void endgroup(picture *f); -void gen_runpicture20(stack *Stack) +void gen_runpicture21(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 245 "runpicture.in" +#line 253 "runpicture.in" f->append(new drawEnd()); } -#line 249 "runpicture.in" +#line 257 "runpicture.in" // void add(picture *dest, picture *src); -void gen_runpicture21(stack *Stack) +void gen_runpicture22(stack *Stack) { picture * src=vm::pop<picture *>(Stack); picture * dest=vm::pop<picture *>(Stack); -#line 250 "runpicture.in" +#line 258 "runpicture.in" dest->add(*src); } -#line 254 "runpicture.in" +#line 262 "runpicture.in" // void prepend(picture *dest, picture *src); -void gen_runpicture22(stack *Stack) +void gen_runpicture23(stack *Stack) { picture * src=vm::pop<picture *>(Stack); picture * dest=vm::pop<picture *>(Stack); -#line 255 "runpicture.in" +#line 263 "runpicture.in" dest->prepend(*src); } -#line 259 "runpicture.in" +#line 267 "runpicture.in" // void postscript(picture *f, string s); -void gen_runpicture23(stack *Stack) +void gen_runpicture24(stack *Stack) { string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 260 "runpicture.in" +#line 268 "runpicture.in" f->append(new drawVerbatim(PostScript,s)); } -#line 264 "runpicture.in" +#line 272 "runpicture.in" // void tex(picture *f, string s); -void gen_runpicture24(stack *Stack) +void gen_runpicture25(stack *Stack) { string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 265 "runpicture.in" +#line 273 "runpicture.in" f->append(new drawVerbatim(TeX,s)); } -#line 269 "runpicture.in" +#line 277 "runpicture.in" // void postscript(picture *f, string s, pair min, pair max); -void gen_runpicture25(stack *Stack) +void gen_runpicture26(stack *Stack) { pair max=vm::pop<pair>(Stack); pair min=vm::pop<pair>(Stack); string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 270 "runpicture.in" +#line 278 "runpicture.in" f->append(new drawVerbatim(PostScript,s,min,max)); } -#line 274 "runpicture.in" +#line 282 "runpicture.in" // void tex(picture *f, string s, pair min, pair max); -void gen_runpicture26(stack *Stack) +void gen_runpicture27(stack *Stack) { pair max=vm::pop<pair>(Stack); pair min=vm::pop<pair>(Stack); string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 275 "runpicture.in" +#line 283 "runpicture.in" f->append(new drawVerbatim(TeX,s,min,max)); } -#line 279 "runpicture.in" +#line 287 "runpicture.in" // void texpreamble(string s); -void gen_runpicture27(stack *Stack) +void gen_runpicture28(stack *Stack) { string s=vm::pop<string>(Stack); -#line 280 "runpicture.in" +#line 288 "runpicture.in" string t=s+"\n"; processDataStruct &pd=processData(); pd.TeXpipepreamble.push_back(t); pd.TeXpreamble.push_back(t); } -#line 287 "runpicture.in" +#line 295 "runpicture.in" // void deletepreamble(); -void gen_runpicture28(stack *) +void gen_runpicture29(stack *) { -#line 288 "runpicture.in" +#line 296 "runpicture.in" if(getSetting<bool>("inlinetex")) { unlink(auxname(outname(),"pre").c_str()); } } -#line 294 "runpicture.in" +#line 302 "runpicture.in" // void _labelpath(picture *f, string s, string size, path g, string justify, pair offset, pen p); -void gen_runpicture29(stack *Stack) +void gen_runpicture30(stack *Stack) { pen p=vm::pop<pen>(Stack); pair offset=vm::pop<pair>(Stack); @@ -512,42 +526,42 @@ void gen_runpicture29(stack *Stack) string size=vm::pop<string>(Stack); string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 296 "runpicture.in" +#line 304 "runpicture.in" f->append(new drawLabelPath(s,size,g,justify,offset,p)); } -#line 300 "runpicture.in" +#line 308 "runpicture.in" // void texreset(); -void gen_runpicture30(stack *) +void gen_runpicture31(stack *) { -#line 301 "runpicture.in" +#line 309 "runpicture.in" processDataStruct &pd=processData(); pd.TeXpipepreamble.clear(); pd.TeXpreamble.clear(); pd.tex.pipeclose(); } -#line 308 "runpicture.in" +#line 316 "runpicture.in" // void layer(picture *f); -void gen_runpicture31(stack *Stack) +void gen_runpicture32(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 309 "runpicture.in" +#line 317 "runpicture.in" f->append(new drawLayer()); } -#line 313 "runpicture.in" +#line 321 "runpicture.in" // void newpage(picture *f); -void gen_runpicture32(stack *Stack) +void gen_runpicture33(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 314 "runpicture.in" +#line 322 "runpicture.in" f->append(new drawNewPage()); } -#line 318 "runpicture.in" +#line 326 "runpicture.in" // void _image(picture *f, realarray2 *data, pair initial, pair final, penarray *palette=NULL, transform t=identity, bool copy=true, bool antialias=false); -void gen_runpicture33(stack *Stack) +void gen_runpicture34(stack *Stack) { bool antialias=vm::pop<bool>(Stack,false); bool copy=vm::pop<bool>(Stack,true); @@ -557,16 +571,16 @@ void gen_runpicture33(stack *Stack) pair initial=vm::pop<pair>(Stack); realarray2 * data=vm::pop<realarray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 321 "runpicture.in" +#line 329 "runpicture.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 328 "runpicture.in" +#line 336 "runpicture.in" // void _image(picture *f, penarray2 *data, pair initial, pair final, transform t=identity, bool copy=true, bool antialias=false); -void gen_runpicture34(stack *Stack) +void gen_runpicture35(stack *Stack) { bool antialias=vm::pop<bool>(Stack,false); bool copy=vm::pop<bool>(Stack,true); @@ -575,38 +589,38 @@ void gen_runpicture34(stack *Stack) pair initial=vm::pop<pair>(Stack); penarray2 * data=vm::pop<penarray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 330 "runpicture.in" +#line 338 "runpicture.in" array *(*copyarray2)(array *a)=copy ? copyArray2: nop; f->append(new drawImage(*copyarray2(data),t*matrix(initial,final),antialias)); } -#line 335 "runpicture.in" +#line 343 "runpicture.in" // string nativeformat(); -void gen_runpicture35(stack *Stack) +void gen_runpicture36(stack *Stack) { -#line 336 "runpicture.in" +#line 344 "runpicture.in" {Stack->push<string>(nativeformat()); return;} } -#line 340 "runpicture.in" +#line 348 "runpicture.in" // bool latex(); -void gen_runpicture36(stack *Stack) +void gen_runpicture37(stack *Stack) { -#line 341 "runpicture.in" +#line 349 "runpicture.in" {Stack->push<bool>(latex(getSetting<string>("tex"))); return;} } -#line 345 "runpicture.in" +#line 353 "runpicture.in" // bool pdf(); -void gen_runpicture37(stack *Stack) +void gen_runpicture38(stack *Stack) { -#line 346 "runpicture.in" +#line 354 "runpicture.in" {Stack->push<bool>(pdf(getSetting<string>("tex"))); return;} } -#line 350 "runpicture.in" +#line 358 "runpicture.in" // void shipout(string prefix=emptystring, picture *f, picture *preamble=NULL, string format=emptystring, bool wait=false, bool view=true, callableTransform *xform); -void gen_runpicture38(stack *Stack) +void gen_runpicture39(stack *Stack) { callableTransform * xform=vm::pop<callableTransform *>(Stack); bool view=vm::pop<bool>(Stack,true); @@ -615,7 +629,7 @@ void gen_runpicture38(stack *Stack) picture * preamble=vm::pop<picture *>(Stack,NULL); picture * f=vm::pop<picture *>(Stack); string prefix=vm::pop<string>(Stack,emptystring); -#line 353 "runpicture.in" +#line 361 "runpicture.in" if(prefix.empty()) prefix=outname(); picture *result=new picture; @@ -658,9 +672,9 @@ void gen_runpicture38(stack *Stack) result->shipout(preamble,prefix,format,0.0,wait,view); } -#line 396 "runpicture.in" +#line 404 "runpicture.in" // void shipout3(string prefix, picture *f, string format=emptystring, real width, real height, real angle, real zoom, triple m, triple M, pair shift, realarray2 *t, realarray *background, triplearray *lights, realarray2 *diffuse, realarray2 *ambient, realarray2 *specular, bool viewportlighting, bool view=true); -void gen_runpicture39(stack *Stack) +void gen_runpicture40(stack *Stack) { bool view=vm::pop<bool>(Stack,true); bool viewportlighting=vm::pop<bool>(Stack); @@ -680,7 +694,7 @@ void gen_runpicture39(stack *Stack) string format=vm::pop<string>(Stack,emptystring); picture * f=vm::pop<picture *>(Stack); string prefix=vm::pop<string>(Stack); -#line 402 "runpicture.in" +#line 410 "runpicture.in" size_t n=checkArrays(lights,diffuse); checkEqual(n,checkArray(ambient)); checkEqual(n,checkArray(specular)); @@ -689,9 +703,9 @@ void gen_runpicture39(stack *Stack) real* Background=copyArrayC(background); triple *Lights=copyTripleArrayC(lights); - real *Diffuse=copyArray2C(diffuse,false,4); - real *Ambient=copyArray2C(ambient,false,4); - real *Specular=copyArray2C(specular,false,4); + real *Diffuse=copyArray2C(diffuse,false,4,UseGC); + real *Ambient=copyArray2C(ambient,false,4,UseGC); + real *Specular=copyArray2C(specular,false,4,UseGC); f->shipout3(prefix,format,width,height,angle,zoom,m,M,shift,T,Background,n, Lights,Diffuse,Ambient,Specular,viewportlighting,view); @@ -700,27 +714,27 @@ void gen_runpicture39(stack *Stack) delete[] T; } -#line 422 "runpicture.in" +#line 430 "runpicture.in" // void shipout3(string prefix, picture *f, Intarray *index, triplearray *center); -void gen_runpicture40(stack *Stack) +void gen_runpicture41(stack *Stack) { triplearray * center=vm::pop<triplearray *>(Stack); Intarray * index=vm::pop<Intarray *>(Stack); picture * f=vm::pop<picture *>(Stack); string prefix=vm::pop<string>(Stack); -#line 423 "runpicture.in" +#line 431 "runpicture.in" f->shipout3(prefix,index,center); } -#line 427 "runpicture.in" +#line 435 "runpicture.in" // void deconstruct(picture *f, picture *preamble=NULL, real magnification=1, callableTransform *xform); -void gen_runpicture41(stack *Stack) +void gen_runpicture42(stack *Stack) { callableTransform * xform=vm::pop<callableTransform *>(Stack); real magnification=vm::pop<real>(Stack,1); picture * preamble=vm::pop<picture *>(Stack,NULL); picture * f=vm::pop<picture *>(Stack); -#line 429 "runpicture.in" +#line 437 "runpicture.in" unsigned level=0; unsigned n=0; @@ -845,23 +859,23 @@ void gen_runpicture41(stack *Stack) // Three-dimensional picture and surface operations // Bezier curve -#line 554 "runpicture.in" +#line 562 "runpicture.in" // void _draw(picture *f, path3 g, pen p, string name=emptystring); -void gen_runpicture42(stack *Stack) +void gen_runpicture43(stack *Stack) { string name=vm::pop<string>(Stack,emptystring); pen p=vm::pop<pen>(Stack); path3 g=vm::pop<path3>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 555 "runpicture.in" +#line 563 "runpicture.in" if(g.size() > 0) f->append(new drawPath3(g,p,name)); } // Bezier patch -#line 561 "runpicture.in" +#line 569 "runpicture.in" // void draw(picture *f, triplearray2 *P, triple center, bool straight, penarray *p, real opacity, real shininess, real PRCshininess, real granularity, triple normal, penarray *colors, bool lighton, string name=emptystring, Int interaction); -void gen_runpicture43(stack *Stack) +void gen_runpicture44(stack *Stack) { Int interaction=vm::pop<Int>(Stack); string name=vm::pop<string>(Stack,emptystring); @@ -877,16 +891,31 @@ void gen_runpicture43(stack *Stack) triple center=vm::pop<triple>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 565 "runpicture.in" +#line 573 "runpicture.in" f->append(new drawSurface(*P,center,straight,*p,opacity,shininess, PRCshininess,granularity,normal,*colors,lighton, name,interaction)); } +// General NURBS curve +#line 580 "runpicture.in" +// void draw(picture *f, triplearray *P, realarray *knot, realarray *weights=emptyarray, pen p, string name=emptystring); +void gen_runpicture45(stack *Stack) +{ + string name=vm::pop<string>(Stack,emptystring); + pen p=vm::pop<pen>(Stack); + realarray * weights=vm::pop<realarray *>(Stack,emptyarray); + realarray * knot=vm::pop<realarray *>(Stack); + triplearray * P=vm::pop<triplearray *>(Stack); + picture * f=vm::pop<picture *>(Stack); +#line 582 "runpicture.in" + f->append(new drawNurbsPath3(*P,knot,weights,p,name)); +} + // General NURBS surface -#line 572 "runpicture.in" +#line 587 "runpicture.in" // void draw(picture *f, triplearray2 *P, realarray *uknot, realarray *vknot, realarray2 *weights=emptyarray, penarray *p, real opacity, real shininess, real PRCshininess, real granularity, penarray *colors, bool lighton, string name=emptystring); -void gen_runpicture44(stack *Stack) +void gen_runpicture46(stack *Stack) { string name=vm::pop<string>(Stack,emptystring); bool lighton=vm::pop<bool>(Stack); @@ -901,53 +930,63 @@ void gen_runpicture44(stack *Stack) realarray * uknot=vm::pop<realarray *>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 576 "runpicture.in" +#line 591 "runpicture.in" f->append(new drawNurbs(*P,uknot,vknot,weights,*p,opacity,shininess, PRCshininess,granularity,*colors,lighton,name)); } -#line 581 "runpicture.in" +#line 596 "runpicture.in" // triple min3(picture *f); -void gen_runpicture45(stack *Stack) +void gen_runpicture47(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 582 "runpicture.in" +#line 597 "runpicture.in" {Stack->push<triple>(f->bounds3().Min()); return;} } -#line 586 "runpicture.in" +#line 601 "runpicture.in" // triple max3(picture *f); -void gen_runpicture46(stack *Stack) +void gen_runpicture48(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 587 "runpicture.in" +#line 602 "runpicture.in" {Stack->push<triple>(f->bounds3().Max()); return;} } -#line 591 "runpicture.in" +#line 606 "runpicture.in" +// triple size3(picture *f); +void gen_runpicture49(stack *Stack) +{ + picture * f=vm::pop<picture *>(Stack); +#line 607 "runpicture.in" + bbox3 b=f->bounds3(); + {Stack->push<triple>(b.Max()-b.Min()); return;} +} + +#line 612 "runpicture.in" // pair minratio(picture *f); -void gen_runpicture47(stack *Stack) +void gen_runpicture50(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 592 "runpicture.in" +#line 613 "runpicture.in" {Stack->push<pair>(f->ratio(::min)); return;} } -#line 596 "runpicture.in" +#line 617 "runpicture.in" // pair maxratio(picture *f); -void gen_runpicture48(stack *Stack) +void gen_runpicture51(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 597 "runpicture.in" +#line 618 "runpicture.in" {Stack->push<pair>(f->ratio(::max)); return;} } -#line 601 "runpicture.in" +#line 622 "runpicture.in" // bool is3D(picture *f); -void gen_runpicture49(stack *Stack) +void gen_runpicture52(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 602 "runpicture.in" +#line 623 "runpicture.in" {Stack->push<bool>(f->have3D()); return;} } @@ -968,95 +1007,101 @@ void gen_runpicture_venv(venv &ve) #line 112 "runpicture.in" addFunc(ve, run::gen_runpicture4, primPair(), "max", formal(primPicture(), "f", false, false)); #line 117 "runpicture.in" - addFunc(ve, run::gen_runpicture5, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath(), "g", false, false), formal(primPen(), "p", false, false)); -#line 122 "runpicture.in" - addFunc(ve, run::gen_runpicture6, primVoid(), "fill", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primPen(), "p", true, false), formal(primBoolean(), "copy", true, false)); + addFunc(ve, run::gen_runpicture5, primPair(), "size", formal(primPicture(), "f", false, false)); +#line 123 "runpicture.in" + addFunc(ve, run::gen_runpicture6, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath(), "g", false, false), formal(primPen(), "p", false, false)); #line 128 "runpicture.in" - addFunc(ve, run::gen_runpicture7, 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 135 "runpicture.in" - addFunc(ve, run::gen_runpicture8, 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 142 "runpicture.in" - addFunc(ve, run::gen_runpicture9, 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 149 "runpicture.in" - addFunc(ve, run::gen_runpicture10, 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 160 "runpicture.in" - addFunc(ve, run::gen_runpicture11, 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 184 "runpicture.in" - addFunc(ve, run::gen_runpicture12, 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 199 "runpicture.in" - addFunc(ve, run::gen_runpicture13, 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)); + addFunc(ve, run::gen_runpicture7, primVoid(), "fill", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primPen(), "p", true, false), formal(primBoolean(), "copy", true, false)); +#line 134 "runpicture.in" + addFunc(ve, run::gen_runpicture8, 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(primTransform(), "t", true, false), formal(primBoolean(), "copy", true, false)); +#line 143 "runpicture.in" + addFunc(ve, run::gen_runpicture9, 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 150 "runpicture.in" + addFunc(ve, run::gen_runpicture10, 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 157 "runpicture.in" + addFunc(ve, run::gen_runpicture11, 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 168 "runpicture.in" + addFunc(ve, run::gen_runpicture12, 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 192 "runpicture.in" + addFunc(ve, run::gen_runpicture13, 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 207 "runpicture.in" - addFunc(ve, run::gen_runpicture14, 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 217 "runpicture.in" - addFunc(ve, run::gen_runpicture15, 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 224 "runpicture.in" - addFunc(ve, run::gen_runpicture16, primVoid(), "endclip", formal(primPicture(), "f", false, false)); -#line 229 "runpicture.in" - addFunc(ve, run::gen_runpicture17, primVoid(), "gsave", formal(primPicture(), "f", false, false)); -#line 234 "runpicture.in" - addFunc(ve, run::gen_runpicture18, primVoid(), "grestore", formal(primPicture(), "f", false, false)); -#line 239 "runpicture.in" - addFunc(ve, run::gen_runpicture19, primVoid(), "begingroup", formal(primPicture(), "f", false, false), formal(primString() , "name", true, false)); -#line 244 "runpicture.in" - addFunc(ve, run::gen_runpicture20, primVoid(), "endgroup", formal(primPicture(), "f", false, false)); -#line 249 "runpicture.in" - addFunc(ve, run::gen_runpicture21, primVoid(), "add", formal(primPicture(), "dest", false, false), formal(primPicture(), "src", false, false)); -#line 254 "runpicture.in" - addFunc(ve, run::gen_runpicture22, primVoid(), "prepend", formal(primPicture(), "dest", false, false), formal(primPicture(), "src", false, false)); -#line 259 "runpicture.in" - addFunc(ve, run::gen_runpicture23, primVoid(), "postscript", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false)); -#line 264 "runpicture.in" - addFunc(ve, run::gen_runpicture24, primVoid(), "tex", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false)); -#line 269 "runpicture.in" - addFunc(ve, run::gen_runpicture25, primVoid(), "postscript", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primPair(), "min", false, false), formal(primPair(), "max", false, false)); -#line 274 "runpicture.in" - addFunc(ve, run::gen_runpicture26, primVoid(), "tex", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primPair(), "min", false, false), formal(primPair(), "max", false, false)); -#line 279 "runpicture.in" - addFunc(ve, run::gen_runpicture27, primVoid(), "texpreamble", formal(primString() , "s", false, false)); + addFunc(ve, run::gen_runpicture14, 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 215 "runpicture.in" + addFunc(ve, run::gen_runpicture15, 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 225 "runpicture.in" + addFunc(ve, run::gen_runpicture16, 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 232 "runpicture.in" + addFunc(ve, run::gen_runpicture17, primVoid(), "endclip", formal(primPicture(), "f", false, false)); +#line 237 "runpicture.in" + addFunc(ve, run::gen_runpicture18, primVoid(), "gsave", formal(primPicture(), "f", false, false)); +#line 242 "runpicture.in" + addFunc(ve, run::gen_runpicture19, primVoid(), "grestore", formal(primPicture(), "f", false, false)); +#line 247 "runpicture.in" + addFunc(ve, run::gen_runpicture20, primVoid(), "begingroup", formal(primPicture(), "f", false, false), formal(primString() , "name", true, false)); +#line 252 "runpicture.in" + addFunc(ve, run::gen_runpicture21, primVoid(), "endgroup", formal(primPicture(), "f", false, false)); +#line 257 "runpicture.in" + addFunc(ve, run::gen_runpicture22, primVoid(), "add", formal(primPicture(), "dest", false, false), formal(primPicture(), "src", false, false)); +#line 262 "runpicture.in" + addFunc(ve, run::gen_runpicture23, primVoid(), "prepend", formal(primPicture(), "dest", false, false), formal(primPicture(), "src", false, false)); +#line 267 "runpicture.in" + addFunc(ve, run::gen_runpicture24, primVoid(), "postscript", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false)); +#line 272 "runpicture.in" + addFunc(ve, run::gen_runpicture25, primVoid(), "tex", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false)); +#line 277 "runpicture.in" + addFunc(ve, run::gen_runpicture26, primVoid(), "postscript", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primPair(), "min", false, false), formal(primPair(), "max", false, false)); +#line 282 "runpicture.in" + addFunc(ve, run::gen_runpicture27, primVoid(), "tex", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primPair(), "min", false, false), formal(primPair(), "max", false, false)); #line 287 "runpicture.in" - addFunc(ve, run::gen_runpicture28, primVoid(), "deletepreamble"); -#line 294 "runpicture.in" - addFunc(ve, run::gen_runpicture29, 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 300 "runpicture.in" - addFunc(ve, run::gen_runpicture30, primVoid(), "texreset"); + addFunc(ve, run::gen_runpicture28, primVoid(), "texpreamble", formal(primString() , "s", false, false)); +#line 295 "runpicture.in" + addFunc(ve, run::gen_runpicture29, primVoid(), "deletepreamble"); +#line 302 "runpicture.in" + addFunc(ve, run::gen_runpicture30, 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 308 "runpicture.in" - addFunc(ve, run::gen_runpicture31, primVoid(), "layer", formal(primPicture(), "f", false, false)); -#line 313 "runpicture.in" - addFunc(ve, run::gen_runpicture32, primVoid(), "newpage", formal(primPicture(), "f", false, false)); -#line 318 "runpicture.in" - addFunc(ve, run::gen_runpicture33, 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 328 "runpicture.in" - addFunc(ve, run::gen_runpicture34, 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 335 "runpicture.in" - addFunc(ve, run::gen_runpicture35, primString() , "nativeformat"); -#line 340 "runpicture.in" - addFunc(ve, run::gen_runpicture36, primBoolean(), "latex"); -#line 345 "runpicture.in" - addFunc(ve, run::gen_runpicture37, primBoolean(), "pdf"); -#line 350 "runpicture.in" - addFunc(ve, run::gen_runpicture38, 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 396 "runpicture.in" - addFunc(ve, run::gen_runpicture39, 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(primReal(), "zoom", false, false), formal(primTriple(), "m", false, false), formal(primTriple(), "m", false, false), formal(primPair(), "shift", 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 422 "runpicture.in" - addFunc(ve, run::gen_runpicture40, primVoid(), "shipout3", formal(primString() , "prefix", false, false), formal(primPicture(), "f", false, false), formal(IntArray(), "index", false, false), formal(tripleArray(), "center", false, false)); -#line 427 "runpicture.in" - addFunc(ve, run::gen_runpicture41, primVoid(), "deconstruct", formal(primPicture(), "f", false, false), formal(primPicture(), "preamble", true, false), formal(primReal(), "magnification", true, false), formal(transformFunction(), "xform", false, false)); -#line 550 "runpicture.in" - addFunc(ve, run::gen_runpicture42, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath3(), "g", false, false), formal(primPen(), "p", false, false), formal(primString() , "name", true, false)); -#line 560 "runpicture.in" - addFunc(ve, run::gen_runpicture43, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray2(), "p", false, false), formal(primTriple(), "center", false, false), formal(primBoolean(), "straight", false, false), formal(penArray() , "p", false, false), formal(primReal(), "opacity", false, false), formal(primReal(), "shininess", false, false), formal(primReal(), "prcshininess", false, false), formal(primReal(), "granularity", false, false), formal(primTriple(), "normal", false, false), formal(penArray() , "colors", false, false), formal(primBoolean(), "lighton", false, false), formal(primString() , "name", true, false), formal(primInt(), "interaction", false, false)); -#line 571 "runpicture.in" - addFunc(ve, run::gen_runpicture44, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray2(), "p", false, false), formal(realArray(), "uknot", false, false), formal(realArray(), "vknot", false, false), formal(realArray2(), "weights", true, false), formal(penArray() , "p", false, false), formal(primReal(), "opacity", false, false), formal(primReal(), "shininess", false, false), formal(primReal(), "prcshininess", false, false), formal(primReal(), "granularity", false, false), formal(penArray() , "colors", false, false), formal(primBoolean(), "lighton", false, false), formal(primString() , "name", true, false)); -#line 581 "runpicture.in" - addFunc(ve, run::gen_runpicture45, primTriple(), "min3", formal(primPicture(), "f", false, false)); + addFunc(ve, run::gen_runpicture31, primVoid(), "texreset"); +#line 316 "runpicture.in" + addFunc(ve, run::gen_runpicture32, primVoid(), "layer", formal(primPicture(), "f", false, false)); +#line 321 "runpicture.in" + addFunc(ve, run::gen_runpicture33, primVoid(), "newpage", formal(primPicture(), "f", false, false)); +#line 326 "runpicture.in" + addFunc(ve, run::gen_runpicture34, 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 336 "runpicture.in" + addFunc(ve, run::gen_runpicture35, 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 343 "runpicture.in" + addFunc(ve, run::gen_runpicture36, primString() , "nativeformat"); +#line 348 "runpicture.in" + addFunc(ve, run::gen_runpicture37, primBoolean(), "latex"); +#line 353 "runpicture.in" + addFunc(ve, run::gen_runpicture38, primBoolean(), "pdf"); +#line 358 "runpicture.in" + addFunc(ve, run::gen_runpicture39, 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 404 "runpicture.in" + addFunc(ve, run::gen_runpicture40, 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(primReal(), "zoom", false, false), formal(primTriple(), "m", false, false), formal(primTriple(), "m", false, false), formal(primPair(), "shift", 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 430 "runpicture.in" + addFunc(ve, run::gen_runpicture41, primVoid(), "shipout3", formal(primString() , "prefix", false, false), formal(primPicture(), "f", false, false), formal(IntArray(), "index", false, false), formal(tripleArray(), "center", false, false)); +#line 435 "runpicture.in" + addFunc(ve, run::gen_runpicture42, primVoid(), "deconstruct", formal(primPicture(), "f", false, false), formal(primPicture(), "preamble", true, false), formal(primReal(), "magnification", true, false), formal(transformFunction(), "xform", false, false)); +#line 558 "runpicture.in" + addFunc(ve, run::gen_runpicture43, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath3(), "g", false, false), formal(primPen(), "p", false, false), formal(primString() , "name", true, false)); +#line 568 "runpicture.in" + addFunc(ve, run::gen_runpicture44, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray2(), "p", false, false), formal(primTriple(), "center", false, false), formal(primBoolean(), "straight", false, false), formal(penArray() , "p", false, false), formal(primReal(), "opacity", false, false), formal(primReal(), "shininess", false, false), formal(primReal(), "prcshininess", false, false), formal(primReal(), "granularity", false, false), formal(primTriple(), "normal", false, false), formal(penArray() , "colors", false, false), formal(primBoolean(), "lighton", false, false), formal(primString() , "name", true, false), formal(primInt(), "interaction", false, false)); +#line 579 "runpicture.in" + addFunc(ve, run::gen_runpicture45, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray(), "p", false, false), formal(realArray(), "knot", false, false), formal(realArray(), "weights", true, false), formal(primPen(), "p", false, false), formal(primString() , "name", true, false)); #line 586 "runpicture.in" - addFunc(ve, run::gen_runpicture46, primTriple(), "max3", formal(primPicture(), "f", false, false)); -#line 591 "runpicture.in" - addFunc(ve, run::gen_runpicture47, primPair(), "minratio", formal(primPicture(), "f", false, false)); + addFunc(ve, run::gen_runpicture46, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray2(), "p", false, false), formal(realArray(), "uknot", false, false), formal(realArray(), "vknot", false, false), formal(realArray2(), "weights", true, false), formal(penArray() , "p", false, false), formal(primReal(), "opacity", false, false), formal(primReal(), "shininess", false, false), formal(primReal(), "prcshininess", false, false), formal(primReal(), "granularity", false, false), formal(penArray() , "colors", false, false), formal(primBoolean(), "lighton", false, false), formal(primString() , "name", true, false)); #line 596 "runpicture.in" - addFunc(ve, run::gen_runpicture48, primPair(), "maxratio", formal(primPicture(), "f", false, false)); + addFunc(ve, run::gen_runpicture47, primTriple(), "min3", formal(primPicture(), "f", false, false)); #line 601 "runpicture.in" - addFunc(ve, run::gen_runpicture49, primBoolean(), "is3D", formal(primPicture(), "f", false, false)); + addFunc(ve, run::gen_runpicture48, primTriple(), "max3", formal(primPicture(), "f", false, false)); +#line 606 "runpicture.in" + addFunc(ve, run::gen_runpicture49, primTriple(), "size3", formal(primPicture(), "f", false, false)); +#line 612 "runpicture.in" + addFunc(ve, run::gen_runpicture50, primPair(), "minratio", formal(primPicture(), "f", false, false)); +#line 617 "runpicture.in" + addFunc(ve, run::gen_runpicture51, primPair(), "maxratio", formal(primPicture(), "f", false, false)); +#line 622 "runpicture.in" + addFunc(ve, run::gen_runpicture52, primBoolean(), "is3D", formal(primPicture(), "f", false, false)); } } // namespace trans diff --git a/Build/source/utils/asymptote/runpicture.in b/Build/source/utils/asymptote/runpicture.in index b0540ae6def..232c4229a17 100644 --- a/Build/source/utils/asymptote/runpicture.in +++ b/Build/source/utils/asymptote/runpicture.in @@ -114,6 +114,12 @@ pair max(picture *f) return f->bounds().Max(); } +pair size(picture *f) +{ + bbox b=f->bounds(); + return b.Max()-b.Min(); +} + void _draw(picture *f, path g, pen p) { f->append(new drawPath(g,p)); @@ -126,10 +132,12 @@ void fill(picture *f, patharray *g, pen p=CURRENTPEN, bool copy=true) } void latticeshade(picture *f, patharray *g, bool stroke=false, - pen fillrule=CURRENTPEN, penarray2 *p, bool copy=true) + pen fillrule=CURRENTPEN, penarray2 *p, transform t=identity, + bool copy=true) { array *(*copyarray)(array *a)=copy ? copyArray: nop; - f->append(new drawLatticeShade(*copyarray(g),stroke,fillrule,*copyarray(p))); + f->append(new drawLatticeShade(*copyarray(g),stroke,fillrule,*copyarray(p), + t)); } void axialshade(picture *f, patharray *g, bool stroke=false, pen pena, pair a, @@ -408,9 +416,9 @@ void shipout3(string prefix, picture *f, string format=emptystring, real* Background=copyArrayC(background); triple *Lights=copyTripleArrayC(lights); - real *Diffuse=copyArray2C(diffuse,false,4); - real *Ambient=copyArray2C(ambient,false,4); - real *Specular=copyArray2C(specular,false,4); + real *Diffuse=copyArray2C(diffuse,false,4,UseGC); + real *Ambient=copyArray2C(ambient,false,4,UseGC); + real *Specular=copyArray2C(specular,false,4,UseGC); f->shipout3(prefix,format,width,height,angle,zoom,m,M,shift,T,Background,n, Lights,Diffuse,Ambient,Specular,viewportlighting,view); @@ -568,6 +576,13 @@ void draw(picture *f, triplearray2 *P, triple center, bool straight, name,interaction)); } +// General NURBS curve +void draw(picture *f, triplearray *P, realarray *knot, + realarray *weights=emptyarray, pen p, string name=emptystring) +{ + f->append(new drawNurbsPath3(*P,knot,weights,p,name)); +} + // General NURBS surface void draw(picture *f, triplearray2 *P, realarray *uknot, realarray *vknot, realarray2 *weights=emptyarray, penarray *p, @@ -588,6 +603,12 @@ triple max3(picture *f) return f->bounds3().Max(); } +triple size3(picture *f) +{ + bbox3 b=f->bounds3(); + return b.Max()-b.Min(); +} + pair minratio(picture *f) { return f->ratio(::min); diff --git a/Build/source/utils/asymptote/runstring.cc b/Build/source/utils/asymptote/runstring.cc index 80585c1742d..a7b7fed8c0d 100644 --- a/Build/source/utils/asymptote/runstring.cc +++ b/Build/source/utils/asymptote/runstring.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); diff --git a/Build/source/utils/asymptote/runsystem.cc b/Build/source/utils/asymptote/runsystem.cc index 0279af5e122..c9ae144bee2 100644 --- a/Build/source/utils/asymptote/runsystem.cc +++ b/Build/source/utils/asymptote/runsystem.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); @@ -124,12 +126,12 @@ void breakpoint(stack *Stack, runnable *r) } } -string convertname(string name, const string& format, bool check=true) +string convertname(string name, const string& format) { if(name.empty()) return buildname(outname(),format,""); else - if(check) checkLocal(name); + name=outpath(name); return format.empty() ? name : format+":"+name; } @@ -162,134 +164,142 @@ void exitFunction(stack *Stack) namespace run { #line 109 "runsystem.in" -// void atupdate(callable *f); +// string outname(); void gen_runsystem0(stack *Stack) { - callable * f=vm::pop<callable *>(Stack); #line 110 "runsystem.in" - processData().atUpdateFunction=f; + {Stack->push<string>(outname()); return;} } #line 114 "runsystem.in" -// callable* atupdate(); +// void atupdate(callable *f); void gen_runsystem1(stack *Stack) { + callable * f=vm::pop<callable *>(Stack); #line 115 "runsystem.in" - {Stack->push<callable*>(processData().atUpdateFunction); return;} + processData().atUpdateFunction=f; } #line 119 "runsystem.in" -// void atexit(callable *f); +// callable* atupdate(); void gen_runsystem2(stack *Stack) { - callable * f=vm::pop<callable *>(Stack); #line 120 "runsystem.in" - processData().atExitFunction=f; + {Stack->push<callable*>(processData().atUpdateFunction); return;} } #line 124 "runsystem.in" -// callable* atexit(); +// void atexit(callable *f); void gen_runsystem3(stack *Stack) { + callable * f=vm::pop<callable *>(Stack); #line 125 "runsystem.in" - {Stack->push<callable*>(processData().atExitFunction); return;} + processData().atExitFunction=f; } #line 129 "runsystem.in" -// void atbreakpoint(callableBp *f); +// callable* atexit(); void gen_runsystem4(stack *Stack) { - callableBp * f=vm::pop<callableBp *>(Stack); #line 130 "runsystem.in" - processData().atBreakpointFunction=f; + {Stack->push<callable*>(processData().atExitFunction); return;} } #line 134 "runsystem.in" -// void breakpoint(runnable *s=NULL); +// void atbreakpoint(callableBp *f); void gen_runsystem5(stack *Stack) { - runnable * s=vm::pop<runnable *>(Stack,NULL); + callableBp * f=vm::pop<callableBp *>(Stack); #line 135 "runsystem.in" - breakpoint(Stack,s); + processData().atBreakpointFunction=f; } #line 139 "runsystem.in" -// string locatefile(string file); +// void breakpoint(runnable *s=NULL); void gen_runsystem6(stack *Stack) { - string file=vm::pop<string>(Stack); + runnable * s=vm::pop<runnable *>(Stack,NULL); #line 140 "runsystem.in" - {Stack->push<string>(locateFile(file)); return;} + breakpoint(Stack,s); } #line 144 "runsystem.in" -// void stop(string file, Int line, runnable *s=NULL); +// string locatefile(string file); void gen_runsystem7(stack *Stack) { + string file=vm::pop<string>(Stack); +#line 145 "runsystem.in" + {Stack->push<string>(locateFile(file)); return;} +} + +#line 149 "runsystem.in" +// void stop(string file, Int line, runnable *s=NULL); +void gen_runsystem8(stack *Stack) +{ runnable * s=vm::pop<runnable *>(Stack,NULL); Int line=vm::pop<Int>(Stack); string file=vm::pop<string>(Stack); -#line 145 "runsystem.in" +#line 150 "runsystem.in" file=locateFile(file); clear(file,line); cout << "setting breakpoint at " << file << ": " << line << endl; bplist.push_back(bpinfo(file,line,s)); } -#line 152 "runsystem.in" +#line 157 "runsystem.in" // void breakpoints(); -void gen_runsystem8(stack *) +void gen_runsystem9(stack *) { -#line 153 "runsystem.in" +#line 158 "runsystem.in" for(mem::list<bpinfo>::iterator p=bplist.begin(); p != bplist.end(); ++p) cout << p->f.name() << ": " << p->f.line() << endl; } -#line 158 "runsystem.in" +#line 163 "runsystem.in" // void clear(string file, Int line); -void gen_runsystem9(stack *Stack) +void gen_runsystem10(stack *Stack) { Int line=vm::pop<Int>(Stack); string file=vm::pop<string>(Stack); -#line 159 "runsystem.in" +#line 164 "runsystem.in" file=locateFile(file); clear(file,line,true); } -#line 164 "runsystem.in" +#line 169 "runsystem.in" // void clear(); -void gen_runsystem10(stack *) +void gen_runsystem11(stack *) { -#line 165 "runsystem.in" +#line 170 "runsystem.in" bplist.clear(); } -#line 169 "runsystem.in" +#line 174 "runsystem.in" // void warn(string s); -void gen_runsystem11(stack *Stack) +void gen_runsystem12(stack *Stack) { string s=vm::pop<string>(Stack); -#line 170 "runsystem.in" +#line 175 "runsystem.in" Warn(s); } -#line 174 "runsystem.in" +#line 179 "runsystem.in" // void nowarn(string s); -void gen_runsystem12(stack *Stack) +void gen_runsystem13(stack *Stack) { string s=vm::pop<string>(Stack); -#line 175 "runsystem.in" +#line 180 "runsystem.in" noWarn(s); } -#line 179 "runsystem.in" +#line 184 "runsystem.in" // void warning(string s, string t, bool position=false); -void gen_runsystem13(stack *Stack) +void gen_runsystem14(stack *Stack) { bool position=vm::pop<bool>(Stack,false); string t=vm::pop<string>(Stack); string s=vm::pop<string>(Stack); -#line 180 "runsystem.in" +#line 185 "runsystem.in" if(settings::warn(s)) { em.warning(position ? getPos() : nullPos,s); em << t; @@ -297,52 +307,61 @@ void gen_runsystem13(stack *Stack) } // Strip directory from string -#line 188 "runsystem.in" +#line 193 "runsystem.in" // string stripdirectory(string *s); -void gen_runsystem14(stack *Stack) +void gen_runsystem15(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 189 "runsystem.in" +#line 194 "runsystem.in" {Stack->push<string>(stripDir(*s)); return;} } // Strip directory from string -#line 194 "runsystem.in" +#line 199 "runsystem.in" // string stripfile(string *s); -void gen_runsystem15(stack *Stack) +void gen_runsystem16(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 195 "runsystem.in" +#line 200 "runsystem.in" {Stack->push<string>(stripFile(*s)); return;} } // Strip file extension from string -#line 200 "runsystem.in" +#line 205 "runsystem.in" // string stripextension(string *s); -void gen_runsystem16(stack *Stack) +void gen_runsystem17(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 201 "runsystem.in" +#line 206 "runsystem.in" {Stack->push<string>(stripExt(*s)); return;} } // Call ImageMagick convert. -#line 206 "runsystem.in" +#line 211 "runsystem.in" // Int convert(string args=emptystring, string file=emptystring, string format=emptystring); -void gen_runsystem17(stack *Stack) +void gen_runsystem18(stack *Stack) { string format=vm::pop<string>(Stack,emptystring); string file=vm::pop<string>(Stack,emptystring); string args=vm::pop<string>(Stack,emptystring); -#line 208 "runsystem.in" +#line 213 "runsystem.in" string name=convertname(file,format); mem::vector<string> cmd; cmd.push_back(getSetting<string>("convert")); push_split(cmd,args); cmd.push_back(name); bool quiet=verbose <= 1; + + char *oldPath=NULL; + string dir=stripFile(outname()); + if(!dir.empty()) { + oldPath=getPath(); + setPath(dir.c_str()); + } Int ret=System(cmd,quiet ? 1 : 0,true,"convert", "your ImageMagick convert utility"); + if(oldPath != NULL) + setPath(oldPath); if(ret == 0 && verbose > 0) cout << "Wrote " << ((file.empty()) ? name : file) << endl; @@ -351,16 +370,16 @@ void gen_runsystem17(stack *Stack) } // Call ImageMagick animate. -#line 225 "runsystem.in" +#line 239 "runsystem.in" // Int animate(string args=emptystring, string file=emptystring, string format=emptystring); -void gen_runsystem18(stack *Stack) +void gen_runsystem19(stack *Stack) { string format=vm::pop<string>(Stack,emptystring); string file=vm::pop<string>(Stack,emptystring); string args=vm::pop<string>(Stack,emptystring); -#line 227 "runsystem.in" +#line 241 "runsystem.in" #ifndef __CYGWIN__ - string name=convertname(file,format,false); + string name=convertname(file,format); if(view()) { mem::vector<string> cmd; cmd.push_back(getSetting<string>("animate")); @@ -372,12 +391,12 @@ void gen_runsystem18(stack *Stack) {Stack->push<Int>(0); return;} } -#line 241 "runsystem.in" +#line 255 "runsystem.in" // void purge(Int divisor=0); -void gen_runsystem19(stack *Stack) +void gen_runsystem20(stack *Stack) { Int divisor=vm::pop<Int>(Stack,0); -#line 242 "runsystem.in" +#line 256 "runsystem.in" purge(divisor); } @@ -388,45 +407,47 @@ namespace trans { void gen_runsystem_venv(venv &ve) { #line 109 "runsystem.in" - addFunc(ve, run::gen_runsystem0, primVoid(), "atupdate", formal(voidFunction(), "f", false, false)); + addFunc(ve, run::gen_runsystem0, primString() , "outname"); #line 114 "runsystem.in" - addFunc(ve, run::gen_runsystem1, voidFunction(), "atupdate"); + addFunc(ve, run::gen_runsystem1, primVoid(), "atupdate", formal(voidFunction(), "f", false, false)); #line 119 "runsystem.in" - addFunc(ve, run::gen_runsystem2, primVoid(), "atexit", formal(voidFunction(), "f", false, false)); + addFunc(ve, run::gen_runsystem2, voidFunction(), "atupdate"); #line 124 "runsystem.in" - addFunc(ve, run::gen_runsystem3, voidFunction(), "atexit"); + addFunc(ve, run::gen_runsystem3, primVoid(), "atexit", formal(voidFunction(), "f", false, false)); #line 129 "runsystem.in" - addFunc(ve, run::gen_runsystem4, primVoid(), "atbreakpoint", formal(breakpointFunction(), "f", false, false)); + addFunc(ve, run::gen_runsystem4, voidFunction(), "atexit"); #line 134 "runsystem.in" - addFunc(ve, run::gen_runsystem5, primVoid(), "breakpoint", formal(primCode(), "s", true, false)); + addFunc(ve, run::gen_runsystem5, primVoid(), "atbreakpoint", formal(breakpointFunction(), "f", false, false)); #line 139 "runsystem.in" - addFunc(ve, run::gen_runsystem6, primString() , "locatefile", formal(primString() , "file", false, false)); + addFunc(ve, run::gen_runsystem6, primVoid(), "breakpoint", formal(primCode(), "s", true, false)); #line 144 "runsystem.in" - addFunc(ve, run::gen_runsystem7, primVoid(), "stop", formal(primString() , "file", false, false), formal(primInt(), "line", false, false), formal(primCode(), "s", true, false)); -#line 152 "runsystem.in" - addFunc(ve, run::gen_runsystem8, primVoid(), "breakpoints"); -#line 158 "runsystem.in" - addFunc(ve, run::gen_runsystem9, primVoid(), "clear", formal(primString() , "file", false, false), formal(primInt(), "line", false, false)); -#line 164 "runsystem.in" - addFunc(ve, run::gen_runsystem10, primVoid(), "clear"); + addFunc(ve, run::gen_runsystem7, primString() , "locatefile", formal(primString() , "file", false, false)); +#line 149 "runsystem.in" + addFunc(ve, run::gen_runsystem8, primVoid(), "stop", formal(primString() , "file", false, false), formal(primInt(), "line", false, false), formal(primCode(), "s", true, false)); +#line 157 "runsystem.in" + addFunc(ve, run::gen_runsystem9, primVoid(), "breakpoints"); +#line 163 "runsystem.in" + addFunc(ve, run::gen_runsystem10, primVoid(), "clear", formal(primString() , "file", false, false), formal(primInt(), "line", false, false)); #line 169 "runsystem.in" - addFunc(ve, run::gen_runsystem11, primVoid(), "warn", formal(primString() , "s", false, false)); + addFunc(ve, run::gen_runsystem11, primVoid(), "clear"); #line 174 "runsystem.in" - addFunc(ve, run::gen_runsystem12, primVoid(), "nowarn", formal(primString() , "s", false, false)); + addFunc(ve, run::gen_runsystem12, primVoid(), "warn", formal(primString() , "s", false, false)); #line 179 "runsystem.in" - addFunc(ve, run::gen_runsystem13, primVoid(), "warning", formal(primString() , "s", false, false), formal(primString() , "t", false, false), formal(primBoolean(), "position", true, false)); -#line 187 "runsystem.in" - addFunc(ve, run::gen_runsystem14, primString() , "stripdirectory", formal(primString(), "s", false, false)); -#line 193 "runsystem.in" - addFunc(ve, run::gen_runsystem15, primString() , "stripfile", formal(primString(), "s", false, false)); -#line 199 "runsystem.in" - addFunc(ve, run::gen_runsystem16, primString() , "stripextension", formal(primString(), "s", false, false)); -#line 205 "runsystem.in" - addFunc(ve, run::gen_runsystem17, primInt(), "convert", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false)); -#line 224 "runsystem.in" - addFunc(ve, run::gen_runsystem18, primInt(), "animate", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false)); -#line 241 "runsystem.in" - addFunc(ve, run::gen_runsystem19, primVoid(), "purge", formal(primInt(), "divisor", true, false)); + addFunc(ve, run::gen_runsystem13, primVoid(), "nowarn", formal(primString() , "s", false, false)); +#line 184 "runsystem.in" + addFunc(ve, run::gen_runsystem14, primVoid(), "warning", formal(primString() , "s", false, false), formal(primString() , "t", false, false), formal(primBoolean(), "position", true, false)); +#line 192 "runsystem.in" + addFunc(ve, run::gen_runsystem15, primString() , "stripdirectory", formal(primString(), "s", false, false)); +#line 198 "runsystem.in" + addFunc(ve, run::gen_runsystem16, primString() , "stripfile", formal(primString(), "s", false, false)); +#line 204 "runsystem.in" + addFunc(ve, run::gen_runsystem17, primString() , "stripextension", formal(primString(), "s", false, false)); +#line 210 "runsystem.in" + addFunc(ve, run::gen_runsystem18, primInt(), "convert", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false)); +#line 238 "runsystem.in" + addFunc(ve, run::gen_runsystem19, primInt(), "animate", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false)); +#line 255 "runsystem.in" + addFunc(ve, run::gen_runsystem20, primVoid(), "purge", formal(primInt(), "divisor", true, false)); } } // namespace trans diff --git a/Build/source/utils/asymptote/runsystem.in b/Build/source/utils/asymptote/runsystem.in index cf0cf6af053..7414e62f011 100644 --- a/Build/source/utils/asymptote/runsystem.in +++ b/Build/source/utils/asymptote/runsystem.in @@ -71,12 +71,12 @@ void breakpoint(stack *Stack, runnable *r) } } -string convertname(string name, const string& format, bool check=true) +string convertname(string name, const string& format) { if(name.empty()) return buildname(outname(),format,""); else - if(check) checkLocal(name); + name=outpath(name); return format.empty() ? name : format+":"+name; } @@ -106,6 +106,11 @@ void exitFunction(stack *Stack) // Autogenerated routines: +string outname() +{ + return outname(); +} + void atupdate(callable *f) { processData().atUpdateFunction=f; @@ -212,8 +217,17 @@ Int convert(string args=emptystring, string file=emptystring, push_split(cmd,args); cmd.push_back(name); bool quiet=verbose <= 1; + + char *oldPath=NULL; + string dir=stripFile(outname()); + if(!dir.empty()) { + oldPath=getPath(); + setPath(dir.c_str()); + } Int ret=System(cmd,quiet ? 1 : 0,true,"convert", "your ImageMagick convert utility"); + if(oldPath != NULL) + setPath(oldPath); if(ret == 0 && verbose > 0) cout << "Wrote " << ((file.empty()) ? name : file) << endl; @@ -226,7 +240,7 @@ Int animate(string args=emptystring, string file=emptystring, string format=emptystring) { #ifndef __CYGWIN__ - string name=convertname(file,format,false); + string name=convertname(file,format); if(view()) { mem::vector<string> cmd; cmd.push_back(getSetting<string>("animate")); diff --git a/Build/source/utils/asymptote/runtime.cc b/Build/source/utils/asymptote/runtime.cc index 08ea1c0599b..96889380400 100644 --- a/Build/source/utils/asymptote/runtime.cc +++ b/Build/source/utils/asymptote/runtime.cc @@ -61,12 +61,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); @@ -547,59 +549,77 @@ void gen_runtime31(stack *Stack) } #line 411 "runtime.in" -// string colorspace(pen p); +// string hex(pen p); void gen_runtime32(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 412 "runtime.in" +#line 412 "runtime.in" + {Stack->push<string>(p.hex()); return;} +} + +#line 416 "runtime.in" +// Int byte(real x); +void gen_runtime33(stack *Stack) +{ + real x=vm::pop<real>(Stack); +#line 417 "runtime.in" + {Stack->push<Int>(byte(x)); return;} +} + +#line 421 "runtime.in" +// string colorspace(pen p); +void gen_runtime34(stack *Stack) +{ + pen p=vm::pop<pen>(Stack); +#line 422 "runtime.in" string s=ColorDeviceSuffix[p.colorspace()]; std::transform(s.begin(),s.end(),s.begin(),tolower); {Stack->push<string>(s); return;} } -#line 418 "runtime.in" +#line 428 "runtime.in" // pen pattern(string *s); -void gen_runtime33(stack *Stack) +void gen_runtime35(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 419 "runtime.in" +#line 429 "runtime.in" {Stack->push<pen>(pen(setpattern,*s)); return;} } -#line 423 "runtime.in" +#line 433 "runtime.in" // string pattern(pen p); -void gen_runtime34(stack *Stack) +void gen_runtime36(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 424 "runtime.in" +#line 434 "runtime.in" {Stack->push<string>(p.fillpattern()); return;} } -#line 428 "runtime.in" +#line 438 "runtime.in" // pen fillrule(Int n); -void gen_runtime35(stack *Stack) +void gen_runtime37(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 429 "runtime.in" +#line 439 "runtime.in" {Stack->push<pen>(pen(n >= 0 && n < nFill ? (FillRule) n : DEFFILL)); return;} } -#line 433 "runtime.in" +#line 443 "runtime.in" // Int fillrule(pen p); -void gen_runtime36(stack *Stack) +void gen_runtime38(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 434 "runtime.in" +#line 444 "runtime.in" {Stack->push<Int>(p.Fillrule()); return;} } -#line 438 "runtime.in" +#line 448 "runtime.in" // pen opacity(real opacity=1.0, string blend=defaulttransparency); -void gen_runtime37(stack *Stack) +void gen_runtime39(stack *Stack) { string blend=vm::pop<string>(Stack,defaulttransparency); real opacity=vm::pop<real>(Stack,1.0); -#line 439 "runtime.in" +#line 449 "runtime.in" for(Int i=0; i < nBlendMode; ++i) if(blend == BlendMode[i]) {Stack->push<pen>(pen(Transparency(blend,opacity))); return;} @@ -608,301 +628,307 @@ void gen_runtime37(stack *Stack) error(buf); } -#line 448 "runtime.in" +#line 458 "runtime.in" // real opacity(pen p); -void gen_runtime38(stack *Stack) +void gen_runtime40(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 449 "runtime.in" +#line 459 "runtime.in" {Stack->push<real>(p.opacity()); return;} } -#line 453 "runtime.in" +#line 463 "runtime.in" // string blend(pen p); -void gen_runtime39(stack *Stack) +void gen_runtime41(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 454 "runtime.in" +#line 464 "runtime.in" {Stack->push<string>(p.blend()); return;} } -#line 458 "runtime.in" -// pen linetype(string *s, real offset=0, bool scale=true, bool adjust=true); -void gen_runtime40(stack *Stack) +#line 468 "runtime.in" +// pen linetype(realarray *pattern, real offset=0, bool scale=true, bool adjust=true); +void gen_runtime42(stack *Stack) { bool adjust=vm::pop<bool>(Stack,true); bool scale=vm::pop<bool>(Stack,true); real offset=vm::pop<real>(Stack,0); - string * s=vm::pop<string *>(Stack); -#line 459 "runtime.in" - {Stack->push<pen>(pen(LineType(*s,offset,scale,adjust))); return;} + realarray * pattern=vm::pop<realarray *>(Stack); +#line 470 "runtime.in" + size_t size=checkArray(pattern); + array *a=new array(size); + for(size_t i=0; i < size; ++i) + (*a)[i]=::max(vm::read<double>(pattern,i),0.0); + + {Stack->push<pen>(pen(LineType(*a,offset,scale,adjust))); return;} } -#line 463 "runtime.in" -// string linetype(pen p=CURRENTPEN); -void gen_runtime41(stack *Stack) +#line 479 "runtime.in" +// realarray* linetype(pen p=CURRENTPEN); +void gen_runtime43(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 464 "runtime.in" - {Stack->push<string>(p.stroke()); return;} +#line 480 "runtime.in" + array a=p.linetype()->pattern; + {Stack->push<realarray*>(copyArray(&a)); return;} } -#line 468 "runtime.in" +#line 485 "runtime.in" // real offset(pen p); -void gen_runtime42(stack *Stack) +void gen_runtime44(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 469 "runtime.in" - {Stack->push<real>(p.linetype().offset); return;} +#line 486 "runtime.in" + {Stack->push<real>(p.linetype()->offset); return;} } -#line 473 "runtime.in" +#line 490 "runtime.in" // bool scale(pen p); -void gen_runtime43(stack *Stack) +void gen_runtime45(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 474 "runtime.in" - {Stack->push<bool>(p.linetype().scale); return;} +#line 491 "runtime.in" + {Stack->push<bool>(p.linetype()->scale); return;} } -#line 478 "runtime.in" +#line 495 "runtime.in" // bool adjust(pen p); -void gen_runtime44(stack *Stack) +void gen_runtime46(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 479 "runtime.in" - {Stack->push<bool>(p.linetype().adjust); return;} +#line 496 "runtime.in" + {Stack->push<bool>(p.linetype()->adjust); return;} } -#line 483 "runtime.in" +#line 500 "runtime.in" // pen adjust(pen p, real arclength, bool cyclic); -void gen_runtime45(stack *Stack) +void gen_runtime47(stack *Stack) { bool cyclic=vm::pop<bool>(Stack); real arclength=vm::pop<real>(Stack); pen p=vm::pop<pen>(Stack); -#line 484 "runtime.in" +#line 501 "runtime.in" {Stack->push<pen>(adjustdash(p,arclength,cyclic)); return;} } -#line 488 "runtime.in" +#line 505 "runtime.in" // pen linecap(Int n); -void gen_runtime46(stack *Stack) +void gen_runtime48(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 489 "runtime.in" +#line 506 "runtime.in" {Stack->push<pen>(pen(setlinecap,n >= 0 && n < nCap ? n : DEFCAP)); return;} } -#line 493 "runtime.in" +#line 510 "runtime.in" // Int linecap(pen p=CURRENTPEN); -void gen_runtime47(stack *Stack) +void gen_runtime49(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 494 "runtime.in" +#line 511 "runtime.in" {Stack->push<Int>(p.cap()); return;} } -#line 498 "runtime.in" +#line 515 "runtime.in" // pen linejoin(Int n); -void gen_runtime48(stack *Stack) +void gen_runtime50(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 499 "runtime.in" +#line 516 "runtime.in" {Stack->push<pen>(pen(setlinejoin,n >= 0 && n < nJoin ? n : DEFJOIN)); return;} } -#line 503 "runtime.in" +#line 520 "runtime.in" // Int linejoin(pen p=CURRENTPEN); -void gen_runtime49(stack *Stack) +void gen_runtime51(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 504 "runtime.in" +#line 521 "runtime.in" {Stack->push<Int>(p.join()); return;} } -#line 508 "runtime.in" +#line 525 "runtime.in" // pen miterlimit(real x); -void gen_runtime50(stack *Stack) +void gen_runtime52(stack *Stack) { real x=vm::pop<real>(Stack); -#line 509 "runtime.in" +#line 526 "runtime.in" {Stack->push<pen>(pen(setmiterlimit,x >= 1.0 ? x : DEFJOIN)); return;} } -#line 513 "runtime.in" +#line 530 "runtime.in" // real miterlimit(pen p=CURRENTPEN); -void gen_runtime51(stack *Stack) +void gen_runtime53(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 514 "runtime.in" +#line 531 "runtime.in" {Stack->push<real>(p.miter()); return;} } -#line 518 "runtime.in" +#line 535 "runtime.in" // pen linewidth(real x); -void gen_runtime52(stack *Stack) +void gen_runtime54(stack *Stack) { real x=vm::pop<real>(Stack); -#line 519 "runtime.in" +#line 536 "runtime.in" {Stack->push<pen>(pen(setlinewidth,x >= 0.0 ? x : DEFWIDTH)); return;} } -#line 523 "runtime.in" +#line 540 "runtime.in" // real linewidth(pen p=CURRENTPEN); -void gen_runtime53(stack *Stack) +void gen_runtime55(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 524 "runtime.in" +#line 541 "runtime.in" {Stack->push<real>(p.width()); return;} } -#line 528 "runtime.in" +#line 545 "runtime.in" // pen fontcommand(string *s); -void gen_runtime54(stack *Stack) +void gen_runtime56(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 529 "runtime.in" +#line 546 "runtime.in" {Stack->push<pen>(pen(setfont,*s)); return;} } -#line 533 "runtime.in" +#line 550 "runtime.in" // string font(pen p=CURRENTPEN); -void gen_runtime55(stack *Stack) +void gen_runtime57(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 534 "runtime.in" +#line 551 "runtime.in" {Stack->push<string>(p.Font()); return;} } -#line 538 "runtime.in" +#line 555 "runtime.in" // pen fontsize(real size, real lineskip); -void gen_runtime56(stack *Stack) +void gen_runtime58(stack *Stack) { real lineskip=vm::pop<real>(Stack); real size=vm::pop<real>(Stack); -#line 539 "runtime.in" +#line 556 "runtime.in" {Stack->push<pen>(pen(setfontsize,size > 0.0 ? size : 0.0, lineskip > 0.0 ? lineskip : 0.0)); return;} } -#line 544 "runtime.in" +#line 561 "runtime.in" // real fontsize(pen p=CURRENTPEN); -void gen_runtime57(stack *Stack) +void gen_runtime59(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 545 "runtime.in" +#line 562 "runtime.in" {Stack->push<real>(p.size()); return;} } -#line 549 "runtime.in" +#line 566 "runtime.in" // real lineskip(pen p=CURRENTPEN); -void gen_runtime58(stack *Stack) +void gen_runtime60(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 550 "runtime.in" +#line 567 "runtime.in" {Stack->push<real>(p.Lineskip()); return;} } -#line 554 "runtime.in" +#line 571 "runtime.in" // pen overwrite(Int n); -void gen_runtime59(stack *Stack) +void gen_runtime61(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 555 "runtime.in" +#line 572 "runtime.in" {Stack->push<pen>(pen(setoverwrite,n >= 0 && n < nOverwrite ? (overwrite_t) n : DEFWRITE)); return;} } -#line 560 "runtime.in" +#line 577 "runtime.in" // Int overwrite(pen p=CURRENTPEN); -void gen_runtime60(stack *Stack) +void gen_runtime62(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 561 "runtime.in" +#line 578 "runtime.in" {Stack->push<Int>(p.Overwrite()); return;} } -#line 565 "runtime.in" +#line 582 "runtime.in" // pen basealign(Int n); -void gen_runtime61(stack *Stack) +void gen_runtime63(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 566 "runtime.in" +#line 583 "runtime.in" {Stack->push<pen>(pen(n >= 0 && n < nBaseLine ? (BaseLine) n : DEFBASE)); return;} } -#line 570 "runtime.in" +#line 587 "runtime.in" // Int basealign(pen p=CURRENTPEN); -void gen_runtime62(stack *Stack) +void gen_runtime64(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 571 "runtime.in" +#line 588 "runtime.in" {Stack->push<Int>(p.Baseline()); return;} } -#line 575 "runtime.in" +#line 592 "runtime.in" // transform transform(pen p); -void gen_runtime63(stack *Stack) +void gen_runtime65(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 576 "runtime.in" +#line 593 "runtime.in" {Stack->push<transform>(p.getTransform()); return;} } -#line 580 "runtime.in" +#line 597 "runtime.in" // path nib(pen p); -void gen_runtime64(stack *Stack) +void gen_runtime66(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 581 "runtime.in" +#line 598 "runtime.in" {Stack->push<path>(p.Path()); return;} } -#line 585 "runtime.in" +#line 602 "runtime.in" // pen makepen(path p); -void gen_runtime65(stack *Stack) +void gen_runtime67(stack *Stack) { path p=vm::pop<path>(Stack); -#line 586 "runtime.in" +#line 603 "runtime.in" {Stack->push<pen>(pen(p)); return;} } -#line 590 "runtime.in" +#line 607 "runtime.in" // pen colorless(pen p); -void gen_runtime66(stack *Stack) +void gen_runtime68(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 591 "runtime.in" +#line 608 "runtime.in" p.colorless(); {Stack->push<pen>(p); return;} } // Interactive mode -#line 597 "runtime.in" +#line 614 "runtime.in" // bool interactive(); -void gen_runtime67(stack *Stack) +void gen_runtime69(stack *Stack) { -#line 598 "runtime.in" +#line 615 "runtime.in" {Stack->push<bool>(interact::interactive); return;} } -#line 603 "runtime.in" +#line 620 "runtime.in" // bool uptodate(); -void gen_runtime68(stack *Stack) +void gen_runtime70(stack *Stack) { -#line 604 "runtime.in" +#line 621 "runtime.in" {Stack->push<bool>(interact::uptodate); return;} } // System commands -#line 610 "runtime.in" +#line 627 "runtime.in" // Int system(stringarray *s); -void gen_runtime69(stack *Stack) +void gen_runtime71(stack *Stack) { stringarray * s=vm::pop<stringarray *>(Stack); -#line 611 "runtime.in" +#line 628 "runtime.in" if(safe) error("system() call disabled; override with option -nosafe"); size_t size=checkArray(s); if(size == 0) {Stack->push<Int>(0); return;} @@ -912,57 +938,57 @@ void gen_runtime69(stack *Stack) {Stack->push<Int>(System(cmd)); return;} } -#line 622 "runtime.in" +#line 639 "runtime.in" // bool view(); -void gen_runtime70(stack *Stack) +void gen_runtime72(stack *Stack) { -#line 623 "runtime.in" +#line 640 "runtime.in" {Stack->push<bool>(view()); return;} } -#line 627 "runtime.in" +#line 644 "runtime.in" // string asydir(); -void gen_runtime71(stack *Stack) +void gen_runtime73(stack *Stack) { -#line 628 "runtime.in" +#line 645 "runtime.in" {Stack->push<string>(systemDir); return;} } -#line 632 "runtime.in" +#line 649 "runtime.in" // string locale(string s=emptystring); -void gen_runtime72(stack *Stack) +void gen_runtime74(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); -#line 633 "runtime.in" +#line 650 "runtime.in" char *L=setlocale(LC_ALL,s.empty() ? NULL : s.c_str()); {Stack->push<string>(L != NULL ? string(L) : ""); return;} } -#line 638 "runtime.in" +#line 655 "runtime.in" // void abort(string s=emptystring); -void gen_runtime73(stack *Stack) +void gen_runtime75(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); -#line 639 "runtime.in" +#line 656 "runtime.in" if(s.empty()) throw handled_error(); error(s.c_str()); } -#line 644 "runtime.in" +#line 661 "runtime.in" // void exit(); -void gen_runtime74(stack *) +void gen_runtime76(stack *) { -#line 645 "runtime.in" +#line 662 "runtime.in" throw quit(); } -#line 649 "runtime.in" +#line 666 "runtime.in" // void assert(bool b, string s=emptystring); -void gen_runtime75(stack *Stack) +void gen_runtime77(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); bool b=vm::pop<bool>(Stack); -#line 650 "runtime.in" +#line 667 "runtime.in" flush(cout); if(!b) { ostringstream buf; @@ -972,34 +998,34 @@ void gen_runtime75(stack *Stack) } } -#line 660 "runtime.in" +#line 677 "runtime.in" // void sleep(Int seconds); -void gen_runtime76(stack *Stack) +void gen_runtime78(stack *Stack) { Int seconds=vm::pop<Int>(Stack); -#line 661 "runtime.in" +#line 678 "runtime.in" if(seconds <= 0) return; sleep(seconds); } -#line 666 "runtime.in" +#line 683 "runtime.in" // void usleep(Int microseconds); -void gen_runtime77(stack *Stack) +void gen_runtime79(stack *Stack) { Int microseconds=vm::pop<Int>(Stack); -#line 667 "runtime.in" +#line 684 "runtime.in" if(microseconds <= 0) return; usleep((unsigned long) microseconds); } -#line 672 "runtime.in" +#line 689 "runtime.in" // void _eval(string *s, bool embedded, bool interactiveWrite=false); -void gen_runtime78(stack *Stack) +void gen_runtime80(stack *Stack) { bool interactiveWrite=vm::pop<bool>(Stack,false); bool embedded=vm::pop<bool>(Stack); string * s=vm::pop<string *>(Stack); -#line 673 "runtime.in" +#line 690 "runtime.in" if(embedded) { trans::coenv *e=Stack->getEnvironment(); vm::interactiveStack *is=dynamic_cast<vm::interactiveStack *>(Stack); @@ -1011,13 +1037,13 @@ void gen_runtime78(stack *Stack) runString(*s,interactiveWrite); } -#line 685 "runtime.in" +#line 702 "runtime.in" // void _eval(runnable *s, bool embedded); -void gen_runtime79(stack *Stack) +void gen_runtime81(stack *Stack) { bool embedded=vm::pop<bool>(Stack); runnable * s=vm::pop<runnable *>(Stack); -#line 686 "runtime.in" +#line 703 "runtime.in" absyntax::block *ast=new absyntax::block(s->getPos(), false); ast->add(s); @@ -1032,42 +1058,46 @@ void gen_runtime79(stack *Stack) runCode(ast); } -#line 701 "runtime.in" +#line 718 "runtime.in" // string location(); -void gen_runtime80(stack *Stack) +void gen_runtime82(stack *Stack) { -#line 702 "runtime.in" +#line 719 "runtime.in" ostringstream buf; buf << getPos(); {Stack->push<string>(buf.str()); return;} } // Wrapper for the stack::load() method. -#line 708 "runtime.in" +#line 725 "runtime.in" void loadModule(stack *Stack) { string * index=vm::pop<string *>(Stack); -#line 709 "runtime.in" +#line 726 "runtime.in" Stack->load(*index); } -#line 713 "runtime.in" +#line 730 "runtime.in" // string cd(string s=emptystring); -void gen_runtime82(stack *Stack) +void gen_runtime84(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); -#line 714 "runtime.in" - if(!s.empty() && !globalwrite()) writeDisabled(); +#line 731 "runtime.in" + if(!s.empty() && !globalwrite()) { + string outname=getSetting<string>("outname"); + string dir=stripDir(outname); + if(dir.empty()) Setting("outname")=getPath()+dirsep+outname; + } {Stack->push<string>(setPath(s.c_str())); return;} } -#line 719 "runtime.in" +#line 740 "runtime.in" // void list(string *s, bool imports=false); -void gen_runtime83(stack *Stack) +void gen_runtime85(stack *Stack) { bool imports=vm::pop<bool>(Stack,false); string * s=vm::pop<string *>(Stack); -#line 720 "runtime.in" +#line 741 "runtime.in" if(*s == "-") return; trans::genv ge; symbol *name=symbol::trans(*s); @@ -1077,18 +1107,18 @@ void gen_runtime83(stack *Stack) // Guide operations -#line 730 "runtime.in" +#line 751 "runtime.in" void nullGuide(stack *Stack) { -#line 731 "runtime.in" +#line 752 "runtime.in" {Stack->push<guide*>(new pathguide(path())); return;} } -#line 736 "runtime.in" +#line 757 "runtime.in" void dotsGuide(stack *Stack) { guidearray * a=vm::pop<guidearray *>(Stack); -#line 737 "runtime.in" +#line 758 "runtime.in" guidevector v; size_t size=checkArray(a); for (size_t i=0; i < size; ++i) @@ -1097,11 +1127,11 @@ void dotsGuide(stack *Stack) {Stack->push<guide*>(new multiguide(v)); return;} } -#line 746 "runtime.in" +#line 767 "runtime.in" void dashesGuide(stack *Stack) { guidearray * a=vm::pop<guidearray *>(Stack); -#line 747 "runtime.in" +#line 768 "runtime.in" static camp::curlSpec curly; static specguide curlout(&curly, camp::OUT); static specguide curlin(&curly, camp::IN); @@ -1127,179 +1157,179 @@ void dashesGuide(stack *Stack) {Stack->push<guide*>(new multiguide(v)); return;} } -#line 773 "runtime.in" +#line 794 "runtime.in" void newCycleToken(stack *Stack) { -#line 774 "runtime.in" +#line 795 "runtime.in" {Stack->push<cycleToken>(cycleToken()); return;} } -#line 778 "runtime.in" +#line 799 "runtime.in" // guide* operator cast(cycleToken tok); -void gen_runtime88(stack *Stack) +void gen_runtime90(stack *Stack) { cycleToken tok=vm::pop<cycleToken>(Stack); -#line 779 "runtime.in" +#line 800 "runtime.in" // Avoid unused variable warning messages. unused(&tok); {Stack->push<guide*>(new cycletokguide()); return;} } -#line 785 "runtime.in" +#line 806 "runtime.in" // guide* operator spec(pair z, Int p); -void gen_runtime89(stack *Stack) +void gen_runtime91(stack *Stack) { Int p=vm::pop<Int>(Stack); pair z=vm::pop<pair>(Stack); -#line 786 "runtime.in" +#line 807 "runtime.in" camp::side d=(camp::side) p; camp::dirSpec *sp=new camp::dirSpec(z); {Stack->push<guide*>(new specguide(sp,d)); return;} } -#line 793 "runtime.in" +#line 814 "runtime.in" // curlSpecifier operator curl(real gamma, Int p); -void gen_runtime90(stack *Stack) +void gen_runtime92(stack *Stack) { Int p=vm::pop<Int>(Stack); real gamma=vm::pop<real>(Stack); -#line 794 "runtime.in" +#line 815 "runtime.in" camp::side s=(camp::side) p; {Stack->push<curlSpecifier>(curlSpecifier(gamma,s)); return;} } -#line 799 "runtime.in" +#line 820 "runtime.in" void curlSpecifierValuePart(stack *Stack) { curlSpecifier spec=vm::pop<curlSpecifier>(Stack); -#line 800 "runtime.in" +#line 821 "runtime.in" {Stack->push<real>(spec.getValue()); return;} } -#line 804 "runtime.in" +#line 825 "runtime.in" void curlSpecifierSidePart(stack *Stack) { curlSpecifier spec=vm::pop<curlSpecifier>(Stack); -#line 805 "runtime.in" +#line 826 "runtime.in" {Stack->push<Int>(spec.getSide()); return;} } -#line 809 "runtime.in" +#line 830 "runtime.in" // guide* operator cast(curlSpecifier spec); -void gen_runtime93(stack *Stack) +void gen_runtime95(stack *Stack) { curlSpecifier spec=vm::pop<curlSpecifier>(Stack); -#line 810 "runtime.in" +#line 831 "runtime.in" {Stack->push<guide*>(new specguide(spec)); return;} } -#line 814 "runtime.in" +#line 835 "runtime.in" // tensionSpecifier operator tension(real tout, real tin, bool atleast); -void gen_runtime94(stack *Stack) +void gen_runtime96(stack *Stack) { bool atleast=vm::pop<bool>(Stack); real tin=vm::pop<real>(Stack); real tout=vm::pop<real>(Stack); -#line 815 "runtime.in" +#line 836 "runtime.in" {Stack->push<tensionSpecifier>(tensionSpecifier(tout, tin, atleast)); return;} } -#line 819 "runtime.in" +#line 840 "runtime.in" void tensionSpecifierOutPart(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 820 "runtime.in" +#line 841 "runtime.in" {Stack->push<real>(t.getOut()); return;} } -#line 824 "runtime.in" +#line 845 "runtime.in" void tensionSpecifierInPart(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 825 "runtime.in" +#line 846 "runtime.in" {Stack->push<real>(t.getIn()); return;} } -#line 829 "runtime.in" +#line 850 "runtime.in" void tensionSpecifierAtleastPart(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 830 "runtime.in" +#line 851 "runtime.in" {Stack->push<bool>(t.getAtleast()); return;} } -#line 834 "runtime.in" +#line 855 "runtime.in" // guide* operator cast(tensionSpecifier t); -void gen_runtime98(stack *Stack) +void gen_runtime100(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 835 "runtime.in" +#line 856 "runtime.in" {Stack->push<guide*>(new tensionguide(t)); return;} } -#line 839 "runtime.in" +#line 860 "runtime.in" // guide* operator controls(pair zout, pair zin); -void gen_runtime99(stack *Stack) +void gen_runtime101(stack *Stack) { pair zin=vm::pop<pair>(Stack); pair zout=vm::pop<pair>(Stack); -#line 840 "runtime.in" +#line 861 "runtime.in" {Stack->push<guide*>(new controlguide(zout, zin)); return;} } -#line 844 "runtime.in" +#line 865 "runtime.in" // Int size(guide *g); -void gen_runtime100(stack *Stack) +void gen_runtime102(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 845 "runtime.in" +#line 866 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<Int>(f.size()); return;} } -#line 851 "runtime.in" +#line 872 "runtime.in" // Int length(guide *g); -void gen_runtime101(stack *Stack) +void gen_runtime103(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 852 "runtime.in" +#line 873 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<Int>(g->cyclic() ? f.size() : f.size()-1); return;} } -#line 858 "runtime.in" +#line 879 "runtime.in" // bool cyclic(guide *g); -void gen_runtime102(stack *Stack) +void gen_runtime104(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 859 "runtime.in" +#line 880 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<bool>(g->cyclic()); return;} } -#line 865 "runtime.in" +#line 886 "runtime.in" // pair point(guide *g, Int t); -void gen_runtime103(stack *Stack) +void gen_runtime105(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 866 "runtime.in" +#line 887 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<pair>(f.Nodes(adjustedIndex(t,f.size(),g->cyclic())).z); return;} } -#line 872 "runtime.in" +#line 893 "runtime.in" // pairarray* dirSpecifier(guide *g, Int t); -void gen_runtime104(stack *Stack) +void gen_runtime106(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 873 "runtime.in" +#line 894 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -1310,13 +1340,13 @@ void gen_runtime104(stack *Stack) {Stack->push<pairarray*>(c); return;} } -#line 884 "runtime.in" +#line 905 "runtime.in" // pairarray* controlSpecifier(guide *g, Int t); -void gen_runtime105(stack *Stack) +void gen_runtime107(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 885 "runtime.in" +#line 906 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -1332,13 +1362,13 @@ void gen_runtime105(stack *Stack) } else {Stack->push<pairarray*>(new array(0)); return;} } -#line 901 "runtime.in" +#line 922 "runtime.in" // tensionSpecifier tensionSpecifier(guide *g, Int t); -void gen_runtime106(stack *Stack) +void gen_runtime108(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 902 "runtime.in" +#line 923 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -1347,13 +1377,13 @@ void gen_runtime106(stack *Stack) {Stack->push<tensionSpecifier>(tensionSpecifier(curr.tout.val,f.Nodes(t+1).tin.val,curr.tout.atleast)); return;} } -#line 911 "runtime.in" +#line 932 "runtime.in" // realarray* curlSpecifier(guide *g, Int t); -void gen_runtime107(stack *Stack) +void gen_runtime109(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 912 "runtime.in" +#line 933 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -1366,12 +1396,12 @@ void gen_runtime107(stack *Stack) {Stack->push<realarray*>(c); return;} } -#line 925 "runtime.in" +#line 946 "runtime.in" // guide* reverse(guide *g); -void gen_runtime108(stack *Stack) +void gen_runtime110(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 926 "runtime.in" +#line 947 "runtime.in" flatguide f; g->flatten(f,false); if(f.precyclic()) @@ -1424,11 +1454,11 @@ void gen_runtime108(stack *Stack) {Stack->push<guide*>(new multiguide(v)); return;} } -#line 980 "runtime.in" +#line 1001 "runtime.in" // realarray* _cputime(); -void gen_runtime109(stack *Stack) +void gen_runtime111(stack *Stack) { -#line 981 "runtime.in" +#line 1002 "runtime.in" static const real ticktime=1.0/sysconf(_SC_CLK_TCK); struct tms buf; @@ -1443,103 +1473,103 @@ void gen_runtime109(stack *Stack) // Transforms -#line 996 "runtime.in" +#line 1017 "runtime.in" // bool ==(transform a, transform b); -void gen_runtime110(stack *Stack) +void gen_runtime112(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 997 "runtime.in" +#line 1018 "runtime.in" {Stack->push<bool>(a == b); return;} } -#line 1002 "runtime.in" +#line 1023 "runtime.in" // bool !=(transform a, transform b); -void gen_runtime111(stack *Stack) +void gen_runtime113(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 1003 "runtime.in" +#line 1024 "runtime.in" {Stack->push<bool>(a != b); return;} } -#line 1007 "runtime.in" +#line 1028 "runtime.in" // transform +(transform a, transform b); -void gen_runtime112(stack *Stack) +void gen_runtime114(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 1008 "runtime.in" +#line 1029 "runtime.in" {Stack->push<transform>(a+b); return;} } -#line 1012 "runtime.in" +#line 1033 "runtime.in" // transform *(transform a, transform b); -void gen_runtime113(stack *Stack) +void gen_runtime115(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 1013 "runtime.in" +#line 1034 "runtime.in" {Stack->push<transform>(a*b); return;} } -#line 1017 "runtime.in" +#line 1038 "runtime.in" // pair *(transform t, pair z); -void gen_runtime114(stack *Stack) +void gen_runtime116(stack *Stack) { pair z=vm::pop<pair>(Stack); transform t=vm::pop<transform>(Stack); -#line 1018 "runtime.in" +#line 1039 "runtime.in" {Stack->push<pair>(t*z); return;} } -#line 1022 "runtime.in" +#line 1043 "runtime.in" // path *(transform t, path g); -void gen_runtime115(stack *Stack) +void gen_runtime117(stack *Stack) { path g=vm::pop<path>(Stack); transform t=vm::pop<transform>(Stack); -#line 1023 "runtime.in" +#line 1044 "runtime.in" {Stack->push<path>(transformed(t,g)); return;} } -#line 1027 "runtime.in" +#line 1048 "runtime.in" // pen *(transform t, pen p); -void gen_runtime116(stack *Stack) +void gen_runtime118(stack *Stack) { pen p=vm::pop<pen>(Stack); transform t=vm::pop<transform>(Stack); -#line 1028 "runtime.in" +#line 1049 "runtime.in" {Stack->push<pen>(transformed(t,p)); return;} } -#line 1032 "runtime.in" +#line 1053 "runtime.in" // picture* *(transform t, picture *f); -void gen_runtime117(stack *Stack) +void gen_runtime119(stack *Stack) { picture * f=vm::pop<picture *>(Stack); transform t=vm::pop<transform>(Stack); -#line 1033 "runtime.in" +#line 1054 "runtime.in" {Stack->push<picture*>(transformed(t,f)); return;} } -#line 1037 "runtime.in" +#line 1058 "runtime.in" // picture* *(realarray2 *t, picture *f); -void gen_runtime118(stack *Stack) +void gen_runtime120(stack *Stack) { picture * f=vm::pop<picture *>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); -#line 1038 "runtime.in" +#line 1059 "runtime.in" {Stack->push<picture*>(transformed(*t,f)); return;} } -#line 1042 "runtime.in" +#line 1063 "runtime.in" // transform ^(transform t, Int n); -void gen_runtime119(stack *Stack) +void gen_runtime121(stack *Stack) { Int n=vm::pop<Int>(Stack); transform t=vm::pop<transform>(Stack); -#line 1043 "runtime.in" +#line 1064 "runtime.in" transform T; if(n < 0) { n=-n; @@ -1549,55 +1579,55 @@ void gen_runtime119(stack *Stack) {Stack->push<transform>(T); return;} } -#line 1053 "runtime.in" +#line 1074 "runtime.in" void transformXPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1054 "runtime.in" +#line 1075 "runtime.in" {Stack->push<real>(t.getx()); return;} } -#line 1058 "runtime.in" +#line 1079 "runtime.in" void transformYPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1059 "runtime.in" +#line 1080 "runtime.in" {Stack->push<real>(t.gety()); return;} } -#line 1063 "runtime.in" +#line 1084 "runtime.in" void transformXXPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1064 "runtime.in" +#line 1085 "runtime.in" {Stack->push<real>(t.getxx()); return;} } -#line 1068 "runtime.in" +#line 1089 "runtime.in" void transformXYPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1069 "runtime.in" +#line 1090 "runtime.in" {Stack->push<real>(t.getxy()); return;} } -#line 1073 "runtime.in" +#line 1094 "runtime.in" void transformYXPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1074 "runtime.in" +#line 1095 "runtime.in" {Stack->push<real>(t.getyx()); return;} } -#line 1078 "runtime.in" +#line 1099 "runtime.in" void transformYYPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1079 "runtime.in" +#line 1100 "runtime.in" {Stack->push<real>(t.getyy()); return;} } -#line 1083 "runtime.in" +#line 1104 "runtime.in" void real6ToTransform(stack *Stack) { real yy=vm::pop<real>(Stack); @@ -1606,127 +1636,127 @@ void real6ToTransform(stack *Stack) real xx=vm::pop<real>(Stack); real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 1085 "runtime.in" +#line 1106 "runtime.in" {Stack->push<transform>(transform(x,y,xx,xy,yx,yy)); return;} } -#line 1089 "runtime.in" +#line 1110 "runtime.in" // transform shift(transform t); -void gen_runtime127(stack *Stack) +void gen_runtime129(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1090 "runtime.in" +#line 1111 "runtime.in" {Stack->push<transform>(transform(t.getx(),t.gety(),0,0,0,0)); return;} } -#line 1094 "runtime.in" +#line 1115 "runtime.in" // transform shiftless(transform t); -void gen_runtime128(stack *Stack) +void gen_runtime130(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1095 "runtime.in" +#line 1116 "runtime.in" {Stack->push<transform>(transform(0,0,t.getxx(),t.getxy(),t.getyx(),t.getyy())); return;} } -#line 1099 "runtime.in" +#line 1120 "runtime.in" // transform identity(); void transformIdentity(stack *Stack) { -#line 1100 "runtime.in" +#line 1121 "runtime.in" {Stack->push<transform>(identity); return;} } -#line 1104 "runtime.in" +#line 1125 "runtime.in" // transform inverse(transform t); -void gen_runtime130(stack *Stack) +void gen_runtime132(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1105 "runtime.in" +#line 1126 "runtime.in" {Stack->push<transform>(inverse(t)); return;} } -#line 1109 "runtime.in" +#line 1130 "runtime.in" // transform shift(pair z); -void gen_runtime131(stack *Stack) +void gen_runtime133(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 1110 "runtime.in" +#line 1131 "runtime.in" {Stack->push<transform>(shift(z)); return;} } -#line 1114 "runtime.in" +#line 1135 "runtime.in" // transform shift(real x, real y); -void gen_runtime132(stack *Stack) +void gen_runtime134(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 1115 "runtime.in" +#line 1136 "runtime.in" {Stack->push<transform>(shift(pair(x,y))); return;} } -#line 1119 "runtime.in" +#line 1140 "runtime.in" // transform xscale(real x); -void gen_runtime133(stack *Stack) +void gen_runtime135(stack *Stack) { real x=vm::pop<real>(Stack); -#line 1120 "runtime.in" +#line 1141 "runtime.in" {Stack->push<transform>(xscale(x)); return;} } -#line 1124 "runtime.in" +#line 1145 "runtime.in" // transform yscale(real y); -void gen_runtime134(stack *Stack) +void gen_runtime136(stack *Stack) { real y=vm::pop<real>(Stack); -#line 1125 "runtime.in" +#line 1146 "runtime.in" {Stack->push<transform>(yscale(y)); return;} } -#line 1129 "runtime.in" +#line 1150 "runtime.in" // transform scale(real x); -void gen_runtime135(stack *Stack) +void gen_runtime137(stack *Stack) { real x=vm::pop<real>(Stack); -#line 1130 "runtime.in" +#line 1151 "runtime.in" {Stack->push<transform>(scale(x)); return;} } -#line 1134 "runtime.in" +#line 1155 "runtime.in" // transform scale(real x, real y); -void gen_runtime136(stack *Stack) +void gen_runtime138(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 1135 "runtime.in" - {Stack->push<transform>(xscale(x)*yscale(y)); return;} +#line 1156 "runtime.in" + {Stack->push<transform>(scale(x,y)); return;} } -#line 1139 "runtime.in" +#line 1160 "runtime.in" // transform slant(real s); -void gen_runtime137(stack *Stack) +void gen_runtime139(stack *Stack) { real s=vm::pop<real>(Stack); -#line 1140 "runtime.in" +#line 1161 "runtime.in" {Stack->push<transform>(slant(s)); return;} } -#line 1144 "runtime.in" +#line 1165 "runtime.in" // transform rotate(real angle, pair z=0); -void gen_runtime138(stack *Stack) +void gen_runtime140(stack *Stack) { pair z=vm::pop<pair>(Stack,0); real angle=vm::pop<real>(Stack); -#line 1145 "runtime.in" +#line 1166 "runtime.in" {Stack->push<transform>(rotatearound(z,radians(angle))); return;} } -#line 1149 "runtime.in" +#line 1170 "runtime.in" // transform reflect(pair a, pair b); -void gen_runtime139(stack *Stack) +void gen_runtime141(stack *Stack) { pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 1150 "runtime.in" +#line 1171 "runtime.in" {Stack->push<transform>(reflectabout(a,b)); return;} } @@ -1801,221 +1831,225 @@ void gen_runtime_venv(venv &ve) #line 383 "runtime.in" addFunc(ve, run::gen_runtime31, realArray(), "colors", formal(primPen(), "p", false, false)); #line 411 "runtime.in" - addFunc(ve, run::gen_runtime32, primString() , "colorspace", formal(primPen(), "p", false, false)); -#line 418 "runtime.in" - addFunc(ve, run::gen_runtime33, primPen(), "pattern", formal(primString(), "s", false, false)); -#line 423 "runtime.in" - addFunc(ve, run::gen_runtime34, primString() , "pattern", formal(primPen(), "p", false, false)); + addFunc(ve, run::gen_runtime32, primString() , "hex", formal(primPen(), "p", false, false)); +#line 416 "runtime.in" + addFunc(ve, run::gen_runtime33, primInt(), "byte", formal(primReal(), "x", false, false)); +#line 421 "runtime.in" + addFunc(ve, run::gen_runtime34, primString() , "colorspace", formal(primPen(), "p", false, false)); #line 428 "runtime.in" - addFunc(ve, run::gen_runtime35, primPen(), "fillrule", formal(primInt(), "n", false, false)); + addFunc(ve, run::gen_runtime35, primPen(), "pattern", formal(primString(), "s", false, false)); #line 433 "runtime.in" - addFunc(ve, run::gen_runtime36, primInt(), "fillrule", formal(primPen(), "p", false, false)); + addFunc(ve, run::gen_runtime36, primString() , "pattern", formal(primPen(), "p", false, false)); #line 438 "runtime.in" - addFunc(ve, run::gen_runtime37, primPen(), "opacity", formal(primReal(), "opacity", true, false), formal(primString() , "blend", true, false)); + addFunc(ve, run::gen_runtime37, primPen(), "fillrule", formal(primInt(), "n", false, false)); +#line 443 "runtime.in" + addFunc(ve, run::gen_runtime38, primInt(), "fillrule", formal(primPen(), "p", false, false)); #line 448 "runtime.in" - addFunc(ve, run::gen_runtime38, primReal(), "opacity", formal(primPen(), "p", false, false)); -#line 453 "runtime.in" - addFunc(ve, run::gen_runtime39, primString() , "blend", formal(primPen(), "p", false, false)); + addFunc(ve, run::gen_runtime39, primPen(), "opacity", formal(primReal(), "opacity", true, false), formal(primString() , "blend", true, false)); #line 458 "runtime.in" - addFunc(ve, run::gen_runtime40, primPen(), "linetype", formal(primString(), "s", false, false), formal(primReal(), "offset", true, false), formal(primBoolean(), "scale", true, false), formal(primBoolean(), "adjust", true, false)); + addFunc(ve, run::gen_runtime40, primReal(), "opacity", formal(primPen(), "p", false, false)); #line 463 "runtime.in" - addFunc(ve, run::gen_runtime41, primString() , "linetype", formal(primPen(), "p", true, false)); + addFunc(ve, run::gen_runtime41, primString() , "blend", formal(primPen(), "p", false, false)); #line 468 "runtime.in" - addFunc(ve, run::gen_runtime42, primReal(), "offset", formal(primPen(), "p", false, false)); -#line 473 "runtime.in" - addFunc(ve, run::gen_runtime43, primBoolean(), "scale", formal(primPen(), "p", false, false)); -#line 478 "runtime.in" - addFunc(ve, run::gen_runtime44, primBoolean(), "adjust", formal(primPen(), "p", false, false)); -#line 483 "runtime.in" - addFunc(ve, run::gen_runtime45, primPen(), "adjust", formal(primPen(), "p", false, false), formal(primReal(), "arclength", false, false), formal(primBoolean(), "cyclic", false, false)); -#line 488 "runtime.in" - addFunc(ve, run::gen_runtime46, primPen(), "linecap", formal(primInt(), "n", false, false)); -#line 493 "runtime.in" - addFunc(ve, run::gen_runtime47, primInt(), "linecap", formal(primPen(), "p", true, false)); -#line 498 "runtime.in" - addFunc(ve, run::gen_runtime48, primPen(), "linejoin", formal(primInt(), "n", false, false)); -#line 503 "runtime.in" - addFunc(ve, run::gen_runtime49, primInt(), "linejoin", formal(primPen(), "p", true, false)); -#line 508 "runtime.in" - addFunc(ve, run::gen_runtime50, primPen(), "miterlimit", formal(primReal(), "x", false, false)); -#line 513 "runtime.in" - addFunc(ve, run::gen_runtime51, primReal(), "miterlimit", formal(primPen(), "p", true, false)); -#line 518 "runtime.in" - addFunc(ve, run::gen_runtime52, primPen(), "linewidth", formal(primReal(), "x", false, false)); -#line 523 "runtime.in" - addFunc(ve, run::gen_runtime53, primReal(), "linewidth", formal(primPen(), "p", true, false)); -#line 528 "runtime.in" - addFunc(ve, run::gen_runtime54, primPen(), "fontcommand", formal(primString(), "s", false, false)); -#line 533 "runtime.in" - addFunc(ve, run::gen_runtime55, primString() , "font", formal(primPen(), "p", true, false)); -#line 538 "runtime.in" - addFunc(ve, run::gen_runtime56, primPen(), "fontsize", formal(primReal(), "size", false, false), formal(primReal(), "lineskip", false, false)); -#line 544 "runtime.in" - addFunc(ve, run::gen_runtime57, primReal(), "fontsize", formal(primPen(), "p", true, false)); -#line 549 "runtime.in" - addFunc(ve, run::gen_runtime58, primReal(), "lineskip", formal(primPen(), "p", true, false)); -#line 554 "runtime.in" - addFunc(ve, run::gen_runtime59, primPen(), "overwrite", formal(primInt(), "n", false, false)); -#line 560 "runtime.in" - addFunc(ve, run::gen_runtime60, primInt(), "overwrite", formal(primPen(), "p", true, false)); -#line 565 "runtime.in" - addFunc(ve, run::gen_runtime61, primPen(), "basealign", formal(primInt(), "n", false, false)); -#line 570 "runtime.in" - addFunc(ve, run::gen_runtime62, primInt(), "basealign", formal(primPen(), "p", true, false)); -#line 575 "runtime.in" - addFunc(ve, run::gen_runtime63, primTransform(), "transform", formal(primPen(), "p", false, false)); -#line 580 "runtime.in" - addFunc(ve, run::gen_runtime64, primPath(), "nib", formal(primPen(), "p", false, false)); -#line 585 "runtime.in" - addFunc(ve, run::gen_runtime65, primPen(), "makepen", formal(primPath(), "p", false, false)); -#line 590 "runtime.in" - addFunc(ve, run::gen_runtime66, primPen(), "colorless", formal(primPen(), "p", false, false)); -#line 596 "runtime.in" - addFunc(ve, run::gen_runtime67, primBoolean(), "interactive"); -#line 603 "runtime.in" - addFunc(ve, run::gen_runtime68, primBoolean(), "uptodate"); -#line 608 "runtime.in" - addFunc(ve, run::gen_runtime69, primInt(), "system", formal(stringArray(), "s", false, false)); -#line 622 "runtime.in" - addFunc(ve, run::gen_runtime70, primBoolean(), "view"); -#line 627 "runtime.in" - addFunc(ve, run::gen_runtime71, primString() , "asydir"); -#line 632 "runtime.in" - addFunc(ve, run::gen_runtime72, primString() , "locale", formal(primString() , "s", true, false)); -#line 638 "runtime.in" - addFunc(ve, run::gen_runtime73, primVoid(), "abort", formal(primString() , "s", true, false)); + addFunc(ve, run::gen_runtime42, primPen(), "linetype", formal(realArray(), "pattern", false, false), formal(primReal(), "offset", true, false), formal(primBoolean(), "scale", true, false), formal(primBoolean(), "adjust", true, false)); +#line 479 "runtime.in" + addFunc(ve, run::gen_runtime43, realArray(), "linetype", formal(primPen(), "p", true, false)); +#line 485 "runtime.in" + addFunc(ve, run::gen_runtime44, primReal(), "offset", formal(primPen(), "p", false, false)); +#line 490 "runtime.in" + addFunc(ve, run::gen_runtime45, primBoolean(), "scale", formal(primPen(), "p", false, false)); +#line 495 "runtime.in" + addFunc(ve, run::gen_runtime46, primBoolean(), "adjust", formal(primPen(), "p", false, false)); +#line 500 "runtime.in" + addFunc(ve, run::gen_runtime47, primPen(), "adjust", formal(primPen(), "p", false, false), formal(primReal(), "arclength", false, false), formal(primBoolean(), "cyclic", false, false)); +#line 505 "runtime.in" + addFunc(ve, run::gen_runtime48, primPen(), "linecap", formal(primInt(), "n", false, false)); +#line 510 "runtime.in" + addFunc(ve, run::gen_runtime49, primInt(), "linecap", formal(primPen(), "p", true, false)); +#line 515 "runtime.in" + addFunc(ve, run::gen_runtime50, primPen(), "linejoin", formal(primInt(), "n", false, false)); +#line 520 "runtime.in" + addFunc(ve, run::gen_runtime51, primInt(), "linejoin", formal(primPen(), "p", true, false)); +#line 525 "runtime.in" + addFunc(ve, run::gen_runtime52, primPen(), "miterlimit", formal(primReal(), "x", false, false)); +#line 530 "runtime.in" + addFunc(ve, run::gen_runtime53, primReal(), "miterlimit", formal(primPen(), "p", true, false)); +#line 535 "runtime.in" + addFunc(ve, run::gen_runtime54, primPen(), "linewidth", formal(primReal(), "x", false, false)); +#line 540 "runtime.in" + addFunc(ve, run::gen_runtime55, primReal(), "linewidth", formal(primPen(), "p", true, false)); +#line 545 "runtime.in" + addFunc(ve, run::gen_runtime56, primPen(), "fontcommand", formal(primString(), "s", false, false)); +#line 550 "runtime.in" + addFunc(ve, run::gen_runtime57, primString() , "font", formal(primPen(), "p", true, false)); +#line 555 "runtime.in" + addFunc(ve, run::gen_runtime58, primPen(), "fontsize", formal(primReal(), "size", false, false), formal(primReal(), "lineskip", false, false)); +#line 561 "runtime.in" + addFunc(ve, run::gen_runtime59, primReal(), "fontsize", formal(primPen(), "p", true, false)); +#line 566 "runtime.in" + addFunc(ve, run::gen_runtime60, primReal(), "lineskip", formal(primPen(), "p", true, false)); +#line 571 "runtime.in" + addFunc(ve, run::gen_runtime61, primPen(), "overwrite", formal(primInt(), "n", false, false)); +#line 577 "runtime.in" + addFunc(ve, run::gen_runtime62, primInt(), "overwrite", formal(primPen(), "p", true, false)); +#line 582 "runtime.in" + addFunc(ve, run::gen_runtime63, primPen(), "basealign", formal(primInt(), "n", false, false)); +#line 587 "runtime.in" + addFunc(ve, run::gen_runtime64, primInt(), "basealign", formal(primPen(), "p", true, false)); +#line 592 "runtime.in" + addFunc(ve, run::gen_runtime65, primTransform(), "transform", formal(primPen(), "p", false, false)); +#line 597 "runtime.in" + addFunc(ve, run::gen_runtime66, primPath(), "nib", formal(primPen(), "p", false, false)); +#line 602 "runtime.in" + addFunc(ve, run::gen_runtime67, primPen(), "makepen", formal(primPath(), "p", false, false)); +#line 607 "runtime.in" + addFunc(ve, run::gen_runtime68, primPen(), "colorless", formal(primPen(), "p", false, false)); +#line 613 "runtime.in" + addFunc(ve, run::gen_runtime69, primBoolean(), "interactive"); +#line 620 "runtime.in" + addFunc(ve, run::gen_runtime70, primBoolean(), "uptodate"); +#line 625 "runtime.in" + addFunc(ve, run::gen_runtime71, primInt(), "system", formal(stringArray(), "s", false, false)); +#line 639 "runtime.in" + addFunc(ve, run::gen_runtime72, primBoolean(), "view"); #line 644 "runtime.in" - addFunc(ve, run::gen_runtime74, primVoid(), "exit"); + addFunc(ve, run::gen_runtime73, primString() , "asydir"); #line 649 "runtime.in" - addFunc(ve, run::gen_runtime75, primVoid(), "assert", formal(primBoolean(), "b", false, false), formal(primString() , "s", true, false)); -#line 660 "runtime.in" - addFunc(ve, run::gen_runtime76, primVoid(), "sleep", formal(primInt(), "seconds", false, false)); + addFunc(ve, run::gen_runtime74, primString() , "locale", formal(primString() , "s", true, false)); +#line 655 "runtime.in" + addFunc(ve, run::gen_runtime75, primVoid(), "abort", formal(primString() , "s", true, false)); +#line 661 "runtime.in" + addFunc(ve, run::gen_runtime76, primVoid(), "exit"); #line 666 "runtime.in" - addFunc(ve, run::gen_runtime77, primVoid(), "usleep", formal(primInt(), "microseconds", false, false)); -#line 672 "runtime.in" - addFunc(ve, run::gen_runtime78, primVoid(), "_eval", formal(primString(), "s", false, false), formal(primBoolean(), "embedded", false, false), formal(primBoolean(), "interactivewrite", true, false)); -#line 685 "runtime.in" - addFunc(ve, run::gen_runtime79, primVoid(), "_eval", formal(primCode(), "s", false, false), formal(primBoolean(), "embedded", false, false)); -#line 701 "runtime.in" - addFunc(ve, run::gen_runtime80, primString() , "location"); -#line 707 "runtime.in" + addFunc(ve, run::gen_runtime77, primVoid(), "assert", formal(primBoolean(), "b", false, false), formal(primString() , "s", true, false)); +#line 677 "runtime.in" + addFunc(ve, run::gen_runtime78, primVoid(), "sleep", formal(primInt(), "seconds", false, false)); +#line 683 "runtime.in" + addFunc(ve, run::gen_runtime79, primVoid(), "usleep", formal(primInt(), "microseconds", false, false)); +#line 689 "runtime.in" + addFunc(ve, run::gen_runtime80, primVoid(), "_eval", formal(primString(), "s", false, false), formal(primBoolean(), "embedded", false, false), formal(primBoolean(), "interactivewrite", true, false)); +#line 702 "runtime.in" + addFunc(ve, run::gen_runtime81, primVoid(), "_eval", formal(primCode(), "s", false, false), formal(primBoolean(), "embedded", false, false)); +#line 718 "runtime.in" + addFunc(ve, run::gen_runtime82, primString() , "location"); +#line 724 "runtime.in" REGISTER_BLTIN(run::loadModule,"loadModule"); -#line 713 "runtime.in" - addFunc(ve, run::gen_runtime82, primString() , "cd", formal(primString() , "s", true, false)); -#line 719 "runtime.in" - addFunc(ve, run::gen_runtime83, primVoid(), "list", formal(primString(), "s", false, false), formal(primBoolean(), "imports", true, false)); -#line 728 "runtime.in" +#line 730 "runtime.in" + addFunc(ve, run::gen_runtime84, primString() , "cd", formal(primString() , "s", true, false)); +#line 740 "runtime.in" + addFunc(ve, run::gen_runtime85, primVoid(), "list", formal(primString(), "s", false, false), formal(primBoolean(), "imports", true, false)); +#line 749 "runtime.in" REGISTER_BLTIN(run::nullGuide,"nullGuide"); -#line 736 "runtime.in" +#line 757 "runtime.in" REGISTER_BLTIN(run::dotsGuide,"dotsGuide"); -#line 746 "runtime.in" +#line 767 "runtime.in" REGISTER_BLTIN(run::dashesGuide,"dashesGuide"); -#line 773 "runtime.in" +#line 794 "runtime.in" REGISTER_BLTIN(run::newCycleToken,"newCycleToken"); -#line 778 "runtime.in" - addFunc(ve, run::gen_runtime88, primGuide(), "operator cast", formal(primCycleToken(), "tok", false, false)); -#line 785 "runtime.in" - addFunc(ve, run::gen_runtime89, primGuide(), "operator spec", formal(primPair(), "z", false, false), formal(primInt(), "p", false, false)); -#line 793 "runtime.in" - addFunc(ve, run::gen_runtime90, primCurlSpecifier(), "operator curl", formal(primReal(), "gamma", false, false), formal(primInt(), "p", false, false)); #line 799 "runtime.in" + addFunc(ve, run::gen_runtime90, primGuide(), "operator cast", formal(primCycleToken(), "tok", false, false)); +#line 806 "runtime.in" + addFunc(ve, run::gen_runtime91, primGuide(), "operator spec", formal(primPair(), "z", false, false), formal(primInt(), "p", false, false)); +#line 814 "runtime.in" + addFunc(ve, run::gen_runtime92, primCurlSpecifier(), "operator curl", formal(primReal(), "gamma", false, false), formal(primInt(), "p", false, false)); +#line 820 "runtime.in" REGISTER_BLTIN(run::curlSpecifierValuePart,"curlSpecifierValuePart"); -#line 804 "runtime.in" +#line 825 "runtime.in" REGISTER_BLTIN(run::curlSpecifierSidePart,"curlSpecifierSidePart"); -#line 809 "runtime.in" - addFunc(ve, run::gen_runtime93, primGuide(), "operator cast", formal(primCurlSpecifier(), "spec", false, false)); -#line 814 "runtime.in" - addFunc(ve, run::gen_runtime94, primTensionSpecifier(), "operator tension", formal(primReal(), "tout", false, false), formal(primReal(), "tin", false, false), formal(primBoolean(), "atleast", false, false)); -#line 819 "runtime.in" +#line 830 "runtime.in" + addFunc(ve, run::gen_runtime95, primGuide(), "operator cast", formal(primCurlSpecifier(), "spec", false, false)); +#line 835 "runtime.in" + addFunc(ve, run::gen_runtime96, primTensionSpecifier(), "operator tension", formal(primReal(), "tout", false, false), formal(primReal(), "tin", false, false), formal(primBoolean(), "atleast", false, false)); +#line 840 "runtime.in" REGISTER_BLTIN(run::tensionSpecifierOutPart,"tensionSpecifierOutPart"); -#line 824 "runtime.in" +#line 845 "runtime.in" REGISTER_BLTIN(run::tensionSpecifierInPart,"tensionSpecifierInPart"); -#line 829 "runtime.in" +#line 850 "runtime.in" REGISTER_BLTIN(run::tensionSpecifierAtleastPart,"tensionSpecifierAtleastPart"); -#line 834 "runtime.in" - addFunc(ve, run::gen_runtime98, primGuide(), "operator cast", formal(primTensionSpecifier(), "t", false, false)); -#line 839 "runtime.in" - addFunc(ve, run::gen_runtime99, primGuide(), "operator controls", formal(primPair(), "zout", false, false), formal(primPair(), "zin", false, false)); -#line 844 "runtime.in" - addFunc(ve, run::gen_runtime100, primInt(), "size", formal(primGuide(), "g", false, false)); -#line 851 "runtime.in" - addFunc(ve, run::gen_runtime101, primInt(), "length", formal(primGuide(), "g", false, false)); -#line 858 "runtime.in" - addFunc(ve, run::gen_runtime102, primBoolean(), "cyclic", formal(primGuide(), "g", false, false)); +#line 855 "runtime.in" + addFunc(ve, run::gen_runtime100, primGuide(), "operator cast", formal(primTensionSpecifier(), "t", false, false)); +#line 860 "runtime.in" + addFunc(ve, run::gen_runtime101, primGuide(), "operator controls", formal(primPair(), "zout", false, false), formal(primPair(), "zin", false, false)); #line 865 "runtime.in" - addFunc(ve, run::gen_runtime103, primPair(), "point", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); + addFunc(ve, run::gen_runtime102, primInt(), "size", formal(primGuide(), "g", false, false)); #line 872 "runtime.in" - addFunc(ve, run::gen_runtime104, pairArray(), "dirSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); -#line 884 "runtime.in" - addFunc(ve, run::gen_runtime105, pairArray(), "controlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); -#line 901 "runtime.in" - addFunc(ve, run::gen_runtime106, primTensionSpecifier(), "tensionSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); -#line 911 "runtime.in" - addFunc(ve, run::gen_runtime107, realArray(), "curlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); -#line 925 "runtime.in" - addFunc(ve, run::gen_runtime108, primGuide(), "reverse", formal(primGuide(), "g", false, false)); -#line 980 "runtime.in" - addFunc(ve, run::gen_runtime109, realArray(), "_cputime"); -#line 994 "runtime.in" - addFunc(ve, run::gen_runtime110, primBoolean(), "==", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); -#line 1002 "runtime.in" - addFunc(ve, run::gen_runtime111, primBoolean(), "!=", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); -#line 1007 "runtime.in" - addFunc(ve, run::gen_runtime112, primTransform(), "+", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); -#line 1012 "runtime.in" - addFunc(ve, run::gen_runtime113, primTransform(), "*", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); -#line 1017 "runtime.in" - addFunc(ve, run::gen_runtime114, primPair(), "*", formal(primTransform(), "t", false, false), formal(primPair(), "z", false, false)); -#line 1022 "runtime.in" - addFunc(ve, run::gen_runtime115, primPath(), "*", formal(primTransform(), "t", false, false), formal(primPath(), "g", false, false)); -#line 1027 "runtime.in" - addFunc(ve, run::gen_runtime116, primPen(), "*", formal(primTransform(), "t", false, false), formal(primPen(), "p", false, false)); -#line 1032 "runtime.in" - addFunc(ve, run::gen_runtime117, primPicture(), "*", formal(primTransform(), "t", false, false), formal(primPicture(), "f", false, false)); -#line 1037 "runtime.in" - addFunc(ve, run::gen_runtime118, primPicture(), "*", formal(realArray2(), "t", false, false), formal(primPicture(), "f", false, false)); -#line 1042 "runtime.in" - addFunc(ve, run::gen_runtime119, primTransform(), "^", formal(primTransform(), "t", false, false), formal(primInt(), "n", false, false)); + addFunc(ve, run::gen_runtime103, primInt(), "length", formal(primGuide(), "g", false, false)); +#line 879 "runtime.in" + addFunc(ve, run::gen_runtime104, primBoolean(), "cyclic", formal(primGuide(), "g", false, false)); +#line 886 "runtime.in" + addFunc(ve, run::gen_runtime105, primPair(), "point", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); +#line 893 "runtime.in" + addFunc(ve, run::gen_runtime106, pairArray(), "dirSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); +#line 905 "runtime.in" + addFunc(ve, run::gen_runtime107, pairArray(), "controlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); +#line 922 "runtime.in" + addFunc(ve, run::gen_runtime108, primTensionSpecifier(), "tensionSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); +#line 932 "runtime.in" + addFunc(ve, run::gen_runtime109, realArray(), "curlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false)); +#line 946 "runtime.in" + addFunc(ve, run::gen_runtime110, primGuide(), "reverse", formal(primGuide(), "g", false, false)); +#line 1001 "runtime.in" + addFunc(ve, run::gen_runtime111, realArray(), "_cputime"); +#line 1015 "runtime.in" + addFunc(ve, run::gen_runtime112, primBoolean(), "==", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); +#line 1023 "runtime.in" + addFunc(ve, run::gen_runtime113, primBoolean(), "!=", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); +#line 1028 "runtime.in" + addFunc(ve, run::gen_runtime114, primTransform(), "+", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); +#line 1033 "runtime.in" + addFunc(ve, run::gen_runtime115, primTransform(), "*", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false)); +#line 1038 "runtime.in" + addFunc(ve, run::gen_runtime116, primPair(), "*", formal(primTransform(), "t", false, false), formal(primPair(), "z", false, false)); +#line 1043 "runtime.in" + addFunc(ve, run::gen_runtime117, primPath(), "*", formal(primTransform(), "t", false, false), formal(primPath(), "g", false, false)); +#line 1048 "runtime.in" + addFunc(ve, run::gen_runtime118, primPen(), "*", formal(primTransform(), "t", false, false), formal(primPen(), "p", false, false)); #line 1053 "runtime.in" - REGISTER_BLTIN(run::transformXPart,"transformXPart"); + addFunc(ve, run::gen_runtime119, primPicture(), "*", formal(primTransform(), "t", false, false), formal(primPicture(), "f", false, false)); #line 1058 "runtime.in" - REGISTER_BLTIN(run::transformYPart,"transformYPart"); + addFunc(ve, run::gen_runtime120, primPicture(), "*", formal(realArray2(), "t", false, false), formal(primPicture(), "f", false, false)); #line 1063 "runtime.in" + addFunc(ve, run::gen_runtime121, primTransform(), "^", formal(primTransform(), "t", false, false), formal(primInt(), "n", false, false)); +#line 1074 "runtime.in" + REGISTER_BLTIN(run::transformXPart,"transformXPart"); +#line 1079 "runtime.in" + REGISTER_BLTIN(run::transformYPart,"transformYPart"); +#line 1084 "runtime.in" REGISTER_BLTIN(run::transformXXPart,"transformXXPart"); -#line 1068 "runtime.in" +#line 1089 "runtime.in" REGISTER_BLTIN(run::transformXYPart,"transformXYPart"); -#line 1073 "runtime.in" +#line 1094 "runtime.in" REGISTER_BLTIN(run::transformYXPart,"transformYXPart"); -#line 1078 "runtime.in" +#line 1099 "runtime.in" REGISTER_BLTIN(run::transformYYPart,"transformYYPart"); -#line 1083 "runtime.in" +#line 1104 "runtime.in" REGISTER_BLTIN(run::real6ToTransform,"real6ToTransform"); -#line 1089 "runtime.in" - addFunc(ve, run::gen_runtime127, primTransform(), "shift", formal(primTransform(), "t", false, false)); -#line 1094 "runtime.in" - addFunc(ve, run::gen_runtime128, primTransform(), "shiftless", formal(primTransform(), "t", false, false)); -#line 1099 "runtime.in" +#line 1110 "runtime.in" + addFunc(ve, run::gen_runtime129, primTransform(), "shift", formal(primTransform(), "t", false, false)); +#line 1115 "runtime.in" + addFunc(ve, run::gen_runtime130, primTransform(), "shiftless", formal(primTransform(), "t", false, false)); +#line 1120 "runtime.in" addFunc(ve, run::transformIdentity, primTransform(), "identity"); -#line 1104 "runtime.in" - addFunc(ve, run::gen_runtime130, primTransform(), "inverse", formal(primTransform(), "t", false, false)); -#line 1109 "runtime.in" - addFunc(ve, run::gen_runtime131, primTransform(), "shift", formal(primPair(), "z", false, false)); -#line 1114 "runtime.in" - addFunc(ve, run::gen_runtime132, primTransform(), "shift", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); -#line 1119 "runtime.in" - addFunc(ve, run::gen_runtime133, primTransform(), "xscale", formal(primReal(), "x", false, false)); -#line 1124 "runtime.in" - addFunc(ve, run::gen_runtime134, primTransform(), "yscale", formal(primReal(), "y", false, false)); -#line 1129 "runtime.in" - addFunc(ve, run::gen_runtime135, primTransform(), "scale", formal(primReal(), "x", false, false)); -#line 1134 "runtime.in" - addFunc(ve, run::gen_runtime136, primTransform(), "scale", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); -#line 1139 "runtime.in" - addFunc(ve, run::gen_runtime137, primTransform(), "slant", formal(primReal(), "s", false, false)); -#line 1144 "runtime.in" - addFunc(ve, run::gen_runtime138, primTransform(), "rotate", formal(primReal(), "angle", false, false), formal(primPair(), "z", true, false)); -#line 1149 "runtime.in" - addFunc(ve, run::gen_runtime139, primTransform(), "reflect", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false)); +#line 1125 "runtime.in" + addFunc(ve, run::gen_runtime132, primTransform(), "inverse", formal(primTransform(), "t", false, false)); +#line 1130 "runtime.in" + addFunc(ve, run::gen_runtime133, primTransform(), "shift", formal(primPair(), "z", false, false)); +#line 1135 "runtime.in" + addFunc(ve, run::gen_runtime134, primTransform(), "shift", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); +#line 1140 "runtime.in" + addFunc(ve, run::gen_runtime135, primTransform(), "xscale", formal(primReal(), "x", false, false)); +#line 1145 "runtime.in" + addFunc(ve, run::gen_runtime136, primTransform(), "yscale", formal(primReal(), "y", false, false)); +#line 1150 "runtime.in" + addFunc(ve, run::gen_runtime137, primTransform(), "scale", formal(primReal(), "x", false, false)); +#line 1155 "runtime.in" + addFunc(ve, run::gen_runtime138, primTransform(), "scale", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false)); +#line 1160 "runtime.in" + addFunc(ve, run::gen_runtime139, primTransform(), "slant", formal(primReal(), "s", false, false)); +#line 1165 "runtime.in" + addFunc(ve, run::gen_runtime140, primTransform(), "rotate", formal(primReal(), "angle", false, false), formal(primPair(), "z", true, false)); +#line 1170 "runtime.in" + addFunc(ve, run::gen_runtime141, primTransform(), "reflect", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false)); } } // namespace trans diff --git a/Build/source/utils/asymptote/runtime.in b/Build/source/utils/asymptote/runtime.in index 08aabf2ea3e..09a946e6b60 100644 --- a/Build/source/utils/asymptote/runtime.in +++ b/Build/source/utils/asymptote/runtime.in @@ -408,6 +408,16 @@ realarray *colors(pen p) return a; } +string hex(pen p) +{ + return p.hex(); +} + +Int byte(real x) +{ + return byte(x); +} + string colorspace(pen p) { string s=ColorDeviceSuffix[p.colorspace()]; @@ -455,29 +465,36 @@ string blend(pen p) return p.blend(); } -pen linetype(string *s, real offset=0, bool scale=true, bool adjust=true) +pen linetype(realarray *pattern, real offset=0, bool scale=true, + bool adjust=true) { - return pen(LineType(*s,offset,scale,adjust)); + size_t size=checkArray(pattern); + array *a=new array(size); + for(size_t i=0; i < size; ++i) + (*a)[i]=::max(vm::read<double>(pattern,i),0.0); + + return pen(LineType(*a,offset,scale,adjust)); } -string linetype(pen p=CURRENTPEN) +realarray *linetype(pen p=CURRENTPEN) { - return p.stroke(); + array a=p.linetype()->pattern; + return copyArray(&a); } real offset(pen p) { - return p.linetype().offset; + return p.linetype()->offset; } bool scale(pen p) { - return p.linetype().scale; + return p.linetype()->scale; } bool adjust(pen p) { - return p.linetype().adjust; + return p.linetype()->adjust; } pen adjust(pen p, real arclength, bool cyclic) @@ -712,7 +729,11 @@ void :loadModule(string *index) string cd(string s=emptystring) { - if(!s.empty() && !globalwrite()) writeDisabled(); + if(!s.empty() && !globalwrite()) { + string outname=getSetting<string>("outname"); + string dir=stripDir(outname); + if(dir.empty()) Setting("outname")=getPath()+dirsep+outname; + } return setPath(s.c_str()); } @@ -1133,7 +1154,7 @@ transform scale(real x) transform scale(real x, real y) { - return xscale(x)*yscale(y); + return scale(x,y); } transform slant(real s) diff --git a/Build/source/utils/asymptote/runtimebase.in b/Build/source/utils/asymptote/runtimebase.in index 6f2acf97048..779c87ae8e5 100644 --- a/Build/source/utils/asymptote/runtimebase.in +++ b/Build/source/utils/asymptote/runtimebase.in @@ -50,12 +50,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); diff --git a/Build/source/utils/asymptote/runtriple.cc b/Build/source/utils/asymptote/runtriple.cc index a9db47acc0c..da4812d9beb 100644 --- a/Build/source/utils/asymptote/runtriple.cc +++ b/Build/source/utils/asymptote/runtriple.cc @@ -49,12 +49,14 @@ array *copyArray(array *a); array *copyArray2(array *a); array *copyArray3(array *a); -double *copyArrayC(const array *a, size_t dim=0); -double *copyArray2C(const array *a, bool square=true, size_t dim2=0); +double *copyArrayC(const array *a, size_t dim=0, GCPlacement placement=NoGC); +double *copyArray2C(const array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); triple *copyTripleArrayC(const array *a, size_t dim=0); triple *copyTripleArray2C(const array *a, bool square=true, size_t dim2=0); -double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0); +double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0, + GCPlacement placement=NoGC); } function *realRealFunction(); diff --git a/Build/source/utils/asymptote/settings.cc b/Build/source/utils/asymptote/settings.cc index 2a1e85bfa72..7197095f304 100644 --- a/Build/source/utils/asymptote/settings.cc +++ b/Build/source/utils/asymptote/settings.cc @@ -55,6 +55,10 @@ extern "C" { #ifdef clear #undef clear #endif +// Workaround broken header file on i386-solaris with g++ 3.4.3. +#ifdef erase +#undef erase +#endif using vm::item; @@ -69,7 +73,7 @@ namespace settings { using camp::pair; -#ifdef HAVE_LIBGL +#ifdef HAVE_GL const bool haveglut=true; #else const bool haveglut=false; @@ -77,6 +81,8 @@ const bool haveglut=false; mode_t mask; +string systemDir=ASYMPTOTE_SYSDIR; + #ifndef __CYGWIN__ bool msdos=false; @@ -91,7 +97,6 @@ string defaultPDFViewer="acroread"; string defaultGhostscript="gs"; string defaultDisplay="display"; string defaultAnimate="animate"; -string systemDir=ASYMPTOTE_SYSDIR; string docdir=ASYMPTOTE_DOCDIR; void queryRegistry() {} const string dirsep="/"; @@ -110,7 +115,6 @@ string defaultGhostscript="gswin32c.exe"; string defaultDisplay="cmd"; //string defaultAnimate="animate"; string defaultAnimate="cmd"; -string systemDir=ASYMPTOTE_SYSDIR; string docdir; const string dirsep="\\"; @@ -184,7 +188,8 @@ void queryRegistry() if(defaultPSViewer != "cmd") defaultPSViewer=getEntry("Ghostgum/GSview/*")+"\\gsview\\"+defaultPSViewer; docdir=getEntry("Microsoft/Windows/CurrentVersion/App Paths/Asymptote/Path"); - if(!systemDir.empty()) // An empty systemDir indicates a TeXLive build + // An empty systemDir indicates a TeXLive build + if(!systemDir.empty() && !docdir.empty()) systemDir=docdir; } @@ -215,6 +220,7 @@ bool globalwrite() {return globaloption || !safe;} const string suffix="asy"; const string guisuffix="gui"; +const string standardprefix="out"; string initdir; string historyname; @@ -1067,6 +1073,8 @@ void initSettings() { addOption(new stringSetting("outformat", 'f', "format", "Convert each output file to specified format", "")); + addOption(new boolSetting("svgemulation", 0, + "Emulate unimplemented SVG shading", false)); addOption(new boolSetting("prc", 0, "Embed 3D PRC graphics in PDF output", true)); addOption(new boolSetting("toolbar", 0, @@ -1249,8 +1257,7 @@ void initSettings() { addOption(new stringSetting("pdfreloadOptions", 0, "string", "")); addOption(new stringSetting("glOptions", 0, "string", "")); addOption(new stringSetting("hyperrefOptions", 0, "str", - "LaTeX hyperref package options", - "setpagesize=false,unicode")); + "","setpagesize=false,unicode,pdfborder=0 0 0")); addOption(new envSetting("config","config."+suffix)); addOption(new envSetting("pdfviewer", defaultPDFViewer)); @@ -1285,8 +1292,8 @@ void setInteractive() { (isatty(STDIN_FILENO) || getSetting<bool>("interactive"))) interact::interactive=true; - historyname=getSetting<bool>("localhistory") ? "."+suffix+"_history" - : (initdir+"/history"); + historyname=getSetting<bool>("localhistory") ? + (string(getPath())+dirsep+"."+suffix+"_history") : (initdir+"/history"); } bool view() { @@ -1307,7 +1314,9 @@ bool trap() { string outname() { string name=getSetting<string>("outname"); - return name.empty() ? "out" : name; + if(name.empty() && interact::interactive) return standardprefix; + if(msdos) backslashToSlash(name); + return name; } string lookup(const string& symbol) @@ -1318,10 +1327,6 @@ string lookup(const string& symbol) cmd.push_back("--var-value="+symbol); iopipestream pipe(cmd); pipe >> s; -// Workaround broken header file on i386-solaris with g++ 3.4.3. -#ifdef erase -#undef erase -#endif size_t n=s.find('\r'); if(n != string::npos) s.erase(n,1); @@ -1534,11 +1539,19 @@ Int getScroll() Int scroll=settings::getSetting<Int>("scroll"); #ifdef HAVE_LIBCURSES if(scroll < 0) { - char *terminal=getenv("TERM"); + static char *terminal=NULL; + if(!terminal) + terminal=getenv("TERM"); if(terminal) { - setupterm(terminal,1,NULL); - scroll=lines > 2 ? lines-1 : 1; - } + int error; + error=setupterm(terminal,1,&error); +#ifndef __CYGWIN__ + if(error == 0) scroll=lines > 2 ? lines-1 : 1; + else +#endif + scroll=0; + } else scroll=0; + } #endif return scroll; diff --git a/Build/source/utils/asymptote/settings.h b/Build/source/utils/asymptote/settings.h index 7327bd2aa82..f6044c6601d 100644 --- a/Build/source/utils/asymptote/settings.h +++ b/Build/source/utils/asymptote/settings.h @@ -58,6 +58,7 @@ bool globalwrite(); extern const string suffix; extern const string guisuffix; +extern const string standardprefix; extern string historyname; diff --git a/Build/source/utils/asymptote/simpson.cc b/Build/source/utils/asymptote/simpson.cc index c17f3545c03..85c8c08160e 100644 --- a/Build/source/utils/asymptote/simpson.cc +++ b/Build/source/utils/asymptote/simpson.cc @@ -15,7 +15,7 @@ typedef struct { bool // Returns true iff successful. simpson(double& integral, // Approximate value of the integral. double (*f)(double), // Pointer to function to be integrated. - double a, double b, // Lower, upper limits of integration (a <= b). + double a, double b, // Lower, upper limits of integration. double acc, // Desired relative accuracy of integral. // Try to make |error| <= acc*abs(integral). double dxmax) // Maximum limit on the width of a subinterval diff --git a/Build/source/utils/asymptote/stm.cc b/Build/source/utils/asymptote/stm.cc index f2bbe2e0df4..c57a41906db 100644 --- a/Build/source/utils/asymptote/stm.cc +++ b/Build/source/utils/asymptote/stm.cc @@ -47,7 +47,7 @@ void expStm::prettyprint(ostream &out, Int indent) body->prettyprint(out, indent+1); } -void expStm::baseTrans(coenv &e, exp *expr) +void baseExpTrans(coenv &e, exp *expr) { types::ty_kind kind = expr->trans(e)->kind; if (kind != types::ty_void) @@ -56,7 +56,7 @@ void expStm::baseTrans(coenv &e, exp *expr) } void expStm::trans(coenv &e) { - baseTrans(e, body); + baseExpTrans(e, body); } // For an object such as currentpicture, write 'picture currentpicture' to @@ -78,59 +78,91 @@ void tryToWriteTypeOfExp(types::ty *t, exp *body) } } +// From dec.cc: +varEntry *makeVarEntry(position pos, coenv &e, record *r, types::ty *t); -exp *tryToWriteExp(coenv &e, exp *body) +void storeExp(coenv &e, types::ty *t, exp *expr) { + assert(t->kind != ty_error); + assert(t->kind != ty_void); + assert(t->kind != ty_overloaded); + + expr->transAsType(e, t); + + // Store the value in a new variable of the proper type. + varEntry *v = makeVarEntry(expr->getPos(), e, 0, t); + e.e.addVar(symbol::trans("operator answer"), v); + v->getLocation()->encode(WRITE, expr->getPos(), e.c); + e.c.encode(inst::pop); +} + +void storeAndWriteExp(coenv &e, types::ty *t, exp *expr) { + storeExp(e, t, expr); + + position pos=expr->getPos(); + baseExpTrans(e, new callExp(pos, new nameExp(pos, "write"), + new nameExp(pos, "operator answer"))); +} + +void tryToWriteExp(coenv &e, exp *expr) { - // First check if it is the kind of expression that should be written. - if (!body->writtenToPrompt() || - !settings::getSetting<bool>("interactiveWrite")) - return body; + position pos=expr->getPos(); + types::ty *t=expr->cgetType(e); - types::ty *t=body->cgetType(e); - if (t->kind == ty_error) - return body; + // If the original expression is bad, just print the errors. + // If it is a function which returns void, just call the function. + if (t->kind == ty_error || t->kind == ty_void) { + baseExpTrans(e, expr); + return; + } - exp *callee=new nameExp(body->getPos(), symbol::trans("write")); - exp *call=new callExp(body->getPos(), callee, body); + exp *callee=new nameExp(pos, symbol::trans("write")); + exp *call=new callExp(pos, callee, expr); types::ty *ct=call->getType(e); if (ct->kind == ty_error || ct->kind == ty_overloaded) { if (t->kind == ty_overloaded) { - // Translate the body in order to print the ambiguity error first. - body->trans(e); + // Translate the expr in order to print the ambiguity error first. + expr->trans(e); em.sync(); assert(em.errors()); // Then, write out all of the types. - tryToWriteTypeOfExp(t, body); - - // Return an innocuous expression to avoid more errors. - return new nullExp(body->getPos()); + tryToWriteTypeOfExp(t, expr); } else { - tryToWriteTypeOfExp(t, body); - return body; + // Write the type of the expression and, since it is unique, assign it to + // 'operator answer' even though its value isn't printed. + tryToWriteTypeOfExp(t, expr); + storeExp(e, t, expr); } } - - // If the exp is overloaded, but the act of writing makes it - // unambiguous, add a suffix to the output to warn the user of this. - if (t->kind == ty_overloaded) { - exp *suffix=new nameExp(body->getPos(), + else if (t->kind == ty_overloaded) { + // If the exp is overloaded, but the act of writing makes it + // unambiguous, add a suffix to the output to warn the user of this. + exp *suffix=new nameExp(pos, symbol::trans("overloadedMessage")); - exp *callWithSuffix=new callExp(body->getPos(), - callee, body, suffix); + exp *callWithSuffix=new callExp(pos, + callee, expr, suffix); if (callWithSuffix->getType(e)->kind != ty_error) - return callWithSuffix; + baseExpTrans(e, callWithSuffix); + else + baseExpTrans(e, call); + } + else { + // Interactive writing can proceed normally. + storeAndWriteExp(e, t, expr); } - - return call; } void expStm::interactiveTrans(coenv &e) { - baseTrans(e, tryToWriteExp(e, body)); + // First check if it is the kind of expression that should be written. + if (body->writtenToPrompt() && + settings::getSetting<bool>("interactiveWrite")) + tryToWriteExp(e, body); + else + baseExpTrans(e, body); } diff --git a/Build/source/utils/asymptote/stm.h b/Build/source/utils/asymptote/stm.h index ab759dfe4a3..254db355a4c 100644 --- a/Build/source/utils/asymptote/stm.h +++ b/Build/source/utils/asymptote/stm.h @@ -75,7 +75,6 @@ public: class expStm : public stm { exp *body; - void baseTrans(coenv &e, exp *expr); public: expStm(position pos, exp *body) : stm(pos), body(body) {} diff --git a/Build/source/utils/asymptote/table.h b/Build/source/utils/asymptote/table.h index e8717cfa8ed..cd8f26d2278 100644 --- a/Build/source/utils/asymptote/table.h +++ b/Build/source/utils/asymptote/table.h @@ -43,10 +43,6 @@ public : void enter(symbol *key, B value); B look(symbol *key); - // Checks if a symbol was added in the last scope. Useful for - // stopping multiple definitions. - B lookInTopScope(symbol *key); - // Allows scoping and overloading of symbols of the same name void beginScope(); void endScope(); @@ -83,15 +79,6 @@ inline B table<B>::look(symbol *key) } template <class B> -inline B table<B>::lookInTopScope(symbol *key) -{ - scope_iterator p = scopes.front().find(key); - if (p!=scopes.front().end()) - return p->second; - return 0; -} - -template <class B> inline void table<B>::beginScope() { scopes.push_front(scope_t()); diff --git a/Build/source/utils/asymptote/texfile.cc b/Build/source/utils/asymptote/texfile.cc index 075826d5ca8..15410d569cd 100644 --- a/Build/source/utils/asymptote/texfile.cc +++ b/Build/source/utils/asymptote/texfile.cc @@ -13,6 +13,8 @@ using std::ofstream; using settings::getSetting; +using vm::array; +using vm::read; namespace camp { @@ -48,12 +50,12 @@ void texfile::miniprologue() << "\\textheight=2048pt" << newl << "\\textwidth=2048pt" << newl << "\\begin{document}" << newl; + latexfontencoding(*out); } else if(settings::context(texengine)) { *out << "\\setuppagenumbering[location=]" << newl << "\\usetypescript[modern]" << newl << "\\starttext\\hbox{%" << newl; } - texfontencoding(*out); } void texfile::prologue() @@ -82,16 +84,13 @@ void texfile::prologue() 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; - if(width > 0) *out << "\\pdfpagewidth=" << width << "bp" << newl; *out << "\\ifx\\pdfhorigin\\undefined" << newl << "\\hoffset=-1in" << newl - << "\\voffset=" << voffset-72.0*xelatexBug << "bp" << newl; + << "\\voffset=" << voffset-72.0 << "bp" << newl; if(height > 0) - *out << "\\pdfpageheight=" << height*0.5*(1.0+xelatexBug) << "bp" + *out << "\\pdfpageheight=" << height << "bp" << newl; *out << "\\else" << newl << "\\pdfhorigin=0bp" << newl @@ -114,6 +113,7 @@ void texfile::prologue() << "\\topmargin=-37.01pt" << newl; *out << "\\begin{document}" << newl; } + latexfontencoding(*out); } else { if(!inlinetex) { if(settings::context(texengine)) { @@ -135,6 +135,7 @@ void texfile::prologue() } } } + beginpage(); } void texfile::beginlayer(const string& psname, bool postscript) @@ -144,11 +145,15 @@ void texfile::beginlayer(const string& psname, bool postscript) if(settings::context(texengine)) *out << "\\externalfigure[" << psname << "]%" << newl; else { - *out << "\\includegraphics"; - if(!settings::pdf(texengine)) + *out << "{\\catcode`\"=12%" << newl + << "\\includegraphics"; + bool pdf=settings::pdf(texengine); + if(!pdf) *out << "[bb=" << box.left << " " << box.bottom << " " << box.right << " " << box.top << "]"; - *out << "{" << psname << "}%" << newl; + if(pdf) *out << "{\"" << stripExt(psname) << "\".pdf}%" << newl; + else *out << "{\"" << psname << "\"}%" << newl; + *out << "}%" << newl; } if(!inlinetex) *out << "\\kern " << (box.left-box.right)*ps2tex << "pt%" << newl; @@ -204,7 +209,7 @@ void texfile::setfont(pen p) if(latex) setlatexfont(*out,p,lastpen); settexfont(*out,p,lastpen,latex); - lastpen=p; + lastpen.setfont(p); } void texfile::setpen(pen p) @@ -220,6 +225,30 @@ void texfile::setpen(pen p) setfont(p); } +void texfile::beginpicture(const bbox& b) +{ + verbatim(settings::beginpicture(texengine)); + if(!settings::context(texengine)) { + verbatim("("); + double width=b.right-b.left; + double height=b.top-b.bottom; + write(width*ps2tex); + verbatim(","); + write(height*ps2tex); + verbatim(")"); + } + verbatimline("%"); +} + +void texfile::endpicture(const bbox& b) +{ + verbatimline(settings::endpicture(texengine)); + verbatim("\\kern"); + double width=b.right-b.left; + write(-width*ps2tex); + verbatimline("pt%"); +} + void texfile::gsave() { *out << settings::beginspecial(texengine); @@ -278,6 +307,7 @@ void texfile::put(const string& label, const transform& T, const pair& z, void texfile::epilogue(bool pipe) { + endpage(); if(settings::latex(texengine)) *out << "\\end{document}" << newl; else if(settings::context(texengine)) @@ -287,4 +317,401 @@ void texfile::epilogue(bool pipe) out->flush(); } +string svgtexfile::nl="{?nl}%\n"; + +void svgtexfile::beginspecial() +{ + inspecial=true; + out->unsetf(std::ios::fixed); + *out << "\\catcode`\\#=11%" << newl + << "\\special{dvisvgm:raw" << nl; +} + +void svgtexfile::endspecial() +{ + inspecial=false; + *out << "}\\catcode`\\#=6%" << newl; + out->setf(std::ios::fixed); +} + +void svgtexfile::begintransform() +{ + *out << "<g transform='matrix(1 0 0 1 " + << (-Hoffset+1.99*settings::cm)*ps2tex << " " + << (1.9*settings::cm+box.top)*ps2tex + << ")'>" << nl; +} + +void svgtexfile::endtransform() +{ + *out << "</g>"; +} + +void svgtexfile::gsave(bool tex) +{ + if(clipstack.size() < 1) + clipstack.push(0); + else + clipstack.push(clipcount); + *out << "\\special{dvisvgm:raw <g>}%" << newl; + pens.push(lastpen); +} + +void svgtexfile::grestore(bool tex) +{ + if(pens.size() < 1 || clipstack.size() < 1) + reportError("grestore without matching gsave"); + lastpen=pens.top(); + pens.pop(); + clipstack.pop(); + *out << "\\special{dvisvgm:raw </g>}%" << newl; +} + +void svgtexfile::clippath() +{ + if(clipstack.size() > 0) { + size_t count=clipstack.top(); + if(count > 0) + *out << "clip-path='url(#clip" << count << ")' "; + } +} + +void svgtexfile::beginpath() +{ + *out << "<path "; + clippath(); + *out << "d='"; +} + +void svgtexfile::endpath() +{ + *out << "/>" << nl; +} + +void svgtexfile::dot(path p, pen q, bool newPath) +{ + beginspecial(); + begintransform(); + *out << "<circle "; + clippath(); + pair z=p.point((Int) 0); + *out << "cx='" << z.getx()*ps2tex + << "' cy='" << -z.gety()*ps2tex + << "' r='" << 0.5*q.width()*ps2tex; +} + +void svgtexfile::beginclip() +{ + beginspecial(); + begintransform(); + *out << "<clipPath "; + clippath(); + ++clipcount; + *out << "id='clip" << clipcount << "'>" << nl; + beginpath(); + if(clipstack.size() >= 0) + clipstack.pop(); + clipstack.push(clipcount); +} + +void svgtexfile::endclip0(const pen &p) +{ + *out << "'"; + fillrule(p,"clip"); + endpath(); + *out << "</clipPath>" << nl; +} + +void svgtexfile::endclip(const pen &p) +{ + endclip0(p); + endtransform(); + endspecial(); +} + +void svgtexfile::fillrule(const pen& p, const string& type) +{ + if(p.Fillrule() != lastpen.Fillrule()) + *out << " " << type << "-rule='" << + (p.evenodd() ? "evenodd" : "nonzero") << "'"; + lastpen.setfillrule(p); +} + +void svgtexfile::color(const pen &p, const string& type) +{ + *out << "' " << type << "='#" << rgbhex(p) << "'"; + double opacity=p.opacity(); + if(opacity != 1.0) + *out << " opacity='" << opacity << "'"; +} + +void svgtexfile::fill(const pen &p) +{ + color(p,"fill"); + fillrule(p); + endpath(); + endtransform(); + endspecial(); +} + +void svgtexfile::properties(const pen& p) +{ + if(p.cap() != lastpen.cap()) + *out << " stroke-linecap='" << PSCap[p.cap()] << "'"; + + if(p.join() != lastpen.join()) + *out << " stroke-linejoin='" << Join[p.join()] << "'"; + + if(p.miter() != lastpen.miter()) + *out << " stroke-miterlimit='" << p.miter()*ps2tex << "'"; + + if(p.width() != lastpen.width()) + *out << " stroke-width='" << p.width()*ps2tex << "'"; + + const LineType *linetype=p.linetype(); + const LineType *lastlinetype=lastpen.linetype(); + + if(!(linetype->pattern == lastlinetype->pattern)) { + size_t n=linetype->pattern.size(); + if(n > 0) { + *out << " stroke-dasharray='"; + *out << vm::read<double>(linetype->pattern,0)*ps2tex; + for(size_t i=1; i < n; ++i) + *out << "," << vm::read<double>(linetype->pattern,i)*ps2tex; + *out << "'"; + } + } + + if(linetype->offset != lastlinetype->offset) + *out << " stroke-dashoffset='" << linetype->offset*ps2tex << "'"; + + lastpen=p; +} + +void svgtexfile::stroke(const pen &p, bool dot) +{ + if(dot) + color(p,"fill"); + else { + color(p,"fill='none' stroke"); + properties(p); + } + endpath(); + endtransform(); + endspecial(); +} + +void svgtexfile::strokepath() +{ + reportWarning("SVG does not support strokepath"); +} + +void svgtexfile::begingradientshade(bool axial, ColorSpace colorspace, + const pen& pena, const pair& a, double ra, + const pen& penb, const pair& b, double rb) +{ + string type=axial ? "linear" : "radial"; + beginspecial(); + *out << "<" << type << "Gradient id='grad" << gradientcount; + if(axial) { + *out << "' x1='" << a.getx()*ps2tex << "' y1='" << -a.gety()*ps2tex + << "' x2='" << b.getx()*ps2tex << "' y2='" << -b.gety()*ps2tex; + } else { + *out << "' cx='" << b.getx()*ps2tex << "' cy='" << -b.gety()*ps2tex + << "' r='" << rb*ps2tex; + } + *out <<"' gradientUnits='userSpaceOnUse'>" << nl + << "<stop offset='0' stop-color='#" << rgbhex(pena) << "'/>" << nl + << "<stop offset='1' stop-color='#" << rgbhex(penb) << "'/>" << nl + << "</" << type << "Gradient>" << nl; + begintransform(); + beginpath(); +} + +void svgtexfile::gradientshade(bool axial, ColorSpace colorspace, + const pen& pena, const pair& a, double ra, + const pen& penb, const pair& b, double rb) +{ + *out << "' fill='url(#grad" << gradientcount << ")'"; + fillrule(pena); + endpath(); + ++gradientcount; + endtransform(); + endspecial(); +} + +// Return the point on the line through p and q that is closest to z. +pair closest(pair p, pair q, pair z) +{ + pair u=q-p; + double denom=dot(u,u); + return denom == 0.0 ? p : p+dot(z-p,u)/denom*u; +} + +void svgtexfile::gouraudshade(const pen& p0, const pair& z0, + const pen& p1, const pair& z1, + const pen& p2, const pair& z2) +{ + string hex[]={rgbhex(p0),rgbhex(p1),rgbhex(p2)}; + pair Z[]={z0,z1,z2}; + + *out << "<defs>" << nl + << "<filter id='colorAdd'>" << nl + << "<feBlend in='SourceGraphic' in2='BackgroundImage'/>" << nl + << "</filter>"; + + for(size_t k=0; k < 3; ++k) { + pair z=Z[k]; + pair opp=closest(Z[(k+1) % 3],Z[(k+2) % 3],z); + *out << "<linearGradient id='grad-" << gouraudcount << "-" << k + << "' gradientUnits='userSpaceOnUse'" << nl + << " x1='" << z.getx()*ps2tex << "' y1='" << -z.gety()*ps2tex + << "' x2='" << opp.getx()*ps2tex << "' y2='" << -opp.gety()*ps2tex + << "'>" << nl + << "<stop offset='0' stop-color='#" << hex[k] + << "' stop-opacity='1'/>" << nl + << "<stop offset='1' stop-color='#" << hex[k] + << "' stop-opacity='0'/>" << nl + << "</linearGradient>" << nl; + } + *out << "<polygon "; + clippath(); + *out << "id='triangle" << gouraudcount << "' points='" + << z0.getx()*ps2tex << "," << -z0.gety()*ps2tex << " " + << z1.getx()*ps2tex << "," << -z1.gety()*ps2tex << " " + << z2.getx()*ps2tex << "," << -z2.gety()*ps2tex << "'/>" << nl + << "</defs>" << nl; + *out << "<use xlink:href='#triangle" << gouraudcount + << "' fill='url(#grad-" << gouraudcount << "-" + << "0)'/>" << nl + << "<use xlink:href='#triangle" << gouraudcount + << "' fill='url(#grad-" << gouraudcount << "-" + << "1)' filter='url(#colorAdd)'/>" << nl + << "<use xlink:href='#triangle" << gouraudcount + << "' fill='url(#grad-" << gouraudcount << "-" + << "2)' filter='url(#colorAdd)'/>" << nl; + ++gouraudcount; +} + +void svgtexfile::begingouraudshade(const vm::array& pens, + const vm::array& vertices, + const vm::array& edges) +{ + size_t size=pens.size(); + if(size == 0) return; + beginclip(); +} + +void svgtexfile::gouraudshade(const pen& pentype, + const array& pens, const array& vertices, + const array& edges) +{ + size_t size=pens.size(); + if(size == 0) return; + + endclip0(pentype); + + pen *p0=NULL,*p1=NULL,*p2=NULL; + pair z0,z1,z2; + + for(size_t i=0; i < size; i++) { + Int edge=read<Int>(edges,i); + + switch(edge) { + case 0: + p0=read<pen *>(pens,i); + z0=read<pair>(vertices,i); + ++i; + if(i < size) { + p1=read<pen *>(pens,i); + z1=read<pair>(vertices,i); + ++i; + if(i < size) { + p2=read<pen *>(pens,i); + z2=read<pair>(vertices,i); + } + } + break; + case 1: + p0=read<pen *>(pens,i); + z0=read<pair>(vertices,i); + break; + case 2: + p1=read<pen *>(pens,i); + z1=read<pair>(vertices,i); + break; + default: + break; + } + if(p0 == NULL || p1 == NULL || p2 == NULL) + reportError("invalid edge flag"); + gouraudshade(*p0,z0,*p1,z1,*p2,z2); + } + endtransform(); + endspecial(); +} + +void svgtexfile::begintensorshade(const vm::array& pens, + const vm::array& boundaries, + const vm::array& z) +{ + beginspecial(); + *out << "<defs>" << nl; + + path g=read<path>(boundaries,0); + pair Z[]={g.point((Int) 0),g.point((Int) 3),g.point((Int) 2), + g.point((Int) 1)}; + + array *pi=read<array *>(pens,0); + if(checkArray(pi) != 4) + reportError("specify 4 pens for each path"); + string hex[]={rgbhex(read<pen>(pi,0)),rgbhex(read<pen>(pi,3)), + rgbhex(read<pen>(pi,2)),rgbhex(read<pen>(pi,1))}; + + *out << "<filter id='colorAdd'>" << nl + << "<feBlend in='SourceGraphic' in2='BackgroundImage'/>" << nl + << "</filter>"; + + pair mean=0.25*(Z[0]+Z[1]+Z[2]+Z[3]); + for(size_t k=0; k < 4; ++k) { + pair opp=(k % 2 == 0) ? Z[(k+2) % 4] : mean; + *out << "<linearGradient id='grad" << tensorcount << "-" << k + << "' gradientUnits='userSpaceOnUse'" << nl + << " x1='" << Z[k].getx()*ps2tex << "' y1='" << -Z[k].gety()*ps2tex + << "' x2='" << opp.getx()*ps2tex << "' y2='" << -opp.gety()*ps2tex + << "'>" << nl + << "<stop offset='0' stop-color='#" << hex[k] + << "' stop-opacity='1'/>" << nl + << "<stop offset='1' stop-color='#" << hex[k] + << "' stop-opacity='0'/>" << nl + << "</linearGradient>" << nl; + } + beginpath(); +} + +void svgtexfile::tensorshade(const pen& pentype, const vm::array& pens, + const vm::array& boundaries, const vm::array& z) +{ + *out << "' id='path" << tensorcount << "'"; + fillrule(pentype); + endpath(); + *out << "</defs></g>" << nl; + begintransform(); + *out << "<use xlink:href='#path" << tensorcount + << "' fill='url(#grad" << tensorcount << "-" + << "0)'/>" << nl + << "<use xlink:href='#path" << tensorcount + << "' fill='url(#grad" << tensorcount << "-" + << "2)' filter='url(#colorAdd)'/>" << nl + << "<use xlink:href='#path" << tensorcount + << "' fill='url(#grad" << tensorcount << "-" + << "1)' filter='url(#colorAdd)'/>" << nl + << "<use xlink:href='#path" << tensorcount + << "' fill='url(#grad" << tensorcount << "-" + << "3)' filter='url(#colorAdd)'/>" << nl; + + ++tensorcount; + endspecial(); +} + } //namespace camp diff --git a/Build/source/utils/asymptote/texfile.h b/Build/source/utils/asymptote/texfile.h index 59f7284c392..a62cfde43bc 100644 --- a/Build/source/utils/asymptote/texfile.h +++ b/Build/source/utils/asymptote/texfile.h @@ -44,16 +44,14 @@ void texuserpreamble(T& out, } template<class T> -void texfontencoding(T& out) +void latexfontencoding(T& out) { - if(settings::latex(settings::getSetting<string>("tex"))) { - out << "\\makeatletter%" << newl - << "\\let\\ASYencoding\\f@encoding%" << newl - << "\\let\\ASYfamily\\f@family%" << newl - << "\\let\\ASYseries\\f@series%" << newl - << "\\let\\ASYshape\\f@shape%" << newl - << "\\makeatother%" << newl; - } + out << "\\makeatletter%" << newl + << "\\let\\ASYencoding\\f@encoding%" << newl + << "\\let\\ASYfamily\\f@family%" << newl + << "\\let\\ASYseries\\f@series%" << newl + << "\\let\\ASYshape\\f@shape%" << newl + << "\\makeatother%" << newl; } template<class T> @@ -88,6 +86,34 @@ void texpreamble(T& out, mem::list<string>& preamble=processData().TeXpreamble, << settings::rawpostscript(texengine) << newl; } +// Work around bug in dvips.def: allow spaces in file names. +template<class T> +void dvipsfix(T &out) +{ + if(!settings::pdf(settings::getSetting<string>("tex"))) { + out << "\\makeatletter" << newl + << "\\def\\Ginclude@eps#1{%" << newl + << " \\message{<#1>}%" << newl + << " \\bgroup" << newl + << " \\def\\@tempa{!}%" << newl + << " \\dimen@\\Gin@req@width" << newl + << " \\dimen@ii.1bp%" << newl + << " \\divide\\dimen@\\dimen@ii" << newl + << " \\@tempdima\\Gin@req@height" << newl + << " \\divide\\@tempdima\\dimen@ii" << newl + << " \\special{PSfile=#1\\space" << newl + << " llx=\\Gin@llx\\space" << newl + << " lly=\\Gin@lly\\space" << newl + << " urx=\\Gin@urx\\space" << newl + << " ury=\\Gin@ury\\space" << newl + << " \\ifx\\Gin@scalex\\@tempa\\else rwi=\\number\\dimen@\\space\\fi" << newl + << " \\ifx\\Gin@scaley\\@tempa\\else rhi=\\number\\@tempdima\\space\\fi" << newl + << " \\ifGin@clip clip\\fi}%" << newl + << " \\egroup}" << newl + << "\\makeatother" << newl; + } +} + template<class T> void texdefines(T& out, mem::list<string>& preamble=processData().TeXpreamble, bool pipe=false) @@ -106,15 +132,19 @@ void texdefines(T& out, mem::list<string>& preamble=processData().TeXpreamble, fout << s << endl; } } - texfontencoding(out); 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) { + dvipsfix(out); + out << "\\usepackage{color}" << newl; + } } - if(pipe) + if(pipe) { out << "\\begin{document}" << newl; + latexfontencoding(out); + } } else if(settings::context(texengine)) { if(!pipe && !settings::getSetting<bool>("inlinetex")) out << "\\usemodule[pictex]" << newl; @@ -133,6 +163,7 @@ void texdefines(T& out, mem::list<string>& preamble=processData().TeXpreamble, << " \\fi" << newl << " \\reserved@a}" << newl << "\\makeatother" << newl; + dvipsfix(out); if(!pipe) out << "\\input picture" << newl; @@ -162,6 +193,7 @@ bool settexfont(T& out, const pen& p, const pen& lastpen, bool latex) } class texfile : public psfile { +protected: bbox box; bool inlinetex; double Hoffset; @@ -171,11 +203,13 @@ public: string texengine; texfile(const string& texname, const bbox& box, bool pipe=false); - ~texfile(); + virtual ~texfile(); void prologue(); + virtual void beginpage() {} void epilogue(bool pipe=false); + virtual void endpage() {} void setlatexcolor(pen p); void setpen(pen p); @@ -200,6 +234,9 @@ public: bool toplevel() {return level == 0;} + void beginpicture(const bbox& b); + void endpicture(const bbox& b); + void writepair(pair z) { *out << z; } @@ -217,6 +254,130 @@ public: void endlayer(); }; +class svgtexfile : public texfile { + mem::stack<size_t> clipstack; + size_t clipcount; + size_t gradientcount; + size_t gouraudcount; + size_t tensorcount; + bool inspecial; + static string nl; +public: + svgtexfile(const string& texname, const bbox& box, bool pipe=false) : + texfile(texname,box,pipe) { + clipcount=0; + gradientcount=0; + gouraudcount=0; + tensorcount=0; + inspecial=false; + } + + void writeclip(path p, bool newPath=true) { + write(p,false); + } + + void dot(path p, pen, bool newPath=true); + + void writeshifted(pair z) { + write(conj(z)*ps2tex); + } + + void translate(pair z) {} + void concat(transform t) {} + + void beginspecial(); + void endspecial(); + + // Prevent unwanted page breaks. + void beginpage() { + beginpicture(box); + } + + void endpage() { + endpicture(box); + } + + void begintransform(); + void endtransform(); + + void clippath(); + + void beginpath(); + void endpath(); + + void newpath() { + beginspecial(); + begintransform(); + beginpath(); + } + + void moveto(pair z) { + *out << "M"; + writeshifted(z); + } + + void lineto(pair z) { + *out << "L"; + writeshifted(z); + } + + void curveto(pair zp, pair zm, pair z1) { + *out << "C"; + writeshifted(zp); writeshifted(zm); writeshifted(z1); + } + + void closepath() { + *out << "Z"; + } + + string rgbhex(pen p) { + p.torgb(); + return p.hex(); + } + + void properties(const pen& p); + void color(const pen &p, const string& type); + + void stroke(const pen &p, bool dot=false); + void strokepath(); + + void fillrule(const pen& p, const string& type="fill"); + void fill(const pen &p); + + void begingradientshade(bool axial, ColorSpace colorspace, + const pen& pena, const pair& a, double ra, + const pen& penb, const pair& b, double rb); + void gradientshade(bool axial, ColorSpace colorspace, + const pen& pena, const pair& a, double ra, + const pen& penb, const pair& b, double rb); + + void gouraudshade(const pen& p0, const pair& z0, + const pen& p1, const pair& z1, + const pen& p2, const pair& z2); + void begingouraudshade(const vm::array& pens, const vm::array& vertices, + const vm::array& edges); + void gouraudshade(const pen& pentype, const vm::array& pens, + const vm::array& vertices, const vm::array& edges); + + void begintensorshade(const vm::array& pens, + const vm::array& boundaries, + const vm::array& z); + void tensorshade(const pen& pentype, const vm::array& pens, + const vm::array& boundaries, const vm::array& z); + + void beginclip(); + + void endclip0(const pen &p); + void endclip(const pen &p); + void endpsclip(const pen &p) {} + + void setpen(pen p) {if(!inspecial) texfile::setpen(p);} + + void gsave(bool tex=false); + + void grestore(bool tex=false); +}; + } //namespace camp #endif diff --git a/Build/source/utils/asymptote/tr.cc b/Build/source/utils/asymptote/tr.cc index 77097ef6680..d76ea846fc6 100644 --- a/Build/source/utils/asymptote/tr.cc +++ b/Build/source/utils/asymptote/tr.cc @@ -44,7 +44,7 @@ #include "common.h" -#ifdef HAVE_LIBGL +#ifdef HAVE_GL #include <assert.h> #include <math.h> diff --git a/Build/source/utils/asymptote/transform.h b/Build/source/utils/asymptote/transform.h index 3d60dfd8069..9b0e402da39 100644 --- a/Build/source/utils/asymptote/transform.h +++ b/Build/source/utils/asymptote/transform.h @@ -166,6 +166,11 @@ inline transform scale(double s) return transform (0.0, 0.0, s, 0.0, 0.0, s); } +inline transform scale(double x, double y) +{ + return transform (0.0, 0.0, x, 0.0, 0.0, y); +} + inline transform scale(pair z) { // Equivalent to multiplication by z. diff --git a/Build/source/utils/asymptote/types.cc b/Build/source/utils/asymptote/types.cc index 20d36363757..72e72a7aac8 100644 --- a/Build/source/utils/asymptote/types.cc +++ b/Build/source/utils/asymptote/types.cc @@ -76,11 +76,11 @@ void ty::print(ostream& out) const } #define SIGFIELD(Type, name, func) \ - if (id == symbol::trans(name) && \ + if (id == symbol::trans(name) && \ equivalent(sig, Type()->getSignature())) \ { \ static trans::virtualFieldAccess a(run::func); \ - static trans::varEntry v(Type(), &a, 0, position()); \ + static trans::varEntry v(Type(), &a, 0, position()); \ return &v; \ } diff --git a/Build/source/utils/asymptote/util.cc b/Build/source/utils/asymptote/util.cc index b9c7db35155..9e307a20800 100644 --- a/Build/source/utils/asymptote/util.cc +++ b/Build/source/utils/asymptote/util.cc @@ -103,12 +103,14 @@ string stripFile(string name) p=name.rfind('\\'); if(p < string::npos) { dir=true; + while(p > 0 && name[p-1] == '\\') --p; name.erase(p+1); } #endif p=name.rfind('/'); if(p < string::npos) { dir=true; + while(p > 0 && name[p-1] == '/') --p; name.erase(p+1); } @@ -150,26 +152,30 @@ string Getenv(const char *name, bool msdos) void writeDisabled() { - camp::reportError("Write/cd to other directories disabled; override with option -globalwrite"); + camp::reportError("Write to other directories disabled; override with option -globalwrite"); } -void checkLocal(string name) +string cleanpath(string name) { - if(globalwrite()) return; -#ifdef __CYGWIN__ - if(name.rfind('\\') < string::npos) writeDisabled(); -#endif - if(name.rfind('/') < string::npos) writeDisabled(); - return; + string dir=stripFile(name); + name=stripDir(name); + spaceToUnderscore(name); + return dir+name; +} + +string outpath(string name) +{ + bool global=globalwrite(); + string dir=stripFile(name); + if(global && !dir.empty()) return name; + string outdir=stripFile(outname()); + if(!(global || dir.empty() || dir == outdir)) writeDisabled(); + return outdir+stripDir(name); } string buildname(string name, string suffix, string aux) { - string dir=stripFile(outname()); - name=globalwrite() ? dir+name : dir+stripDir(name); - - name=stripExt(name,defaultformat()); - name += aux; + name=stripExt(outpath(name),defaultformat())+aux; if(!suffix.empty()) name += "."+suffix; return name; } @@ -286,7 +292,7 @@ int System(const mem::vector<string> &command, int quiet, bool wait, if(quiet < 2) { ostringstream msg; msg << "Command failed: "; - for(size_t i=0; i < command.size(); ++i) msg << command[i]; + for(size_t i=0; i < command.size(); ++i) msg << command[i] << " "; camp::reportError(msg); } } @@ -305,7 +311,7 @@ int System(const mem::vector<string> &command, int quiet, bool wait, if(quiet < 2) { ostringstream msg; msg << "Command exited abnormally: "; - for(size_t i=0; i < command.size(); ++i) msg << command[i]; + for(size_t i=0; i < command.size(); ++i) msg << command[i] << " "; camp::reportError(msg); } } diff --git a/Build/source/utils/asymptote/util.h b/Build/source/utils/asymptote/util.h index 57712ae78f0..73dc411b97d 100644 --- a/Build/source/utils/asymptote/util.h +++ b/Build/source/utils/asymptote/util.h @@ -36,8 +36,11 @@ string stripExt(string name, const string& suffix=""); void writeDisabled(); -// Check if global writes are disabled and name contains a directory. -void checkLocal(string name); +// Replace spaces in file part of name with underscores. +string cleanpath(string name); + +// Construct the full output path. +string outpath(string name); // Construct a filename from the original, adding aux at the end, and // changing the suffix. @@ -109,8 +112,6 @@ extern bool False; // Strip blank lines (which would break the bidirectional TeX pipe) string stripblanklines(const string& s); -extern char *currentpath; - const char *startPath(); const char* setPath(const char *s, bool quiet=false); const char *changeDirectory(const char *s); @@ -127,6 +128,10 @@ void execError(const char *command, const char *hint, const char *application); // pop-up a new viewer if the old one has been closed. void popupHelp(); +#ifdef __CYGWIN__ +inline long long llabs(long long x) {return x >= 0 ? x : -x;} +#endif + inline Int Abs(Int x) { #ifdef HAVE_LONG_LONG return llabs(x); diff --git a/Build/source/utils/asymptote/virtualfieldaccess.h b/Build/source/utils/asymptote/virtualfieldaccess.h index 115900733ce..a47627df750 100644 --- a/Build/source/utils/asymptote/virtualfieldaccess.h +++ b/Build/source/utils/asymptote/virtualfieldaccess.h @@ -25,7 +25,7 @@ class virtualFieldAccess : public access { access *getter; access *setter; - // As an optimization could add a 'caller' field, to handle calls to + // As an optimization, one could add a 'caller' field, to handle calls to // functions such as 'a.push(x)' where a is an array more efficiently. public: virtualFieldAccess(access *getter, access *setter = 0) |