diff options
Diffstat (limited to 'Build/source/utils')
169 files changed, 5801 insertions, 3875 deletions
diff --git a/Build/source/utils/README b/Build/source/utils/README index 3e3b5d8db62..53fd598c2c6 100644 --- a/Build/source/utils/README +++ b/Build/source/utils/README @@ -4,7 +4,7 @@ Public domain. Originally written 2005 by Karl Berry. Extra utilities we (optionally) compile for TeX Live. See comments in ../texk/README. -asymptote 1.96 - checked 8jun10 +asymptote 1.98 - checked 15jun10 update to TL from CTAN, to include prebuilt doc. see http://tug.org/texlive/build.html#asymptote and tlpkg/bin/tl-update-asy diff --git a/Build/source/utils/asymptote/ChangeLog b/Build/source/utils/asymptote/ChangeLog index 4d1fba7e7ed..4c391a848b8 100644 --- a/Build/source/utils/asymptote/ChangeLog +++ b/Build/source/utils/asymptote/ChangeLog @@ -1,4 +1,466 @@ ------------------------------------------------------------------------ +r5009 | jcbowman | 2010-06-14 02:39:57 -0600 (Mon, 14 Jun 2010) | 6 lines +Changed paths: + M /trunk/asymptote/array.cc + M /trunk/asymptote/array.h + M /trunk/asymptote/builtin.cc + M /trunk/asymptote/common.h + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/item.h + M /trunk/asymptote/program.cc + M /trunk/asymptote/runarray.in + M /trunk/asymptote/runsystem.in + M /trunk/asymptote/runtime.in + +On C99-compliant machines with 64 bit integers, use compact items for +the virtual machine, relying on Asymptote's internal type checking (compile +with -DCOMPACT=0 to re-enable the type_info data field). This change required +restricting T[] array(int n, T value, int depth=intMax) to 0, 1, or 2 +dimensional arrays. + +------------------------------------------------------------------------ +r5008 | jcbowman | 2010-06-14 00:43:24 -0600 (Mon, 14 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/base/plain_constants.asy + M /trunk/asymptote/path.cc + +Fix definition of undefined. +------------------------------------------------------------------------ +r5007 | jcbowman | 2010-06-13 16:47:27 -0600 (Sun, 13 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/base/three_tube.asy + +Rename tube to pipe. + +------------------------------------------------------------------------ +r5006 | jcbowman | 2010-06-13 16:11:19 -0600 (Sun, 13 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/runlabel.in + +Work around bug in gs 8.71: discard noncyclic stokepaths. + +------------------------------------------------------------------------ +r5005 | hammera | 2010-06-13 10:56:15 -0600 (Sun, 13 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/application.cc + M /trunk/asymptote/application.h + +Half-exact function matching. + +------------------------------------------------------------------------ +r5004 | hammera | 2010-06-13 10:55:44 -0600 (Sun, 13 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/Makefile.in + M /trunk/asymptote/base/three_tube.asy + M /trunk/asymptote/builtin.cc + M /trunk/asymptote/camp.y + M /trunk/asymptote/exp.cc + M /trunk/asymptote/exp.h + M /trunk/asymptote/tests/types/constructor.asy + M /trunk/asymptote/tests/types/resolve.asy + +Handle function equality specially. + +------------------------------------------------------------------------ +r5003 | jcbowman | 2010-06-13 10:03:39 -0600 (Sun, 13 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/examples/sinc.asy + +Improve example. +------------------------------------------------------------------------ +r5002 | jcbowman | 2010-06-13 09:24:04 -0600 (Sun, 13 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/asymptote.nsi + M /trunk/asymptote/patches/fixmem.reg + +Make heap_chunk_in_mb a multiple of 256MB. +------------------------------------------------------------------------ +r5001 | jcbowman | 2010-06-12 12:14:19 -0600 (Sat, 12 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/memory.h + +Revert -r4971:4973. +------------------------------------------------------------------------ +r5000 | hammera | 2010-06-12 12:06:29 -0600 (Sat, 12 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/Makefile.in + M /trunk/asymptote/TODO + M /trunk/asymptote/application.cc + M /trunk/asymptote/application.h + M /trunk/asymptote/builtin.cc + M /trunk/asymptote/drawpath.cc + M /trunk/asymptote/entry.cc + M /trunk/asymptote/entry.h + M /trunk/asymptote/env.cc + M /trunk/asymptote/env.h + M /trunk/asymptote/exp.cc + M /trunk/asymptote/exp.h + M /trunk/asymptote/name.cc + M /trunk/asymptote/record.cc + M /trunk/asymptote/tests/types/resolve.asy + M /trunk/asymptote/types.h + +Overloading resolution optimizations. + +------------------------------------------------------------------------ +r4999 | jcbowman | 2010-06-12 01:24:50 -0600 (Sat, 12 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/examples/basealign.asy + +Improve example. +------------------------------------------------------------------------ +r4998 | jcbowman | 2010-06-12 01:15:54 -0600 (Sat, 12 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_Label.asy + M /trunk/asymptote/drawlabel.cc + M /trunk/asymptote/transform.h + +Align labels with rotational instead of shiftless part of transform. + +------------------------------------------------------------------------ +r4997 | jcbowman | 2010-06-12 01:14:29 -0600 (Sat, 12 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/examples/xxsq01y.asy + +Update example. +------------------------------------------------------------------------ +r4996 | jcbowman | 2010-06-11 23:47:28 -0600 (Fri, 11 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/examples/xxsq01.asy + +Fix example. +------------------------------------------------------------------------ +r4995 | jcbowman | 2010-06-11 23:46:51 -0600 (Fri, 11 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/configure.ac + +Increment version to 1.98svn. +------------------------------------------------------------------------ +r4994 | jcbowman | 2010-06-11 22:19:24 -0600 (Fri, 11 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/prc/test.cc + M /trunk/asymptote/prc/writePRC.h + +Replace M_PI by pi for portability. +------------------------------------------------------------------------ +r4993 | jcbowman | 2010-06-11 21:47:41 -0600 (Fri, 11 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/runarray.in + +Fix warning message. +------------------------------------------------------------------------ +r4992 | jcbowman | 2010-06-11 21:27:14 -0600 (Fri, 11 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/configure.ac + +Fix typo. +------------------------------------------------------------------------ +r4991 | jcbowman | 2010-06-11 17:26:38 -0600 (Fri, 11 Jun 2010) | 4 lines +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/configure.ac + M /trunk/asymptote/prc/oPRCFile.cc + M /trunk/asymptote/prc/writePRC.h + +Remove tr1 includes. + +Improve local gc detection. + +------------------------------------------------------------------------ +r4990 | jcbowman | 2010-06-11 14:59:59 -0600 (Fri, 11 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/prc/writePRC.cc + +Rename log2 to Log2. + +------------------------------------------------------------------------ +r4989 | jcbowman | 2010-06-11 14:54:47 -0600 (Fri, 11 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/doc/GaussianSurface.asy + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/examples/BezierPatch.asy + M /trunk/asymptote/examples/Klein.asy + M /trunk/asymptote/examples/RiemannSurface.asy + M /trunk/asymptote/examples/RiemannSurfaceRoot.asy + M /trunk/asymptote/examples/SierpinskiGasket.asy + M /trunk/asymptote/examples/SierpinskiSponge.asy + M /trunk/asymptote/examples/cheese.asy + M /trunk/asymptote/examples/cyclohexane.asy + M /trunk/asymptote/examples/elevation.asy + M /trunk/asymptote/examples/epix.asy + M /trunk/asymptote/examples/equilchord.asy + M /trunk/asymptote/examples/extrudedcontour.asy + M /trunk/asymptote/examples/filesurface.asy + M /trunk/asymptote/examples/magnetic.asy + M /trunk/asymptote/examples/p-orbital.asy + M /trunk/asymptote/examples/parametricelevation.asy + M /trunk/asymptote/examples/parametricsurface.asy + M /trunk/asymptote/examples/pipeintersection.asy + M /trunk/asymptote/examples/roll.asy + M /trunk/asymptote/examples/shellsqrtx01.asy + M /trunk/asymptote/examples/slidedemo.asy + M /trunk/asymptote/examples/soccerball.asy + M /trunk/asymptote/examples/sphere.asy + M /trunk/asymptote/examples/sphericalharmonic.asy + M /trunk/asymptote/examples/spiral3.asy + M /trunk/asymptote/examples/splitpatch.asy + M /trunk/asymptote/examples/sqrtx01.asy + M /trunk/asymptote/examples/sqrtx01y1.asy + M /trunk/asymptote/examples/stroke3.asy + M /trunk/asymptote/examples/threeviews.asy + M /trunk/asymptote/examples/torus.asy + M /trunk/asymptote/examples/trefoilknot.asy + M /trunk/asymptote/examples/trumpet.asy + M /trunk/asymptote/examples/truncatedIcosahedron.asy + M /trunk/asymptote/examples/twistedtubes.asy + M /trunk/asymptote/examples/vectorfieldsphere.asy + M /trunk/asymptote/examples/washer.asy + M /trunk/asymptote/examples/washermethod.asy + M /trunk/asymptote/examples/wedge.asy + M /trunk/asymptote/examples/xxsq01.asy + M /trunk/asymptote/examples/xxsq01x-1.asy + +Update examples to use merge=true for surfaces. + +------------------------------------------------------------------------ +r4988 | jcbowman | 2010-06-11 14:53:22 -0600 (Fri, 11 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/item.h + +Remove unused preprocessor conditionals. + +------------------------------------------------------------------------ +r4987 | jcbowman | 2010-06-11 11:51:54 -0600 (Fri, 11 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/prc/oPRCFile.h + M /trunk/asymptote/prc/writePRC.h + +Fix more memory leaks. + +------------------------------------------------------------------------ +r4986 | jcbowman | 2010-06-11 02:15:51 -0600 (Fri, 11 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/prc/oPRCFile.h + M /trunk/asymptote/prc/writePRC.h + +Fix more memory leaks. + +------------------------------------------------------------------------ +r4985 | jcbowman | 2010-06-11 01:48:05 -0600 (Fri, 11 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/prc/oPRCFile.h + +Fix PRC memory leak. + +------------------------------------------------------------------------ +r4984 | jcbowman | 2010-06-10 17:09:05 -0600 (Thu, 10 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/prc/PRCbitStream.cc + M /trunk/asymptote/prc/oPRCFile.cc + M /trunk/asymptote/prc/oPRCFile.h + M /trunk/asymptote/prc/test.cc + M /trunk/asymptote/prc/writePRC.cc + M /trunk/asymptote/prc/writePRC.h + +Remove tr1 (gcc-4.3) dependence, courtesy of Michail. + +------------------------------------------------------------------------ +r4983 | jcbowman | 2010-06-10 10:24:59 -0600 (Thu, 10 Jun 2010) | 4 lines +Changed paths: + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/base/three_surface.asy + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/examples/cos3.asy + M /trunk/asymptote/examples/exp3.asy + M /trunk/asymptote/examples/gamma3.asy + M /trunk/asymptote/examples/sin3.asy + M /trunk/asymptote/glrender.cc + +Add option (default true) to fill subdivision cracks in unlighted labels. + +Update examples. + +------------------------------------------------------------------------ +r4982 | jcbowman | 2010-06-10 09:28:59 -0600 (Thu, 10 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/patches/README + A /trunk/asymptote/patches/fixmem.reg + +Add patch to fix MSWindows memory limit. +------------------------------------------------------------------------ +r4981 | jcbowman | 2010-06-10 09:24:16 -0600 (Thu, 10 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/camp.l + +Add missing include. + +------------------------------------------------------------------------ +r4980 | jcbowman | 2010-06-09 23:08:24 -0600 (Wed, 09 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/exp.h + +Fix typename of symbol. + +------------------------------------------------------------------------ +r4979 | jcbowman | 2010-06-09 22:00:22 -0600 (Wed, 09 Jun 2010) | 4 lines +Changed paths: + 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.cc + M /trunk/asymptote/glrender.h + M /trunk/asymptote/runpicture.in + +Add billboard support for Bezier curves. + +Fix OpenGL zoom flicker. + +------------------------------------------------------------------------ +r4978 | jcbowman | 2010-06-09 21:01:46 -0600 (Wed, 09 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/asymptote.nsi + +Update location of heap_chunk_in_mb in Windows registry. + +------------------------------------------------------------------------ +r4977 | jcbowman | 2010-06-09 16:25:20 -0600 (Wed, 09 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/prc/PRC.h + M /trunk/asymptote/prc/writePRC.cc + M /trunk/asymptote/runmath.in + +Use a portable integer log2 function. + +------------------------------------------------------------------------ +r4976 | jcbowman | 2010-06-09 16:22:08 -0600 (Wed, 09 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/interact.cc + +Work around missing readline include. + +------------------------------------------------------------------------ +r4975 | hammera | 2010-06-09 11:39:07 -0600 (Wed, 09 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/camp.l + +Don't print non-printable characters. + +------------------------------------------------------------------------ +r4974 | jcbowman | 2010-06-09 11:02:20 -0600 (Wed, 09 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + +Fix offscreen detection (broken in r4627). + +------------------------------------------------------------------------ +r4973 | jcbowman | 2010-06-09 08:57:03 -0600 (Wed, 09 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/memory.h + +Fix __GNU_PREREQ. + +------------------------------------------------------------------------ +r4972 | jcbowman | 2010-06-08 21:38:12 -0600 (Tue, 08 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/memory.h + +Require tr1/unordered_map on systems without __GNUC_PREREQ. + +------------------------------------------------------------------------ +r4971 | jcbowman | 2010-06-08 21:26:55 -0600 (Tue, 08 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/configure.ac + +Support older g++ compilers. + +------------------------------------------------------------------------ +r4970 | jcbowman | 2010-06-08 14:50:38 -0600 (Tue, 08 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/configure.ac + +Avoid g++ informational message and speed up compilation. + +------------------------------------------------------------------------ +r4969 | hammera | 2010-06-08 11:39:49 -0600 (Tue, 08 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/TODO + M /trunk/asymptote/application.cc + M /trunk/asymptote/application.h + M /trunk/asymptote/builtin.cc + M /trunk/asymptote/builtin.h + M /trunk/asymptote/camp.l + M /trunk/asymptote/camp.y + M /trunk/asymptote/coder.cc + M /trunk/asymptote/coder.h + M /trunk/asymptote/constructor.cc + M /trunk/asymptote/dec.cc + M /trunk/asymptote/dec.h + M /trunk/asymptote/entry.cc + M /trunk/asymptote/entry.h + M /trunk/asymptote/env.cc + M /trunk/asymptote/env.h + M /trunk/asymptote/envcompleter.cc + M /trunk/asymptote/errors + M /trunk/asymptote/exp.cc + M /trunk/asymptote/exp.h + M /trunk/asymptote/findsym.pl + M /trunk/asymptote/fundec.cc + M /trunk/asymptote/fundec.h + M /trunk/asymptote/genv.cc + M /trunk/asymptote/genv.h + M /trunk/asymptote/name.cc + M /trunk/asymptote/name.h + M /trunk/asymptote/opsymbols.pl + M /trunk/asymptote/record.cc + M /trunk/asymptote/record.h + M /trunk/asymptote/runtime.in + M /trunk/asymptote/stm.cc + M /trunk/asymptote/stm.h + M /trunk/asymptote/symbol.cc + M /trunk/asymptote/symbol.h + M /trunk/asymptote/table.h + M /trunk/asymptote/tests/arith/integer.asy + M /trunk/asymptote/types.cc + M /trunk/asymptote/types.h + +Replaced symbol table with custom hash table. + +------------------------------------------------------------------------ +r4968 | jcbowman | 2010-06-07 11:29:30 -0600 (Mon, 07 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Emphasize that version 9.0 of Adobe Reader is now required. + +------------------------------------------------------------------------ +r4967 | jcbowman | 2010-06-07 10:05:16 -0600 (Mon, 07 Jun 2010) | 2 lines +Changed paths: + M /trunk/asymptote/base/graph3.asy + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/examples/vectorfieldsphere.asy + +Update grouping. + +------------------------------------------------------------------------ +r4966 | jcbowman | 2010-06-07 07:55:14 -0600 (Mon, 07 Jun 2010) | 3 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Acknowledge contributions of Michail Vidiassov (coauthor with Orest Shardt of +current PRC driver). + +------------------------------------------------------------------------ +r4965 | jcbowman | 2010-06-06 09:58:38 -0600 (Sun, 06 Jun 2010) | 1 line +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/configure.ac + +Increment version to 1.97svn. +------------------------------------------------------------------------ r4964 | jcbowman | 2010-06-06 08:19:42 -0600 (Sun, 06 Jun 2010) | 2 lines Changed paths: M /trunk/asymptote/algebra3.cc diff --git a/Build/source/utils/asymptote/Makefile.in b/Build/source/utils/asymptote/Makefile.in index 92b9e0bdbff..eab0bd238f3 100644 --- a/Build/source/utils/asymptote/Makefile.in +++ b/Build/source/utils/asymptote/Makefile.in @@ -46,7 +46,9 @@ LATEXFILES = asymptote.sty asycolors.sty ocg.sty CONTEXTFILES = colo-asy.tex ASY = ./asy -dir base -config "" -render=0 -DEFS = @DEFS@ @OPTIONS@ -DPRESYM +DEFS = @DEFS@ @OPTIONS@ \ + -DPRESYM -DFASTCAST -DCALLEE_SEARCH -DEXACT_MATCH -DTEST_ADDED_OPS \ + -DNO_FUNC_OPS CFLAGS = @CPPFLAGS@ @CFLAGS@ OPTS = $(DEFS) $(CFLAGS) INCL = -I . @INCL@ diff --git a/Build/source/utils/asymptote/ReleaseNotes b/Build/source/utils/asymptote/ReleaseNotes index f06b4616c50..10581da2852 100644 --- a/Build/source/utils/asymptote/ReleaseNotes +++ b/Build/source/utils/asymptote/ReleaseNotes @@ -1,3 +1,17 @@ +Release Notes for Version 1.98 + +Memory usage and garbage collection were greatly improved, and many optimizations were made. Labels are now aligned using the rotational instead of shiftless part of the transform. A portable CYGWIN memory limit fix was implemented. Noncyclic stokepaths are now discarded to work around a bug in gs 8.71.k. + +Release Notes for Version 1.97 + +A new render.labelfill option (enabled by default) fills subdivision cracks in +unlighted labels. The dependence on gcc-4.3 was removed. Offscreen detection and +zoom bugs in the OpenGL renderer were fixed. Three-dimensional grouping was +improved. The symbol table was replaced with a custom hash table. Portability +updates were made. The Cygwin memory limit fix for MSWindows now works even on +systems that lack a complete Cygwin installation. The examples were updated to +exploit the new PRC rendering options + Release Notes for Version 1.96 The viewpoint function and some examples were updated. diff --git a/Build/source/utils/asymptote/TODO b/Build/source/utils/asymptote/TODO index bb9fec483a5..11eface34c8 100644 --- a/Build/source/utils/asymptote/TODO +++ b/Build/source/utils/asymptote/TODO @@ -1,12 +1,20 @@ Andy: possible optimizations: + fix func op and three.asy + rewrite exp::transToType and protoenv::castSource + varpush+pop --> no op + varsave+pop --> one op + closure+pushfunc+varsave+pop --> savefunc + stack::popWithoutReturningValue + look at position information saved in program, maybe save separately + formal::addOps calls trans only hash first 3 or 4 args of signature - hashify symbol table rm transToType from varinitArg::trans run a perfect match through multimatch first (no casting allowed) - STATIC_SYMBOL(name) define to avoid retranslating symbols in addOps change camp.y to flag arglists with named args remove addFunctionOps in favor of == and != defined in types.h - remove most makesymbols in camp.l + +Andy: testing in errortest.asy for packing versus casting, default argument +ambiguities, and whatever else you can think of Andy: operator tuple, to let people define their own tuples diff --git a/Build/source/utils/asymptote/allsymbols.h b/Build/source/utils/asymptote/allsymbols.h index 73e7564aa49..e00feb33c03 100644 --- a/Build/source/utils/asymptote/allsymbols.h +++ b/Build/source/utils/asymptote/allsymbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/application.cc b/Build/source/utils/asymptote/application.cc index 5a287bf2559..533b624fe55 100644 --- a/Build/source/utils/asymptote/application.cc +++ b/Build/source/utils/asymptote/application.cc @@ -34,7 +34,11 @@ bool castable(env &e, formal& target, formal& source) { score castScore(env &e, formal& target, formal& source) { return equivalent(target.t,source.t) ? EXACT : (!target.Explicit && +#ifdef FASTCAST + e.fastCastable(target.t,source.t)) ? CAST : FAIL; +#else e.castable(target.t,source.t, symbol::castsym)) ? CAST : FAIL; +#endif } @@ -115,18 +119,26 @@ public: } }; +ty *restCellType(signature *sig) { + formal& f=sig->getRest(); + if (f.t) { + array *a=dynamic_cast<array *>(f.t); + if (a) + return a->celltype; + } + + return 0; +} void application::initRest() { - types::formal& f=sig->getRest(); + formal& f=sig->getRest(); if (f.t) { - types::array *a=dynamic_cast<types::array *>(f.t); - if(!a) + ty *ct = restCellType(sig); + if (!ct) vm::error("formal rest argument must be an array"); - static symbol *null=0; - rf=types::formal(a->celltype, null, false, f.Explicit); + rf=formal(ct, symbol::nullsym, false, f.Explicit); } - if (f.t || sig->isOpen) { rest=new restArg(); } @@ -135,7 +147,7 @@ void application::initRest() { //const Int REST=-1; const Int NOMATCH=-2; -Int application::find(symbol *name) { +Int application::find(symbol name) { formal_vector &f=sig->formals; for (size_t i=index; i<f.size(); ++i) if (f[i].name==name && args[i]==0) @@ -192,7 +204,7 @@ bool application::matchAtSpot(size_t spot, env &e, formal &source, bool application::matchArgument(env &e, formal &source, varinit *a, size_t evalIndex) { - assert(source.name==0); + assert(!source.name); if (index==args.size()) // Try to pack into the rest array. @@ -207,7 +219,7 @@ bool application::matchArgument(env &e, formal &source, bool application::matchNamedArgument(env &e, formal &source, varinit *a, size_t evalIndex) { - assert(source.name!=0); + assert(source.name); Int spot=find(source.name); return spot!=NOMATCH && matchAtSpot(spot, e, source, a, evalIndex); @@ -268,20 +280,6 @@ bool application::matchSignature(env &e, types::signature *source, return complete(); } -#if 0 -application *application::matchHelper(env &e, - application *app, - signature *source) -{ - return app->matchSignature(e, source) ? app : 0; -} - -application *application::match(env &e, signature *target, signature *source) { - application *app=new application(target); - return matchHelper(e, app, source); -} -#endif - bool application::matchOpen(env &e, signature *source, arglist &al) { assert(rest); @@ -305,10 +303,13 @@ application *application::match(env &e, function *t, signature *source, assert(t->kind==ty_function); application *app=new application(t); - if (t->getSignature()->isOpen) - return app->matchOpen(e, source, al) ? app : 0; - else - return app->matchSignature(e, source, al) ? app : 0; + bool success = t->getSignature()->isOpen ? + app->matchOpen(e, source, al) : + app->matchSignature(e, source, al); + + //cout << "MATCH " << success << endl; + + return success ? app : 0; } void application::transArgs(coenv &e) { @@ -321,34 +322,307 @@ void application::transArgs(coenv &e) { rest->trans(e,temps); } -app_list multimatch(env &e, - types::overloaded *o, - types::signature *source, - arglist &al) +bool application::exact() { + if (sig->isOpen) + return false; + for (score_vector::iterator p = scores.begin(); p != scores.end(); ++p) + if (*p != EXACT) + return false; + return true; +} + +bool application::halfExact() { + if (sig->isOpen) + return false; + if (scores.size() != 2) + return false; + if (scores[0] == EXACT && scores[1] == CAST) + return true; + if (scores[0] == CAST && scores[1] == EXACT) + return true; + return false; +} + +// True if any of the formals have names. +bool namedFormals(signature *sig) +{ + formal_vector formals = sig->formals; + size_t n = formals.size(); + for (size_t i = 0; i < n; ++i) { + if (formals[i].name) + return true; + } + return false; +} + +// Tests if arguments in the source signature can be matched to the formals +// in the target signature with no casting or packing. +// This allows overloaded args, but not named args. +bool exactlyMatchable(signature *target, signature *source) +{ + // Open signatures never exactly match. + if (target->isOpen) + return false; + +#if 0 + assert(!namedFormals(source)); +#endif + + formal_vector& formals = target->formals; + formal_vector& args = source->formals; + + // Sizes of the two lists. + size_t fn = formals.size(), an = args.size(); + + // Indices for the two lists. + size_t fi = 0, ai = 0; + + while (fi < fn && ai < an) { + if (equivalent(formals[fi].t, args[ai].t)) { + // Arguments match, move to the next. + ++fi; ++ai; + } else if (formals[fi].defval) { + // Match formal to default value. + ++fi; + } else { + // Failed to match formal. + return false; + } + } + + assert(fi == fn || ai == an); + + // Packing array arguments into the rest formal is inexact. Do not allow it + // here. + if (ai < an) + return false; + + assert(ai == an); + + // Match any remaining formal to defaults. + while (fi < fn) + if (formals[fi].defval) { + // Match formal to default value. + ++fi; + } else { + // Failed to match formal. + return false; + } + + // Non-rest arguments have matched. + assert(fi == fn && ai == an); + + // Try to match the rest argument if given. + if (source->hasRest()) { + if (!target->hasRest()) + return false; + + if (!equivalent(source->getRest().t, target->getRest().t)) + return false; + } + + // All arguments have matched. + return true; +} + +// Tries to match applications without casting. If an application matches +// here, we need not attempt to match others with the slower, more general +// techniques. +app_list exactMultimatch(env &e, + types::overloaded *o, + types::signature *source, + arglist &al) +{ + assert(source); + + app_list l; + + // This can't handle named arguments. + if (namedFormals(source)) + return l; /* empty */ + + for (ty_vector::iterator t=o->sub.begin(); t!=o->sub.end(); ++t) + { + if ((*t)->kind != ty_function) + continue; + + function *ft = (function *)*t; + + if (!exactlyMatchable(ft->getSignature(), source)) + continue; + + application *a=application::match(e, ft, source, al); + assert(a); + + // Consider calling + // void f(int x, real y=0.0, int z=0) + // with + // f(1,2) + // exactlyMatchable will return true, matching 1 to x and 2 to z, but the + // application::match will give an inexact match of 1 to x to 2 to y, due + // to the cast from int to real. Therefore, we must test for exactness + // even after matching. + if (a->exact()) + l.push_back(a); + } + + //cout << "EXACTMATCH " << (!l.empty()) << endl; + return l; +} + +bool halfExactMightMatch(signature *target, types::ty *t1, types::ty *t2) +{ + formal_vector& formals = target->formals; + if (formals.size() < 2) + return false; + if (formals.size() > 2) { + // We should probably abort the whole matching in this case. For now, + // return true and let the usual matching handle it. + return true; + } + + assert(formals[0].t); + assert(formals[1].t); + + // Test if one of the arguments matches exactly. + return equivalent(formals[0].t, t1) || equivalent(formals[1].t, t2); +} + +// Most commonly after exact matches are cases such as 2+3.4, that is, binary +// operations were one of the operands matches exactly and the other does not. +// This searches for this so-called "half-exact" matches. +// This should only be called after exactMultimatch has failed. +app_list halfExactMultimatch(env &e, + types::overloaded *o, + types::signature *source, + arglist &al) { assert(source); app_list l; + + // Half exact is only in the case of two arguments. + formal_vector& formals = source->formals; + if (formals.size() != 2 || source->hasRest()) + return l; /* empty */ + + // This can't handle named arguments. + if (namedFormals(source)) + return l; /* empty */ + + // Alias the two argument types. + types::ty *t1 = formals[0].t; + types::ty *t2 = formals[1].t; + + assert(t1); assert(t2); + + for (ty_vector::iterator t=o->sub.begin(); t!=o->sub.end(); ++t) + { + if ((*t)->kind != ty_function) + continue; + + function *ft = (function *)*t; + +#if 1 + if (!halfExactMightMatch(ft->getSignature(), t1, t2)) + continue; +#endif + + application *a=application::match(e, ft, source, al); + +#if 1 + if (a && a->halfExact()) + l.push_back(a); +#endif + } + + return l; +} + +// The full overloading resolution system, which handles casting of arguments, +// packing into rest arguments, named arguments, etc. +app_list inexactMultimatch(env &e, + types::overloaded *o, + types::signature *source, + arglist &al) +{ + assert(source); + + app_list l; + + +#define DEBUG_GETAPP 0 #if DEBUG_GETAPP + //cout << "source: " << *source << endl; + //cout << "ARGS: " << source->getNumFormals() << endl; bool perfect=false; + bool exact=false; + bool halfExact=false; #endif for(ty_vector::iterator t=o->sub.begin(); t!=o->sub.end(); ++t) { if ((*t)->kind==ty_function) { #if DEBUG_GETAPP function *ft = dynamic_cast<function *>(*t); - if (equivalent(ft->getSignature(), source)) + signature *target = ft->getSignature(); + cout << "TOTAL" << endl; + cout << "ARGS: source: " << source->getNumFormals() + << " target: " << target->getNumFormals() << endl; + //cout << "target: " << *target << endl; + if (equivalent(target, source)) perfect = true; +#if 0 + cout << "TOTAL" << endl; + if (target->getNumFormals() < source->getNumFormals() && + !target->hasRest()) { + cout << "TOO MANY ARGS" << endl; + } else if (target->getNumFormals() == source->getNumFormals() && + !target->hasRest()) { + cout << "EXACT ARGS" << endl; + } else { + cout << "NOT TOO MANY ARGS" << endl; + } +#endif #endif application *a=application::match(e, (function *)(*t), source, al); if (a) l.push_back(a); +#if DEBUG_GETAPP + if (a && !namedFormals(source)) { + if (a->exact() != exactlyMatchable(ft->getSignature(), source)) { + cout << a->exact() << " != " + << exactlyMatchable(ft->getSignature(), source) << endl; + cout << "ft = " << *ft << endl; + cout << "args = " << *source << endl; + } + assert(a->exact() == exactlyMatchable(ft->getSignature(), source)); + if (a->halfExact() && !namedFormals(source)) { + if (!halfExactMightMatch(target, source->getFormal(0).t, + source->getFormal(1).t)) + { + cerr << "target: " << *target << " source: " << *source << endl; + cerr.flush(); + } + cerr << "test" << endl;; + cerr.flush(); + assert(halfExactMightMatch(target, source->getFormal(0).t, + source->getFormal(1).t)); + } + + } + if (a && a->exact()) exact = true; + if (a && a->halfExact()) halfExact = true; +#endif } } #if DEBUG_GETAPP - cout << (perfect ? "PERFECT" : "IMPERFECT") << endl; + cout << (perfect ? "PERFECT" : + exact ? "EXACT" : + halfExact ? "HALFEXACT" : + "IMPERFECT") + << endl; #endif if (l.size() > 1) { @@ -364,19 +638,61 @@ app_list multimatch(env &e, return l; } -#if 0 -app_list resolve(env &e, - types::ty *t, - types::signature *source) -{ - if (t->kind == ty_overloaded) - return multimatch(e, (overloaded *)t, source); - else { - overloaded o; - o.add(t); - return multimatch(e, &o, source); +enum testExactType { + TEST_EXACT, + DONT_TEST_EXACT, +}; + +// Sanity check for multimatch optimizations. +void sameApplications(app_list a, app_list b, testExactType te) { + assert(a.size() == b.size()); + + if (te == TEST_EXACT) { + for (app_list::iterator i = a.begin(); i != a.end(); ++i) { + if (!(*i)->exact()) { + cout << *(*i)->getType() << endl; + } + assert((*i)->exact()); + } + for (app_list::iterator i = b.begin(); i != b.end(); ++i) + assert((*i)->exact()); } + + if (a.size() == 1) + assert(equivalent(a.front()->getType(), b.front()->getType())); } + +app_list multimatch(env &e, + types::overloaded *o, + types::signature *source, + arglist &al) +{ +#ifdef EXACT_MATCH + app_list a = exactMultimatch(e, o, source, al); + if (!a.empty()) { +#if DEBUG_CACHE + // Make sure that exactMultimatch and the fallback return the same + // application(s). + sameApplications(a, inexactMultimatch(e, o, source, al), TEST_EXACT); +#endif + + return a; + } + + a = halfExactMultimatch(e, o, source, al); + if (!a.empty()) { +#if DEBUG_CACHE + // Make sure that exactMultimatch and the fallback return the same + // application(s). + sameApplications(a, inexactMultimatch(e, o, source, al), DONT_TEST_EXACT); +#endif + + return a; + } #endif + // Slow but most general method. + return inexactMultimatch(e, o, source, al); +} + } // namespace trans diff --git a/Build/source/utils/asymptote/application.h b/Build/source/utils/asymptote/application.h index 060afeafdb3..13302453b5b 100644 --- a/Build/source/utils/asymptote/application.h +++ b/Build/source/utils/asymptote/application.h @@ -232,7 +232,7 @@ class application : public gc { // Finds the first unmatched formal of the given name, returning the index. // The rest formal is not tested. This function returns FAIL if no formals // match. - Int find(symbol *name); + Int find(symbol name); // Match the formal at index to its default argument (if it has one). bool matchDefault(); @@ -287,6 +287,15 @@ public: types::function *getType() { return t; } + + // This returns true in the special case that the arguments matched without + // casting or packing into the rest formal. + bool exact(); + + // The next best thing (score-wise) to an exact match. This returns true if + // there are two arguments, one of which is cast and one is matched exactly + // and neither are packed into the rest argument. + bool halfExact(); }; typedef mem::list<application *> app_list; diff --git a/Build/source/utils/asymptote/array.cc b/Build/source/utils/asymptote/array.cc index e0ee2145407..58c43710641 100644 --- a/Build/source/utils/asymptote/array.cc +++ b/Build/source/utils/asymptote/array.cc @@ -154,22 +154,19 @@ void array::setSlice(Int left, Int right, array *a) } } -item copyItemToDepth(item i, Int depth) +item copyItemToDepth(item i, size_t depth) { - assert(depth >= 0); - if (depth == 0 || !isarray(i)) + if (depth == 0) return i; else return get<array *>(i)->copyToDepth(depth); } -array *array::copyToDepth(Int depth) +array *array::copyToDepth(size_t depth) { - assert(depth >= 0); if (depth == 0) { return this; - } - else { + } else { size_t n=this->size(); array *a=new array(n); a->cycle = this->cycle; @@ -181,7 +178,7 @@ array *array::copyToDepth(Int depth) } } -array::array(size_t n, item i, Int depth) +array::array(size_t n, item i, size_t depth) : mem::vector<item>(n), cycle(false) { for (size_t k=0; k<n; ++k) diff --git a/Build/source/utils/asymptote/array.h b/Build/source/utils/asymptote/array.h index beee263c815..58a97d7b253 100644 --- a/Build/source/utils/asymptote/array.h +++ b/Build/source/utils/asymptote/array.h @@ -27,7 +27,7 @@ public: : mem::vector<item>(n), cycle(false) {} - array(size_t n, item i, Int depth); + array(size_t n, item i, size_t depth); void push(item i) { @@ -58,7 +58,7 @@ public: return cycle; } - array *copyToDepth(Int depth); + array *copyToDepth(size_t depth); }; template <typename T> @@ -95,17 +95,10 @@ inline size_t checkArrays(const vm::array *a, const vm::array *b) return asize; } -// Tests if an item is actually an array. This needs to be defined here, -// after the array type is declared. -inline bool isarray(const item& it) -{ - return *it.kind == typeid(array); -} - -// Copies an item to a depth d. If d==0 or if the item is not array, then the -// item is just returned without copying, otherwise, the array and its -// subarrays are copied as deeply as possible up to a depth d. -item copyItemToDepth(item i, Int depth); +// Copies an item to a depth d. If d == 0 then the item is just returned +// without copying, otherwise, the array and its subarrays are copied to +// depth d. +item copyItemToDepth(item i, size_t depth); } // namespace vm diff --git a/Build/source/utils/asymptote/asy-keywords.el b/Build/source/utils/asymptote/asy-keywords.el index 1328eae5e2c..6ab99004d56 100644 --- a/Build/source/utils/asymptote/asy-keywords.el +++ b/Build/source/utils/asymptote/asy-keywords.el @@ -2,7 +2,7 @@ ;; This file is automatically generated by asy-list.pl. ;; Changes will be overwritten. ;; -(defvar asy-keywords-version "1.96") +(defvar asy-keywords-version "1.98") (defvar asy-keyword-name '( and controls tension atleast curl if else while for do return break continue struct typedef new access import unravel from include quote static public private restricted this explicit true false null cycle newframe operator )) diff --git a/Build/source/utils/asymptote/asymptote.nsi b/Build/source/utils/asymptote/asymptote.nsi index 725245d06eb..453a420aa67 100644 --- a/Build/source/utils/asymptote/asymptote.nsi +++ b/Build/source/utils/asymptote/asymptote.nsi @@ -133,7 +133,7 @@ Section -Post WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Path" "$INSTDIR" WriteRegStr HKLM "${PRODUCT_FILE_TYPE_REGKEY1}" "" "ASYFile" WriteRegStr HKLM "${PRODUCT_FILE_TYPE_REGKEY2}" "" '"$INSTDIR\asy.bat" "%1"' - WriteRegDWORD HKLM "SOFTWARE\Cygnus Solutions\Cygwin" "heap_chunk_in_mb" 0xFFFFFFFF + WriteRegDWORD HKLM "SOFTWARE\Cygwin" "heap_chunk_in_mb" 0xFFFFFF00 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "CYGWIN" ${If} $0 == "" WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "CYGWIN" "nodosfilewarning" diff --git a/Build/source/utils/asymptote/asymptote.spec b/Build/source/utils/asymptote/asymptote.spec index d1990a7bca0..9dcfa6b3ecd 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.96 +Version: 1.98 Release: 1%{?dist} Summary: Descriptive vector graphics language diff --git a/Build/source/utils/asymptote/base/graph3.asy b/Build/source/utils/asymptote/base/graph3.asy index 9c6529a74dd..ee83e8cb99b 100644 --- a/Build/source/utils/asymptote/base/graph3.asy +++ b/Build/source/utils/asymptote/base/graph3.asy @@ -1877,10 +1877,11 @@ void draw(picture pic=currentpicture, Label[] L=new Label[], void draw(picture pic=currentpicture, Label[] L=new Label[], guide3[][] g, pen p=currentpen, light light=currentlight, - string name="", interaction interaction=LabelInteraction()) + string name="", render render=defaultrender, + interaction interaction=LabelInteraction()) { draw(pic,L,g,sequence(new pen(int) {return p;},g.length),light,name, - interaction); + render,interaction); } real maxlength(triple f(pair z), pair a, pair b, int nu, int nv) @@ -1893,7 +1894,8 @@ picture vectorfield(path3 vector(pair v), triple f(pair z), pair a, pair b, int nu=nmesh, int nv=nu, bool truesize=false, real maxlength=truesize ? 0 : maxlength(f,a,b,nu,nv), bool cond(pair z)=null, pen p=currentpen, - arrowbar3 arrow=Arrow3, margin3 margin=PenMargin3) + arrowbar3 arrow=Arrow3, margin3 margin=PenMargin3, + string name="", render render=defaultrender) { picture pic; real du=1/nu; @@ -1915,21 +1917,24 @@ picture vectorfield(path3 vector(pair v), triple f(pair z), pair a, pair b, scale=max > 0 ? maxlength/max : 1; } else scale=1; + begingroup3(pic,name == "" ? "vectorfield" : name,render); for(int i=0; i <= nu; ++i) { real x=interp(a.x,b.x,i*du); for(int j=0; j <= nv; ++j) { pair z=(x,interp(a.y,b.y,j*dv)); if(all || cond(z)) { path3 g=scale3(scale)*vector(z); + string name="vector"; if(truesize) { picture opic; - draw(opic,g,p,arrow,margin); + draw(opic,g,p,arrow,margin,name,render); add(pic,opic,f(z)); } else - draw(pic,shift(f(z))*g,p,arrow,margin); + draw(pic,shift(f(z))*g,p,arrow,margin,name,render); } } } + endgroup3(pic); return pic; } diff --git a/Build/source/utils/asymptote/base/plain_Label.asy b/Build/source/utils/asymptote/base/plain_Label.asy index 6e6f231375a..4f9d9a20f11 100644 --- a/Build/source/utils/asymptote/base/plain_Label.asy +++ b/Build/source/utils/asymptote/base/plain_Label.asy @@ -297,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(shiftless(t)*align); + align=length(align)*unit(rotation(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_constants.asy b/Build/source/utils/asymptote/base/plain_constants.asy index ba8947c91c2..d1d11b1b1c5 100644 --- a/Build/source/utils/asymptote/base/plain_constants.asy +++ b/Build/source/utils/asymptote/base/plain_constants.asy @@ -1,4 +1,4 @@ -restricted int undefined=intMax+((intMax % 2)-1); +restricted int undefined=(intMax % 2 == 1) ? intMax : intMax-1; restricted real inches=72; restricted real inch=inches; diff --git a/Build/source/utils/asymptote/base/three.asy b/Build/source/utils/asymptote/base/three.asy index b0d9c456faa..2de8b4a5cca 100644 --- a/Build/source/utils/asymptote/base/three.asy +++ b/Build/source/utils/asymptote/base/three.asy @@ -36,6 +36,7 @@ struct render // General parameters: real margin; // shrink amount for rendered openGL viewport, in bp. real tubegranularity; // granularity for rendering tubes + bool labelfill; // fill subdivision cracks in unlighted labels static render defaultrender; @@ -46,7 +47,8 @@ struct render bool3 merge=defaultrender.merge, int sphere=defaultrender.sphere, real margin=defaultrender.margin, - real tubegranularity=defaultrender.tubegranularity) + real tubegranularity=defaultrender.tubegranularity, + bool labelfill=defaultrender.labelfill) { this.compression=compression; this.granularity=granularity; @@ -56,6 +58,7 @@ struct render this.sphere=sphere; this.margin=margin; this.tubegranularity=tubegranularity; + this.labelfill=labelfill; } } @@ -70,6 +73,7 @@ defaultrender.merge=false; defaultrender.margin=0.02; defaultrender.tubegranularity=0.005; defaultrender.sphere=NURBSsphere; +defaultrender.labelfill=true; real defaultshininess=0.25; @@ -2127,8 +2131,7 @@ pair max(frame f, projection P) void draw(picture pic=currentpicture, Label L="", path3 g, align align=NoAlign, material p=currentpen, margin3 margin=NoMargin3, - light light=nolight, string name="", - render render=defaultrender) + light light=nolight, string name="", render render=defaultrender) { pen q=(pen) p; pic.add(new void(frame f, transform3 t, picture pic, projection P) { @@ -2167,13 +2170,13 @@ draw=new void(frame f, path3 g, material p=currentpen, void cylinder(transform3) {}; void sphere(transform3, bool half) {}; void disk(transform3) {}; - void tube(path3, path3); + void pipe(path3, path3); if(prc) { cylinder=new void(transform3 t) {drawPRCcylinder(f,t,p,light);}; sphere=new void(transform3 t, bool half) {drawPRCsphere(f,t,half,p,light,render);}; - disk=new void(transform3 t) {draw(f,t*unitdisk,p,light);}; - tube=new void(path3 center, path3 g) + disk=new void(transform3 t) {draw(f,t*unitdisk,p,light,render);}; + pipe=new void(path3 center, path3 g) {drawPRCtube(f,center,g,p,light);}; } real linecap; @@ -2193,7 +2196,7 @@ draw=new void(frame f, path3 g, material p=currentpen, L += 2; } } - tube T=tube(g,width,render,cylinder,sphere,tube); + tube T=tube(g,width,render,cylinder,sphere,pipe); path3 c=T.center; if(L >= 0) { if(open) { @@ -2300,10 +2303,11 @@ void draw(picture pic=currentpicture, Label L="", path3 g, begingroup3(pic,name,render); bool drawpath=arrow(pic,g,p,margin,light,arrowheadlight); if(bar(pic,g,p,margin,light,arrowheadlight) && drawpath) - draw(pic,L,g,align,p,margin,light); + draw(pic,L,g,align,p,margin,light,render); if(group) endgroup3(pic); - label(pic,L,g,align,(pen) p); + if(L.s != "") + label(pic,L,g,align,(pen) p); } void draw(frame f, path3 g, material p=currentpen, arrowbar3 arrow, @@ -2316,7 +2320,7 @@ void draw(frame f, path3 g, material p=currentpen, arrowbar3 arrow, if(group) begingroup3(f,name,render); if(arrow(pic,g,p,NoMargin3,light,arrowheadlight)) - draw(f,g,p,light,P); + draw(f,g,p,light,render,P); add(f,pic.fit()); if(group) endgroup3(f); @@ -2349,7 +2353,8 @@ void add(picture src, triple position, bool group=true, bool above=true) void arrow(picture pic=currentpicture, Label L="", triple b, triple dir, real length=arrowlength, align align=NoAlign, pen p=currentpen, arrowbar3 arrow=Arrow3, margin3 margin=EndMargin3, - light light=nolight, light arrowheadlight=currentlight) + light light=nolight, light arrowheadlight=currentlight, + string name="", render render=defaultrender) { Label L=L.copy(); if(L.defaultposition) L.position(0); @@ -2358,7 +2363,7 @@ void arrow(picture pic=currentpicture, Label L="", triple b, triple dir, picture opic; marginT3 margin=margin(b--b,p); // Extract margin.begin and margin.end triple a=(margin.begin+length+margin.end)*unit(dir); - draw(opic,L,a--O,align,p,arrow,margin,light,arrowheadlight); + draw(opic,L,a--O,align,p,arrow,margin,light,arrowheadlight,name,render); add(pic,opic,b); } @@ -2366,10 +2371,11 @@ void arrow(picture pic=currentpicture, Label L="", triple b, pair dir, real length=arrowlength, align align=NoAlign, pen p=currentpen, arrowbar3 arrow=Arrow3, margin3 margin=EndMargin3, light light=nolight, light arrowheadlight=currentlight, + string name="", render render=defaultrender, projection P=currentprojection) { arrow(pic,L,b,invert(dir,b,P),length,align,p,arrow,margin,light, - arrowheadlight); + arrowheadlight,name,render); } triple min3(picture pic, projection P=currentprojection) diff --git a/Build/source/utils/asymptote/base/three_surface.asy b/Build/source/utils/asymptote/base/three_surface.asy index e00acfa8367..c4f05c7882f 100644 --- a/Build/source/utils/asymptote/base/three_surface.asy +++ b/Build/source/utils/asymptote/base/three_surface.asy @@ -1431,8 +1431,12 @@ void label(frame f, Label L, triple position, align align=NoAlign, L.T3=transform3(P); begingroup3(f,name == "" ? L.s : name,render); if(is3D()) { - for(patch S : surface(L,position).s) + bool lighton=light.on(); + for(patch S : surface(L,position).s) { draw3D(f,S,position,L.p,light,interaction); + if(render.labelfill && !lighton) // Fill subdivision cracks + _draw(f,S.external(),position,L.p,interaction.type); + } } else { pen p=color(L.T3*Z,L.p,light,shiftless(P.T.modelview)); if(L.defaulttransform3) { @@ -1475,10 +1479,15 @@ void label(picture pic=currentpicture, Label L, triple position, surface S=surface(L,v); begingroup3(f,name == "" ? L.s : name,render,v,interaction.type); - if(is3D()) - for(patch S : surface(L,v).s) + bool lighton=light.on(); + if(is3D()) { + for(patch S : surface(L,v).s) { draw3D(f,S,v,L.p,light,interaction); - + if(render.labelfill && !lighton) // Fill subdivision cracks + _draw(f,S.external(),v,L.p,interaction.type); + } + } + if(pic != null) { pen p=color(L.T3*Z,L.p,light,shiftless(P.T.modelview)); if(L.defaulttransform3) { diff --git a/Build/source/utils/asymptote/base/three_tube.asy b/Build/source/utils/asymptote/base/three_tube.asy index 2eb5e4cf716..281eb0716da 100644 --- a/Build/source/utils/asymptote/base/three_tube.asy +++ b/Build/source/utils/asymptote/base/three_tube.asy @@ -296,7 +296,7 @@ struct tube void operator init(path3 p, real width, render render=defaultrender, void cylinder(transform3)=Null, void sphere(transform3, bool half)=Null, - void tube(path3, path3)=null) { + void pipe(path3, path3)=null) { real r=0.5*width; void generate(path3 p) { @@ -380,7 +380,7 @@ struct tube path3 Center=path3(pre,point,post,b,T.cyclic); center=center&Center; - if(tube != null) { // Compute path along tube + if(pipe != null) { // Compute path along tube triple[] pre=new triple[n+1]; triple[] point=new triple[n+1]; triple[] post=new triple[n+1]; @@ -392,7 +392,7 @@ struct tube point[i+1]=P[3][0]; } post[n]=S.s[S.index[n-1][0]].P[3][0]; - tube(Center,path3(pre,point,post,b,T.cyclic)); + pipe(Center,path3(pre,point,post,b,T.cyclic)); } } } diff --git a/Build/source/utils/asymptote/builtin.cc b/Build/source/utils/asymptote/builtin.cc index 8e2d80cb3f1..2e95dc2f394 100644 --- a/Build/source/utils/asymptote/builtin.cc +++ b/Build/source/utils/asymptote/builtin.cc @@ -77,7 +77,7 @@ void gen_runpath3d_venv(venv &ve); void gen_runmath_venv(venv &ve); -void addType(tenv &te, symbol *name, ty *t) +void addType(tenv &te, symbol name, ty *t) { te.enter(name, new tyEntry(t,0,0,position())); } @@ -93,7 +93,7 @@ void base_tenv(tenv &te) const formal noformal(0); -void addFunc(venv &ve, access *a, ty *result, symbol *id, +void addFunc(venv &ve, access *a, ty *result, symbol id, formal f1=noformal, formal f2=noformal, formal f3=noformal, formal f4=noformal, formal f5=noformal, formal f6=noformal, formal f7=noformal, formal f8=noformal, formal f9=noformal, @@ -130,7 +130,7 @@ void addFunc(venv &ve, access *a, ty *result, symbol *id, } // Add a function with one or more default arguments. -void addFunc(venv &ve, bltin f, ty *result, symbol *name, +void addFunc(venv &ve, bltin f, ty *result, symbol name, formal f1, formal f2, formal f3, formal f4, formal f5, formal f6, formal f7, formal f8, formal f9, formal fA, formal fB, formal fC, formal fD, formal fE, formal fF, formal fG, formal fH, formal fI) @@ -141,26 +141,7 @@ void addFunc(venv &ve, bltin f, ty *result, symbol *name, fA,fB,fC,fD,fE,fF,fG,fH,fI); } -#if 0 -// Add a function with one or more default arguments. -void addFunc(venv &ve, bltin f, ty *result, const char *name, - formal f1, formal f2, formal f3, formal f4, formal f5, formal f6, - formal f7, formal f8, formal f9, formal fA, formal fB, formal fC, - formal fD, formal fE, formal fF, formal fG, formal fH, formal fI) -{ - REGISTER_BLTIN(f, name); - access *a = new bltinAccess(f); - addFunc(ve,a,result,symbol::trans(name),f1,f2,f3,f4,f5,f6,f7,f8,f9, - fA,fB,fC,fD,fE,fF,fG,fH,fI); -} - -void addFunc(venv &ve, access *a, ty *result, const char *name, formal f1) -{ - addFunc(ve,a,result,symbol::trans(name),f1); -} -#endif - -void addOpenFunc(venv &ve, bltin f, ty *result, symbol *name) +void addOpenFunc(venv &ve, bltin f, ty *result, symbol name) { function *fun = new function(result, signature::OPEN); @@ -174,7 +155,7 @@ void addOpenFunc(venv &ve, bltin f, ty *result, symbol *name) // Add a rest function with zero or more default/explicit arguments. -void addRestFunc(venv &ve, bltin f, ty *result, symbol *name, formal frest, +void addRestFunc(venv &ve, bltin f, ty *result, symbol name, formal frest, formal f1=noformal, formal f2=noformal, formal f3=noformal, formal f4=noformal, formal f5=noformal, formal f6=noformal, formal f7=noformal, formal f8=noformal, formal f9=noformal) @@ -200,13 +181,13 @@ void addRestFunc(venv &ve, bltin f, ty *result, symbol *name, formal frest, ve.enter(name, ent); } -void addRealFunc0(venv &ve, bltin fcn, symbol *name) +void addRealFunc0(venv &ve, bltin fcn, symbol name) { addFunc(ve, fcn, primReal(), name); } template<double (*fcn)(double)> -void addRealFunc(venv &ve, symbol *name) +void addRealFunc(venv &ve, symbol name) { addFunc(ve, realReal<fcn>, primReal(), name, formal(primReal(),SYM(x))); addFunc(ve, arrayFunc<double,double,fcn>, realArray(), name, @@ -215,7 +196,7 @@ void addRealFunc(venv &ve, symbol *name) #define addRealFunc(fcn, sym) addRealFunc<fcn>(ve, sym); -void addRealFunc2(venv &ve, bltin fcn, symbol *name) +void addRealFunc2(venv &ve, bltin fcn, symbol name) { addFunc(ve,fcn,primReal(),name,formal(primReal(),SYM(a)), formal(primReal(),SYM(b))); @@ -229,8 +210,8 @@ void realRealInt(vm::stack *s) { } template<double (*fcn)(double, int)> -void addRealIntFunc(venv& ve, symbol *name, symbol *arg1, - symbol *arg2) { +void addRealIntFunc(venv& ve, symbol name, symbol arg1, + symbol arg2) { addFunc(ve, realRealInt<fcn>, primReal(), name, formal(primReal(), arg1), formal(primInt(), arg2)); } @@ -334,7 +315,7 @@ void realRealIntGSL(vm::stack *s) // Add a GSL special function from the GNU GSL library template<double (*fcn)(double)> -void addGSLRealFunc(symbol *name, symbol *arg1=SYM(x)) +void addGSLRealFunc(symbol name, symbol arg1=SYM(x)) { addFunc(GSLModule->e.ve, realRealGSL<fcn>, primReal(), name, formal(primReal(),arg1)); @@ -342,15 +323,15 @@ void addGSLRealFunc(symbol *name, symbol *arg1=SYM(x)) // Add a GSL_PREC_DOUBLE GSL special function. template<double (*fcn)(double, gsl_mode_t)> -void addGSLDOUBLEFunc(symbol *name, symbol *arg1=SYM(x)) +void addGSLDOUBLEFunc(symbol name, symbol arg1=SYM(x)) { addFunc(GSLModule->e.ve, realRealDOUBLE<fcn>, primReal(), name, formal(primReal(),arg1)); } template<double (*fcn)(double, double, gsl_mode_t)> -void addGSLDOUBLE2Func(symbol *name, symbol *arg1=SYM(phi), - symbol *arg2=SYM(k)) +void addGSLDOUBLE2Func(symbol name, symbol arg1=SYM(phi), + symbol arg2=SYM(k)) { addFunc(GSLModule->e.ve, realRealRealDOUBLE<fcn>, primReal(), name, formal(primReal(),arg1), formal(primReal(),arg2)); @@ -367,8 +348,8 @@ void realRealRealRealDOUBLE(vm::stack *s) } template<double (*fcn)(double, double, double, gsl_mode_t)> -void addGSLDOUBLE3Func(symbol *name, symbol *arg1, symbol *arg2, - symbol *arg3) +void addGSLDOUBLE3Func(symbol name, symbol arg1, symbol arg2, + symbol arg3) { addFunc(GSLModule->e.ve, realRealRealRealDOUBLE<fcn>, primReal(), name, formal(primReal(),arg1), formal(primReal(),arg2), @@ -387,8 +368,8 @@ void realRealRealRealRealDOUBLE(vm::stack *s) } template<double (*fcn)(double, double, double, double, gsl_mode_t)> -void addGSLDOUBLE4Func(symbol *name, symbol *arg1, symbol *arg2, - symbol *arg3, symbol *arg4) +void addGSLDOUBLE4Func(symbol name, symbol arg1, symbol arg2, + symbol arg3, symbol arg4) { addFunc(GSLModule->e.ve, realRealRealRealRealDOUBLE<fcn>, primReal(), name, formal(primReal(),arg1), formal(primReal(),arg2), @@ -396,7 +377,7 @@ void addGSLDOUBLE4Func(symbol *name, symbol *arg1, symbol *arg2, } template<double (*fcn)(unsigned)> -void addGSLIntFunc(symbol *name) +void addGSLIntFunc(symbol name) { addFunc(GSLModule->e.ve, realIntGSL<fcn>, primReal(), name, formal(primInt(),SYM(s))); @@ -411,31 +392,31 @@ void realSignedGSL(vm::stack *s) } template<double (*fcn)(int)> -void addGSLSignedFunc(symbol *name, symbol *arg1) +void addGSLSignedFunc(symbol name, symbol arg1) { addFunc(GSLModule->e.ve, realSignedGSL<fcn>, primReal(), name, formal(primInt(),arg1)); } template<double (*fcn)(int, double)> -void addGSLIntRealFunc(symbol *name, symbol *arg1=SYM(n), - symbol *arg2=SYM(x)) +void addGSLIntRealFunc(symbol name, symbol arg1=SYM(n), + symbol arg2=SYM(x)) { addFunc(GSLModule->e.ve, realIntRealGSL<fcn>, primReal(), name, formal(primInt(),arg1), formal(primReal(),arg2)); } template<double (*fcn)(double, double)> -void addGSLRealRealFunc(symbol *name, symbol *arg1=SYM(nu), - symbol *arg2=SYM(x)) +void addGSLRealRealFunc(symbol name, symbol arg1=SYM(nu), + symbol arg2=SYM(x)) { addFunc(GSLModule->e.ve, realRealRealGSL<fcn>, primReal(), name, formal(primReal(),arg1), formal(primReal(),arg2)); } template<double (*fcn)(double, double, double)> -void addGSLRealRealRealFunc(symbol *name, symbol *arg1, - symbol *arg2, symbol *arg3) +void addGSLRealRealRealFunc(symbol name, symbol arg1, + symbol arg2, symbol arg3) { addFunc(GSLModule->e.ve, realRealRealRealGSL<fcn>, primReal(), name, formal(primReal(),arg1), formal(primReal(),arg2), @@ -443,8 +424,8 @@ void addGSLRealRealRealFunc(symbol *name, symbol *arg1, } template<int (*fcn)(double, double, double)> -void addGSLRealRealRealFuncInt(symbol *name, symbol *arg1, - symbol *arg2, symbol *arg3) +void addGSLRealRealRealFuncInt(symbol name, symbol arg1, + symbol arg2, symbol arg3) { addFunc(GSLModule->e.ve, intRealRealRealGSL<fcn>, primInt(), name, formal(primReal(),arg1), formal(primReal(),arg2), @@ -452,8 +433,8 @@ void addGSLRealRealRealFuncInt(symbol *name, symbol *arg1, } template<double (*fcn)(double, unsigned)> -void addGSLRealIntFunc(symbol *name, symbol *arg1=SYM(nu), - symbol *arg2=SYM(s)) +void addGSLRealIntFunc(symbol name, symbol arg1=SYM(nu), + symbol arg2=SYM(s)) { addFunc(GSLModule->e.ve, realRealIntGSL<fcn>, primReal(), name, formal(primReal(),arg1), formal(primInt(),arg2)); @@ -469,7 +450,7 @@ void realRealSignedGSL(vm::stack *s) } template<double (*fcn)(double, int)> -void addGSLRealSignedFunc(symbol *name, symbol *arg1, symbol *arg2) +void addGSLRealSignedFunc(symbol name, symbol arg1, symbol arg2) { addFunc(GSLModule->e.ve, realRealSignedGSL<fcn>, primReal(), name, formal(primReal(),arg1), formal(primInt(),arg2)); @@ -485,8 +466,8 @@ void realUnsignedUnsignedGSL(vm::stack *s) } template<double (*fcn)(unsigned int, unsigned int)> -void addGSLUnsignedUnsignedFunc(symbol *name, symbol *arg1, - symbol *arg2) +void addGSLUnsignedUnsignedFunc(symbol name, symbol arg1, + symbol arg2) { addFunc(GSLModule->e.ve, realUnsignedUnsignedGSL<fcn>, primReal(), name, formal(primInt(), arg1), formal(primInt(), arg2)); @@ -503,8 +484,8 @@ void realIntRealRealGSL(vm::stack *s) } template<double (*fcn)(int, double, double)> -void addGSLIntRealRealFunc(symbol *name, symbol *arg1, - symbol *arg2, symbol *arg3) +void addGSLIntRealRealFunc(symbol name, symbol arg1, + symbol arg2, symbol arg3) { addFunc(GSLModule->e.ve, realIntRealRealGSL<fcn>, primReal(), name, formal(primInt(), arg1), formal(primReal(), arg2), @@ -522,8 +503,8 @@ void realIntIntRealGSL(vm::stack *s) } template<double (*fcn)(int, int, double)> -void addGSLIntIntRealFunc(symbol *name, symbol *arg1, symbol *arg2, - symbol *arg3) +void addGSLIntIntRealFunc(symbol name, symbol arg1, symbol arg2, + symbol arg3) { addFunc(GSLModule->e.ve, realIntIntRealGSL<fcn>, primReal(), name, formal(primInt(), arg1), formal(primInt(), arg2), @@ -542,9 +523,9 @@ void realIntIntRealRealGSL(vm::stack *s) } template<double (*fcn)(int, int, double, double)> -void addGSLIntIntRealRealFunc(symbol *name, symbol *arg1, - symbol *arg2, symbol *arg3, - symbol *arg4) +void addGSLIntIntRealRealFunc(symbol name, symbol arg1, + symbol arg2, symbol arg3, + symbol arg4) { addFunc(GSLModule->e.ve, realIntIntRealRealGSL<fcn>, primReal(), name, formal(primInt(), arg1), formal(primInt(), arg2), @@ -563,9 +544,9 @@ void realRealRealRealRealGSL(vm::stack *s) } template<double (*fcn)(double, double, double, double)> -void addGSLRealRealRealRealFunc(symbol *name, symbol *arg1, - symbol *arg2, symbol *arg3, - symbol *arg4) +void addGSLRealRealRealRealFunc(symbol name, symbol arg1, + symbol arg2, symbol arg3, + symbol arg4) { addFunc(GSLModule->e.ve, realRealRealRealRealGSL<fcn>, primReal(), name, formal(primReal(), arg1), formal(primReal(), arg2), @@ -587,10 +568,10 @@ void realIntIntIntIntIntIntGSL(vm::stack *s) } template<double (*fcn)(int, int, int, int, int, int)> -void addGSLIntIntIntIntIntIntFunc(symbol *name, symbol *arg1, - symbol *arg2, symbol *arg3, - symbol *arg4, symbol *arg5, - symbol *arg6) +void addGSLIntIntIntIntIntIntFunc(symbol name, symbol arg1, + symbol arg2, symbol arg3, + symbol arg4, symbol arg5, + symbol arg6) { addFunc(GSLModule->e.ve, realIntIntIntIntIntIntGSL<fcn>, primReal(), name, formal(primInt(), arg1), formal(primInt(), arg2), @@ -616,11 +597,11 @@ void realIntIntIntIntIntIntIntIntIntGSL(vm::stack *s) } template<double (*fcn)(int, int, int, int, int, int, int, int, int)> -void addGSLIntIntIntIntIntIntIntIntIntFunc(symbol *name, symbol *arg1, - symbol *arg2, symbol *arg3, - symbol *arg4, symbol *arg5, - symbol *arg6, symbol *arg7, - symbol *arg8, symbol *arg9) +void addGSLIntIntIntIntIntIntIntIntIntFunc(symbol name, symbol arg1, + symbol arg2, symbol arg3, + symbol arg4, symbol arg5, + symbol arg6, symbol arg7, + symbol arg8, symbol arg9) { addFunc(GSLModule->e.ve, realIntIntIntIntIntIntIntIntIntGSL<fcn>, primReal(), name, formal(primInt(), arg1), formal(primInt(), arg2), @@ -688,7 +669,7 @@ void addCast(venv &ve, ty *target, ty *source, bltin f) { } template<class T> -void addVariable(venv &ve, T *ref, ty *t, symbol *name, +void addVariable(venv &ve, T *ref, ty *t, symbol name, record *module=settings::getSettingsModule()) { access *a = new refAccess<T>(ref); varEntry *ent = new varEntry(t, a, PUBLIC, module, 0, position()); @@ -696,7 +677,7 @@ void addVariable(venv &ve, T *ref, ty *t, symbol *name, } template<class T> -void addVariable(venv &ve, T value, ty *t, symbol *name, +void addVariable(venv &ve, T value, ty *t, symbol name, record *module=settings::getSettingsModule(), permission perm=PUBLIC) { item* ref=new item; @@ -707,7 +688,7 @@ void addVariable(venv &ve, T value, ty *t, symbol *name, } template<class T> -void addConstant(venv &ve, T value, ty *t, symbol *name, +void addConstant(venv &ve, T value, ty *t, symbol name, record *module=settings::getSettingsModule()) { addVariable(ve,value,t,name,module,RESTRICTED); } @@ -794,35 +775,35 @@ void addGuideOperators(venv &ve) } /* Avoid typing the same type three times. */ -void addSimpleOperator(venv &ve, bltin f, ty *t, symbol *name) +void addSimpleOperator(venv &ve, bltin f, ty *t, symbol name) { addFunc(ve,f,t,name,formal(t,SYM(a)),formal(t,SYM(b))); } -void addBooleanOperator(venv &ve, bltin f, ty *t, symbol *name) +void addBooleanOperator(venv &ve, bltin f, ty *t, symbol name) { addFunc(ve,f,primBoolean(),name,formal(t,SYM(a)),formal(t,SYM(b))); } template<class T, template <class S> class op> -void addArray2Array2Op(venv &ve, ty *t3, symbol *name) +void addArray2Array2Op(venv &ve, ty *t3, symbol name) { addFunc(ve,array2Array2Op<T,op>,t3,name,formal(t3,SYM(a)),formal(t3,SYM(b))); } template<class T, template <class S> class op> -void addOpArray2(venv &ve, ty *t1, symbol *name, ty *t3) +void addOpArray2(venv &ve, ty *t1, symbol name, ty *t3) { addFunc(ve,opArray2<T,T,op>,t3,name,formal(t1,SYM(a)),formal(t3,SYM(b))); } template<class T, template <class S> class op> -void addArray2Op(venv &ve, ty *t1, symbol *name, ty *t3) +void addArray2Op(venv &ve, ty *t1, symbol name, ty *t3) { addFunc(ve,array2Op<T,T,op>,t3,name,formal(t3,SYM(a)),formal(t1,SYM(b))); } template<class T, template <class S> class op> -void addOps(venv &ve, ty *t1, symbol *name, ty *t2) +void addOps(venv &ve, ty *t1, symbol name, ty *t2) { addSimpleOperator(ve,binaryOp<T,op>,t1,name); addFunc(ve,opArray<T,T,op>,t2,name,formal(t1,SYM(a)),formal(t2,SYM(b))); @@ -831,7 +812,7 @@ void addOps(venv &ve, ty *t1, symbol *name, ty *t2) } template<class T, template <class S> class op> -void addBooleanOps(venv &ve, ty *t1, symbol *name, ty *t2) +void addBooleanOps(venv &ve, ty *t1, symbol name, ty *t2) { addBooleanOperator(ve,binaryOp<T,op>,t1,name); addFunc(ve,opArray<T,T,op>, @@ -893,7 +874,7 @@ inline T negate(T x) { } template<class T, template <class S> class op> -void addBinOps(venv &ve, ty *t1, ty *t2, ty *t3, ty *t4, symbol *name) +void addBinOps(venv &ve, ty *t1, ty *t2, ty *t3, ty *t4, symbol name) { addFunc(ve,binopArray<T,op>,t1,name,formal(t2,SYM(a))); addFunc(ve,binopArray2<T,op>,t1,name,formal(t3,SYM(a))); @@ -966,16 +947,35 @@ void addOps(venv &ve, ty *t1, ty *t2, ty *t3, ty *t4, bool integer=false, void addArrayOps(venv &ve, types::array *t) { ty *ct = t->celltype; + +#ifdef TEST_ADDED_OPS + // Check for the alias function to see if these operation have already been + // added, if they have, don't add them again. + static types::function aliasType(primBoolean(), primVoid(), primVoid()); + aliasType.sig.formals[0].t = t; + aliasType.sig.formals[1].t = t; +#endif + + if (ve.lookByType(SYM(alias), &aliasType)) + return; addFunc(ve, run::arrayAlias, primBoolean(), SYM(alias), formal(t, SYM(a)), formal(t, SYM(b))); - addFunc(ve, run::newDuplicateArray, - t, SYM(array), formal(primInt(), SYM(n)), - formal(ct, SYM(value)), - formal(primInt(), SYM(depth), /*optional=*/ true)); + size_t depth=(size_t) t->depth(); + typedef void (*stackFcn)(stack *Stack); + static stackFcn routine[]={run::copyArray0,run::copyArray1,run::copyArray2}; + + Int ndepth=sizeof(routine)/sizeof(stackFcn); + + if(depth <= ndepth) { + addFunc(ve, routine[depth-1], + t, SYM(array), formal(primInt(), SYM(n)), + formal(ct, SYM(value)), + formal(primInt(), SYM(depth), true)); + } - switch (t->depth()) { + switch (depth) { case 1: addFunc(ve, run::arrayCopy, t, SYM(copy), formal(t, SYM(a))); addRestFunc(ve, run::arrayConcat, t, SYM(concat), new types::array(t)); @@ -1014,12 +1014,17 @@ void addRecordOps(venv &ve, record *r) void addFunctionOps(venv &ve, function *f) { +#ifdef NO_FUNC_OPS + // No function ops. +#else addFunc(ve, run::boolFuncEq, primBoolean(), SYM_EQ, formal(f, SYM(a)), formal(f, SYM(b))); addFunc(ve, run::boolFuncNeq, primBoolean(), SYM_NEQ, formal(f, SYM(a)), formal(f, SYM(b))); +#endif } + void addOperators(venv &ve) { addSimpleOperator(ve,binaryOp<string,plus>,primString(),SYM_PLUS); @@ -1094,7 +1099,7 @@ void addOperators(venv &ve) addRestFunc(ve,diagonal<pair>,pairArray2(),SYM(diagonal),pairArray()); } -dummyRecord *createDummyRecord(venv &ve, symbol *name) +dummyRecord *createDummyRecord(venv &ve, symbol name) { dummyRecord *r=new dummyRecord(name); #ifdef DEBUG_FRAME diff --git a/Build/source/utils/asymptote/builtin.h b/Build/source/utils/asymptote/builtin.h index cf877023d58..617400803c0 100644 --- a/Build/source/utils/asymptote/builtin.h +++ b/Build/source/utils/asymptote/builtin.h @@ -22,7 +22,7 @@ void base_venv(venv &); extern const types::formal noformal; // Add a function with one or more default arguments. -void addFunc(venv &ve, vm::bltin f, types::ty *result, symbol *name, +void addFunc(venv &ve, vm::bltin f, types::ty *result, symbol name, types::formal f1=noformal, types::formal f2=noformal, types::formal f3=noformal, types::formal f4=noformal, types::formal f5=noformal, types::formal f6=noformal, diff --git a/Build/source/utils/asymptote/builtin.symbols.h b/Build/source/utils/asymptote/builtin.symbols.h index 02e44568514..21db5448461 100644 --- a/Build/source/utils/asymptote/builtin.symbols.h +++ b/Build/source/utils/asymptote/builtin.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/camp.l b/Build/source/utils/asymptote/camp.l index 477a6d32a2d..4e6f3b23bf2 100644 --- a/Build/source/utils/asymptote/camp.l +++ b/Build/source/utils/asymptote/camp.l @@ -9,6 +9,7 @@ #include <iostream> #include <fstream> #include <sstream> +#include <cstring> #include "util.h" #include "modifier.h" @@ -83,7 +84,7 @@ void adjust() yylval.pos = here(); } -void savesymbol(symbol *name) +void savesymbol(symbol name) { adjust(); yylval.ps.pos=here(); @@ -101,20 +102,15 @@ void savesymbol(symbol *name) #define DEFSYMBOL(name) \ savesymbol(name) -void makesymbol(bool op=true, string text = yytext) +void makesymbol() { - // TODO: Refactor to a call to savesymbol. - adjust(); - yylval.ps.pos=here(); - yylval.ps.sym=op ? symbol::opTrans(text) : symbol::literalTrans(text); + assert(strlen(yytext) == (size_t)yyleng); + savesymbol(symbol::rawTrans(yytext, yyleng+1)); } -void makeselfsymbol(bool op=true, string text = yytext) +void makeopsymbol() { - /* Copy all but the last digit, which should be an =. */ - assert(text[text.length()-1] == '='); - text.erase(text.length()-1); - makesymbol(op,text); + savesymbol(symbol::opTrans(yytext)); } void makemod(trans::modifier mod) { @@ -165,9 +161,16 @@ void reportEOF() { em.sync(); } -string stringbuild; +position stringpos; // The position of the start of the string. +string stringbuild; // Stores the string literal as it is read. namespace { +void startstring() +{ + adjust(); + stringpos = here(); +} + void append(char c) { stringbuild.push_back(c); @@ -177,7 +180,7 @@ void append(char c) void getstring(void) { // NOTE: Replace here() with a position at the start of the string. - makesymbol(false,stringbuild); + yylval.stre = new stringExp(stringpos, stringbuild); string().swap(stringbuild); } } @@ -323,14 +326,14 @@ EXTRAOPS <<|>>|$|$$|@|@@|~ "---" {DEFSYMBOL(SYM_LONGDASH); return LONGDASH; } "&" {DEFSYMBOL(SYM_AMPERSAND); return AMPERSAND; } "|" {DEFSYMBOL(SYM_BAR); return BAR; } -{EXTRAOPS} {makesymbol(); return OPERATOR; } +{EXTRAOPS} {makeopsymbol(); return OPERATOR; } -"+=" {makeselfsymbol(); return ADD; } -"-=" {makeselfsymbol(); return SUBTRACT; } -"*=" {makeselfsymbol(); return TIMES; } -"/=" {makeselfsymbol(); return DIVIDE; } -"%=" {makeselfsymbol(); return MOD; } -"^=" {makeselfsymbol(); return EXPONENT; } +"+=" {savesymbol(SYM_PLUS); return SELFOP; } +"-=" {savesymbol(SYM_MINUS); return SELFOP; } +"*=" {savesymbol(SYM_TIMES); return SELFOP; } +"/=" {savesymbol(SYM_DIVIDE); return SELFOP; } +"%=" {savesymbol(SYM_MOD); return SELFOP; } +"^=" {savesymbol(SYM_CARET); return SELFOP; } and {adjust(); return AND; } controls {DEFSYMBOL(SYM_CONTROLS); return CONTROLS; } @@ -398,31 +401,34 @@ operator {adjust(); BEGIN opname; } BEGIN INITIAL; return GARBAGE; } -"**" { makesymbol(true, "^"); +"**" { savesymbol(SYM_CARET); BEGIN INITIAL; return ID; } [-+*/%^!<>]|==|!=|<=|>=|&|\||\^\^|\.\.|::|--|---|\+\+|{EXTRAOPS} { - makesymbol(); + makeopsymbol(); BEGIN INITIAL; return ID;} {LETTER}({LETTER}|[0-9])* { - makesymbol(true); + makeopsymbol(); BEGIN INITIAL; return ID; } . {} } {LETTER}({LETTER}|[0-9])* { - makesymbol(false); + makesymbol(); return ID; } \/\* {adjust(); /*commentDepth = 1;*/ BEGIN lexcomment; } -\" {adjust(); BEGIN texstring; } -\' {adjust(); BEGIN cstring; } +\" {startstring(); BEGIN texstring; } +\' {startstring(); BEGIN cstring; } <<EOF>> { setEOF("unexpected end of input"); yyterminate(); } -. { - adjust(); error(); em <<"invalid token '" << yytext << "'"; } - +. {adjust(); + error(); + em << "invalid token"; + if (isgraph(yytext[0])) + em << " '" << yytext[0] << "'"; + } diff --git a/Build/source/utils/asymptote/camp.tab.cc b/Build/source/utils/asymptote/camp.tab.cc index 728b0851496..239d5eb4555 100644 --- a/Build/source/utils/asymptote/camp.tab.cc +++ b/Build/source/utils/asymptote/camp.tab.cc @@ -84,6 +84,7 @@ #include "fundec.h" #include "stm.h" #include "modifier.h" +#include "opsymbols.h" // Avoid error messages with unpatched bison-1.875: #ifndef __attribute__ @@ -115,7 +116,7 @@ using mem::string; /* Line 189 of yacc.c */ -#line 119 "camp.tab.c" +#line 120 "camp.tab.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -143,66 +144,61 @@ using mem::string; know about them. */ enum yytokentype { ID = 258, - ADD = 259, - SUBTRACT = 260, - TIMES = 261, - DIVIDE = 262, - MOD = 263, - EXPONENT = 264, - DOTS = 265, - COLONS = 266, - DASHES = 267, - INCR = 268, - LONGDASH = 269, - CONTROLS = 270, - TENSION = 271, - ATLEAST = 272, - CURL = 273, - COR = 274, - CAND = 275, - BAR = 276, - AMPERSAND = 277, - EQ = 278, - NEQ = 279, - LT = 280, - LE = 281, - GT = 282, - GE = 283, - CARETS = 284, - LOGNOT = 285, - OPERATOR = 286, - STRING = 287, - LOOSE = 288, - ASSIGN = 289, - DIRTAG = 290, - JOIN_PREC = 291, - AND = 292, - ELLIPSIS = 293, - ACCESS = 294, - UNRAVEL = 295, - IMPORT = 296, - INCLUDE = 297, - FROM = 298, - QUOTE = 299, - STRUCT = 300, - TYPEDEF = 301, - NEW = 302, - IF = 303, - ELSE = 304, - WHILE = 305, - DO = 306, - FOR = 307, - BREAK = 308, - CONTINUE = 309, - RETURN_ = 310, - THIS = 311, - EXPLICIT = 312, - GARBAGE = 313, - LIT = 314, - PERM = 315, - MODIFIER = 316, - UNARY = 317, - EXP_IN_PARENS_RULE = 318 + SELFOP = 259, + DOTS = 260, + COLONS = 261, + DASHES = 262, + INCR = 263, + LONGDASH = 264, + CONTROLS = 265, + TENSION = 266, + ATLEAST = 267, + CURL = 268, + COR = 269, + CAND = 270, + BAR = 271, + AMPERSAND = 272, + EQ = 273, + NEQ = 274, + LT = 275, + LE = 276, + GT = 277, + GE = 278, + CARETS = 279, + LOGNOT = 280, + OPERATOR = 281, + LOOSE = 282, + ASSIGN = 283, + DIRTAG = 284, + JOIN_PREC = 285, + AND = 286, + ELLIPSIS = 287, + ACCESS = 288, + UNRAVEL = 289, + IMPORT = 290, + INCLUDE = 291, + FROM = 292, + QUOTE = 293, + STRUCT = 294, + TYPEDEF = 295, + NEW = 296, + IF = 297, + ELSE = 298, + WHILE = 299, + DO = 300, + FOR = 301, + BREAK = 302, + CONTINUE = 303, + RETURN_ = 304, + THIS = 305, + EXPLICIT = 306, + GARBAGE = 307, + LIT = 308, + STRING = 309, + PERM = 310, + MODIFIER = 311, + UNARY = 312, + EXP_IN_PARENS_RULE = 313 }; #endif @@ -213,18 +209,19 @@ typedef union YYSTYPE { /* Line 214 of yacc.c */ -#line 46 "camp.y" +#line 47 "camp.y" position pos; bool boo; struct { position pos; - sym::symbol *sym; + sym::symbol sym; } ps; absyntax::name *n; absyntax::varinit *vi; absyntax::arrayinit *ai; absyntax::exp *e; + absyntax::stringExp *stre; absyntax::specExp *se; absyntax::joinExp *j; absyntax::explist *elist; @@ -262,7 +259,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 266 "camp.tab.c" +#line 263 "camp.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -274,7 +271,7 @@ typedef union YYSTYPE /* Line 264 of yacc.c */ -#line 278 "camp.tab.c" +#line 275 "camp.tab.c" #ifdef short # undef short @@ -489,20 +486,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 2361 +#define YYLAST 2174 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 81 +#define YYNTOKENS 76 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 51 /* YYNRULES -- Number of rules. */ -#define YYNRULES 204 +#define YYNRULES 199 /* YYNRULES -- Number of states. */ -#define YYNSTATES 389 +#define YYNSTATES 379 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 318 +#define YYMAXUTOK 313 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -513,16 +510,16 @@ static const yytype_uint8 yytranslate[] = 0, 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, 2, 2, 34, 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, 41, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 29, 2, 2, + 42, 43, 27, 25, 45, 26, 44, 28, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 36, 48, + 2, 2, 2, 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, 52, 2, 53, 35, 2, 2, 2, 2, 2, + 2, 46, 2, 47, 30, 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, 46, 2, 47, 2, 2, 2, 2, + 2, 2, 2, 40, 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, 2, 2, 2, 2, 2, 2, 2, @@ -538,10 +535,10 @@ 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, 29, 36, 37, 38, 39, 40, - 43, 44, 45, 55, 56, 57, 58, 59, 60, 61, + 31, 32, 33, 34, 37, 38, 39, 49, 50, 51, + 52, 53, 54, 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 + 72, 73, 74, 75 }; #if YYDEBUG @@ -564,119 +561,115 @@ static const yytype_uint16 yyprhs[] = 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 + 547, 550, 553, 556, 559, 563, 568, 570, 572, 575, + 578, 582, 587, 591, 597, 605, 607, 611, 615, 617, + 619, 622, 627, 631, 637, 640, 645, 647, 649, 652, + 658, 666, 672, 680, 690, 699, 702, 705, 708, 712, + 714, 716, 717, 719, 721, 722, 724, 725, 727, 729 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = +static const yytype_int8 yyrhs[] = { - 82, 0, -1, 83, -1, -1, 83, 86, -1, -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 + 77, 0, -1, 78, -1, -1, 78, 81, -1, -1, + 79, 81, -1, 3, -1, 80, 44, 3, -1, 29, + -1, 83, -1, 120, -1, 82, 83, -1, 82, 120, + -1, 73, -1, 72, -1, 82, 73, -1, 82, 72, + -1, 89, -1, 107, -1, 108, -1, 50, 88, 48, + -1, 54, 80, 51, 85, 48, -1, 54, 80, 51, + 27, 48, -1, 51, 80, 48, -1, 54, 86, 50, + 85, 48, -1, 54, 86, 50, 27, 48, -1, 52, + 87, 48, -1, 53, 3, 48, -1, 53, 71, 48, + -1, 3, -1, 3, 3, 3, -1, 84, -1, 85, + 45, 84, -1, 3, -1, 71, -1, 3, -1, 86, + 3, 3, -1, 87, -1, 88, 45, 87, -1, 90, + 48, -1, 91, 95, -1, 92, -1, 80, 93, -1, + 80, -1, 46, 47, -1, 93, 46, 47, -1, 46, + 114, 47, -1, 94, 46, 114, 47, -1, 96, -1, + 95, 45, 96, -1, 97, -1, 97, 34, 98, -1, + 3, -1, 3, 93, -1, 3, 42, 43, -1, 3, + 42, 103, 43, -1, 114, -1, 100, -1, 40, 79, + 41, -1, 40, 41, -1, 40, 49, 98, 41, -1, + 40, 101, 41, -1, 40, 101, 49, 98, 41, -1, + 45, -1, 102, -1, 102, 45, -1, 98, -1, 102, + 45, 98, -1, 104, -1, 104, 49, 106, -1, 49, + 106, -1, 106, -1, 104, 45, 106, -1, 68, -1, + -1, 105, 91, -1, 105, 91, 97, -1, 105, 91, + 97, 34, 98, -1, 91, 3, 42, 43, 122, -1, + 91, 3, 42, 103, 43, 122, -1, 56, 3, 99, + -1, 57, 89, -1, 36, -1, 114, 36, -1, 36, + 114, -1, 114, 36, 114, -1, 110, 44, 3, -1, + 80, 46, 114, 47, -1, 110, 46, 114, 47, -1, + 80, 46, 109, 47, -1, 110, 46, 109, 47, -1, + 80, 42, 43, -1, 80, 42, 112, 43, -1, 110, + 42, 43, -1, 110, 42, 112, 43, -1, 42, 114, + 43, -1, 42, 80, 43, -1, 67, -1, 114, -1, + 3, 34, 114, -1, 113, -1, 113, 49, 111, -1, + 49, 111, -1, 111, -1, 113, 45, 111, -1, 80, + -1, 110, -1, 70, -1, 71, -1, 70, 114, -1, + 42, 80, 43, 114, -1, 42, 80, 93, 43, 114, + -1, 25, 114, -1, 26, 114, -1, 31, 114, -1, + 114, 25, 114, -1, 114, 26, 114, -1, 114, 27, + 114, -1, 114, 28, 114, -1, 114, 29, 114, -1, + 114, 30, 114, -1, 114, 20, 114, -1, 114, 21, + 114, -1, 114, 22, 114, -1, 114, 23, 114, -1, + 114, 18, 114, -1, 114, 19, 114, -1, 114, 15, + 114, -1, 114, 14, 114, -1, 114, 24, 114, -1, + 114, 17, 114, -1, 114, 16, 114, -1, 114, 32, + 114, -1, 114, 8, 114, -1, 58, 92, -1, 58, + 92, 94, -1, 58, 92, 94, 93, -1, 58, 92, + 93, -1, 58, 92, 93, 100, -1, 58, 92, 42, + 43, 122, -1, 58, 92, 93, 42, 43, 122, -1, + 58, 92, 42, 103, 43, 122, -1, 58, 92, 93, + 42, 103, 43, 122, -1, 114, 35, 114, 36, 114, + -1, 114, 34, 114, -1, 42, 114, 45, 114, 43, + -1, 42, 114, 45, 114, 45, 114, 43, -1, 42, + 114, 45, 114, 45, 114, 45, 114, 45, 114, 45, + 114, 43, -1, 114, 115, 114, -1, 114, 116, -1, + 8, 114, -1, 7, 114, -1, 114, 8, -1, 114, + 4, 114, -1, 55, 40, 78, 41, -1, 7, -1, + 117, -1, 116, 117, -1, 117, 116, -1, 116, 117, + 116, -1, 40, 13, 114, 41, -1, 40, 114, 41, + -1, 40, 114, 45, 114, 41, -1, 40, 114, 45, + 114, 45, 114, 41, -1, 5, -1, 5, 118, 5, + -1, 5, 119, 5, -1, 6, -1, 9, -1, 11, + 114, -1, 11, 114, 39, 114, -1, 11, 12, 114, + -1, 11, 12, 114, 39, 114, -1, 10, 114, -1, + 10, 114, 39, 114, -1, 48, -1, 122, -1, 121, + 48, -1, 59, 42, 114, 43, 120, -1, 59, 42, + 114, 43, 120, 60, 120, -1, 61, 42, 114, 43, + 120, -1, 62, 120, 61, 42, 114, 43, 48, -1, + 63, 42, 123, 48, 124, 48, 125, 43, 120, -1, + 63, 42, 91, 3, 36, 114, 43, 120, -1, 64, + 48, -1, 65, 48, -1, 66, 48, -1, 66, 114, + 48, -1, 114, -1, 99, -1, -1, 126, -1, 90, + -1, -1, 114, -1, -1, 126, -1, 121, -1, 126, + 45, 121, -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, 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 + 0, 179, 179, 183, 184, 189, 190, 195, 196, 197, + 202, 203, 204, 206, 211, 212, 213, 215, 220, 221, + 222, 223, 225, 227, 229, 230, 232, 234, 236, 237, + 242, 244, 248, 249, 254, 255, 260, 262, 266, 267, + 272, 276, 280, 281, 285, 289, 290, 294, 295, 300, + 301, 306, 307, 312, 313, 314, 316, 321, 322, 326, + 331, 332, 334, 336, 341, 342, 343, 347, 349, 354, + 355, 357, 361, 362, 367, 368, 372, 374, 376, 381, + 383, 388, 389, 393, 394, 395, 396, 400, 401, 403, + 404, 406, 407, 410, 414, 415, 417, 419, 421, 425, + 426, 430, 431, 433, 437, 438, 444, 445, 446, 447, + 449, 450, 452, 454, 456, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 476, 477, 478, 480, 482, 484, 486, + 488, 490, 495, 497, 502, 504, 506, 508, 510, 512, + 514, 520, 522, 525, 527, 528, 535, 536, 538, 541, + 544, 550, 551, 552, 555, 561, 562, 564, 566, 567, + 571, 573, 576, 579, 585, 586, 591, 592, 593, 594, + 596, 598, 600, 602, 604, 606, 607, 608, 609, 613, + 617, 621, 622, 623, 627, 628, 632, 633, 637, 638 }; #endif @@ -685,17 +678,16 @@ static const yytype_uint16 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 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", "'+'", - "'-'", "'*'", "'/'", "'%'", "'^'", "LOGNOT", "OPERATOR", "STRING", + "$end", "error", "$undefined", "ID", "SELFOP", "DOTS", "COLONS", + "DASHES", "INCR", "LONGDASH", "CONTROLS", "TENSION", "ATLEAST", "CURL", + "COR", "CAND", "BAR", "AMPERSAND", "EQ", "NEQ", "LT", "LE", "GT", "GE", + "CARETS", "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "LOGNOT", "OPERATOR", "LOOSE", "ASSIGN", "'?'", "':'", "DIRTAG", "JOIN_PREC", "AND", "'{'", "'}'", "'('", "')'", "'.'", "','", "'['", "']'", "';'", "ELLIPSIS", "ACCESS", "UNRAVEL", "IMPORT", "INCLUDE", "FROM", "QUOTE", "STRUCT", "TYPEDEF", "NEW", "IF", "ELSE", "WHILE", "DO", "FOR", "BREAK", - "CONTINUE", "RETURN_", "THIS", "EXPLICIT", "GARBAGE", "LIT", "PERM", - "MODIFIER", "UNARY", "EXP_IN_PARENS_RULE", "$accept", "file", + "CONTINUE", "RETURN_", "THIS", "EXPLICIT", "GARBAGE", "LIT", "STRING", + "PERM", "MODIFIER", "UNARY", "EXP_IN_PARENS_RULE", "$accept", "file", "fileblock", "bareblock", "name", "runnable", "modifiers", "dec", "idpair", "idpairlist", "strid", "stridpair", "stridpairlist", "vardec", "barevardec", "type", "celltype", "dims", "dimexps", "decidlist", @@ -715,40 +707,38 @@ 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, 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, + 275, 276, 277, 278, 279, 43, 45, 42, 47, 37, + 94, 280, 281, 282, 283, 63, 58, 284, 285, 286, + 123, 125, 40, 41, 46, 44, 91, 93, 59, 287, + 288, 289, 290, 291, 292, 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, - 318 + 308, 309, 310, 311, 312, 313 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 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, - 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 + 0, 76, 77, 78, 78, 79, 79, 80, 80, 80, + 81, 81, 81, 81, 82, 82, 82, 82, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, + 89, 90, 91, 91, 92, 93, 93, 94, 94, 95, + 95, 96, 96, 97, 97, 97, 97, 98, 98, 99, + 100, 100, 100, 100, 101, 101, 101, 102, 102, 103, + 103, 103, 104, 104, 105, 105, 106, 106, 106, 107, + 107, 108, 108, 109, 109, 109, 109, 110, 110, 110, + 110, 110, 110, 110, 110, 110, 110, 110, 110, 111, + 111, 112, 112, 112, 113, 113, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 115, 115, 115, 115, + 115, 116, 116, 116, 116, 117, 117, 117, 117, 117, + 118, 118, 118, 118, 119, 119, 120, 120, 120, 120, + 120, 120, 120, 120, 120, 120, 120, 120, 120, 121, + 122, 123, 123, 123, 124, 124, 125, 125, 126, 126 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -769,12 +759,11 @@ static const yytype_uint8 yyr2[] = 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 + 2, 2, 2, 2, 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 @@ -783,112 +772,110 @@ static const yytype_uint8 yyr2[] = static const yytype_uint8 yydefact[] = { 3, 0, 2, 1, 7, 0, 0, 0, 0, 9, - 0, 109, 5, 0, 181, 0, 0, 0, 0, 0, + 0, 5, 0, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, + 98, 108, 109, 15, 14, 106, 4, 0, 10, 18, + 0, 0, 42, 190, 19, 20, 107, 189, 11, 0, + 177, 106, 152, 151, 113, 114, 115, 0, 106, 0, + 36, 35, 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, 0, 191, 185, 186, 187, 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, + 51, 0, 0, 0, 0, 165, 168, 156, 153, 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 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, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 150, 157, 178, 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, 193, 0, 198, 0, 192, 188, 7, 92, + 0, 104, 0, 101, 99, 8, 83, 45, 0, 0, + 0, 75, 54, 0, 0, 94, 0, 87, 0, 0, + 154, 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, + 119, 120, 121, 133, 145, 0, 0, 0, 149, 158, + 159, 111, 0, 0, 37, 39, 30, 0, 32, 0, + 0, 0, 155, 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, + 53, 194, 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, + 91, 89, 174, 0, 170, 166, 167, 0, 0, 162, + 0, 160, 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, + 60, 64, 0, 67, 0, 65, 0, 0, 0, 179, + 181, 0, 0, 195, 0, 199, 100, 105, 102, 86, + 79, 56, 0, 172, 0, 144, 161, 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 + 141, 0, 48, 0, 0, 0, 196, 80, 175, 0, + 171, 163, 0, 147, 0, 0, 61, 0, 68, 143, + 180, 182, 0, 0, 197, 173, 0, 0, 78, 63, + 184, 0, 164, 0, 183, 0, 0, 0, 148 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -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 + -1, 1, 2, 57, 51, 36, 37, 38, 228, 229, + 62, 63, 64, 39, 40, 41, 42, 182, 158, 98, + 99, 100, 266, 43, 267, 304, 305, 237, 238, 239, + 240, 44, 45, 178, 46, 171, 172, 173, 47, 131, + 132, 133, 193, 194, 48, 49, 50, 165, 314, 363, + 166 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -236 +#define YYPACT_NINF -208 static const yytype_int16 yypact[] = { - -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 + -208, 23, 474, -208, -208, 913, 913, 913, 913, -208, + 913, -208, 913, -208, 17, 12, 17, 18, 16, -27, + 69, 12, 12, 42, 44, 616, 62, 79, 80, 733, + -208, 6, -208, -208, -208, 36, -208, 545, -208, -208, + 90, 146, -208, -208, -208, -208, 100, 1804, -208, 109, + -208, 132, 128, 128, 128, 128, -208, 332, 110, 1197, + 164, -208, 166, -208, 102, 115, 134, 145, 155, 133, + 0, 154, -208, 169, -6, -208, 205, 175, 118, 913, + 913, 160, 913, -208, -208, -208, 1012, 128, 235, 221, + 659, 179, -208, -208, -208, -208, -208, 124, 181, -208, + 193, 690, 227, 743, 913, 83, -208, -208, 6, -208, + 913, 913, 913, 913, 913, 913, 913, 913, 913, 913, + 913, 913, 913, 913, 913, 913, 913, 913, 913, 913, + 786, 913, -208, 191, -208, 743, -208, -208, 6, 149, + -208, 913, 230, 17, -208, -208, -208, -208, -208, 39, + 43, 403, -208, 187, 135, -16, 817, 99, 195, 1491, + 1531, 197, -208, 242, -208, 199, 208, -208, 216, -208, + 944, -208, 211, 139, 1804, -208, 913, -208, 209, 1049, + 210, -13, 179, 205, 860, -208, 215, -208, 212, 1086, + 1804, 913, 870, 257, 258, 172, 2022, 2050, 2078, 2106, + 2134, 2134, 483, 483, 483, 483, 552, 30, 30, 128, + 128, 128, 128, 412, 1804, 1767, 913, 1239, 172, 191, + -208, -208, 913, 1281, -208, -208, 262, 219, -208, 168, + 222, 170, -208, 13, 169, 201, -208, 228, 140, 12, + -208, 1123, 165, 94, -208, 817, 179, 616, 616, 913, + 7, 913, 913, 913, -208, -208, 944, 944, 1804, -208, + 913, -208, -208, 169, 233, -208, -208, -208, 1804, -208, + -208, -208, 1839, 913, 1876, -208, -208, 913, 1691, -208, + 913, -208, -208, -208, 913, 270, -208, 277, -208, -208, + -208, -208, 238, -208, -208, 169, 201, 201, 205, -208, + -208, -208, 860, -208, 22, 237, 169, 240, 1160, 225, + -208, 1571, 913, 1804, 239, -208, 1804, -208, -208, 1804, + -208, 169, 913, 1913, 913, 1986, -208, 1323, 1365, -208, + -208, -208, -208, -208, -208, 252, 247, -208, 860, 860, + -208, 169, -208, 616, 241, 1611, 913, -208, 1950, 913, + 1950, -208, 913, -208, 913, 860, -208, 250, -208, -208, + -208, -208, 616, 249, 208, 1950, 1729, 1407, -208, -208, + -208, 616, -208, 913, -208, 1449, 913, 1651, -208 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -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 + -208, -208, 223, -208, 10, 243, -208, 259, 11, 144, + 281, -8, -208, 280, 226, -17, 282, -24, -208, -208, + 120, 14, -207, 236, 153, -208, -208, -164, -208, -208, + -206, -208, -208, 213, -208, -156, 214, -208, -5, -208, + -117, 182, -208, -208, -19, -72, -166, -208, -208, -208, + -35 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -898,529 +885,490 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -45 static const yytype_int16 yytable[] = { - 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, 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, + 52, 53, 54, 55, 76, 56, 81, 59, 66, 4, + 164, 91, 35, 72, 254, 4, 220, 264, 95, 69, + 60, 67, 58, 3, 86, 65, 87, 234, 70, 294, + 263, 74, 77, 235, 139, 303, 235, 10, 89, -44, + 153, 9, 226, 312, 89, 9, 226, 35, 12, 233, + 91, 149, 236, 153, 157, 236, 291, 123, 124, 125, + 126, 19, 235, 337, 22, 163, 227, 35, 293, 292, + 230, 338, 73, 30, 159, 160, 31, 32, 88, 307, + 89, 236, 90, 174, 79, 179, 80, 61, 61, 68, + 333, 334, 35, 191, 192, 336, 174, 320, 189, 190, + 317, 318, 281, 195, 82, 196, 197, 198, 199, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 217, 218, 83, 84, 332, + 179, 357, 358, 221, 246, 225, 223, 306, 96, 242, + 340, 243, 101, 235, 102, 180, 103, 143, 368, 97, + 144, 241, 88, 138, 89, 347, 90, 134, 126, 89, + 155, 35, 236, 145, 156, 174, 181, -34, 4, 142, + 153, 258, 5, 6, 88, 359, 89, 233, 135, 268, + 315, 153, 146, -34, 256, 296, 272, 274, 257, 297, + 7, 8, 222, 147, 9, 180, 10, 121, 122, 123, + 124, 125, 126, 148, 150, 242, 300, 12, 154, 11, + 301, 278, 130, 287, 302, 287, 288, 282, 290, 89, + 19, 161, 298, 22, 175, 180, 183, 184, 309, 310, + 187, 130, 30, 224, 177, 31, 32, 268, 168, 249, + 308, 245, 5, 6, 311, 250, 313, 251, 316, 74, + 253, 174, 174, 252, 255, 319, 259, 262, 269, 270, + 7, 8, 275, 276, 9, 285, 10, 286, 323, 236, + 289, 295, 325, 329, 164, 327, 321, 12, 169, 328, + 226, 331, 339, 341, 170, 343, 355, 346, 356, 361, + 19, 369, 371, 22, 231, 151, 94, 268, 330, 71, + 137, 75, 30, 265, 78, 31, 32, 345, 162, 152, + 244, 364, 335, 0, 219, 186, 188, 348, 0, 350, + 0, 0, 0, 0, 360, 0, 0, 0, 0, 0, + 0, 0, 0, 268, 268, 4, 0, 0, 0, 5, + 6, 0, 0, 370, 365, 0, 0, 366, 0, 367, + 268, 0, 374, 0, 0, 0, 0, 7, 8, 0, + 0, 9, 0, 10, 0, 0, 0, 0, 375, 0, + 0, 377, 11, 136, 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, + 0, 0, 31, 32, 33, 34, 4, 0, 0, 0, + 5, 6, 0, 0, 0, 0, 0, 105, 106, 107, + 108, 109, 0, 0, 0, 0, 0, 0, 7, 8, + 0, 0, 9, 0, 10, 0, 120, 121, 122, 123, + 124, 125, 126, 11, 232, 12, 0, 0, 0, 0, + 0, 13, 130, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 0, 24, 25, 26, 27, 28, 29, + 30, 0, 0, 31, 32, 33, 34, 4, 0, 0, + 0, 5, 6, 0, 0, 0, 0, 0, 105, 106, + 107, 108, 109, 0, 0, 0, 0, 0, 0, 7, + 8, 0, 0, 9, 0, 10, 0, 120, 121, 122, + 123, 124, 125, 126, 11, 127, 12, 0, 0, 0, + 0, 0, 13, 130, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 0, 24, 25, 26, 27, 28, + 29, 30, 0, 0, 31, 32, 33, 34, 4, 0, + 0, 0, 5, 6, 0, 0, 0, 105, 106, 107, + 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, + 7, 8, 0, 0, 9, 0, 10, 121, 122, 123, + 124, 125, 126, 0, 0, 11, 0, 12, 0, 0, + 0, 0, 130, 13, 0, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 0, 24, 25, 26, 27, + 28, 29, 30, 0, 0, 31, 32, 92, 93, 4, + 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, 0, + 0, 0, 0, 0, 0, 0, 11, 0, 12, 0, + 0, 0, 4, 0, 13, 0, 5, 6, 0, 0, + 0, 19, 0, 0, 22, 23, 0, 24, 25, 26, + 27, 28, 29, 30, 7, 8, 31, 32, 9, 0, + 10, 0, 0, 168, 0, 176, 0, 5, 6, 0, + 0, 12, 0, 0, 0, 0, 177, 0, 0, 0, + 0, 0, 0, 0, 19, 7, 8, 22, 0, 9, + 0, 10, 0, 0, 0, 0, 30, 0, 0, 31, + 32, 0, 12, 185, 0, 0, 4, 0, 0, 170, + 5, 6, 0, 0, 0, 19, 4, 0, 22, 0, + 5, 6, 0, 0, 0, 0, 0, 30, 7, 8, + 31, 32, 9, 0, 10, 0, 0, 0, 7, 8, + 0, 0, 9, 0, 10, 12, 0, 0, 0, 176, + 0, 85, 0, 0, 0, 12, 0, 0, 19, 4, + 0, 22, 0, 5, 6, 0, 0, 0, 19, 216, + 30, 22, 0, 31, 32, 0, 0, 0, 0, 0, + 30, 7, 8, 31, 32, 9, 0, 10, 0, 0, + 4, 0, 0, 0, 5, 6, 0, 0, 12, 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, 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, + 0, 19, 7, 8, 22, 0, 9, 0, 10, 0, + 0, 0, 0, 30, 0, 0, 31, 32, 0, 12, + 0, 0, 0, 4, 177, 0, 0, 5, 6, 0, + 0, 0, 19, 4, 0, 22, 0, 5, 6, 0, + 0, 0, 273, 0, 30, 7, 8, 31, 32, 9, + 0, 10, 0, 0, 0, 7, 8, 0, 0, 9, + 242, 10, 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 0, 0, 19, 4, 0, 22, 0, + 5, 6, 0, 0, 0, 19, 0, 30, 22, 0, + 31, 32, 0, 0, 0, 0, 0, 30, 7, 8, + 31, 32, 9, 0, 10, 0, 0, 168, 0, 0, + 0, 5, 6, 0, 0, 12, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 19, 7, + 8, 22, 0, 9, 0, 10, 0, 0, 0, 0, + 30, 0, 0, 31, 32, 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, 32, 104, 105, 106, 107, + 108, 109, 0, 0, 0, 0, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 0, 127, 0, 128, 129, 0, 0, + 0, 0, 130, 104, 105, 106, 107, 108, 109, 0, + 167, 0, 0, 110, 111, 112, 113, 114, 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, + 0, 127, 0, 128, 129, 260, 0, 0, 0, 130, + 104, 105, 106, 107, 108, 109, 261, 0, 0, 0, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 0, 127, 0, + 128, 129, 260, 0, 0, 0, 130, 104, 105, 106, + 107, 108, 109, 271, 0, 0, 0, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 0, 127, 0, 128, 129, 0, + 0, 0, 0, 130, 104, 105, 106, 107, 108, 109, + 299, 0, 0, 0, 110, 111, 112, 113, 114, 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, 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, - 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, 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, 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, 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, - 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, 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, 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, - 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, 336, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 0, 0, 0, 0, 115, + 126, 0, 127, 0, 128, 129, 0, 0, 0, 0, + 130, 104, 105, 106, 107, 108, 109, 342, 0, 0, + 0, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 0, 127, + 0, 128, 129, 0, 0, 0, 0, 130, 0, 0, + 140, 0, 141, 104, 105, 106, 107, 108, 109, 0, + 0, 0, 0, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 0, 127, 0, 128, 129, 0, 0, 0, 0, 130, + 279, 0, 0, 0, 280, 104, 105, 106, 107, 108, + 109, 0, 0, 0, 0, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 0, 127, 0, 128, 129, 0, 0, 0, + 0, 130, 0, 0, 283, 0, 284, 104, 105, 106, + 107, 108, 109, 0, 0, 0, 0, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 0, 127, 0, 128, 129, 0, + 0, 0, 0, 130, 351, 0, 0, 0, 352, 104, + 105, 106, 107, 108, 109, 0, 0, 0, 0, 110, + 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 0, 127, 0, 128, + 129, 0, 0, 0, 0, 130, 0, 0, 353, 0, + 354, 104, 105, 106, 107, 108, 109, 0, 0, 0, + 0, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 0, 127, + 0, 128, 129, 0, 0, 0, 0, 130, 0, 0, + 0, 0, 373, 104, 105, 106, 107, 108, 109, 0, + 0, 0, 0, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 0, 127, 0, 128, 129, 0, 0, 0, 0, 130, + 0, 0, 0, 0, 376, 104, 105, 106, 107, 108, + 109, 0, 0, 0, 0, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 0, 127, 0, 128, 129, 0, 0, 0, + 0, 130, 0, 0, 247, 104, 105, 106, 107, 108, + 109, 0, 0, 0, 0, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 0, 127, 0, 128, 129, 0, 0, 0, + 0, 130, 0, 0, 248, 104, 105, 106, 107, 108, + 109, 0, 0, 0, 0, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 0, 127, 0, 128, 129, 0, 0, 0, + 0, 130, 0, 0, 344, 104, 105, 106, 107, 108, + 109, 0, 0, 0, 0, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 0, 127, 0, 128, 129, 0, 0, 0, + 0, 130, 0, 0, 362, 104, 105, 106, 107, 108, + 109, 0, 0, 0, 0, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 0, 127, 0, 128, 129, 0, 0, 0, + 0, 130, 0, 0, 378, 104, 105, 106, 107, 108, + 109, 0, 0, 0, 0, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 0, 127, 0, 128, 129, 0, 0, 0, + 0, 130, 326, 104, 105, 106, 107, 108, 109, 0, + 0, 0, 0, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 0, 127, 0, 128, 129, 0, 0, 0, 0, 130, + 372, 104, 105, 106, 107, 108, 109, 0, 0, 0, + 0, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 0, 127, + 0, 128, 129, 277, 0, 0, 0, 130, 104, 105, + 106, 107, 108, 109, 0, 0, 0, 0, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 0, 127, 0, 128, 129, + 0, 0, 0, 104, 130, 106, 107, 108, 109, 0, + 0, 0, 0, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 0, 127, 0, 128, 129, 0, 0, 0, 322, 130, + 104, 0, 106, 107, 108, 109, 0, 0, 0, 0, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 0, 127, 0, + 128, 129, 0, 0, 0, 324, 130, 104, 0, 106, + 107, 108, 109, 0, 0, 0, 0, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 0, 127, 0, 128, 129, 0, + 0, 0, 349, 130, 104, 0, 106, 107, 108, 109, + 0, 0, 0, 0, 110, 111, 112, 113, 114, 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, 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, + 126, 0, 127, 0, 128, 129, 0, 0, 0, 0, + 130, 105, 106, 107, 108, 109, 0, 0, 0, 0, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 0, 127, 0, + 0, 129, 0, 0, 0, 0, 130, 105, 106, 107, + 108, 109, 0, 0, 0, 0, 0, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 0, 127, 105, 106, 107, 108, 109, + 0, 0, 130, 0, 0, 0, 112, 113, 114, 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, - 131, 0, 132, 0, 0, 0, 0, 0, 0, 0, - 0, 135 + 126, 0, 127, 105, 106, 107, 108, 109, 0, 0, + 130, 0, 0, 0, 0, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 0, + 127, 105, 106, 107, 108, 109, 0, 0, 130, 0, + 0, 0, 0, 0, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 0, 127, 105, + 106, 107, 108, 109, 0, 0, 130, 0, 0, 0, + 0, 0, 0, 0, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 0, 127, 0, 0, 0, + 0, 0, 0, 0, 130 }; static const yytype_int16 yycheck[] = { - 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, + 5, 6, 7, 8, 21, 10, 25, 12, 16, 3, + 82, 35, 2, 40, 170, 3, 133, 181, 37, 3, + 3, 3, 12, 0, 29, 15, 31, 43, 18, 235, + 43, 21, 22, 49, 58, 242, 49, 31, 44, 3, + 46, 29, 3, 36, 44, 29, 3, 37, 42, 42, + 74, 51, 68, 46, 78, 68, 43, 27, 28, 29, + 30, 55, 49, 41, 58, 82, 27, 57, 234, 233, + 27, 49, 3, 67, 79, 80, 70, 71, 42, 243, + 44, 68, 46, 88, 42, 90, 42, 71, 71, 71, + 296, 297, 82, 10, 11, 302, 101, 263, 103, 104, + 256, 257, 219, 108, 42, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 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, 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, -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, + 125, 126, 127, 128, 129, 130, 131, 48, 48, 295, + 135, 338, 339, 138, 158, 143, 141, 43, 48, 40, + 306, 42, 42, 49, 44, 46, 46, 45, 355, 3, + 48, 156, 42, 43, 44, 321, 46, 48, 30, 44, + 42, 151, 68, 48, 46, 170, 42, 3, 3, 3, + 46, 176, 7, 8, 42, 341, 44, 42, 46, 184, + 252, 46, 48, 50, 45, 45, 191, 192, 49, 49, + 25, 26, 43, 48, 29, 46, 31, 25, 26, 27, + 28, 29, 30, 48, 50, 40, 41, 42, 3, 40, + 45, 216, 40, 45, 49, 45, 48, 222, 48, 44, + 55, 61, 239, 58, 3, 46, 45, 34, 247, 248, + 3, 40, 67, 3, 47, 70, 71, 242, 3, 42, + 245, 46, 7, 8, 249, 3, 251, 48, 253, 239, + 34, 256, 257, 45, 43, 260, 47, 47, 43, 47, + 25, 26, 5, 5, 29, 3, 31, 48, 273, 68, + 48, 43, 277, 3, 346, 280, 43, 42, 43, 284, + 3, 43, 45, 43, 49, 60, 34, 48, 41, 48, + 55, 41, 43, 58, 150, 72, 37, 302, 287, 18, + 57, 21, 67, 183, 22, 70, 71, 312, 82, 73, + 157, 346, 298, -1, 132, 101, 103, 322, -1, 324, + -1, -1, -1, -1, 343, -1, -1, -1, -1, -1, + -1, -1, -1, 338, 339, 3, -1, -1, -1, 7, + 8, -1, -1, 362, 349, -1, -1, 352, -1, 354, + 355, -1, 371, -1, -1, -1, -1, 25, 26, -1, + -1, 29, -1, 31, -1, -1, -1, -1, 373, -1, + -1, 376, 40, 41, 42, -1, -1, -1, -1, -1, + 48, -1, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, -1, 61, 62, 63, 64, 65, 66, 67, + -1, -1, 70, 71, 72, 73, 3, -1, -1, -1, + 7, 8, -1, -1, -1, -1, -1, 5, 6, 7, + 8, 9, -1, -1, -1, -1, -1, -1, 25, 26, + -1, -1, 29, -1, 31, -1, 24, 25, 26, 27, + 28, 29, 30, 40, 41, 42, -1, -1, -1, -1, + -1, 48, 40, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, -1, 61, 62, 63, 64, 65, 66, + 67, -1, -1, 70, 71, 72, 73, 3, -1, -1, + -1, 7, 8, -1, -1, -1, -1, -1, 5, 6, + 7, 8, 9, -1, -1, -1, -1, -1, -1, 25, + 26, -1, -1, 29, -1, 31, -1, 24, 25, 26, + 27, 28, 29, 30, 40, 32, 42, -1, -1, -1, + -1, -1, 48, 40, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, -1, 61, 62, 63, 64, 65, + 66, 67, -1, -1, 70, 71, 72, 73, 3, -1, + -1, -1, 7, 8, -1, -1, -1, 5, 6, 7, + 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, + 25, 26, -1, -1, 29, -1, 31, 25, 26, 27, + 28, 29, 30, -1, -1, 40, -1, 42, -1, -1, + -1, -1, 40, 48, -1, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, -1, 61, 62, 63, 64, + 65, 66, 67, -1, -1, 70, 71, 72, 73, 3, + -1, -1, -1, 7, 8, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 25, 26, -1, -1, 29, -1, 31, -1, -1, + -1, -1, -1, -1, -1, -1, 40, -1, 42, -1, + -1, -1, 3, -1, 48, -1, 7, 8, -1, -1, + -1, 55, -1, -1, 58, 59, -1, 61, 62, 63, + 64, 65, 66, 67, 25, 26, 70, 71, 29, -1, + 31, -1, -1, 3, -1, 36, -1, 7, 8, -1, + -1, 42, -1, -1, -1, -1, 47, -1, -1, -1, + -1, -1, -1, -1, 55, 25, 26, 58, -1, 29, + -1, 31, -1, -1, -1, -1, 67, -1, -1, 70, + 71, -1, 42, 43, -1, -1, 3, -1, -1, 49, + 7, 8, -1, -1, -1, 55, 3, -1, 58, -1, + 7, 8, -1, -1, -1, -1, -1, 67, 25, 26, + 70, 71, 29, -1, 31, -1, -1, -1, 25, 26, + -1, -1, 29, -1, 31, 42, -1, -1, -1, 36, + -1, 48, -1, -1, -1, 42, -1, -1, 55, 3, + -1, 58, -1, 7, 8, -1, -1, -1, 55, 13, + 67, 58, -1, 70, 71, -1, -1, -1, -1, -1, + 67, 25, 26, 70, 71, 29, -1, 31, -1, -1, + 3, -1, -1, -1, 7, 8, -1, -1, 42, -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, + -1, 55, 25, 26, 58, -1, 29, -1, 31, -1, + -1, -1, -1, 67, -1, -1, 70, 71, -1, 42, + -1, -1, -1, 3, 47, -1, -1, 7, 8, -1, + -1, -1, 55, 3, -1, 58, -1, 7, 8, -1, + -1, -1, 12, -1, 67, 25, 26, 70, 71, 29, + -1, 31, -1, -1, -1, 25, 26, -1, -1, 29, + 40, 31, 42, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 42, -1, -1, 55, 3, -1, 58, -1, + 7, 8, -1, -1, -1, 55, -1, 67, 58, -1, + 70, 71, -1, -1, -1, -1, -1, 67, 25, 26, + 70, 71, 29, -1, 31, -1, -1, 3, -1, -1, + -1, 7, 8, -1, -1, 42, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 55, 25, + 26, 58, -1, 29, -1, 31, -1, -1, -1, -1, + 67, -1, -1, 70, 71, -1, 42, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, + -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, + -1, 67, -1, -1, 70, 71, 4, 5, 6, 7, + 8, 9, -1, -1, -1, -1, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, -1, 32, -1, 34, 35, -1, -1, + -1, -1, 40, 4, 5, 6, 7, 8, 9, -1, + 48, -1, -1, 14, 15, 16, 17, 18, 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, + -1, 32, -1, 34, 35, 36, -1, -1, -1, 40, + 4, 5, 6, 7, 8, 9, 47, -1, -1, -1, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, -1, 32, -1, + 34, 35, 36, -1, -1, -1, 40, 4, 5, 6, + 7, 8, 9, 47, -1, -1, -1, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, -1, 32, -1, 34, 35, -1, + -1, -1, -1, 40, 4, 5, 6, 7, 8, 9, + 47, -1, -1, -1, 14, 15, 16, 17, 18, 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, -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, -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, -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, -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, -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, -1, 46, 47, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, + 30, -1, 32, -1, 34, 35, -1, -1, -1, -1, + 40, 4, 5, 6, 7, 8, 9, 47, -1, -1, + -1, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, + -1, 34, 35, -1, -1, -1, -1, 40, -1, -1, + 43, -1, 45, 4, 5, 6, 7, 8, 9, -1, + -1, -1, -1, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + -1, 32, -1, 34, 35, -1, -1, -1, -1, 40, + 41, -1, -1, -1, 45, 4, 5, 6, 7, 8, + 9, -1, -1, -1, -1, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, -1, 32, -1, 34, 35, -1, -1, -1, + -1, 40, -1, -1, 43, -1, 45, 4, 5, 6, + 7, 8, 9, -1, -1, -1, -1, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, -1, 32, -1, 34, 35, -1, + -1, -1, -1, 40, 41, -1, -1, -1, 45, 4, + 5, 6, 7, 8, 9, -1, -1, -1, -1, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, -1, 32, -1, 34, + 35, -1, -1, -1, -1, 40, -1, -1, 43, -1, + 45, 4, 5, 6, 7, 8, 9, -1, -1, -1, + -1, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, + -1, 34, 35, -1, -1, -1, -1, 40, -1, -1, + -1, -1, 45, 4, 5, 6, 7, 8, 9, -1, + -1, -1, -1, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + -1, 32, -1, 34, 35, -1, -1, -1, -1, 40, + -1, -1, -1, -1, 45, 4, 5, 6, 7, 8, + 9, -1, -1, -1, -1, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, -1, 32, -1, 34, 35, -1, -1, -1, + -1, 40, -1, -1, 43, 4, 5, 6, 7, 8, + 9, -1, -1, -1, -1, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, -1, 32, -1, 34, 35, -1, -1, -1, + -1, 40, -1, -1, 43, 4, 5, 6, 7, 8, + 9, -1, -1, -1, -1, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, -1, 32, -1, 34, 35, -1, -1, -1, + -1, 40, -1, -1, 43, 4, 5, 6, 7, 8, + 9, -1, -1, -1, -1, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, -1, 32, -1, 34, 35, -1, -1, -1, + -1, 40, -1, -1, 43, 4, 5, 6, 7, 8, + 9, -1, -1, -1, -1, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, -1, 32, -1, 34, 35, -1, -1, -1, + -1, 40, -1, -1, 43, 4, 5, 6, 7, 8, + 9, -1, -1, -1, -1, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, -1, 32, -1, 34, 35, -1, -1, -1, + -1, 40, 41, 4, 5, 6, 7, 8, 9, -1, + -1, -1, -1, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + -1, 32, -1, 34, 35, -1, -1, -1, -1, 40, + 41, 4, 5, 6, 7, 8, 9, -1, -1, -1, + -1, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, + -1, 34, 35, 36, -1, -1, -1, 40, 4, 5, + 6, 7, 8, 9, -1, -1, -1, -1, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, -1, 32, -1, 34, 35, + -1, -1, -1, 4, 40, 6, 7, 8, 9, -1, + -1, -1, -1, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + -1, 32, -1, 34, 35, -1, -1, -1, 39, 40, + 4, -1, 6, 7, 8, 9, -1, -1, -1, -1, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, -1, 32, -1, + 34, 35, -1, -1, -1, 39, 40, 4, -1, 6, + 7, 8, 9, -1, -1, -1, -1, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, -1, 32, -1, 34, 35, -1, + -1, -1, 39, 40, 4, -1, 6, 7, 8, 9, + -1, -1, -1, -1, 14, 15, 16, 17, 18, 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, -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, + 30, -1, 32, -1, 34, 35, -1, -1, -1, -1, + 40, 5, 6, 7, 8, 9, -1, -1, -1, -1, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, -1, 32, -1, + -1, 35, -1, -1, -1, -1, 40, 5, 6, 7, + 8, 9, -1, -1, -1, -1, -1, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, -1, 32, 5, 6, 7, 8, 9, + -1, -1, 40, -1, -1, -1, 16, 17, 18, 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 + 30, -1, 32, 5, 6, 7, 8, 9, -1, -1, + 40, -1, -1, -1, -1, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, -1, + 32, 5, 6, 7, 8, 9, -1, -1, 40, -1, + -1, -1, -1, -1, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, -1, 32, 5, + 6, 7, 8, 9, -1, -1, 40, -1, -1, -1, + -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, -1, 32, -1, -1, -1, + -1, -1, -1, -1, 40 }; /* 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, 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, 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 + 0, 77, 78, 0, 3, 7, 8, 25, 26, 29, + 31, 40, 42, 48, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, + 67, 70, 71, 72, 73, 80, 81, 82, 83, 89, + 90, 91, 92, 99, 107, 108, 110, 114, 120, 121, + 122, 80, 114, 114, 114, 114, 114, 79, 80, 114, + 3, 71, 86, 87, 88, 80, 87, 3, 71, 3, + 80, 86, 40, 3, 80, 89, 91, 80, 92, 42, + 42, 120, 42, 48, 48, 48, 114, 114, 42, 44, + 46, 93, 72, 73, 83, 120, 48, 3, 95, 96, + 97, 42, 44, 46, 4, 5, 6, 7, 8, 9, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 32, 34, 35, + 40, 115, 116, 117, 48, 46, 41, 81, 43, 93, + 43, 45, 3, 45, 48, 48, 48, 48, 48, 51, + 50, 78, 99, 46, 3, 42, 46, 93, 94, 114, + 114, 61, 90, 91, 121, 123, 126, 48, 3, 43, + 49, 111, 112, 113, 114, 3, 36, 47, 109, 114, + 46, 42, 93, 45, 34, 43, 112, 3, 109, 114, + 114, 10, 11, 118, 119, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 13, 114, 114, 117, + 116, 114, 43, 114, 3, 87, 3, 27, 84, 85, + 27, 85, 41, 42, 43, 49, 68, 103, 104, 105, + 106, 114, 40, 42, 100, 46, 93, 43, 43, 42, + 3, 48, 45, 34, 111, 43, 45, 49, 114, 47, + 36, 47, 47, 43, 103, 96, 98, 100, 114, 43, + 47, 47, 114, 12, 114, 5, 5, 36, 114, 41, + 45, 116, 114, 43, 45, 3, 48, 45, 48, 48, + 48, 43, 103, 122, 106, 43, 45, 49, 91, 47, + 41, 45, 49, 98, 101, 102, 43, 103, 114, 120, + 120, 114, 36, 114, 124, 121, 114, 111, 111, 114, + 122, 43, 39, 114, 39, 114, 41, 114, 114, 3, + 84, 43, 122, 106, 106, 97, 98, 41, 49, 45, + 122, 43, 47, 60, 43, 114, 48, 122, 114, 39, + 114, 41, 45, 43, 45, 34, 41, 98, 98, 122, + 120, 48, 43, 125, 126, 114, 114, 114, 98, 41, + 120, 43, 41, 45, 120, 114, 45, 114, 43 }; #define yyerrok (yyerrstatus = 0) @@ -2234,56 +2182,56 @@ yyreduce: case 2: /* Line 1455 of yacc.c */ -#line 177 "camp.y" +#line 179 "camp.y" { absyntax::root = (yyvsp[(1) - (1)].b); ;} break; case 3: /* Line 1455 of yacc.c */ -#line 181 "camp.y" +#line 183 "camp.y" { (yyval.b) = new file(lexerPos(), false); ;} break; case 4: /* Line 1455 of yacc.c */ -#line 183 "camp.y" +#line 185 "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" +#line 189 "camp.y" { (yyval.b) = new block(lexerPos(), true); ;} break; case 6: /* Line 1455 of yacc.c */ -#line 189 "camp.y" +#line 191 "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" +#line 195 "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" +#line 196 "camp.y" { (yyval.n) = new qualifiedName((yyvsp[(2) - (3)].pos), (yyvsp[(1) - (3)].n), (yyvsp[(3) - (3)].ps).sym); ;} break; case 9: /* Line 1455 of yacc.c */ -#line 195 "camp.y" +#line 197 "camp.y" { (yyval.n) = new simpleName((yyvsp[(1) - (1)].ps).pos, symbol::trans("operator answer")); ;} break; @@ -2291,322 +2239,323 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 200 "camp.y" +#line 202 "camp.y" { (yyval.run) = (yyvsp[(1) - (1)].d); ;} break; case 11: /* Line 1455 of yacc.c */ -#line 201 "camp.y" +#line 203 "camp.y" { (yyval.run) = (yyvsp[(1) - (1)].s); ;} break; case 12: /* Line 1455 of yacc.c */ -#line 203 "camp.y" +#line 205 "camp.y" { (yyval.run) = new modifiedRunnable((yyvsp[(1) - (2)].ml)->getPos(), (yyvsp[(1) - (2)].ml), (yyvsp[(2) - (2)].d)); ;} break; case 13: /* Line 1455 of yacc.c */ -#line 205 "camp.y" +#line 207 "camp.y" { (yyval.run) = new modifiedRunnable((yyvsp[(1) - (2)].ml)->getPos(), (yyvsp[(1) - (2)].ml), (yyvsp[(2) - (2)].s)); ;} break; case 14: /* Line 1455 of yacc.c */ -#line 209 "camp.y" +#line 211 "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" +#line 212 "camp.y" { (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" +#line 214 "camp.y" { (yyval.ml) = (yyvsp[(1) - (2)].ml); (yyval.ml)->add((yyvsp[(2) - (2)].mod).val); ;} break; case 17: /* Line 1455 of yacc.c */ -#line 214 "camp.y" +#line 216 "camp.y" { (yyval.ml) = (yyvsp[(1) - (2)].ml); (yyval.ml)->add((yyvsp[(2) - (2)].perm).val); ;} break; case 18: /* Line 1455 of yacc.c */ -#line 218 "camp.y" +#line 220 "camp.y" { (yyval.d) = (yyvsp[(1) - (1)].vd); ;} break; case 19: /* Line 1455 of yacc.c */ -#line 219 "camp.y" +#line 221 "camp.y" { (yyval.d) = (yyvsp[(1) - (1)].d); ;} break; case 20: /* Line 1455 of yacc.c */ -#line 220 "camp.y" +#line 222 "camp.y" { (yyval.d) = (yyvsp[(1) - (1)].d); ;} break; case 21: /* Line 1455 of yacc.c */ -#line 222 "camp.y" +#line 224 "camp.y" { (yyval.d) = new accessdec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].ipl)); ;} break; case 22: /* Line 1455 of yacc.c */ -#line 224 "camp.y" +#line 226 "camp.y" { (yyval.d) = new unraveldec((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].n), (yyvsp[(4) - (5)].ipl)); ;} break; case 23: /* Line 1455 of yacc.c */ -#line 226 "camp.y" +#line 228 "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" +#line 229 "camp.y" { (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" +#line 231 "camp.y" { (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" +#line 233 "camp.y" { (yyval.d) = new fromaccessdec((yyvsp[(1) - (5)].pos), (yyvsp[(2) - (5)].ps).sym, WILDCARD); ;} break; case 27: /* Line 1455 of yacc.c */ -#line 233 "camp.y" +#line 235 "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" +#line 236 "camp.y" { (yyval.d) = new includedec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].ps).sym); ;} break; case 29: /* Line 1455 of yacc.c */ -#line 236 "camp.y" - { (yyval.d) = new includedec((yyvsp[(1) - (3)].pos), (string)*(yyvsp[(2) - (3)].ps).sym); ;} +#line 238 "camp.y" + { (yyval.d) = new includedec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].stre)->getString()); ;} break; case 30: /* Line 1455 of yacc.c */ -#line 240 "camp.y" +#line 242 "camp.y" { (yyval.ip) = new idpair((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; case 31: /* Line 1455 of yacc.c */ -#line 242 "camp.y" +#line 244 "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" +#line 248 "camp.y" { (yyval.ipl) = new idpairlist(); (yyval.ipl)->add((yyvsp[(1) - (1)].ip)); ;} break; case 33: /* Line 1455 of yacc.c */ -#line 248 "camp.y" +#line 250 "camp.y" { (yyval.ipl) = (yyvsp[(1) - (3)].ipl); (yyval.ipl)->add((yyvsp[(3) - (3)].ip)); ;} break; case 34: /* Line 1455 of yacc.c */ -#line 252 "camp.y" +#line 254 "camp.y" { (yyval.ps) = (yyvsp[(1) - (1)].ps); ;} break; case 35: /* Line 1455 of yacc.c */ -#line 253 "camp.y" - { (yyval.ps) = (yyvsp[(1) - (1)].ps); ;} +#line 255 "camp.y" + { (yyval.ps).pos = (yyvsp[(1) - (1)].stre)->getPos(); + (yyval.ps).sym = symbol::trans((yyvsp[(1) - (1)].stre)->getString()); ;} break; case 36: /* Line 1455 of yacc.c */ -#line 257 "camp.y" +#line 260 "camp.y" { (yyval.ip) = new idpair((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; case 37: /* Line 1455 of yacc.c */ -#line 259 "camp.y" +#line 262 "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" +#line 266 "camp.y" { (yyval.ipl) = new idpairlist(); (yyval.ipl)->add((yyvsp[(1) - (1)].ip)); ;} break; case 39: /* Line 1455 of yacc.c */ -#line 265 "camp.y" +#line 268 "camp.y" { (yyval.ipl) = (yyvsp[(1) - (3)].ipl); (yyval.ipl)->add((yyvsp[(3) - (3)].ip)); ;} break; case 40: /* Line 1455 of yacc.c */ -#line 269 "camp.y" +#line 272 "camp.y" { (yyval.vd) = (yyvsp[(1) - (2)].vd); ;} break; case 41: /* Line 1455 of yacc.c */ -#line 273 "camp.y" +#line 276 "camp.y" { (yyval.vd) = new vardec((yyvsp[(1) - (2)].t)->getPos(), (yyvsp[(1) - (2)].t), (yyvsp[(2) - (2)].dil)); ;} break; case 42: /* Line 1455 of yacc.c */ -#line 277 "camp.y" +#line 280 "camp.y" { (yyval.t) = (yyvsp[(1) - (1)].t); ;} break; case 43: /* Line 1455 of yacc.c */ -#line 278 "camp.y" +#line 281 "camp.y" { (yyval.t) = new arrayTy((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].dim)); ;} break; case 44: /* Line 1455 of yacc.c */ -#line 282 "camp.y" +#line 285 "camp.y" { (yyval.t) = new nameTy((yyvsp[(1) - (1)].n)); ;} break; case 45: /* Line 1455 of yacc.c */ -#line 286 "camp.y" +#line 289 "camp.y" { (yyval.dim) = new dimensions((yyvsp[(1) - (2)].pos)); ;} break; case 46: /* Line 1455 of yacc.c */ -#line 287 "camp.y" +#line 290 "camp.y" { (yyval.dim) = (yyvsp[(1) - (3)].dim); (yyval.dim)->increase(); ;} break; case 47: /* Line 1455 of yacc.c */ -#line 291 "camp.y" +#line 294 "camp.y" { (yyval.elist) = new explist((yyvsp[(1) - (3)].pos)); (yyval.elist)->add((yyvsp[(2) - (3)].e)); ;} break; case 48: /* Line 1455 of yacc.c */ -#line 293 "camp.y" +#line 296 "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" +#line 300 "camp.y" { (yyval.dil) = new decidlist((yyvsp[(1) - (1)].di)->getPos()); (yyval.dil)->add((yyvsp[(1) - (1)].di)); ;} break; case 50: /* Line 1455 of yacc.c */ -#line 299 "camp.y" +#line 302 "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" +#line 306 "camp.y" { (yyval.di) = new decid((yyvsp[(1) - (1)].dis)->getPos(), (yyvsp[(1) - (1)].dis)); ;} break; case 52: /* Line 1455 of yacc.c */ -#line 305 "camp.y" +#line 308 "camp.y" { (yyval.di) = new decid((yyvsp[(1) - (3)].dis)->getPos(), (yyvsp[(1) - (3)].dis), (yyvsp[(3) - (3)].vi)); ;} break; case 53: /* Line 1455 of yacc.c */ -#line 309 "camp.y" +#line 312 "camp.y" { (yyval.dis) = new decidstart((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; case 54: /* Line 1455 of yacc.c */ -#line 310 "camp.y" +#line 313 "camp.y" { (yyval.dis) = new decidstart((yyvsp[(1) - (2)].ps).pos, (yyvsp[(1) - (2)].ps).sym, (yyvsp[(2) - (2)].dim)); ;} break; case 55: /* Line 1455 of yacc.c */ -#line 311 "camp.y" +#line 314 "camp.y" { (yyval.dis) = new fundecidstart((yyvsp[(1) - (3)].ps).pos, (yyvsp[(1) - (3)].ps).sym, 0, new formals((yyvsp[(2) - (3)].pos))); ;} break; @@ -2614,84 +2563,84 @@ yyreduce: case 56: /* Line 1455 of yacc.c */ -#line 314 "camp.y" +#line 317 "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 1455 of yacc.c */ -#line 318 "camp.y" +#line 321 "camp.y" { (yyval.vi) = (yyvsp[(1) - (1)].e); ;} break; case 58: /* Line 1455 of yacc.c */ -#line 319 "camp.y" +#line 322 "camp.y" { (yyval.vi) = (yyvsp[(1) - (1)].ai); ;} break; case 59: /* Line 1455 of yacc.c */ -#line 324 "camp.y" +#line 327 "camp.y" { (yyval.b) = (yyvsp[(2) - (3)].b); ;} break; case 60: /* Line 1455 of yacc.c */ -#line 328 "camp.y" +#line 331 "camp.y" { (yyval.ai) = new arrayinit((yyvsp[(1) - (2)].pos)); ;} break; case 61: /* Line 1455 of yacc.c */ -#line 330 "camp.y" +#line 333 "camp.y" { (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" +#line 335 "camp.y" { (yyval.ai) = (yyvsp[(2) - (3)].ai); ;} break; case 63: /* Line 1455 of yacc.c */ -#line 334 "camp.y" +#line 337 "camp.y" { (yyval.ai) = (yyvsp[(2) - (5)].ai); (yyval.ai)->addRest((yyvsp[(4) - (5)].vi)); ;} break; case 64: /* Line 1455 of yacc.c */ -#line 338 "camp.y" +#line 341 "camp.y" { (yyval.ai) = new arrayinit((yyvsp[(1) - (1)].pos)); ;} break; case 65: /* Line 1455 of yacc.c */ -#line 339 "camp.y" +#line 342 "camp.y" { (yyval.ai) = (yyvsp[(1) - (1)].ai); ;} break; case 66: /* Line 1455 of yacc.c */ -#line 340 "camp.y" +#line 343 "camp.y" { (yyval.ai) = (yyvsp[(1) - (2)].ai); ;} break; case 67: /* Line 1455 of yacc.c */ -#line 344 "camp.y" +#line 347 "camp.y" { (yyval.ai) = new arrayinit((yyvsp[(1) - (1)].vi)->getPos()); (yyval.ai)->add((yyvsp[(1) - (1)].vi));;} break; @@ -2699,147 +2648,147 @@ yyreduce: case 68: /* Line 1455 of yacc.c */ -#line 347 "camp.y" +#line 350 "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" +#line 354 "camp.y" { (yyval.fls) = (yyvsp[(1) - (1)].fls); ;} break; case 70: /* Line 1455 of yacc.c */ -#line 353 "camp.y" +#line 356 "camp.y" { (yyval.fls) = (yyvsp[(1) - (3)].fls); (yyval.fls)->addRest((yyvsp[(3) - (3)].fl)); ;} break; case 71: /* Line 1455 of yacc.c */ -#line 354 "camp.y" +#line 357 "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" +#line 361 "camp.y" { (yyval.fls) = new formals((yyvsp[(1) - (1)].fl)->getPos()); (yyval.fls)->add((yyvsp[(1) - (1)].fl)); ;} break; case 73: /* Line 1455 of yacc.c */ -#line 360 "camp.y" +#line 363 "camp.y" { (yyval.fls) = (yyvsp[(1) - (3)].fls); (yyval.fls)->add((yyvsp[(3) - (3)].fl)); ;} break; case 74: /* Line 1455 of yacc.c */ -#line 364 "camp.y" +#line 367 "camp.y" { (yyval.boo) = true; ;} break; case 75: /* Line 1455 of yacc.c */ -#line 365 "camp.y" +#line 368 "camp.y" { (yyval.boo) = false; ;} break; case 76: /* Line 1455 of yacc.c */ -#line 370 "camp.y" +#line 373 "camp.y" { (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" +#line 375 "camp.y" { (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 1455 of yacc.c */ -#line 374 "camp.y" +#line 377 "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" +#line 382 "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)); ;} break; case 80: /* Line 1455 of yacc.c */ -#line 381 "camp.y" +#line 384 "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 1455 of yacc.c */ -#line 385 "camp.y" +#line 388 "camp.y" { (yyval.d) = new recorddec((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].b)); ;} break; case 82: /* Line 1455 of yacc.c */ -#line 386 "camp.y" +#line 389 "camp.y" { (yyval.d) = new typedec((yyvsp[(1) - (2)].pos), (yyvsp[(2) - (2)].vd)); ;} break; case 83: /* Line 1455 of yacc.c */ -#line 390 "camp.y" +#line 393 "camp.y" { (yyval.slice) = new slice((yyvsp[(1) - (1)].pos), 0, 0); ;} break; case 84: /* Line 1455 of yacc.c */ -#line 391 "camp.y" +#line 394 "camp.y" { (yyval.slice) = new slice((yyvsp[(2) - (2)].pos), (yyvsp[(1) - (2)].e), 0); ;} break; case 85: /* Line 1455 of yacc.c */ -#line 392 "camp.y" +#line 395 "camp.y" { (yyval.slice) = new slice((yyvsp[(1) - (2)].pos), 0, (yyvsp[(2) - (2)].e)); ;} break; case 86: /* Line 1455 of yacc.c */ -#line 393 "camp.y" +#line 396 "camp.y" { (yyval.slice) = new slice((yyvsp[(2) - (3)].pos), (yyvsp[(1) - (3)].e), (yyvsp[(3) - (3)].e)); ;} break; case 87: /* Line 1455 of yacc.c */ -#line 397 "camp.y" +#line 400 "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" +#line 401 "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)); ;} break; @@ -2847,14 +2796,14 @@ yyreduce: case 89: /* Line 1455 of yacc.c */ -#line 400 "camp.y" +#line 403 "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" +#line 404 "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)); ;} break; @@ -2862,14 +2811,14 @@ yyreduce: case 91: /* Line 1455 of yacc.c */ -#line 403 "camp.y" +#line 406 "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" +#line 407 "camp.y" { (yyval.e) = new callExp((yyvsp[(2) - (3)].pos), new nameExp((yyvsp[(1) - (3)].n)->getPos(), (yyvsp[(1) - (3)].n)), new arglist()); ;} @@ -2878,7 +2827,7 @@ yyreduce: case 93: /* Line 1455 of yacc.c */ -#line 408 "camp.y" +#line 411 "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)); ;} @@ -2887,336 +2836,336 @@ yyreduce: case 94: /* Line 1455 of yacc.c */ -#line 411 "camp.y" +#line 414 "camp.y" { (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" +#line 416 "camp.y" { (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" +#line 418 "camp.y" { (yyval.e) = (yyvsp[(2) - (3)].e); ;} break; case 97: /* Line 1455 of yacc.c */ -#line 417 "camp.y" +#line 420 "camp.y" { (yyval.e) = new nameExp((yyvsp[(2) - (3)].n)->getPos(), (yyvsp[(2) - (3)].n)); ;} break; case 98: /* Line 1455 of yacc.c */ -#line 418 "camp.y" +#line 421 "camp.y" { (yyval.e) = new thisExp((yyvsp[(1) - (1)].pos)); ;} break; case 99: /* Line 1455 of yacc.c */ -#line 422 "camp.y" - { (yyval.arg).name=0; (yyval.arg).val=(yyvsp[(1) - (1)].e); ;} +#line 425 "camp.y" + { (yyval.arg).name = symbol::nullsym; (yyval.arg).val=(yyvsp[(1) - (1)].e); ;} break; case 100: /* Line 1455 of yacc.c */ -#line 423 "camp.y" - { (yyval.arg).name=(yyvsp[(1) - (3)].ps).sym; (yyval.arg).val=(yyvsp[(3) - (3)].e); ;} +#line 426 "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" +#line 430 "camp.y" { (yyval.alist) = (yyvsp[(1) - (1)].alist); ;} break; case 102: /* Line 1455 of yacc.c */ -#line 429 "camp.y" +#line 432 "camp.y" { (yyval.alist) = (yyvsp[(1) - (3)].alist); (yyval.alist)->rest = (yyvsp[(3) - (3)].arg); ;} break; case 103: /* Line 1455 of yacc.c */ -#line 430 "camp.y" +#line 433 "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" +#line 437 "camp.y" { (yyval.alist) = new arglist(); (yyval.alist)->add((yyvsp[(1) - (1)].arg)); ;} break; case 105: /* Line 1455 of yacc.c */ -#line 436 "camp.y" +#line 439 "camp.y" { (yyval.alist) = (yyvsp[(1) - (3)].alist); (yyval.alist)->add((yyvsp[(3) - (3)].arg)); ;} break; case 106: /* Line 1455 of yacc.c */ -#line 441 "camp.y" +#line 444 "camp.y" { (yyval.e) = new nameExp((yyvsp[(1) - (1)].n)->getPos(), (yyvsp[(1) - (1)].n)); ;} break; case 107: /* Line 1455 of yacc.c */ -#line 442 "camp.y" +#line 445 "camp.y" { (yyval.e) = (yyvsp[(1) - (1)].e); ;} break; case 108: /* Line 1455 of yacc.c */ -#line 443 "camp.y" +#line 446 "camp.y" { (yyval.e) = (yyvsp[(1) - (1)].e); ;} break; case 109: /* Line 1455 of yacc.c */ -#line 444 "camp.y" - { (yyval.e) = new stringExp((yyvsp[(1) - (1)].ps).pos, *(yyvsp[(1) - (1)].ps).sym); ;} +#line 447 "camp.y" + { (yyval.e) = (yyvsp[(1) - (1)].stre); ;} break; case 110: /* Line 1455 of yacc.c */ -#line 446 "camp.y" +#line 449 "camp.y" { (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" +#line 451 "camp.y" { (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" +#line 453 "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)); ;} break; case 113: /* Line 1455 of yacc.c */ -#line 452 "camp.y" +#line 455 "camp.y" { (yyval.e) = new unaryExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), (yyvsp[(1) - (2)].ps).sym); ;} break; case 114: /* Line 1455 of yacc.c */ -#line 454 "camp.y" +#line 457 "camp.y" { (yyval.e) = new unaryExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), (yyvsp[(1) - (2)].ps).sym); ;} break; case 115: /* Line 1455 of yacc.c */ -#line 455 "camp.y" +#line 458 "camp.y" { (yyval.e) = new unaryExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), (yyvsp[(1) - (2)].ps).sym); ;} break; case 116: /* Line 1455 of yacc.c */ -#line 456 "camp.y" +#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 117: /* Line 1455 of yacc.c */ -#line 457 "camp.y" +#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 118: /* Line 1455 of yacc.c */ -#line 458 "camp.y" +#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 119: /* Line 1455 of yacc.c */ -#line 459 "camp.y" +#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 120: /* Line 1455 of yacc.c */ -#line 460 "camp.y" +#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 121: /* Line 1455 of yacc.c */ -#line 461 "camp.y" +#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 122: /* Line 1455 of yacc.c */ -#line 462 "camp.y" +#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 123: /* Line 1455 of yacc.c */ -#line 463 "camp.y" +#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 124: /* Line 1455 of yacc.c */ -#line 464 "camp.y" +#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 125: /* Line 1455 of yacc.c */ -#line 465 "camp.y" +#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)); ;} break; case 126: /* 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)); ;} +#line 469 "camp.y" + { (yyval.e) = new equalityExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 127: /* 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)); ;} +#line 470 "camp.y" + { (yyval.e) = new equalityExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} break; case 128: /* Line 1455 of yacc.c */ -#line 468 "camp.y" +#line 471 "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 1455 of yacc.c */ -#line 469 "camp.y" +#line 472 "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 1455 of yacc.c */ -#line 470 "camp.y" +#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 131: /* Line 1455 of yacc.c */ -#line 471 "camp.y" +#line 474 "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 1455 of yacc.c */ -#line 472 "camp.y" +#line 475 "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 1455 of yacc.c */ -#line 473 "camp.y" +#line 476 "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" +#line 477 "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 135: /* Line 1455 of yacc.c */ -#line 476 "camp.y" +#line 479 "camp.y" { (yyval.e) = new newRecordExp((yyvsp[(1) - (2)].pos), (yyvsp[(2) - (2)].t)); ;} break; case 136: /* Line 1455 of yacc.c */ -#line 478 "camp.y" +#line 481 "camp.y" { (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" +#line 483 "camp.y" { (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" +#line 485 "camp.y" { (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" +#line 487 "camp.y" { (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" +#line 489 "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" +#line 491 "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)), @@ -3226,14 +3175,14 @@ yyreduce: case 142: /* Line 1455 of yacc.c */ -#line 493 "camp.y" +#line 496 "camp.y" { (yyval.e) = new newFunctionExp((yyvsp[(1) - (6)].pos), (yyvsp[(2) - (6)].t), (yyvsp[(4) - (6)].fls), (yyvsp[(6) - (6)].s)); ;} break; case 143: /* Line 1455 of yacc.c */ -#line 495 "camp.y" +#line 498 "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), @@ -3243,52 +3192,52 @@ yyreduce: case 144: /* Line 1455 of yacc.c */ -#line 500 "camp.y" +#line 503 "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 1455 of yacc.c */ -#line 501 "camp.y" +#line 504 "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" +#line 507 "camp.y" { (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" +#line 509 "camp.y" { (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" +#line 511 "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)); ;} break; case 149: /* Line 1455 of yacc.c */ -#line 510 "camp.y" +#line 513 "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" +#line 515 "camp.y" { (yyvsp[(2) - (2)].se)->setSide(camp::OUT); joinExp *jexp = - new joinExp((yyvsp[(2) - (2)].se)->getPos(), symbol::trans("..")); + new joinExp((yyvsp[(2) - (2)].se)->getPos(), SYM_DOTS); (yyval.e)=jexp; jexp->pushBack((yyvsp[(1) - (2)].e)); jexp->pushBack((yyvsp[(2) - (2)].se)); ;} break; @@ -3296,394 +3245,359 @@ yyreduce: 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("+")); ;} +#line 521 "camp.y" + { (yyval.e) = new prefixExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), SYM_PLUS); ;} break; case 152: /* 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 1455 of yacc.c */ #line 523 "camp.y" - { (yyval.e) = new postfixExp((yyvsp[(2) - (2)].ps).pos, (yyvsp[(1) - (2)].e), symbol::trans("+")); ;} + { (yyval.e) = new prefixExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), SYM_MINUS); ;} 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: + case 153: /* 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)); ;} + { (yyval.e) = new postfixExp((yyvsp[(2) - (2)].ps).pos, (yyvsp[(1) - (2)].e), SYM_PLUS); ;} break; - case 156: + case 154: /* 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 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: + case 155: /* 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 selfExp((yyvsp[(2) - (3)].ps).pos, (yyvsp[(1) - (3)].e), (yyvsp[(2) - (3)].ps).sym, (yyvsp[(3) - (3)].e)); ;} - break; - - case 160: - -/* Line 1455 of yacc.c */ -#line 533 "camp.y" { (yyval.e) = new quoteExp((yyvsp[(1) - (4)].pos), (yyvsp[(3) - (4)].b)); ;} break; - case 161: + case 156: /* Line 1455 of yacc.c */ -#line 539 "camp.y" +#line 535 "camp.y" { (yyval.j) = new joinExp((yyvsp[(1) - (1)].ps).pos,(yyvsp[(1) - (1)].ps).sym); ;} break; - case 162: + case 157: /* Line 1455 of yacc.c */ -#line 541 "camp.y" +#line 537 "camp.y" { (yyval.j) = (yyvsp[(1) - (1)].j); ;} break; - case 163: + case 158: /* Line 1455 of yacc.c */ -#line 543 "camp.y" +#line 539 "camp.y" { (yyvsp[(1) - (2)].se)->setSide(camp::OUT); (yyval.j) = (yyvsp[(2) - (2)].j); (yyval.j)->pushFront((yyvsp[(1) - (2)].se)); ;} break; - case 164: + case 159: /* Line 1455 of yacc.c */ -#line 546 "camp.y" +#line 542 "camp.y" { (yyvsp[(2) - (2)].se)->setSide(camp::IN); (yyval.j) = (yyvsp[(1) - (2)].j); (yyval.j)->pushBack((yyvsp[(2) - (2)].se)); ;} break; - case 165: + case 160: /* Line 1455 of yacc.c */ -#line 549 "camp.y" +#line 545 "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 166: + case 161: /* Line 1455 of yacc.c */ -#line 554 "camp.y" +#line 550 "camp.y" { (yyval.se) = new specExp((yyvsp[(2) - (4)].ps).pos, (yyvsp[(2) - (4)].ps).sym, (yyvsp[(3) - (4)].e)); ;} break; - case 167: + case 162: /* Line 1455 of yacc.c */ -#line 555 "camp.y" +#line 551 "camp.y" { (yyval.se) = new specExp((yyvsp[(1) - (3)].pos), symbol::opTrans("spec"), (yyvsp[(2) - (3)].e)); ;} break; - case 168: + case 163: /* Line 1455 of yacc.c */ -#line 557 "camp.y" +#line 553 "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 169: + case 164: /* Line 1455 of yacc.c */ -#line 560 "camp.y" +#line 556 "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 170: + case 165: /* Line 1455 of yacc.c */ -#line 565 "camp.y" +#line 561 "camp.y" { (yyval.j) = new joinExp((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; - case 171: + case 166: /* Line 1455 of yacc.c */ -#line 567 "camp.y" +#line 563 "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: + case 167: /* Line 1455 of yacc.c */ -#line 569 "camp.y" +#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)); ;} break; - case 173: + case 168: /* Line 1455 of yacc.c */ -#line 570 "camp.y" +#line 566 "camp.y" { (yyval.j) = new joinExp((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; - case 174: + case 169: /* Line 1455 of yacc.c */ -#line 571 "camp.y" +#line 567 "camp.y" { (yyval.j) = new joinExp((yyvsp[(1) - (1)].ps).pos, (yyvsp[(1) - (1)].ps).sym); ;} break; - case 175: + case 170: /* Line 1455 of yacc.c */ -#line 575 "camp.y" +#line 571 "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 176: + case 171: /* Line 1455 of yacc.c */ -#line 578 "camp.y" +#line 574 "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 177: + case 172: /* Line 1455 of yacc.c */ -#line 581 "camp.y" +#line 577 "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 178: + case 173: /* Line 1455 of yacc.c */ -#line 584 "camp.y" +#line 580 "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 179: + case 174: /* Line 1455 of yacc.c */ -#line 589 "camp.y" +#line 585 "camp.y" { (yyval.e) = new unaryExp((yyvsp[(1) - (2)].ps).pos, (yyvsp[(2) - (2)].e), (yyvsp[(1) - (2)].ps).sym); ;} break; - case 180: + case 175: /* Line 1455 of yacc.c */ -#line 591 "camp.y" +#line 587 "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: + case 176: /* Line 1455 of yacc.c */ -#line 595 "camp.y" +#line 591 "camp.y" { (yyval.s) = new emptyStm((yyvsp[(1) - (1)].pos)); ;} break; - case 182: + case 177: /* Line 1455 of yacc.c */ -#line 596 "camp.y" +#line 592 "camp.y" { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; - case 183: + case 178: /* Line 1455 of yacc.c */ -#line 597 "camp.y" +#line 593 "camp.y" { (yyval.s) = (yyvsp[(1) - (2)].s); ;} break; - case 184: + case 179: /* Line 1455 of yacc.c */ -#line 599 "camp.y" +#line 595 "camp.y" { (yyval.s) = new ifStm((yyvsp[(1) - (5)].pos), (yyvsp[(3) - (5)].e), (yyvsp[(5) - (5)].s)); ;} break; - case 185: + case 180: /* Line 1455 of yacc.c */ -#line 601 "camp.y" +#line 597 "camp.y" { (yyval.s) = new ifStm((yyvsp[(1) - (7)].pos), (yyvsp[(3) - (7)].e), (yyvsp[(5) - (7)].s), (yyvsp[(7) - (7)].s)); ;} break; - case 186: + case 181: /* Line 1455 of yacc.c */ -#line 603 "camp.y" +#line 599 "camp.y" { (yyval.s) = new whileStm((yyvsp[(1) - (5)].pos), (yyvsp[(3) - (5)].e), (yyvsp[(5) - (5)].s)); ;} break; - case 187: + case 182: /* Line 1455 of yacc.c */ -#line 605 "camp.y" +#line 601 "camp.y" { (yyval.s) = new doStm((yyvsp[(1) - (7)].pos), (yyvsp[(2) - (7)].s), (yyvsp[(5) - (7)].e)); ;} break; - case 188: + case 183: /* Line 1455 of yacc.c */ -#line 607 "camp.y" +#line 603 "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)); ;} break; - case 189: + case 184: /* Line 1455 of yacc.c */ -#line 609 "camp.y" +#line 605 "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: + case 185: /* Line 1455 of yacc.c */ -#line 610 "camp.y" +#line 606 "camp.y" { (yyval.s) = new breakStm((yyvsp[(1) - (2)].pos)); ;} break; - case 191: + case 186: /* Line 1455 of yacc.c */ -#line 611 "camp.y" +#line 607 "camp.y" { (yyval.s) = new continueStm((yyvsp[(1) - (2)].pos)); ;} break; - case 192: + case 187: /* Line 1455 of yacc.c */ -#line 612 "camp.y" +#line 608 "camp.y" { (yyval.s) = new returnStm((yyvsp[(1) - (2)].pos)); ;} break; - case 193: + case 188: /* Line 1455 of yacc.c */ -#line 613 "camp.y" +#line 609 "camp.y" { (yyval.s) = new returnStm((yyvsp[(1) - (3)].pos), (yyvsp[(2) - (3)].e)); ;} break; - case 194: + case 189: /* Line 1455 of yacc.c */ -#line 617 "camp.y" +#line 613 "camp.y" { (yyval.s) = new expStm((yyvsp[(1) - (1)].e)->getPos(), (yyvsp[(1) - (1)].e)); ;} break; - case 195: + case 190: /* Line 1455 of yacc.c */ -#line 621 "camp.y" +#line 617 "camp.y" { (yyval.s) = new blockStm((yyvsp[(1) - (1)].b)->getPos(), (yyvsp[(1) - (1)].b)); ;} break; - case 196: + case 191: /* Line 1455 of yacc.c */ -#line 625 "camp.y" +#line 621 "camp.y" { (yyval.run) = 0; ;} break; - case 197: + case 192: /* Line 1455 of yacc.c */ -#line 626 "camp.y" +#line 622 "camp.y" { (yyval.run) = (yyvsp[(1) - (1)].sel); ;} break; - case 198: + case 193: /* Line 1455 of yacc.c */ -#line 627 "camp.y" +#line 623 "camp.y" { (yyval.run) = (yyvsp[(1) - (1)].vd); ;} break; - case 199: + case 194: /* Line 1455 of yacc.c */ -#line 631 "camp.y" +#line 627 "camp.y" { (yyval.e) = 0; ;} break; - case 200: + case 195: /* Line 1455 of yacc.c */ -#line 632 "camp.y" +#line 628 "camp.y" { (yyval.e) = (yyvsp[(1) - (1)].e); ;} break; - case 201: + case 196: /* Line 1455 of yacc.c */ -#line 636 "camp.y" +#line 632 "camp.y" { (yyval.sel) = 0; ;} break; - case 202: + case 197: /* Line 1455 of yacc.c */ -#line 637 "camp.y" +#line 633 "camp.y" { (yyval.sel) = (yyvsp[(1) - (1)].sel); ;} break; - case 203: + case 198: /* Line 1455 of yacc.c */ -#line 641 "camp.y" +#line 637 "camp.y" { (yyval.sel) = new stmExpList((yyvsp[(1) - (1)].s)->getPos()); (yyval.sel)->add((yyvsp[(1) - (1)].s)); ;} break; - case 204: + case 199: /* Line 1455 of yacc.c */ -#line 643 "camp.y" +#line 639 "camp.y" { (yyval.sel) = (yyvsp[(1) - (3)].sel); (yyval.sel)->add((yyvsp[(3) - (3)].s)); ;} break; /* Line 1455 of yacc.c */ -#line 3687 "camp.tab.c" +#line 3601 "camp.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/Build/source/utils/asymptote/camp.tab.h b/Build/source/utils/asymptote/camp.tab.h index bf0b8a9ce50..cd6c58db7cc 100644 --- a/Build/source/utils/asymptote/camp.tab.h +++ b/Build/source/utils/asymptote/camp.tab.h @@ -40,66 +40,61 @@ know about them. */ enum yytokentype { ID = 258, - ADD = 259, - SUBTRACT = 260, - TIMES = 261, - DIVIDE = 262, - MOD = 263, - EXPONENT = 264, - DOTS = 265, - COLONS = 266, - DASHES = 267, - INCR = 268, - LONGDASH = 269, - CONTROLS = 270, - TENSION = 271, - ATLEAST = 272, - CURL = 273, - COR = 274, - CAND = 275, - BAR = 276, - AMPERSAND = 277, - EQ = 278, - NEQ = 279, - LT = 280, - LE = 281, - GT = 282, - GE = 283, - CARETS = 284, - LOGNOT = 285, - OPERATOR = 286, - STRING = 287, - LOOSE = 288, - ASSIGN = 289, - DIRTAG = 290, - JOIN_PREC = 291, - AND = 292, - ELLIPSIS = 293, - ACCESS = 294, - UNRAVEL = 295, - IMPORT = 296, - INCLUDE = 297, - FROM = 298, - QUOTE = 299, - STRUCT = 300, - TYPEDEF = 301, - NEW = 302, - IF = 303, - ELSE = 304, - WHILE = 305, - DO = 306, - FOR = 307, - BREAK = 308, - CONTINUE = 309, - RETURN_ = 310, - THIS = 311, - EXPLICIT = 312, - GARBAGE = 313, - LIT = 314, - PERM = 315, - MODIFIER = 316, - UNARY = 317, - EXP_IN_PARENS_RULE = 318 + SELFOP = 259, + DOTS = 260, + COLONS = 261, + DASHES = 262, + INCR = 263, + LONGDASH = 264, + CONTROLS = 265, + TENSION = 266, + ATLEAST = 267, + CURL = 268, + COR = 269, + CAND = 270, + BAR = 271, + AMPERSAND = 272, + EQ = 273, + NEQ = 274, + LT = 275, + LE = 276, + GT = 277, + GE = 278, + CARETS = 279, + LOGNOT = 280, + OPERATOR = 281, + LOOSE = 282, + ASSIGN = 283, + DIRTAG = 284, + JOIN_PREC = 285, + AND = 286, + ELLIPSIS = 287, + ACCESS = 288, + UNRAVEL = 289, + IMPORT = 290, + INCLUDE = 291, + FROM = 292, + QUOTE = 293, + STRUCT = 294, + TYPEDEF = 295, + NEW = 296, + IF = 297, + ELSE = 298, + WHILE = 299, + DO = 300, + FOR = 301, + BREAK = 302, + CONTINUE = 303, + RETURN_ = 304, + THIS = 305, + EXPLICIT = 306, + GARBAGE = 307, + LIT = 308, + STRING = 309, + PERM = 310, + MODIFIER = 311, + UNARY = 312, + EXP_IN_PARENS_RULE = 313 }; #endif @@ -110,18 +105,19 @@ typedef union YYSTYPE { /* Line 1676 of yacc.c */ -#line 46 "camp.y" +#line 47 "camp.y" position pos; bool boo; struct { position pos; - sym::symbol *sym; + sym::symbol sym; } ps; absyntax::name *n; absyntax::varinit *vi; absyntax::arrayinit *ai; absyntax::exp *e; + absyntax::stringExp *stre; absyntax::specExp *se; absyntax::joinExp *j; absyntax::explist *elist; @@ -159,7 +155,7 @@ typedef union YYSTYPE /* Line 1676 of yacc.c */ -#line 163 "camp.tab.h" +#line 159 "camp.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/Build/source/utils/asymptote/camp.y b/Build/source/utils/asymptote/camp.y index a3b199ebd61..94feb807c32 100644 --- a/Build/source/utils/asymptote/camp.y +++ b/Build/source/utils/asymptote/camp.y @@ -13,6 +13,7 @@ #include "fundec.h" #include "stm.h" #include "modifier.h" +#include "opsymbols.h" // Avoid error messages with unpatched bison-1.875: #ifndef __attribute__ @@ -48,12 +49,13 @@ using mem::string; bool boo; struct { position pos; - sym::symbol *sym; + sym::symbol sym; } ps; absyntax::name *n; absyntax::varinit *vi; absyntax::arrayinit *ai; absyntax::exp *e; + absyntax::stringExp *stre; absyntax::specExp *se; absyntax::joinExp *j; absyntax::explist *elist; @@ -89,12 +91,11 @@ using mem::string; absyntax::formals *fls; } -%token <ps> ID ADD SUBTRACT TIMES DIVIDE MOD EXPONENT +%token <ps> ID SELFOP DOTS COLONS DASHES INCR LONGDASH CONTROLS TENSION ATLEAST CURL COR CAND BAR AMPERSAND EQ NEQ LT LE GT GE CARETS '+' '-' '*' '/' '%' '^' LOGNOT OPERATOR - STRING %token <pos> LOOSE ASSIGN '?' ':' DIRTAG JOIN_PREC AND '{' '}' '(' ')' '.' ',' '[' ']' ';' ELLIPSIS @@ -103,10 +104,11 @@ using mem::string; THIS EXPLICIT GARBAGE %token <e> LIT +%token <stre> STRING %token <perm> PERM %token <mod> MODIFIER -%right ASSIGN ADD SUBTRACT TIMES DIVIDE MOD EXPONENT +%right ASSIGN SELFOP %right '?' ':' %left COR %left CAND @@ -233,7 +235,7 @@ dec: { $$ = new importdec($1, $2); } | INCLUDE ID ';' { $$ = new includedec($1, $2.sym); } | INCLUDE STRING ';' - { $$ = new includedec($1, (string)*$2.sym); } + { $$ = new includedec($1, $2->getString()); } ; idpair: @@ -249,8 +251,9 @@ idpairlist: ; strid: - STRING { $$ = $1; } -| ID { $$ = $1; } + ID { $$ = $1; } +| STRING { $$.pos = $1->getPos(); + $$.sym = symbol::trans($1->getString()); } ; stridpair: @@ -419,8 +422,8 @@ value: ; argument: - exp { $$.name=0; $$.val=$1; } -| ID ASSIGN exp { $$.name=$1.sym; $$.val=$3; } + exp { $$.name = symbol::nullsym; $$.val=$1; } +| ID ASSIGN exp { $$.name = $1.sym; $$.val=$3; } ; arglist: @@ -441,7 +444,7 @@ exp: name { $$ = new nameExp($1->getPos(), $1); } | value { $$ = $1; } | LIT { $$ = $1; } -| STRING { $$ = new stringExp($1.pos, *$1.sym); } +| STRING { $$ = $1; } /* This is for scaling expressions such as 105cm */ | LIT exp { $$ = new scaleExp($1->getPos(), $1, $2); } | '(' name ')' exp @@ -463,8 +466,8 @@ exp: | exp LE exp { $$ = new binaryExp($2.pos, $1, $2.sym, $3); } | exp GT exp { $$ = new binaryExp($2.pos, $1, $2.sym, $3); } | exp GE exp { $$ = new binaryExp($2.pos, $1, $2.sym, $3); } -| exp EQ exp { $$ = new binaryExp($2.pos, $1, $2.sym, $3); } -| exp NEQ exp { $$ = new binaryExp($2.pos, $1, $2.sym, $3); } +| exp EQ exp { $$ = new equalityExp($2.pos, $1, $2.sym, $3); } +| exp NEQ exp { $$ = new equalityExp($2.pos, $1, $2.sym, $3); } | exp CAND exp { $$ = new andExp($2.pos, $1, $2.sym, $3); } | exp COR exp { $$ = new orExp($2.pos, $1, $2.sym, $3); } | exp CARETS exp { $$ = new binaryExp($2.pos, $1, $2.sym, $3); } @@ -511,24 +514,17 @@ exp: | exp dir %prec DIRTAG { $2->setSide(camp::OUT); joinExp *jexp = - new joinExp($2->getPos(), symbol::trans("..")); + new joinExp($2->getPos(), SYM_DOTS); $$=jexp; jexp->pushBack($1); jexp->pushBack($2); } | INCR exp %prec UNARY - { $$ = new prefixExp($1.pos, $2, symbol::trans("+")); } + { $$ = new prefixExp($1.pos, $2, SYM_PLUS); } | DASHES exp %prec UNARY - { $$ = new prefixExp($1.pos, $2, symbol::trans("-")); } + { $$ = new prefixExp($1.pos, $2, SYM_MINUS); } /* Illegal - will be caught during translation. */ | exp INCR %prec UNARY - { $$ = new postfixExp($2.pos, $1, symbol::trans("+")); } -| exp ADD exp { $$ = new selfExp($2.pos, $1, $2.sym, $3); } -| exp SUBTRACT exp - { $$ = new selfExp($2.pos, $1, $2.sym, $3); } -| exp TIMES exp { $$ = new selfExp($2.pos, $1, $2.sym, $3); } -| exp DIVIDE exp { $$ = new selfExp($2.pos, $1, $2.sym, $3); } -| exp MOD exp { $$ = new selfExp($2.pos, $1, $2.sym, $3); } -| exp EXPONENT exp - { $$ = new selfExp($2.pos, $1, $2.sym, $3); } + { $$ = new postfixExp($2.pos, $1, SYM_PLUS); } +| exp SELFOP exp { $$ = new selfExp($2.pos, $1, $2.sym, $3); } | QUOTE '{' fileblock '}' { $$ = new quoteExp($1, $3); } ; diff --git a/Build/source/utils/asymptote/coder.cc b/Build/source/utils/asymptote/coder.cc index fc71f730b44..6b08408ab2c 100644 --- a/Build/source/utils/asymptote/coder.cc +++ b/Build/source/utils/asymptote/coder.cc @@ -109,11 +109,11 @@ coder coder::newCodelet() DEFAULT_DYNAMIC, false); } -record *coder::newRecord(symbol *id) +record *coder::newRecord(symbol id) { frame *underlevel = getFrame(); - frame *level = new frame(*id, underlevel, 0); + frame *level = new frame(id, underlevel, 0); record *r = new record(id, level); diff --git a/Build/source/utils/asymptote/coder.h b/Build/source/utils/asymptote/coder.h index c6524f3c4ad..92176cf774b 100644 --- a/Build/source/utils/asymptote/coder.h +++ b/Build/source/utils/asymptote/coder.h @@ -182,7 +182,7 @@ public: coder newFunction(string name, function *t, modifier sord=DEFAULT_DYNAMIC); // Creates a new record type. - record *newRecord(symbol *id); + record *newRecord(symbol id); // Create a coder for the initializer of the record. coder newRecordInit(record *r, modifier sord=DEFAULT_DYNAMIC); diff --git a/Build/source/utils/asymptote/common.h b/Build/source/utils/asymptote/common.h index 16b9d57d567..0ae0f2cccd1 100644 --- a/Build/source/utils/asymptote/common.h +++ b/Build/source/utils/asymptote/common.h @@ -32,25 +32,40 @@ #include "memory.h" #if defined(HAVE_LONG_LONG) && defined(LONG_LONG_MAX) && defined(LONG_LONG_MIN) -#define Int_MAX LONG_LONG_MAX +#define Int_MAX2 LONG_LONG_MAX #define Int_MIN LONG_LONG_MIN typedef long long Int; typedef unsigned long long unsignedInt; #else #undef HAVE_LONG_LONG #ifdef HAVE_LONG -#define Int_MAX LONG_MAX +#define Int_MAX2 LONG_MAX #define Int_MIN LONG_MIN typedef long Int; typedef unsigned long unsignedInt; #else -#define Int_MAX INT_MAX +#define Int_MAX2 INT_MAX #define Int_MIN INT_MIN typedef int Int; typedef unsigned int unsignedInt; #endif #endif +#ifndef COMPACT +#if Int_MAX2 >= 0x7fffffffffffffffLL +#define COMPACT 1 +#else +#define COMPACT 0 +#endif +#endif + +#ifdef COMPACT +// Reserve highest two values for DefaultValue and Undefined states. +#define Int_MAX (Int_MAX2-2) +#else +#define Int_MAX Int_MAX2 +#endif + using std::cout; using std::cin; using std::cerr; diff --git a/Build/source/utils/asymptote/configure b/Build/source/utils/asymptote/configure index 6cf43608a3d..a9c215d25d4 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.96. +# Generated by GNU Autoconf 2.63 for Asymptote 1.98. # # 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.96' -PACKAGE_STRING='Asymptote 1.96' +PACKAGE_VERSION='1.98' +PACKAGE_STRING='Asymptote 1.98' 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.96 to adapt to many kinds of systems. +\`configure' configures Asymptote 1.98 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.96:";; + short | recursive ) echo "Configuration of Asymptote 1.98:";; 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.96 +Asymptote configure 1.98 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.96, which was +It was created by Asymptote $as_me 1.98, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -5929,6 +5929,7 @@ if test "$GXX" = yes ; then if test "$ac_gcc_version" -lt 4; then CFLAGS=$CFLAGS" -finline-limit=400" fi + CFLAGS=$CFLAGS" --no-var-tracking" fi ac_ext=cpp @@ -6488,7 +6489,7 @@ OPTIONS="-D_FILE_OFFSET_BITS=64 " GCLIB= GCPPLIB= GCNAME="Boehm Garbage Collector" -GCOPTIONS="" +GCOPTIONS="--disable-shared --enable-large-config" if test "x$ac_cv_use_gc" != "xno" ; then OPTIONS=$OPTIONS"-DUSEGC " case $ac_cv_use_gc in @@ -6708,6 +6709,7 @@ $as_echo "$as_me: enabling system $GCNAME" >&6;} else GCDIR=$GCVERSION + INCL="-I\$(GC)/include" GCLIB="\$(GC)/.libs/libgc.a" { $as_echo "$as_me:$LINENO: $GCNAME library not found" >&5 $as_echo "$as_me: $GCNAME library not found" >&6;} @@ -6715,6 +6717,7 @@ fi else GCDIR=$GCVERSION + GCLIB="\$(GC)/.libs/libgc.a" INCL="-I\$(GC)/include" { $as_echo "$as_me:$LINENO: $GCNAME header file not found" >&5 $as_echo "$as_me: $GCNAME header file not found" >&6;} @@ -6725,7 +6728,6 @@ fi ;; *) GCDIR=$ac_cv_use_gc - 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" @@ -12019,7 +12021,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.96, which was +This file was extended by Asymptote $as_me 1.98, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12078,7 +12080,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -Asymptote config.status 1.96 +Asymptote config.status 1.98 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 a2bf1cf0ca6..eba5113d9ab 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.96],[http://sourceforge.net/projects/asymptote]) +AC_INIT([Asymptote],[1.98],[http://sourceforge.net/projects/asymptote]) VERSION=$PACKAGE_VERSION AC_SUBST(VERSION) @@ -107,6 +107,7 @@ if test "$GXX" = yes ; then if test "$ac_gcc_version" -lt 4; then CFLAGS=$CFLAGS" -finline-limit=400" fi + CFLAGS=$CFLAGS" --no-var-tracking" fi AC_CHECK_HEADER(tr1/unordered_map,, @@ -134,7 +135,7 @@ OPTIONS="-D_FILE_OFFSET_BITS=64 " GCLIB= GCPPLIB= GCNAME="Boehm Garbage Collector" -GCOPTIONS="" +GCOPTIONS="--disable-shared --enable-large-config" if test "x$ac_cv_use_gc" != "xno" ; then OPTIONS=$OPTIONS"-DUSEGC " case $ac_cv_use_gc in @@ -153,16 +154,17 @@ if test "x$ac_cv_use_gc" != "xno" ; then LIBS=$LIBS"-lgc " AC_MSG_NOTICE([enabling system $GCNAME])],[ GCDIR=$GCVERSION + INCL="-I\$(GC)/include" GCLIB="\$(GC)/.libs/libgc.a" AC_MSG_NOTICE($GCNAME library not found)]), GCDIR=$GCVERSION + GCLIB="\$(GC)/.libs/libgc.a" INCL="-I\$(GC)/include" AC_MSG_NOTICE($GCNAME header file not found)) CPPFLAGS=$CPPFLAGS_SAVE ;; *) GCDIR=$ac_cv_use_gc - GCOPTIONS="--disable-shared --enable-large-config" AC_MSG_NOTICE([enabling local $GCNAME $GCDIR]) GCLIB="\$(GC)/.libs/libgc.a" INCL="-I\$(GC)/include" diff --git a/Build/source/utils/asymptote/constructor.cc b/Build/source/utils/asymptote/constructor.cc index d22e9ee31d0..e1d240b9846 100644 --- a/Build/source/utils/asymptote/constructor.cc +++ b/Build/source/utils/asymptote/constructor.cc @@ -34,7 +34,7 @@ using namespace types; // Defined in dec.cc. varEntry *makeVarEntry(position pos, coenv &e, record *r, types::ty *t); -bool definesImplicitConstructor(coenv &e, record *r, varEntry *v, symbol *id) +bool definesImplicitConstructor(coenv &e, record *r, varEntry *v, symbol id) { if (id == symbol::initsym && r != 0 && diff --git a/Build/source/utils/asymptote/dec.cc b/Build/source/utils/asymptote/dec.cc index bc2be656e70..b48bffaa338 100644 --- a/Build/source/utils/asymptote/dec.cc +++ b/Build/source/utils/asymptote/dec.cc @@ -161,10 +161,10 @@ void block::transAsRecordBody(coenv &e, record *r) e.c.closeRecord(); } -record *block::transAsFile(genv& ge, symbol *id) +record *block::transAsFile(genv& ge, symbol id) { // Create the new module. - record *r = new record(id, new frame(*id,0,0)); + record *r = new record(id, new frame(id,0,0)); // Create coder and environment to translate the module. // File-level modules have dynamic fields by default. @@ -304,7 +304,7 @@ void modifiedRunnable::transAsField(coenv &e, record *r) void decidstart::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "decidstart '" << *id << "'\n"; + out << "decidstart '" << id << "'\n"; if (dims) dims->prettyprint(out, indent+1); @@ -336,7 +336,7 @@ void decidstart::addOps(types::ty *base, coenv &e, record *r) void fundecidstart::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "fundecidstart '" << *id << "'\n"; + out << "fundecidstart '" << id << "'\n"; if (dims) dims->prettyprint(out, indent+1); @@ -404,11 +404,11 @@ varEntry *makeVarEntry(position pos, coenv &e, record *r, types::ty *t) { // Defined in constructor.cc. -bool definesImplicitConstructor(coenv &e, record *r, varEntry *v, symbol *id); +bool definesImplicitConstructor(coenv &e, record *r, varEntry *v, symbol id); void addConstructorFromInitializer(position pos, coenv &e, record *r, varEntry *init); -void addVar(coenv &e, record *r, varEntry *v, symbol *id) +void addVar(coenv &e, record *r, varEntry *v, symbol id) { // Test for 'operator init' definitions that implicitly define constructors: if (definesImplicitConstructor(e, r, v, id)) @@ -458,7 +458,7 @@ types::ty *inferType(position pos, coenv &e, varinit *init) } void createVar(position pos, coenv &e, record *r, - symbol *id, types::ty *t, varinit *init) + symbol id, types::ty *t, varinit *init) { // I'm not sure how to handle inferred types in these cases. assert(t->kind != types::ty_inferred); @@ -469,7 +469,7 @@ void createVar(position pos, coenv &e, record *r, } void createVarOutOfOrder(position pos, coenv &e, record *r, - symbol *id, types::ty *t, varinit *init) + symbol id, types::ty *t, varinit *init) { /* For declarations such as "var x = 5;", infer the type from the * initializer. @@ -482,7 +482,7 @@ void createVarOutOfOrder(position pos, coenv &e, record *r, addVar(e, r, v, id); } -void addTypeWithPermission(coenv &e, record *r, tyEntry *base, symbol *id) +void addTypeWithPermission(coenv &e, record *r, tyEntry *base, symbol id) { // Only bother encoding permissions for private types. tyEntry *ent = (r && e.c.getPermission()==PRIVATE) ? @@ -600,12 +600,12 @@ public: // Creates a local variable to hold the import and translate the accessing of // the import, but doesn't add the import to the environment. -varEntry *accessModule(position pos, coenv &e, record *r, symbol *id) +varEntry *accessModule(position pos, coenv &e, record *r, symbol id) { - record *imp=e.e.getModule(id, (string)*id); + record *imp=e.e.getModule(id, (string)id); if (!imp) { em.error(pos); - em << "could not load module '" << *id << "'"; + em << "could not load module '" << id << "'"; em.sync(); return 0; } @@ -613,7 +613,7 @@ varEntry *accessModule(position pos, coenv &e, record *r, symbol *id) // Create a varinit that evaluates to the module. // This is effectively the expression "loadModule(filename)". callExp init(pos, new loadModuleExp(pos, imp), - new stringExp(pos, *id)); + new stringExp(pos, (string)id)); // The varEntry should have whereDefined()==0 as it is not defined inside // the record r. @@ -627,7 +627,7 @@ varEntry *accessModule(position pos, coenv &e, record *r, symbol *id) void idpair::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "idpair (" << "'" << *src << "' as " << *dest << ")\n"; + out << "idpair (" << "'" << src << "' as " << dest << ")\n"; } void idpair::transAsAccess(coenv &e, record *r) @@ -648,7 +648,7 @@ void idpair::transAsUnravel(coenv &e, record *r, r->e.add(src, dest, source, qualifier, e.c); if (!e.e.add(src, dest, source, qualifier, e.c)) { em.error(getPos()); - em << "no matching types or fields of name '" << *src << "'"; + em << "no matching types or fields of name '" << src << "'"; } } @@ -731,7 +731,7 @@ fromdec::qualifier unraveldec::getQualifier(coenv &e, record *) void fromaccessdec::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "fromaccessdec '" << *id << "'\n"; + out << "fromaccessdec '" << id << "'\n"; idpairlist *f=this->fields; if(f) f->prettyprint(out, indent+1); } @@ -792,7 +792,7 @@ void typedec::prettyprint(ostream &out, Int indent) void recorddec::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "structdec '" << *id << "'\n"; + out << "structdec '" << id << "'\n"; body->prettyprint(out, indent+1); } diff --git a/Build/source/utils/asymptote/dec.h b/Build/source/utils/asymptote/dec.h index 00198ff3353..e17c5fd114d 100644 --- a/Build/source/utils/asymptote/dec.h +++ b/Build/source/utils/asymptote/dec.h @@ -214,7 +214,7 @@ public: void transAsRecordBody(coenv &e, record *r); - types::record *transAsFile(genv& ge, symbol *id); + types::record *transAsFile(genv& ge, symbol id); // A block is guaranteed to return iff one of the runnables is guaranteed to // return. @@ -294,11 +294,11 @@ public: class decidstart : public absyn { protected: - symbol *id; + symbol id; dimensions *dims; public: - decidstart(position pos, symbol *id, dimensions *dims = 0) + decidstart(position pos, symbol id, dimensions *dims = 0) : absyn(pos), id(id), dims(dims) {} virtual void prettyprint(ostream &out, Int indent); @@ -311,7 +311,7 @@ public: // after the id, this will add the standard functions for that new type. virtual void addOps(types::ty *base, coenv &e, record *r); - virtual symbol *getName() + virtual symbol getName() { return id; } }; @@ -323,7 +323,7 @@ class fundecidstart : public decidstart { public: fundecidstart(position pos, - symbol *id, + symbol id, dimensions *dims = 0, formals *params = 0) : decidstart(pos, id, dims), params(params) {} @@ -388,7 +388,7 @@ public: }; void createVar(position pos, coenv &e, record *r, - symbol *id, types::ty *t, varinit *init); + symbol id, types::ty *t, varinit *init); class vardec : public dec { ty *base; @@ -416,16 +416,20 @@ public: }; struct idpair : public absyn { - symbol *src; // The name of the module to access. - symbol *dest; // What to call it in the local environment. + symbol src; // The name of the module to access. + symbol dest; // What to call it in the local environment. bool valid; // If it parsed properly. - idpair(position pos, symbol *id) + idpair(position pos, symbol id) : absyn(pos), src(id), dest(id), valid(true) {} - idpair(position pos, symbol *src, symbol *as, symbol *dest) + idpair(position pos, symbol src, symbol as, symbol dest) : absyn(pos), src(src), dest(dest), valid(as==symbol::trans("as")) {} + idpair(position pos, string src, symbol as, symbol dest) + : absyn(pos), src(symbol::trans(src)), dest(dest), + valid(as==symbol::trans("as")) {} + void checkValidity() { if (!valid) { em.error(getPos()); @@ -534,11 +538,11 @@ public: // A fromaccess declaration dumps fields and types of a module into the local // scope. It does not add the module as a variable in the local scope. class fromaccessdec : public fromdec { - symbol *id; + symbol id; qualifier getQualifier(coenv &e, record *r); public: - fromaccessdec(position pos, symbol *id, idpairlist *fields) + fromaccessdec(position pos, symbol id, idpairlist *fields) : fromdec(pos, fields), id(id) {} void prettyprint(ostream &out, Int indent); @@ -577,8 +581,8 @@ class includedec : public dec { public: includedec(position pos, string filename) : dec(pos), filename(filename) {} - includedec(position pos, symbol *id) - : dec(pos), filename(*id) {} + includedec(position pos, symbol id) + : dec(pos), filename(id) {} void prettyprint(ostream &out, Int indent); void loadFailed(coenv &e); @@ -604,14 +608,14 @@ public: // A struct declaration. class recorddec : public dec { - symbol *id; + symbol id; block *body; void transRecordInitializer(coenv &e, record *parent); void addPostRecordEnvironment(coenv &e, record *r, record *parent); public: - recorddec(position pos, symbol *id, block *body) + recorddec(position pos, symbol id, block *body) : dec(pos), id(id), body(body) {} virtual ~recorddec() @@ -625,7 +629,7 @@ public: // Returns a runnable that facilitates the autoplain feature. runnable *autoplainRunnable(); -void addVar(coenv &e, record *r, varEntry *v, symbol *id); +void addVar(coenv &e, record *r, varEntry *v, symbol id); } // namespace absyntax diff --git a/Build/source/utils/asymptote/doc/CAD.pdf b/Build/source/utils/asymptote/doc/CAD.pdf Binary files differindex 4406335c391..e5cfb778ea7 100644 --- a/Build/source/utils/asymptote/doc/CAD.pdf +++ b/Build/source/utils/asymptote/doc/CAD.pdf diff --git a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info b/Build/source/utils/asymptote/doc/FAQ/asy-faq.info index efd60036acc..1664d59845e 100644 --- a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info +++ b/Build/source/utils/asymptote/doc/FAQ/asy-faq.info @@ -9,7 +9,7 @@ END-INFO-DIR-ENTRY File: $prefix.info, Node: Top, Next: Question 1.1, Up: (dir) ASYMPTOTE FREQUENTLY ASKED QUESTIONS - 06 Jun 2010 + 14 Jun 2010 This is the list of Frequently Asked Questions about Asymptote (asy). diff --git a/Build/source/utils/asymptote/doc/GaussianSurface.asy b/Build/source/utils/asymptote/doc/GaussianSurface.asy index 7b75a5133a7..bf198a6a243 100644 --- a/Build/source/utils/asymptote/doc/GaussianSurface.asy +++ b/Build/source/utils/asymptote/doc/GaussianSurface.asy @@ -16,6 +16,6 @@ xaxis3(Label("$x$"),red,Arrow3); yaxis3(Label("$y$"),red,Arrow3); zaxis3(XYZero(extend=true),red,Arrow3); -draw(s,lightgray,meshpen=black+thick(),nolight); +draw(s,lightgray,meshpen=black+thick(),nolight,render(merge=true)); label("$O$",O,-Z+Y,red); diff --git a/Build/source/utils/asymptote/doc/asymptote.pdf b/Build/source/utils/asymptote/doc/asymptote.pdf Binary files differindex 0bd7a54892d..e0b2b521e80 100644 --- a/Build/source/utils/asymptote/doc/asymptote.pdf +++ b/Build/source/utils/asymptote/doc/asymptote.pdf diff --git a/Build/source/utils/asymptote/doc/asymptote.texi b/Build/source/utils/asymptote/doc/asymptote.texi index a25fae07653..38b624a5ed3 100644 --- a/Build/source/utils/asymptote/doc/asymptote.texi +++ b/Build/source/utils/asymptote/doc/asymptote.texi @@ -5073,10 +5073,9 @@ themselves (in which case they are each initialized to empty arrays). @cindex @code{array} @item T[] array(int n, T value, int depth=intMax) -returns an array consisting of @code{n} copies of value. By default, if -@code{value} is itself an array, a deep copy of that array is made for -each entry in the new array. If @code{depth} is specified, this deep copying -only recurses to the number of levels specified. +returns an array consisting of @code{n} deep copies of a 0, 1, or 2 +dimensional array @code{T value}. If @code{depth} is specified, this +deep copying recurses to no more than the number of levels specified. @cindex @code{sequence} @item int[] sequence(int n) @@ -7740,7 +7739,7 @@ Some (broken) @code{UNIX} graphics drivers may require the command line setting @cindex @code{views} @item Embed the 3D @acronym{PRC} format in a @acronym{PDF} file and view the resulting @acronym{PDF} file with -version @code{8.0} or later of @code{Adobe Reader}. +version @code{9.0} or later of @code{Adobe Reader}. In addition to the default @code{settings.prc=true}, this requires @code{settings.outformat="pdf"}, which can be specified by the command line option @code{-f pdf}, put in the @code{Asymptote} configuration @@ -9382,9 +9381,9 @@ author of the program @code{MetaPost} that inspired the development of The authors of @code{Asymptote} are Andy Hammerlindl, John Bowman, and Tom Prince. Sean Healy designed the @code{Asymptote} logo. Other -contributors include Radoslav Marinov, Orest Shardt, Chris Savage, -Philippe Ivaldi, Olivier Guib@'e, Jacques Pienaar, Mark Henning, Steve -Melenchuk, Martin Wiebusch, and Stefan Knorr. +contributors include Michail Vidiassov, Radoslav Marinov, Orest Shardt, +Chris Savage, Philippe Ivaldi, Olivier Guib@'e, Jacques Pienaar, +Mark Henning, Steve Melenchuk, Martin Wiebusch, and Stefan Knorr. @node Index @unnumbered Index @@ -9545,4 +9544,4 @@ Melenchuk, Martin Wiebusch, and Stefan Knorr. @c LocalWords: setpagesize pdfborder controlsystem OmitTickInterval SixViews @c LocalWords: OmitTickIntervals tickmodifiers autorotated SixViewsUS @c LocalWords: ThreeViewsUS ThreeViewsFR SixViewsFR ThreeViews partialsum -@c LocalWords: defaultrender +@c LocalWords: defaultrender Vidiassov diff --git a/Build/source/utils/asymptote/doc/png/asymptote.info b/Build/source/utils/asymptote/doc/png/asymptote.info index b8497480d4c..481694a9d08 100644 --- a/Build/source/utils/asymptote/doc/png/asymptote.info +++ b/Build/source/utils/asymptote/doc/png/asymptote.info @@ -1,7 +1,7 @@ This is asymptote.info, produced by makeinfo version 4.13 from ../asymptote.texi. -This file documents `Asymptote', version 1.96. +This file documents `Asymptote', version 1.98. `http://asymptote.sourceforge.net' @@ -23,7 +23,7 @@ File: asymptote.info, Node: Top, Next: Description, Up: (dir) Asymptote ********* -This file documents `Asymptote', version 1.96. +This file documents `Asymptote', version 1.98. `http://asymptote.sourceforge.net' @@ -3955,10 +3955,9 @@ of type `T[]'. arrays). `T[] array(int n, T value, int depth=intMax)' - returns an array consisting of `n' copies of value. By default, if - `value' is itself an array, a deep copy of that array is made for - each entry in the new array. If `depth' is specified, this deep - copying only recurses to the number of levels specified. + returns an array consisting of `n' deep copies of a 0, 1, or 2 + dimensional array `T value'. If `depth' is specified, this deep + copying recurses to no more than the number of levels specified. `int[] sequence(int n)' if `n >= 1' returns the array `{0,1,...,n-1}' (otherwise returns a @@ -6769,7 +6768,7 @@ There are four choices for viewing 3D `Asymptote' output: (slower) indirect rendering. 3. Embed the 3D PRC format in a PDF file and view the resulting PDF - file with version `8.0' or later of `Adobe Reader'. In addition + file with version `9.0' or later of `Adobe Reader'. In addition to the default `settings.prc=true', this requires `settings.outformat="pdf"', which can be specified by the command line option `-f pdf', put in the `Asymptote' configuration file @@ -7313,7 +7312,7 @@ xaxis3(Label("$x$"),red,Arrow3); yaxis3(Label("$y$"),red,Arrow3); zaxis3(XYZero(extend=true),red,Arrow3); -draw(s,lightgray,meshpen=black+thick(),nolight); +draw(s,lightgray,meshpen=black+thick(),nolight,render(merge=true)); label("$O$",O,-Z+Y,red); @@ -8330,9 +8329,9 @@ which `MetaPost' is based). The authors of `Asymptote' are Andy Hammerlindl, John Bowman, and Tom Prince. Sean Healy designed the `Asymptote' logo. Other -contributors include Radoslav Marinov, Orest Shardt, Chris Savage, -Philippe Ivaldi, Olivier Guibe', Jacques Pienaar, Mark Henning, Steve -Melenchuk, Martin Wiebusch, and Stefan Knorr. +contributors include Michail Vidiassov, Radoslav Marinov, Orest Shardt, +Chris Savage, Philippe Ivaldi, Olivier Guibe', Jacques Pienaar, Mark +Henning, Steve Melenchuk, Martin Wiebusch, and Stefan Knorr. File: asymptote.info, Node: Index, Prev: Credits, Up: Top @@ -8443,11 +8442,11 @@ Index (line 48) * Airy: Mathematical functions. (line 48) -* alias <1>: Arrays. (line 183) +* alias <1>: Arrays. (line 182) * alias: Structures. (line 52) * align: Options. (line 166) * Align: label. (line 12) -* all: Arrays. (line 331) +* all: Arrays. (line 330) * Allow: Pens. (line 327) * AND: Arithmetic & logical. (line 80) @@ -8641,15 +8640,15 @@ Index * colorless: Pens. (line 54) * colors: Pens. (line 51) * comma: Files. (line 58) -* comma-separated-value mode: Arrays. (line 364) +* comma-separated-value mode: Arrays. (line 363) * command-line options <1>: Options. (line 6) * command-line options: Configuring. (line 83) * comment character: Files. (line 15) * compass directions: Tutorial. (line 104) * Compiling from UNIX source: Compiling from UNIX source. (line 6) -* complement: Arrays. (line 150) -* concat: Arrays. (line 179) +* complement: Arrays. (line 149) +* concat: Arrays. (line 178) * conditional <1>: Arithmetic & logical. (line 73) * conditional: Programming. (line 8) @@ -8673,7 +8672,7 @@ Index * convert: Configuring. (line 67) * convertOptions: Options. (line 128) * Coons shading: fill. (line 74) -* copy: Arrays. (line 170) +* copy: Arrays. (line 169) * Cos: Mathematical functions. (line 20) * cos: Mathematical functions. @@ -8687,10 +8686,10 @@ Index * cross: Data types. (line 167) * crossframe: markers. (line 23) * crosshatch: Pens. (line 267) -* csv: Arrays. (line 364) +* csv: Arrays. (line 363) * CTZ: Arithmetic & logical. (line 80) -* cubicroots: Arrays. (line 320) +* cubicroots: Arrays. (line 319) * curl <1>: three. (line 6) * curl: Bezier curves. (line 63) * curlSpecifier: Paths and guides. (line 391) @@ -8731,9 +8730,9 @@ Index * delete <1>: Arrays. (line 39) * delete: Files. (line 145) * description: Description. (line 6) -* diagonal: Arrays. (line 305) +* diagonal: Arrays. (line 304) * diamond: flowchart. (line 57) -* dimension: Arrays. (line 369) +* dimension: Arrays. (line 368) * dir <1>: three. (line 502) * dir <2>: Paths and guides. (line 98) * dir <3>: Data types. (line 85) @@ -8744,7 +8743,7 @@ Index * dirtime: Paths and guides. (line 152) * display: Configuring. (line 67) * do: Programming. (line 29) -* dot <1>: Arrays. (line 261) +* dot <1>: Arrays. (line 260) * dot <2>: Data types. (line 98) * dot: draw. (line 83) * DotMargin: draw. (line 42) @@ -8796,9 +8795,9 @@ Index * EndPoint: label. (line 57) * envelope: Frames and pictures. (line 22) * environment variables: Configuring. (line 87) -* eof <1>: Arrays. (line 346) +* eof <1>: Arrays. (line 345) * eof: Files. (line 88) -* eol <1>: Arrays. (line 346) +* eol <1>: Arrays. (line 345) * eol: Files. (line 88) * EPS <1>: Options. (line 141) * EPS: label. (line 80) @@ -8843,7 +8842,7 @@ Index (line 15) * feynman: feynman. (line 6) * fft <1>: math. (line 26) -* fft: Arrays. (line 248) +* fft: Arrays. (line 247) * FFTW: Compiling from UNIX source. (line 58) * file <1>: Debugger. (line 45) @@ -8857,7 +8856,7 @@ Index * FillDraw: draw. (line 26) * filloutside: fill. (line 27) * fillrule: Pens. (line 152) -* find <1>: Arrays. (line 159) +* find <1>: Arrays. (line 158) * find: Data types. (line 224) * firstcut: Paths and guides. (line 247) * fit: Frames and pictures. (line 103) @@ -8956,7 +8955,7 @@ Index * i_scaled: Mathematical functions. (line 48) * iconic: three. (line 210) -* identity <1>: Arrays. (line 302) +* identity <1>: Arrays. (line 301) * identity <2>: Mathematical functions. (line 6) * identity: Transforms. (line 24) @@ -9009,7 +9008,7 @@ Index * InTicks: graph3. (line 34) * intMax: Data types. (line 28) * intMin: Data types. (line 28) -* inverse <1>: Arrays. (line 308) +* inverse <1>: Arrays. (line 307) * inverse: Transforms. (line 16) * invert: three. (line 422) * invisible: Pens. (line 39) @@ -9068,8 +9067,8 @@ Index * libsigsegv <1>: Help. (line 33) * libsigsegv: Functions. (line 88) * limits: graph. (line 636) -* line: Arrays. (line 346) -* line mode: Arrays. (line 346) +* line: Arrays. (line 345) +* line mode: Arrays. (line 345) * Linear: graph. (line 682) * linecap: Pens. (line 129) * linejoin: Pens. (line 138) @@ -9096,7 +9095,7 @@ Index * MacOS X binary distributions: MacOS X binary distributions. (line 6) * makepen: Pens. (line 300) -* map: Arrays. (line 141) +* map: Arrays. (line 140) * Margin: draw. (line 42) * Margin3: three. (line 559) * margins: three. (line 262) @@ -9112,7 +9111,7 @@ Index * mathematical functions: Mathematical functions. (line 6) * max <1>: three. (line 502) -* max <2>: Arrays. (line 227) +* max <2>: Arrays. (line 226) * max <3>: Frames and pictures. (line 7) * max: Paths and guides. (line 264) * maxbound: Data types. (line 104) @@ -9133,7 +9132,7 @@ Index * midpoint: Paths and guides. (line 166) * MidPoint: label. (line 57) * min <1>: three. (line 502) -* min <2>: Arrays. (line 220) +* min <2>: Arrays. (line 219) * min <3>: Frames and pictures. (line 7) * min: Paths and guides. (line 260) * minbound: Data types. (line 101) @@ -9222,7 +9221,7 @@ Index * packing: Rest arguments. (line 30) * pair <1>: Data types. (line 41) * pair: Tutorial. (line 49) -* pairs: Arrays. (line 244) +* pairs: Arrays. (line 243) * paperheight: Configuring. (line 61) * papertype: Configuring. (line 61) * paperwidth: Configuring. (line 61) @@ -9294,7 +9293,7 @@ Index * public: Structures. (line 6) * push: Arrays. (line 39) * Python usage: Interactive mode. (line 80) -* quadraticroots: Arrays. (line 311) +* quadraticroots: Arrays. (line 310) * quarticroots: math. (line 22) * quit <1>: Debugger. (line 54) * quit <2>: Interactive mode. (line 59) @@ -9314,9 +9313,9 @@ Index (line 39) * randMax: Mathematical functions. (line 39) -* read: Arrays. (line 387) +* read: Arrays. (line 386) * reading: Files. (line 11) -* reading string arrays: Arrays. (line 356) +* reading string arrays: Arrays. (line 355) * readline: Files. (line 130) * real: Data types. (line 33) * realDigits: Data types. (line 33) @@ -9342,7 +9341,7 @@ Index * restricted: Structures. (line 6) * return: Debugger. (line 48) * reverse <1>: three. (line 502) -* reverse <2>: Arrays. (line 146) +* reverse <2>: Arrays. (line 145) * reverse <3>: Paths and guides. (line 169) * reverse: Data types. (line 248) * rewind: Files. (line 88) @@ -9381,7 +9380,7 @@ Index * scaled graph: graph. (line 663) * scientific graph: graph. (line 396) * scroll: Files. (line 104) -* search: Arrays. (line 164) +* search: Arrays. (line 163) * search paths: Search paths. (line 6) * Seascape: Frames and pictures. (line 100) * secondary axis: graph. (line 813) @@ -9394,7 +9393,7 @@ Index * segmentation fault: Help. (line 33) * self operators: Self & prefix operators. (line 6) -* sequence: Arrays. (line 128) +* sequence: Arrays. (line 127) * settings <1>: Options. (line 113) * settings: Configuring. (line 23) * sgn: Mathematical functions. @@ -9440,8 +9439,8 @@ Index * slopefield: slopefield. (line 6) * solid: Pens. (line 95) * solids: solids. (line 9) -* solve: Arrays. (line 280) -* sort: Arrays. (line 186) +* solve: Arrays. (line 279) +* sort: Arrays. (line 185) * Spline <1>: graph3. (line 100) * Spline: graph. (line 34) * split: Data types. (line 261) @@ -9474,7 +9473,7 @@ Index * subpictures: Frames and pictures. (line 103) * substr: Data types. (line 244) * Subversion: Subversion. (line 6) -* sum: Arrays. (line 215) +* sum: Arrays. (line 214) * superpath: Tutorial. (line 132) * Suppress: Pens. (line 331) * SuppressQuiet: Pens. (line 335) @@ -9538,12 +9537,12 @@ Index * transform: Transforms. (line 6) * transform3: three. (line 432) * transparency: Pens. (line 222) -* transpose: Arrays. (line 207) +* transpose: Arrays. (line 206) * tree: tree. (line 9) * trembling: trembling. (line 6) * triangle: geometry. (line 6) * triangulate: contour. (line 157) -* tridiagonal: Arrays. (line 268) +* tridiagonal: Arrays. (line 267) * trigonometric integrals: Mathematical functions. (line 48) * triple: Data types. (line 108) @@ -9559,7 +9558,7 @@ Index * unfill: fill. (line 106) * UnFill: draw. (line 26) * unicode: unicode. (line 6) -* uniform: Arrays. (line 155) +* uniform: Arrays. (line 154) * Uninstall: Uninstall. (line 6) * unique: math. (line 64) * unit: Data types. (line 78) @@ -9590,7 +9589,7 @@ Index (line 6) * vectorfield: graph. (line 975) * vectorfield3: graph3. (line 159) -* vectorization: Arrays. (line 325) +* vectorization: Arrays. (line 324) * verbatim: Frames and pictures. (line 271) * vertex-dependent colors: three. (line 81) * Vertical: flowchart. (line 81) @@ -9607,11 +9606,11 @@ Index * Wheel: palette. (line 22) * wheel mouse: GUI. (line 6) * while: Programming. (line 29) -* white-space string delimiter mode: Arrays. (line 356) +* white-space string delimiter mode: Arrays. (line 355) * width: LaTeX usage. (line 31) * windingnumber: Paths and guides. (line 268) -* word: Arrays. (line 356) -* write <1>: Arrays. (line 396) +* word: Arrays. (line 355) +* write <1>: Arrays. (line 395) * write: Files. (line 50) * X: three. (line 274) * xasy: GUI. (line 6) @@ -9744,80 +9743,80 @@ Node: Named arguments147188 Node: Rest arguments149350 Node: Mathematical functions152160 Node: Arrays156767 -Ref: sort163720 -Ref: tridiagonal166130 -Ref: solve167358 -Node: Slices171551 -Node: Casts175441 -Node: Import177406 -Node: Static182633 -Node: LaTeX usage185527 -Node: Base modules191001 -Node: plain193501 -Node: simplex194153 -Node: math194426 -Node: interpolate197117 -Node: geometry197396 -Node: trembling197990 -Node: stats198341 -Node: patterns198601 -Node: markers198837 -Node: tree200620 -Node: binarytree200808 -Node: drawtree201397 -Node: syzygy201601 -Node: feynman201875 -Node: roundedpath202150 -Node: animation202433 -Ref: animate202850 -Node: embed203989 -Node: slide205778 -Node: MetaPost206118 -Node: unicode206834 -Node: latin1207722 -Node: babel208090 -Node: labelpath208319 -Node: labelpath3209139 -Node: annotate209450 -Node: CAD209921 -Node: graph210231 -Ref: ticks217360 -Ref: pathmarkers230639 -Ref: marker231104 -Ref: markuniform231455 -Ref: errorbars233246 -Ref: automatic scaling237302 -Node: palette247948 -Ref: images248066 -Ref: image252237 -Ref: logimage252715 -Ref: penimage253521 -Node: three253965 -Ref: PostScript3D278507 -Node: obj280199 -Node: graph3280451 -Ref: GaussianSurface285576 -Node: grid3286661 -Node: solids287401 -Node: tube288349 -Node: flowchart290584 -Node: contour295153 -Node: contour3300278 -Node: slopefield300585 -Node: ode302022 -Node: Options302282 -Ref: configuration file308078 -Ref: settings308078 -Ref: convert309279 -Node: Interactive mode312246 -Ref: history314399 -Node: GUI315704 -Node: GUI installation316207 -Node: GUI usage317337 -Node: PostScript to Asymptote318240 -Node: Help318996 -Node: Debugger320732 -Node: Credits322517 -Node: Index323430 +Ref: sort163651 +Ref: tridiagonal166061 +Ref: solve167289 +Node: Slices171482 +Node: Casts175372 +Node: Import177337 +Node: Static182564 +Node: LaTeX usage185458 +Node: Base modules190932 +Node: plain193432 +Node: simplex194084 +Node: math194357 +Node: interpolate197048 +Node: geometry197327 +Node: trembling197921 +Node: stats198272 +Node: patterns198532 +Node: markers198768 +Node: tree200551 +Node: binarytree200739 +Node: drawtree201328 +Node: syzygy201532 +Node: feynman201806 +Node: roundedpath202081 +Node: animation202364 +Ref: animate202781 +Node: embed203920 +Node: slide205709 +Node: MetaPost206049 +Node: unicode206765 +Node: latin1207653 +Node: babel208021 +Node: labelpath208250 +Node: labelpath3209070 +Node: annotate209381 +Node: CAD209852 +Node: graph210162 +Ref: ticks217291 +Ref: pathmarkers230570 +Ref: marker231035 +Ref: markuniform231386 +Ref: errorbars233177 +Ref: automatic scaling237233 +Node: palette247879 +Ref: images247997 +Ref: image252168 +Ref: logimage252646 +Ref: penimage253452 +Node: three253896 +Ref: PostScript3D278438 +Node: obj280130 +Node: graph3280382 +Ref: GaussianSurface285507 +Node: grid3286611 +Node: solids287351 +Node: tube288299 +Node: flowchart290534 +Node: contour295103 +Node: contour3300228 +Node: slopefield300535 +Node: ode301972 +Node: Options302232 +Ref: configuration file308028 +Ref: settings308028 +Ref: convert309229 +Node: Interactive mode312196 +Ref: history314349 +Node: GUI315654 +Node: GUI installation316157 +Node: GUI usage317287 +Node: PostScript to Asymptote318190 +Node: Help318946 +Node: Debugger320682 +Node: Credits322467 +Node: Index323399 End Tag Table diff --git a/Build/source/utils/asymptote/drawelement.h b/Build/source/utils/asymptote/drawelement.h index 2898431b79c..27eecdc488a 100644 --- a/Build/source/utils/asymptote/drawelement.h +++ b/Build/source/utils/asymptote/drawelement.h @@ -109,6 +109,7 @@ public: virtual ~drawElement() {} static pen lastpen; + static const triple zero; // Adjust the bbox of the picture based on the addition of this // element. The iopipestream is needed for determining label sizes. diff --git a/Build/source/utils/asymptote/drawlabel.cc b/Build/source/utils/asymptote/drawlabel.cc index 484ecf3cb89..9b9a20ef1af 100644 --- a/Build/source/utils/asymptote/drawlabel.cc +++ b/Build/source/utils/asymptote/drawlabel.cc @@ -243,7 +243,7 @@ bool drawLabel::write(texfile *out, const bbox&) drawElement *drawLabel::transformed(const transform& t) { return new drawLabel(label,size,t*T,t*position, - length(align)*unit(shiftless(t)*align),pentype); + length(align)*unit(rotation(t)*align),pentype); } void drawLabelPath::bounds(bbox& b, iopipestream& tex, boxvector&, bboxlist&) diff --git a/Build/source/utils/asymptote/drawpath.cc b/Build/source/utils/asymptote/drawpath.cc index 9332ead8939..14dd7692812 100644 --- a/Build/source/utils/asymptote/drawpath.cc +++ b/Build/source/utils/asymptote/drawpath.cc @@ -43,6 +43,12 @@ double PatternLength(double arclength, const array& pat, ncycle*sum+terminator : 0.0; } +bool isdashed(pen& p) { + const LineType *linetype=p.linetype(); + size_t n=linetype->pattern.size(); + return n > 0; +} + pen adjustdash(pen& p, double arclength, bool cyclic) { pen q=p; @@ -127,7 +133,8 @@ bool drawPath::draw(psfile *out) if (n == 0 || pentype.invisible()) return true; - pen q=adjustdash(pentype,p.arclength(),p.cyclic()); + pen q = isdashed(pentype) ? adjustdash(pentype,p.arclength(),p.cyclic()) : + pentype; penSave(out); penTranslate(out); diff --git a/Build/source/utils/asymptote/drawpath3.cc b/Build/source/utils/asymptote/drawpath3.cc index 699928b9b38..b41c69a1114 100644 --- a/Build/source/utils/asymptote/drawpath3.cc +++ b/Build/source/utils/asymptote/drawpath3.cc @@ -50,6 +50,8 @@ void drawPath3::render(GLUnurbs *nurb, double, const triple&, const triple&, if(n == 0 || invisible || ((color.A < 1.0) ^ transparent)) return; + bool havebillboard=interaction == BILLBOARD; + GLfloat Diffuse[]={0.0,0.0,0.0,color.A}; glMaterialfv(GL_FRONT,GL_DIFFUSE,Diffuse); @@ -63,22 +65,36 @@ void drawPath3::render(GLUnurbs *nurb, double, const triple&, const triple&, glMaterialf(GL_FRONT,GL_SHININESS,128.0); + if(havebillboard) BB.init(); + if(straight) { glBegin(GL_LINE_STRIP); for(Int i=0; i <= n; ++i) { triple v=g.point(i); - glVertex3f(v.getx(),v.gety(),v.getz()); + if(havebillboard) { + static GLfloat controlpoints[3]; + BB.store(controlpoints,v,center); + glVertex3fv(controlpoints); + } else + glVertex3f(v.getx(),v.gety(),v.getz()); } glEnd(); } else { for(Int i=0; i < n; ++i) { static GLfloat knots[8]={0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0}; static GLfloat controlpoints[12]; - store(controlpoints,g.point(i)); - store(controlpoints+3,g.postcontrol(i)); - store(controlpoints+6,g.precontrol(i+1)); - store(controlpoints+9,g.point(i+1)); - + if(havebillboard) { + BB.store(controlpoints,g.point(i),center); + BB.store(controlpoints+3,g.postcontrol(i),center); + BB.store(controlpoints+6,g.precontrol(i+1),center); + BB.store(controlpoints+9,g.point(i+1),center); + } else { + store(controlpoints,g.point(i)); + store(controlpoints+3,g.postcontrol(i)); + store(controlpoints+6,g.precontrol(i+1)); + store(controlpoints+9,g.point(i+1)); + } + gluBeginCurve(nurb); gluNurbsCurve(nurb,8,knots,3,controlpoints,4,GL_MAP1_VERTEX_3); gluEndCurve(nurb); diff --git a/Build/source/utils/asymptote/drawpath3.h b/Build/source/utils/asymptote/drawpath3.h index 97801cdc452..ef49ba74bc4 100644 --- a/Build/source/utils/asymptote/drawpath3.h +++ b/Build/source/utils/asymptote/drawpath3.h @@ -15,18 +15,24 @@ namespace camp { class drawPath3 : public drawElement { protected: const path3 g; + triple center; bool straight; RGBAColour color; bool invisible; + Interaction interaction; triple Min,Max; public: - drawPath3(path3 g, const pen& p) : - g(g), straight(g.piecewisestraight()), color(rgba(p)), - invisible(p.invisible()), Min(g.min()), Max(g.max()) {} + drawPath3(path3 g, triple center, const pen& p, Interaction interaction) : + g(g), center(center), straight(g.piecewisestraight()), color(rgba(p)), + invisible(p.invisible()), interaction(interaction), + Min(g.min()), Max(g.max()) {} drawPath3(const vm::array& t, const drawPath3 *s) : - g(camp::transformed(t,s->g)), straight(s->straight), color(s->color), - invisible(s->invisible), Min(g.min()), Max(g.max()) {} + g(camp::transformed(t,s->g)), center(center), straight(s->straight), + color(s->color), invisible(s->invisible), interaction(s->interaction), + Min(g.min()), Max(g.max()) { + center=run::operator *(t,s->center); + } virtual ~drawPath3() {} diff --git a/Build/source/utils/asymptote/drawsurface.cc b/Build/source/utils/asymptote/drawsurface.cc index e5c8194700f..9a52e0c1919 100644 --- a/Build/source/utils/asymptote/drawsurface.cc +++ b/Build/source/utils/asymptote/drawsurface.cc @@ -10,7 +10,7 @@ namespace camp { const double pixel=1.0; // Adaptive rendering constant. -const triple drawSurface::zero; +const triple drawElement::zero; using vm::array; @@ -26,27 +26,6 @@ void storecolor(GLfloat *colors, int i, const vm::array &pens, int j) } #endif -inline void initMatrix(GLfloat *v, double x, double ymin, double zmin, - double ymax, double zmax) -{ - v[0]=x; - v[1]=ymin; - v[2]=zmin; - v[3]=1.0; - v[4]=x; - v[5]=ymin; - v[6]=zmax; - v[7]=1.0; - v[8]=x; - v[9]=ymax; - v[10]=zmin; - v[11]=1.0; - v[12]=x; - v[13]=ymax; - v[14]=zmax; - v[15]=1.0; -} - void drawSurface::bounds(bbox3& b) { double x,y,z; @@ -142,7 +121,7 @@ void drawSurface::ratio(pair &b, double (*m)(double, double), double fuzz, } bool drawSurface::write(prcfile *out, unsigned int *, array *, array *, double, - groupsmap&) + groupsmap&) { if(invisible || !prc) return true; @@ -217,35 +196,6 @@ inline double fraction(const triple& d, const triple& size) fraction(d.getz(),size.getz())); } -#ifdef HAVE_GL -struct billboard -{ - triple u,v,w; - - void init() { - gl::projection P=gl::camera(false); - w=unit(P.camera-P.target); - v=unit(perp(P.up,w)); - u=cross(v,w); - } - - void store(GLfloat* C, const triple& V, - const triple ¢er=drawSurface::zero) { - double cx=center.getx(); - double cy=center.gety(); - double cz=center.getz(); - double x=V.getx()-cx; - double y=V.gety()-cy; - double z=V.getz()-cz; - C[0]=cx+u.getx()*x+v.getx()*y+w.getx()*z; - C[1]=cy+u.gety()*x+v.gety()*y+w.gety()*z; - C[2]=cz+u.getz()*x+v.getz()*y+w.getz()*z; - } -}; - -billboard BB; -#endif - void drawSurface::render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, double perspective, bool transparent) @@ -260,34 +210,36 @@ void drawSurface::render(GLUnurbs *nurb, double size2, static GLfloat v1[16]; static GLfloat v2[16]; - initMatrix(v1,Min.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); - initMatrix(v2,Max.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); - - glPushMatrix(); - glMultMatrixf(v1); - glGetFloatv(GL_MODELVIEW_MATRIX,v); - glPopMatrix(); - - bbox3 B(v[0],v[1],v[2]); - B.addnonempty(v[4],v[5],v[6]); - B.addnonempty(v[8],v[9],v[10]); - B.addnonempty(v[12],v[13],v[14]); - - glPushMatrix(); - glMultMatrixf(v2); - glGetFloatv(GL_MODELVIEW_MATRIX,v); - glPopMatrix(); - - B.addnonempty(v[0],v[1],v[2]); - B.addnonempty(v[4],v[5],v[6]); - B.addnonempty(v[8],v[9],v[10]); - B.addnonempty(v[12],v[13],v[14]); - - triple M=B.Max(); - triple m=B.Min(); - bool havebillboard=interaction == BILLBOARD; + triple m,M; + if(perspective || !havebillboard) { + initMatrix(v1,v2); + + glPushMatrix(); + glMultMatrixf(v1); + glGetFloatv(GL_MODELVIEW_MATRIX,v); + glPopMatrix(); + + bbox3 B(v[0],v[1],v[2]); + B.addnonempty(v[4],v[5],v[6]); + B.addnonempty(v[8],v[9],v[10]); + B.addnonempty(v[12],v[13],v[14]); + + glPushMatrix(); + glMultMatrixf(v2); + glGetFloatv(GL_MODELVIEW_MATRIX,v); + glPopMatrix(); + + B.addnonempty(v[0],v[1],v[2]); + B.addnonempty(v[4],v[5],v[6]); + B.addnonempty(v[8],v[9],v[10]); + B.addnonempty(v[12],v[13],v[14]); + + m=B.Min(); + M=B.Max(); + } + if(perspective) { double f=m.getz()*perspective; double F=M.getz()*perspective; @@ -349,7 +301,7 @@ void drawSurface::render(GLUnurbs *nurb, double size2, if(lighton) { if(havenormal && fraction(dperp,size3)*size2 <= 0.1) { if(havebillboard) - BB.store(Normal,normal); + BB.store(Normal,normal,zero); else store(Normal,normal); glNormal3fv(Normal); @@ -388,7 +340,7 @@ void drawSurface::render(GLUnurbs *nurb, double size2, } if(havebillboard) - BB.store(Normal,normal); + BB.store(Normal,normal,zero); else store(Normal,normal); @@ -527,8 +479,7 @@ void drawNurbs::render(GLUnurbs *nurb, double size2, static GLfloat v1[16]; static GLfloat v2[16]; - initMatrix(v1,Min.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); - initMatrix(v2,Max.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); + initMatrix(v1,v2); glPushMatrix(); glMultMatrixf(v1); @@ -549,9 +500,9 @@ void drawNurbs::render(GLUnurbs *nurb, double size2, B.addnonempty(v[4],v[5],v[6]); B.addnonempty(v[8],v[9],v[10]); B.addnonempty(v[12],v[13],v[14]); - - triple M=B.Max(); + triple m=B.Min(); + triple M=B.Max(); double s; if(perspective) { diff --git a/Build/source/utils/asymptote/drawsurface.h b/Build/source/utils/asymptote/drawsurface.h index 80ed57515d7..ed19bd80a60 100644 --- a/Build/source/utils/asymptote/drawsurface.h +++ b/Build/source/utils/asymptote/drawsurface.h @@ -16,8 +16,29 @@ namespace camp { #ifdef HAVE_GL void storecolor(GLfloat *colors, int i, const vm::array &pens, int j); -#endif +inline void initMatrix(GLfloat *v, double x, double ymin, double zmin, + double ymax, double zmax) +{ + v[0]=x; + v[1]=ymin; + v[2]=zmin; + v[3]=1.0; + v[4]=x; + v[5]=ymin; + v[6]=zmax; + v[7]=1.0; + v[8]=x; + v[9]=ymax; + v[10]=zmin; + v[11]=1.0; + v[12]=x; + v[13]=ymax; + v[14]=zmax; + v[15]=1.0; +} +#endif + class drawSurface : public drawElement { protected: Triple *controls; @@ -34,7 +55,7 @@ protected: triple normal; bool invisible; bool lighton; - int interaction; + Interaction interaction; triple Min,Max; bool prc; @@ -46,12 +67,10 @@ protected: #endif public: - static const triple zero; - drawSurface(const vm::array& g, triple center, bool straight, const vm::array&p, double opacity, double shininess, double PRCshininess, triple normal, const vm::array &pens, - bool lighton, int interaction, bool prc) : + bool lighton, Interaction interaction, bool prc) : center(center), straight(straight), opacity(opacity), shininess(shininess), PRCshininess(PRCshininess), normal(unit(normal)), lighton(lighton), interaction(interaction), prc(prc) { @@ -124,10 +143,10 @@ public: } } else controls=NULL; +#ifdef HAVE_GL center=run::operator *(t,s->center); normal=run::multshiftless(t,s->normal); -#ifdef HAVE_GL if(s->colors) { colors=new(UseGC) GLfloat[16]; for(size_t i=0; i < 16; ++i) @@ -148,6 +167,14 @@ public: groupsmap&); void displacement(); + +#ifdef HAVE_GL + void initMatrix(GLfloat *v1, GLfloat *v2) { + camp::initMatrix(v1,Min.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); + camp::initMatrix(v2,Max.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); + } +#endif + void render(GLUnurbs *nurb, double, const triple& Min, const triple& Max, double perspective, bool transparent); @@ -312,7 +339,14 @@ public: void displacement(); void ratio(pair &b, double (*m)(double, double), double, bool &first); - + +#ifdef HAVE_GL + void initMatrix(GLfloat *v1, GLfloat *v2) { + camp::initMatrix(v1,Min.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); + camp::initMatrix(v2,Max.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); + } +#endif + void render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, double perspective, bool transparent); diff --git a/Build/source/utils/asymptote/entry.cc b/Build/source/utils/asymptote/entry.cc index 9871f59766c..93fb9997054 100644 --- a/Build/source/utils/asymptote/entry.cc +++ b/Build/source/utils/asymptote/entry.cc @@ -89,7 +89,7 @@ varEntry *qualifyVarEntry(varEntry *qv, varEntry *v) } -bool tenv::add(symbol *dest, +bool tenv::add(symbol dest, names_t::value_type &x, varEntry *qualifier, coder &c) { if (!x.second.empty()) { @@ -108,7 +108,7 @@ void tenv::add(tenv& source, varEntry *qualifier, coder &c) { add(p->first, *p, qualifier, c); } -bool tenv::add(symbol *src, symbol *dest, +bool tenv::add(symbol src, symbol dest, tenv& source, varEntry *qualifier, coder &c) { names_t::iterator p = source.names.find(src); if (p != source.names.end()) @@ -127,7 +127,7 @@ void venv::add(venv& source, varEntry *qualifier, coder &c) add(p->first, p->first, source, qualifier, c); } -bool venv::add(symbol *src, symbol *dest, +bool venv::add(symbol src, symbol dest, venv& source, varEntry *qualifier, coder &c) { bool added=false; @@ -139,7 +139,7 @@ bool venv::add(symbol *src, symbol *dest, ++p) { varEntry *v=*p; if (!equivalent(v->getType(), &set)) { - set.addDistinct(v->getType(), src->special); + set.addDistinct(v->getType(), src->special()); if (v->checkPerm(READ, c)) { enter(dest, qualifyVarEntry(qualifier, v)); added=true; @@ -150,7 +150,7 @@ bool venv::add(symbol *src, symbol *dest, return added; } -varEntry *venv::lookByType(symbol *name, ty *t) +varEntry *venv::lookByType(symbol name, ty *t) { // Find first applicable function. name_t &list = names[name]; @@ -168,7 +168,7 @@ void venv::list(record *module) bool where=settings::getSetting<bool>("where"); // List all functions and variables. for(names_t::iterator N = names.begin(); N != names.end(); ++N) { - symbol *s=N->first; + symbol s=N->first; name_t &list=names[s]; for(name_iterator p = list.begin(); p != list.end(); ++p) { if(!module || (*p)->whereDefined() == module) { @@ -181,7 +181,7 @@ void venv::list(record *module) flush(cout); } -ty *venv::getType(symbol *name) +ty *venv::getType(symbol name) { types::overloaded set; @@ -191,7 +191,7 @@ ty *venv::getType(symbol *name) for(name_iterator p = list.begin(); p != list.end(); ++p) { - set.addDistinct((*p)->getType(), name->special); + set.addDistinct((*p)->getType(), name->special()); } return set.simplify(); @@ -225,7 +225,7 @@ bool venv::keyeq::operator()(const key k, const key l) const { cerr << "l.t = " << l.t << " " << l << endl; #endif return k.name==l.name && - (k.name->special ? equivalent(k.t, l.t) : + (k.name.special() ? equivalent(k.t, l.t) : equivalent(k.t->getSignature(), l.t->getSignature())); } @@ -250,7 +250,46 @@ void venv::remove(key k) { names[k.name].pop_front(); } -void venv::enter(symbol *name, varEntry *v) { +#ifdef CALLEE_SEARCH +size_t numArgs(ty *t) { + signature *sig = t->getSignature(); + return sig ? sig->getNumFormals() : 0; +} + +void checkMaxArgs(venv *ve, symbol name, size_t expected) { + size_t maxFormals = 0; + ty *t = ve->getType(name); + if (types::overloaded *o=dynamic_cast<types::overloaded *>(t)) { + for (types::ty_vector::iterator i=o->sub.begin(); i != o->sub.end(); ++i) + { + size_t n = numArgs(*i); + if (n > maxFormals) + maxFormals = n; + } + } else { + maxFormals = numArgs(t); + } + if (expected != maxFormals) { + cout << "expected: " << expected << " computed: " << maxFormals << endl; + cout << "types: " << endl; + if (types::overloaded *o=dynamic_cast<types::overloaded *>(t)) { + cout << " overloaded" << endl; + for (types::ty_vector::iterator i=o->sub.begin(); i != o->sub.end(); + ++i) + { + cout << " " << **i << endl; + } + } else { + cout << " non-overloaded" << endl; + cout << " " << *t << endl; + } + cout.flush(); + } + assert(expected == maxFormals); +} +#endif + +void venv::enter(symbol name, varEntry *v) { assert(!scopes.empty()); key k(name, v); #ifdef DEBUG_ENTRY @@ -271,7 +310,80 @@ void venv::enter(symbol *name, varEntry *v) { all[k]=val; scopes.top().insert(keymultimap::value_type(k,val)); + +#ifdef CALLEE_SEARCH + // I'm not sure if this works properly with rest arguments. + signature *sig = v->getSignature(); + size_t newmax = sig ? sig->getNumFormals() : 0; + mem::list<value *>& namelist = names[k.name]; + if (!namelist.empty()) { + size_t oldmax = namelist.front()->maxFormals; + if (oldmax > newmax) + newmax = oldmax; + } + val->maxFormals = newmax; + namelist.push_front(val); + + // A sanity check, disabled for speed reasons. +#ifdef DEBUG_CACHE + checkMaxArgs(this, k.name, val->maxFormals); +#endif +#else names[k.name].push_front(val); +#endif +} + + +varEntry *venv::lookBySignature(symbol name, signature *sig) { +#ifdef CALLEE_SEARCH + // Rest arguments are complicated and rare. Don't handle them here. + if (sig->hasRest()) { +#if 0 + if (lookByType(key(name, sig))) + cout << "FAIL BY REST ARG" << endl; + else + cout << "FAIL BY REST ARG AND NO-MATCH" << endl; +#endif + return 0; + } + + // Likewise with the special operators. + if (name.special()) { + //cout << "FAIL BY SPECIAL" << endl; + return 0; + } + + mem::list<value *>& namelist = names[name]; + if (namelist.empty()) { + // No variables of this name. + //cout << "FAIL BY EMPTY" << endl; + return 0; + } + + // Avoid ambiguities with default parameters. + if (namelist.front()->maxFormals != sig->getNumFormals()) { +#if 0 + if (lookByType(key(name, sig))) + cout << "FAIL BY NUMARGS" << endl; + else + cout << "FAIL BY NUMARGS AND NO-MATCH" << endl; +#endif + return 0; + } + + // At this point, any function with an equivalent an signature will be equal + // to the result of the normal overloaded function resolution. We may + // safely return it. + varEntry *result = lookByType(key(name, sig)); +#if 0 + if (!result) + cout << "FAIL BY NO-MATCH" << endl; +#endif + return result; +#else + // The maxFormals field is necessary for this optimization. + return 0; +#endif } void venv::add(venv& source, varEntry *qualifier, coder &c) @@ -284,7 +396,7 @@ void venv::add(venv& source, varEntry *qualifier, coder &c) } } -bool venv::add(symbol *src, symbol *dest, +bool venv::add(symbol src, symbol dest, venv& source, varEntry *qualifier, coder &c) { bool added=false; @@ -303,10 +415,10 @@ bool venv::add(symbol *src, symbol *dest, } -ty *venv::getType(symbol *name) +ty *venv::getType(symbol name) { #if 0 - cout << "getType: " << *name << endl; + cout << "getType: " << name << endl; #endif types::overloaded set; values &list=names[name]; @@ -318,7 +430,7 @@ ty *venv::getType(symbol *name) return set.simplify(); } -void venv::listValues(symbol *name, values &vals, record *module) +void venv::listValues(symbol name, values &vals, record *module) { ostream& out=cout; @@ -342,10 +454,10 @@ void venv::list(record *module) listValues(N->first, N->second,module); } -void venv::completions(mem::list<symbol *>& l, string start) +void venv::completions(mem::list<symbol >& l, string start) { for(namemap::iterator N = names.begin(); N != names.end(); ++N) - if (prefix(start, *(N->first)) && !N->second.empty()) + if (prefix(start, N->first) && !N->second.empty()) l.push_back(N->first); } diff --git a/Build/source/utils/asymptote/entry.h b/Build/source/utils/asymptote/entry.h index 66d98628d05..d465046961c 100644 --- a/Build/source/utils/asymptote/entry.h +++ b/Build/source/utils/asymptote/entry.h @@ -165,7 +165,7 @@ inline tyEntry *qualifyTyEntry(varEntry *qv, tyEntry *ent) { // The type environment. class tenv : public sym::table<tyEntry *> { - bool add(symbol *dest, names_t::value_type &x, varEntry *qualifier, + bool add(symbol dest, names_t::value_type &x, varEntry *qualifier, coder &c); public: // Add the entries in one environment to another, if qualifier is @@ -175,46 +175,38 @@ public: // Adds entries of the name src in source as the name dest, returning true if // any were added. - bool add(symbol *src, symbol *dest, + bool add(symbol src, symbol dest, tenv& source, varEntry *qualifier, coder &c); }; #ifdef NOHASH //{{{ class venv : public sym::table<varEntry*> { + /* This version of venv is provided for compiling on systems which do not + * have some form of STL hash table. It will eventually be removed. + * See the hash version below for documentation on the functions. + */ public: venv() {} - // This is an optimization in the hashtable version that is duplicated here - // for compatibility. It is identical to venv(). struct file_env_tag {}; venv(file_env_tag) {} -#if 0 - // Look for a function that exactly matches the signature given. - varEntry *lookExact(symbol *name, signature *key); -#endif - - // Add the entries in one environment to another, if qualifier is - // non-null, it is a record and the source environment are its fields. - // The coder is necessary to check which variables are accessible and - // should be added. void add(venv& source, varEntry *qualifier, coder &c); - // Add all unshadowed variables from source of the name src as variables - // named dest. Returns true if at least one was added. - bool add(symbol *src, symbol *dest, + bool add(symbol src, symbol dest, venv& source, varEntry *qualifier, coder &c); - // Look for a function that exactly matches the type given. - varEntry *lookByType(symbol *name, ty *t); + varEntry *lookByType(symbol name, ty *t); - // Return the type of the variable, if name is overloaded, return an - // overloaded type. - ty *getType(symbol *name); + varEntry *lookBySignature(symbol name, signature *sig) { + // This optimization is not implemented for the NOHASH version. + return 0; + } + + ty *getType(symbol name); friend std::ostream& operator<< (std::ostream& out, const venv& ve); - // Prints a list of the variables to the standard output. void list(record *module=0); }; @@ -224,20 +216,20 @@ public: // venv implemented with a hash table. class venv { struct key : public gc { - symbol *name; + symbol name; ty *t; - key(symbol *name, ty *t) + key(symbol name, ty *t) : name(name), t(t) {} /* A fake key used for searching just based on a signature. */ - key(symbol *name, signature *sig) + key(symbol name, signature *sig) : name(name), t(new types::function(types::primError(), sig)) { - assert(!name->special); + assert(!name.special()); } - key(symbol *name, varEntry *v) + key(symbol name, varEntry *v) : name(name), t(v->getType()) {} }; friend ostream& operator<< (ostream& out, const venv::key &k); @@ -247,16 +239,22 @@ class venv { bool shadowed; value *next; // The entry (of the same key) that this one shadows. +#ifdef CALLEE_SEARCH + // The maximum number of formals in any of the overloaded functions of + // this name (at the time this value was entered). + size_t maxFormals; +#endif + value(varEntry *v) : v(v), shadowed(false), next(0) {} }; struct namehash { - size_t operator()(const symbol *name) const { - return (size_t)name; + size_t operator()(const symbol name) const { + return name.hash(); } }; struct nameeq { - bool operator()(const symbol *s, const symbol *t) const { + bool operator()(const symbol s, const symbol t) const { return s==t; } }; @@ -266,8 +264,8 @@ class venv { return sig ? sig->hash() : 0; } size_t operator()(const key k) const { - return (size_t)(k.name) * 107 + - (k.name->special ? k.t->hash() : hashSig(k.t)); + return k.name.hash() * 107 + + (k.name.special() ? k.t->hash() : hashSig(k.t)); } }; struct keyeq { @@ -275,7 +273,7 @@ class venv { #if TEST_COLLISION bool base(const key k, const key l) const { return k.name==l.name && - (k.name->special ? equivalent(k.t, l.t) : + (k.name->special() ? equivalent(k.t, l.t) : equivalent(k.t->getSignature(), l.t->getSignature())); } @@ -300,10 +298,10 @@ class venv { // all values of that name. Used to get the (possibly overloaded) type // of the name. typedef mem::list<value *> values; - typedef mem::unordered_map<symbol *, values, namehash, nameeq> namemap; + typedef mem::unordered_map<symbol, values, namehash, nameeq> namemap; namemap names; - void listValues(symbol *name, values &vals, record *module); + void listValues(symbol name, values &vals, record *module); // Helper function for endScope. void remove(key k); @@ -326,7 +324,7 @@ public: beginScope(); } - void enter(symbol *name, varEntry *v); + void enter(symbol name, varEntry *v); // Add the entries in one environment to another, if qualifier is // non-null, it is a record and entries of the source environment are its @@ -336,7 +334,7 @@ public: // Add all unshadowed variables from source of the name src as variables // named dest. Returns true if at least one was added. - bool add(symbol *src, symbol *dest, + bool add(symbol src, symbol dest, venv& source, varEntry *qualifier, coder &c); varEntry *lookByType(key k) { @@ -345,18 +343,25 @@ public: } // Look for a function that exactly matches the type given. - varEntry *lookByType(symbol *name, ty *t) { + varEntry *lookByType(symbol name, ty *t) { return lookByType(key(name, t)); } // An optimization heuristic. Try to guess the signature of a variable and // look it up. This is allowed to return 0 even if the appropriate variable - // exists. - varEntry *lookBySignature(symbol *name, signature *sig) { - return name->special ? 0 : lookByType(key(name, sig)); - } - - ty *getType(symbol *name); + // exists. If it returns a varEntry from an overloaded number of choices, + // the returned function must be the one which would be called with + // arguments given by sig, and its signature must be equivalent to sig. + // For instance, in + // int f(int a, int b); + // int f(int a, int b, int c = 1); + // f(a,b); + // looking up the signature of 'f' with arguments (int, int) must return 0 + // as there is an ambiguity. The maxFormals field is used to ensure we + // avoid such ambiguities. + varEntry *lookBySignature(symbol name, signature *sig); + + ty *getType(symbol name); void beginScope() { scopes.push(keymultimap()); @@ -384,7 +389,7 @@ public: void list(record *module=0); // Adds to l, all names prefixed by start. - void completions(mem::list<symbol *>& l, string start); + void completions(mem::list<symbol>& l, string start); }; #endif diff --git a/Build/source/utils/asymptote/env.cc b/Build/source/utils/asymptote/env.cc index 465b07a8caf..6eedb8bec66 100644 --- a/Build/source/utils/asymptote/env.cc +++ b/Build/source/utils/asymptote/env.cc @@ -23,9 +23,9 @@ namespace trans { // back to env when checking casting of subtypes. class envCaster : public caster { protoenv &e; - symbol *name; + symbol name; public: - envCaster(protoenv &e, symbol *name) + envCaster(protoenv &e, symbol name) : e(e), name(name) {} access *operator() (ty *target, ty *source) { @@ -37,7 +37,7 @@ public: } }; -access *protoenv::baseLookupCast(ty *target, ty *source, symbol *name) { +access *protoenv::baseLookupCast(ty *target, ty *source, symbol name) { static identAccess id; assert(target->kind != ty_overloaded && @@ -57,7 +57,7 @@ access *protoenv::baseLookupCast(ty *target, ty *source, symbol *name) { } } -access *protoenv::lookupCast(ty *target, ty *source, symbol *name) { +access *protoenv::lookupCast(ty *target, ty *source, symbol name) { access *a=baseLookupCast(target, source, name); if (a) return a; @@ -66,12 +66,12 @@ access *protoenv::lookupCast(ty *target, ty *source, symbol *name) { return source->castTo(target, ec); } -bool protoenv::castable(ty *target, ty *source, symbol *name) { +bool protoenv::castable(ty *target, ty *source, symbol name) { struct castTester : public tester { protoenv &e; - symbol *name; + symbol name; - castTester(protoenv &e, symbol *name) + castTester(protoenv &e, symbol name) : e(e), name(name) {} bool base(ty *t, ty *s) { @@ -88,12 +88,57 @@ bool protoenv::castable(ty *target, ty *source, symbol *name) { return ct.test(target,source); } -ty *protoenv::castTarget(ty *target, ty *source, symbol *name) { +#ifdef FASTCAST +bool protoenv::fastCastable(ty *target, ty *source) { + assert(target->kind != types::ty_overloaded); + assert(target->kind != types::ty_error); + assert(source->kind != types::ty_error); + + // To avoid memory allocation, fill one static variable with new parameters + // in each call. + static types::function castFunc(primVoid(), primVoid()); + castFunc.result = target; + + if (source->kind == types::ty_overloaded) { + bool result = false; + types::ty_vector& v = ((overloaded *)source)->sub; + for (size_t i = 0; i < v.size(); ++i) { + castFunc.sig.formals[0].t = v[i]; + if (lookupVarByType(symbol::castsym, &castFunc)) { + result = true; + break; + } + } + //assert(result == castable(target, source, symbol::castsym)); + //cout << "fc OVERLOADED " << (result ? "CAST" : "FAIL") << endl; + return result; + } + //else cout << "fc SIMPLE" << endl; + + // Don't test for equivalent, as that is already done by the castScore + // code. Assert disabled for speed. +#if 0 + assert(!equivalent(target, source)); +#endif + + castFunc.sig.formals[0].t = source; + + if (lookupVarByType(symbol::castsym, &castFunc)) + return true; + + // Test for generic casts of null. This should be moved to a types.h + // routine. + return source->kind == ty_null && target->isReference(); +} +#endif + + +ty *protoenv::castTarget(ty *target, ty *source, symbol name) { struct resolver : public collector { protoenv &e; - symbol *name; + symbol name; - resolver(protoenv &e, symbol *name) + resolver(protoenv &e, symbol name) : e(e), name(name) {} types::ty *base(types::ty *target, types::ty *source) { @@ -105,12 +150,12 @@ ty *protoenv::castTarget(ty *target, ty *source, symbol *name) { return r.collect(target, source); } -ty *protoenv::castSource(ty *target, ty *source, symbol *name) { +ty *protoenv::castSource(ty *target, ty *source, symbol name) { struct resolver : public collector { protoenv &e; - symbol *name; + symbol name; - resolver(protoenv &e, symbol *name) + resolver(protoenv &e, symbol name) : e(e), name(name) {} types::ty *base(types::ty *target, types::ty *source) { @@ -150,7 +195,7 @@ env::~env() { } -record *env::getModule(symbol *id, string filename) +record *env::getModule(symbol id, string filename) { return ge.getModule(id, filename); } diff --git a/Build/source/utils/asymptote/env.h b/Build/source/utils/asymptote/env.h index 1d9b2be1166..40569dd5390 100644 --- a/Build/source/utils/asymptote/env.h +++ b/Build/source/utils/asymptote/env.h @@ -37,7 +37,7 @@ public: tenv te; venv ve; - access *baseLookupCast(ty *target, ty *source, symbol *name); + access *baseLookupCast(ty *target, ty *source, symbol name); public: // Start an environment for a file-level module. @@ -61,24 +61,24 @@ public: te.collapseScope(); ve.collapseScope(); } - tyEntry *lookupTyEntry(symbol *s) + tyEntry *lookupTyEntry(symbol s) { return te.look(s); } - ty *lookupType(symbol *s) + ty *lookupType(symbol s) { tyEntry *ent=lookupTyEntry(s); return ent ? ent->t : 0; } - varEntry *lookupVarByType(symbol *name, ty *t) + varEntry *lookupVarByType(symbol name, ty *t) { // Search in local vars. return ve.lookByType(name, t); } - varEntry *lookupVarBySignature(symbol *name, types::signature *sig) + varEntry *lookupVarBySignature(symbol name, types::signature *sig) { return ve.lookBySignature(name, sig); } @@ -94,27 +94,34 @@ public: } // Find the function that handles casting between the types. - // The name is "operator cast" for implicitCasting and "operator ecast" for + // The name is "operator cast" for implicit casting and "operator ecast" for // explicit. - access *lookupCast(ty *target, ty *source, symbol *name); - bool castable(ty *target, ty *source, symbol *name); + access *lookupCast(ty *target, ty *source, symbol name); + bool castable(ty *target, ty *source, symbol name); + + +#ifdef FASTCAST + // A cast lookup designed to work quickly with the application matching + // code. The target type must not be overloaded. + bool fastCastable(ty *target, ty *source); +#endif // Given overloaded types, this resolves which types should be the target and // the source of the cast. - ty *castTarget(ty *target, ty *source, symbol *name); - ty *castSource(ty *target, ty *source, symbol *name); + ty *castTarget(ty *target, ty *source, symbol name); + ty *castSource(ty *target, ty *source, symbol name); - ty *varGetType(symbol *name) + ty *varGetType(symbol name) { return ve.getType(name); } - void addType(symbol *name, tyEntry *desc) + void addType(symbol name, tyEntry *desc) { te.enter(name, desc); } - void addVar(symbol *name, varEntry *desc) + void addVar(symbol name, varEntry *desc) { // Don't check for multiple variables, as this makes adding casts // and initializers harder. @@ -130,7 +137,7 @@ public: // Add variables and types of name src from another environment under the // name dest in this environment. - bool add(symbol *src, symbol *dest, + bool add(symbol src, symbol dest, protoenv &source, varEntry *qualifier, coder &c) { return te.add(src, dest, source.te, qualifier, c) | @@ -149,7 +156,7 @@ public: // Adds to a list the keywords in the environment that start with the given // prefix. Used for automatic completion at the interactive prompt. - typedef mem::list<symbol *> symbol_list; + typedef mem::list<symbol> symbol_list; void completions(symbol_list &l, string start) { te.completions(l, start); @@ -172,7 +179,7 @@ public: ~env(); - record *getModule(symbol *id, string filename); + record *getModule(symbol id, string filename); }; } // namespace trans diff --git a/Build/source/utils/asymptote/envcompleter.cc b/Build/source/utils/asymptote/envcompleter.cc index 6c8135f0edd..9477a77f3c7 100644 --- a/Build/source/utils/asymptote/envcompleter.cc +++ b/Build/source/utils/asymptote/envcompleter.cc @@ -30,8 +30,8 @@ void envCompleter::basicCompletions(symbol_list &l, string start) { if (!basicListLoaded) loadBasicList(); - for(symbol_list::iterator p = basicList.begin(); p != basicList.end(); ++p) - if (prefix(start, **p)) + for (symbol_list::iterator p = basicList.begin(); p != basicList.end(); ++p) + if (prefix(start, *p)) l.push_back(*p); } @@ -49,9 +49,9 @@ char *envCompleter::operator () (const char *text, int state) { if (index==l.end()) return 0; else { - symbol *name=*index; + symbol name=*index; ++index; - return StrdupMalloc((string) *name); + return StrdupMalloc((string)name); } } diff --git a/Build/source/utils/asymptote/errors b/Build/source/utils/asymptote/errors index d91b8e7ddb1..c5bec4882a4 100644 --- a/Build/source/utils/asymptote/errors +++ b/Build/source/utils/asymptote/errors @@ -44,7 +44,7 @@ errortest.asy: 234.5: function must return a value errortest.asy: 241.11: function must return a value errortest.asy: 244.11: function must return a value errortest.asy: 290.3: built-in functions cannot be modified -errortest.asy: 298.18: cannot cast 'string' to 'int' +errortest.asy: 298.11: cannot cast 'string' to 'int' errortest.asy: 312.4: accessing private field outside of structure errortest.asy: 313.4: accessing private field outside of structure errortest.asy: 314.4: accessing private field outside of structure diff --git a/Build/source/utils/asymptote/examples/BezierPatch.asy b/Build/source/utils/asymptote/examples/BezierPatch.asy index 0e6b477eb13..8d770e058ae 100644 --- a/Build/source/utils/asymptote/examples/BezierPatch.asy +++ b/Build/source/utils/asymptote/examples/BezierPatch.asy @@ -1,7 +1,7 @@ import three; size(10cm); -currentlight=(0,0,1); +currentlight=Viewport; surface s=surface(patch(new triple[][] { {(0,0,0),(1,0,0),(1,0,0),(2,0,0)}, diff --git a/Build/source/utils/asymptote/examples/Klein.asy b/Build/source/utils/asymptote/examples/Klein.asy index b2f6d1b0e79..99914d90432 100644 --- a/Build/source/utils/asymptote/examples/Klein.asy +++ b/Build/source/utils/asymptote/examples/Klein.asy @@ -22,7 +22,7 @@ triple f(pair t) { } surface s=surface(f,(0,0),(2pi,2pi),8,8,Spline); -draw(s,lightolive+white,"bottle"); +draw(s,lightolive+white,"bottle",render(merge=true)); string lo="$\displaystyle u\in[0,\pi]: \cases{x=3\cos u(1+\sin u)+(2-\cos u)\cos u\cos v,\cr y=8\sin u+(2-\cos u)\sin u\cos v,\cr diff --git a/Build/source/utils/asymptote/examples/RiemannSurface.asy b/Build/source/utils/asymptote/examples/RiemannSurface.asy index f32ca4d7539..a1f1b665089 100644 --- a/Build/source/utils/asymptote/examples/RiemannSurface.asy +++ b/Build/source/utils/asymptote/examples/RiemannSurface.asy @@ -10,4 +10,4 @@ triple f(pair t) {return (exp(t.x)*cos(t.y),exp(t.x)*sin(t.y),t.y);} surface s=surface(f,(-4,-2pi),(0,4pi),8,16,Spline); s.colors(palette(s.map(zpart),Rainbow())); -draw(s); +draw(s,render(merge=true)); diff --git a/Build/source/utils/asymptote/examples/RiemannSurfaceRoot.asy b/Build/source/utils/asymptote/examples/RiemannSurfaceRoot.asy index 93bd7035842..8cb3af2cfa9 100644 --- a/Build/source/utils/asymptote/examples/RiemannSurfaceRoot.asy +++ b/Build/source/utils/asymptote/examples/RiemannSurfaceRoot.asy @@ -1,11 +1,10 @@ // Riemann surface of z^{1/n} import graph3; import palette; - + int n=3; size(200,300,keepAspect=false); -//settings.nothin=true; currentprojection=orthographic(10,10,30); currentlight=(10,10,5); @@ -14,4 +13,4 @@ triple f(pair t) {return (t.x*cos(t.y),t.x*sin(t.y),t.x^(1/n)*sin(t.y/n));} surface s=surface(f,(0,0),(1,2pi*n),8,16,Spline); s.colors(palette(s.map(zpart),Rainbow())); -draw(s,meshpen=black); +draw(s,meshpen=black,render(merge=true)); diff --git a/Build/source/utils/asymptote/examples/SierpinskiGasket.asy b/Build/source/utils/asymptote/examples/SierpinskiGasket.asy index 57251735db8..2e0d4facd64 100644 --- a/Build/source/utils/asymptote/examples/SierpinskiGasket.asy +++ b/Build/source/utils/asymptote/examples/SierpinskiGasket.asy @@ -28,4 +28,4 @@ recur(O,0.5,1); s.colors(palette(s.map(zpart),Rainbow())); -draw(s); +draw(s,render(merge=true)); diff --git a/Build/source/utils/asymptote/examples/SierpinskiSponge.asy b/Build/source/utils/asymptote/examples/SierpinskiSponge.asy index 209c3d182ed..328447d4ac4 100644 --- a/Build/source/utils/asymptote/examples/SierpinskiSponge.asy +++ b/Build/source/utils/asymptote/examples/SierpinskiSponge.asy @@ -39,4 +39,4 @@ sf.append(rotate(90,Y)*s); sf.append(rotate(90,Z)*s); sf.colors(palette(sf.map(abs),Rainbow())); -draw(sf); +draw(sf,render(compression=Low,merge=true)); diff --git a/Build/source/utils/asymptote/examples/basealign.asy b/Build/source/utils/asymptote/examples/basealign.asy index 8a34bdab4b7..4bf83c94033 100644 --- a/Build/source/utils/asymptote/examples/basealign.asy +++ b/Build/source/utils/asymptote/examples/basealign.asy @@ -1,5 +1,7 @@ import fontsize; import three; + +settings.autobillboard=false; currentprojection=orthographic(Z); defaultpen(fontsize(100pt)); diff --git a/Build/source/utils/asymptote/examples/cheese.asy b/Build/source/utils/asymptote/examples/cheese.asy index f283f5c8115..9a16e4130dc 100644 --- a/Build/source/utils/asymptote/examples/cheese.asy +++ b/Build/source/utils/asymptote/examples/cheese.asy @@ -9,4 +9,4 @@ real f(real x, real y, real z) { surface sf=surface(contour3(f,(-2pi,-2pi,-2pi),(2pi,2pi,2pi),12)); sf.colors(palette(sf.map(abs),Gradient(red,yellow))); -draw(sf,nolight); +draw(sf,nolight,render(merge=true)); diff --git a/Build/source/utils/asymptote/examples/cos3.asy b/Build/source/utils/asymptote/examples/cos3.asy index fa9c8f49550..ef8054d6627 100644 --- a/Build/source/utils/asymptote/examples/cos3.asy +++ b/Build/source/utils/asymptote/examples/cos3.asy @@ -6,15 +6,12 @@ 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); -} +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); +draw(s,render(compression=Low,merge=true)); real xmin=point((-1,-1,-1)).x; real xmax=point((1,1,1)).x; @@ -23,3 +20,6 @@ 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 8e1ff466b9d..11b01551c8d 100644 --- a/Build/source/utils/asymptote/examples/cyclohexane.asy +++ b/Build/source/utils/asymptote/examples/cyclohexane.asy @@ -36,6 +36,8 @@ triple h12=rotate(120,c6,c5)*h11; pen Black=gray(0.4); +defaultrender=render(compression=Zero,merge=true); + draw(shift(c1)*carbon,Black); draw(shift(c2)*carbon,Black); draw(shift(c3)*carbon,Black); diff --git a/Build/source/utils/asymptote/examples/elevation.asy b/Build/source/utils/asymptote/examples/elevation.asy index 4e4579d98a9..1ff4ee38f28 100644 --- a/Build/source/utils/asymptote/examples/elevation.asy +++ b/Build/source/utils/asymptote/examples/elevation.asy @@ -6,6 +6,8 @@ currentprojection=orthographic(0.8,1,1); size(400,300,IgnoreAspect); +defaultrender.merge=true; + real f(pair z) {return cos(2*pi*z.x)*sin(2*pi*z.y);} surface s=surface(f,(-1/2,-1/2),(1/2,1/2),50,Spline); diff --git a/Build/source/utils/asymptote/examples/epix.asy b/Build/source/utils/asymptote/examples/epix.asy index df0cd3d336c..b833289bd80 100644 --- a/Build/source/utils/asymptote/examples/epix.asy +++ b/Build/source/utils/asymptote/examples/epix.asy @@ -6,7 +6,7 @@ currentprojection=perspective(4,2,3); real f(pair z) {return z.y^3/2-3z.x^2*z.y;} -draw(surface(f,(-1,-1),(1,1),nx=10,Spline),green); +draw(surface(f,(-1,-1),(1,1),nx=10,Spline),green,render(merge=true)); draw(Label("$y$",1),(0,0,0)--(0,2,0),red,Arrow3); draw(Label("$x$",1),(0,0,0)--(2,0,0),red,Arrow3); diff --git a/Build/source/utils/asymptote/examples/equilchord.asy b/Build/source/utils/asymptote/examples/equilchord.asy index ae3665b1a66..b93da942d08 100644 --- a/Build/source/utils/asymptote/examples/equilchord.asy +++ b/Build/source/utils/asymptote/examples/equilchord.asy @@ -15,7 +15,7 @@ draw((-a,-a,0)--(-a,a,0)--(a,a,0)--(a,-a,0)--cycle,lightgray); xaxis3(Label("$x$",1),red,Arrow3); yaxis3(Label("$y$",1),red,Arrow3); draw(circle((0,0,0),1),dashed); -draw(surface(F,(-1,-1),(t,1),20,monotonic),green,black); +draw(surface(F,(-1,-1),(t,1),20,monotonic),green,black,render(merge=true)); real y=sqrt(1-t^2); draw((t,y,0)--(t,-y,0)--(t,0,sqrt(3)*y)--cycle,blue); label("$1$",(1,0,0),-Y+X); diff --git a/Build/source/utils/asymptote/examples/exp3.asy b/Build/source/utils/asymptote/examples/exp3.asy index e7508a29297..39baba993f3 100644 --- a/Build/source/utils/asymptote/examples/exp3.asy +++ b/Build/source/utils/asymptote/examples/exp3.asy @@ -6,15 +6,12 @@ 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); -} +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); +draw(s,render(compression=Low,merge=true)); real xmin=point((-1,-1,-1)).x; real xmax=point((1,1,1)).x; diff --git a/Build/source/utils/asymptote/examples/extrudedcontour.asy b/Build/source/utils/asymptote/examples/extrudedcontour.asy index b5ad885a350..7b2f67459ce 100644 --- a/Build/source/utils/asymptote/examples/extrudedcontour.asy +++ b/Build/source/utils/asymptote/examples/extrudedcontour.asy @@ -8,15 +8,16 @@ real b=4; real f(pair z) {return (z.x+z.y)/(2+cos(z.x)*sin(z.y));} guide[][] g=contour(f,(-10,-10),(10,10),new real[]{8},150); +render render=render(merge=true); for(guide p:g[0]){ - draw(extrude(p,8Z),palered); - draw(path3(p),red+2pt); + draw(extrude(p,8Z),palered,render); + draw(path3(p),red+2pt,render); } -draw(lift(f,g),red+2pt); +draw(lift(f,g),red+2pt,render); surface s=surface(f,(0,0),(10,10),20,Spline); s.colors(palette(s.map(zpart),Rainbow()+opacity(0.5))); -draw(s); +draw(s,render); axes3("$x$","$y$","$z$",Arrow3); diff --git a/Build/source/utils/asymptote/examples/filesurface.asy b/Build/source/utils/asymptote/examples/filesurface.asy index 98adc045f07..2a93c96ec19 100644 --- a/Build/source/utils/asymptote/examples/filesurface.asy +++ b/Build/source/utils/asymptote/examples/filesurface.asy @@ -21,7 +21,7 @@ real[] level=uniform(min(f)*(1-sqrtEpsilon),max(f)*(1+sqrtEpsilon),4); s.colors(palette(s.map(new real(triple v) {return find(level >= v.z);}), Rainbow())); -draw(s,meshpen=thick()); +draw(s,meshpen=thick(),render(merge=true)); triple m=currentpicture.userMin; triple M=currentpicture.userMax; diff --git a/Build/source/utils/asymptote/examples/gamma3.asy b/Build/source/utils/asymptote/examples/gamma3.asy index e7fdde015e0..e522dad4e70 100644 --- a/Build/source/utils/asymptote/examples/gamma3.asy +++ b/Build/source/utils/asymptote/examples/gamma3.asy @@ -22,7 +22,7 @@ real Arg(triple v) } s.colors(palette(s.map(Arg),Wheel())); -draw(s); +draw(s,render(compression=Low,merge=true)); real xmin=point((-1,-1,-1)).x; real xmax=point((1,1,1)).x; diff --git a/Build/source/utils/asymptote/examples/magnetic.asy b/Build/source/utils/asymptote/examples/magnetic.asy index 4dc187f5770..3ae40466d43 100644 --- a/Build/source/utils/asymptote/examples/magnetic.asy +++ b/Build/source/utils/asymptote/examples/magnetic.asy @@ -10,7 +10,8 @@ real B(real z) {return 1-0.5cos(pi*z/10);} real f(real x, real y, real z) {return 0.5B(z)*(a(z)*x^2+b(z)*y^2)-1;} -draw(surface(contour3(f,(-2,-2,-10),(2,2,10),10)),blue+opacity(0.75)); +draw(surface(contour3(f,(-2,-2,-10),(2,2,10),10)),blue+opacity(0.75), + render(merge=true)); xaxis3(Label("$x$",1),red); yaxis3(Label("$y$",1),red); diff --git a/Build/source/utils/asymptote/examples/p-orbital.asy b/Build/source/utils/asymptote/examples/p-orbital.asy index d8b22bc2982..1932e098c67 100644 --- a/Build/source/utils/asymptote/examples/p-orbital.asy +++ b/Build/source/utils/asymptote/examples/p-orbital.asy @@ -2,6 +2,7 @@ import graph3; import palette; size(200); currentprojection=orthographic(6,8,2); +viewportmargin=(1cm,0); real c0=0.1; @@ -22,7 +23,9 @@ real R=abs((20,20,20)); surface s=surface(f,(0,0),(R,2pi),100,8,Spline,cond); s.colors(palette(s.map(abs),Gradient(palegreen,heavyblue))); -draw(s); + +render render=render(compression=Low,merge=true); +draw(s,render); draw(zscale3(-1)*s); axes3("$x$","$y$","$z$",Arrow3); diff --git a/Build/source/utils/asymptote/examples/parametricelevation.asy b/Build/source/utils/asymptote/examples/parametricelevation.asy index 52cec8728a5..ac0f0b09ad5 100644 --- a/Build/source/utils/asymptote/examples/parametricelevation.asy +++ b/Build/source/utils/asymptote/examples/parametricelevation.asy @@ -7,4 +7,4 @@ currentprojection=orthographic(4,2,4); triple f(pair z) {return expi(z.x,z.y);} surface s=surface(f,(0,0),(pi,2pi),10,Spline); -draw(s,mean(palette(s.map(zpart),BWRainbow())),black,nolight); +draw(s,mean(palette(s.map(zpart),BWRainbow())),black,nolight,render(merge=true)); diff --git a/Build/source/utils/asymptote/examples/parametricsurface.asy b/Build/source/utils/asymptote/examples/parametricsurface.asy index de669b59faf..299ea72eef7 100644 --- a/Build/source/utils/asymptote/examples/parametricsurface.asy +++ b/Build/source/utils/asymptote/examples/parametricsurface.asy @@ -20,4 +20,4 @@ surface s=surface(f,(0,0),(2pi,2pi),8,8,Spline); // draw(s,nullpen,meshpen=p); // surface & mesh -draw(s,lightgray,meshpen=p); +draw(s,lightgray,meshpen=p,render(merge=true)); diff --git a/Build/source/utils/asymptote/examples/pipeintersection.asy b/Build/source/utils/asymptote/examples/pipeintersection.asy index 5bf9cfbe6f3..6b0388f1378 100644 --- a/Build/source/utils/asymptote/examples/pipeintersection.asy +++ b/Build/source/utils/asymptote/examples/pipeintersection.asy @@ -9,4 +9,5 @@ real f(pair z) {return min(sqrt(1-z.x^2),sqrt(1-z.y^2));} surface s=surface(f,(0,0),(1,1),40,Spline); transform3 t=rotate(90,O,Z), t2=t*t, t3=t2*t, i=xscale3(-1)*zscale3(-1); -draw(surface(s,t*s,t2*s,t3*s,i*s,i*t*s,i*t2*s,i*t3*s),blue,render(merge=true)); +draw(surface(s,t*s,t2*s,t3*s,i*s,i*t*s,i*t2*s,i*t3*s),blue, + render(compression=Low,closed=true,merge=true)); diff --git a/Build/source/utils/asymptote/examples/roll.asy b/Build/source/utils/asymptote/examples/roll.asy index 088da3177f4..4d15ac0febe 100644 --- a/Build/source/utils/asymptote/examples/roll.asy +++ b/Build/source/utils/asymptote/examples/roll.asy @@ -7,4 +7,4 @@ return(t.x+t.y/4+sin(t.y),cos(t.y),sin(t.y)); } surface s=surface(f,(0,0),(2pi,2pi),7,20,Spline); -draw(s,olive); +draw(s,olive,render(merge=true)); diff --git a/Build/source/utils/asymptote/examples/shellsqrtx01.asy b/Build/source/utils/asymptote/examples/shellsqrtx01.asy index c4edec122c8..553200df14c 100644 --- a/Build/source/utils/asymptote/examples/shellsqrtx01.asy +++ b/Build/source/utils/asymptote/examples/shellsqrtx01.asy @@ -13,12 +13,14 @@ path p=graph(F,0,1,n=30,operator ..)--(1,0)--cycle; path3 p3=path3(p); revolution a=revolution(p3,X,alpha,0); -draw(surface(a),color); + +render render=render(compression=0,merge=true); +draw(surface(a),color,render); draw(p3,blue); surface s=surface(p); -draw(s,color); -draw(rotate(alpha,X)*s,color); +draw(s,color,render); +draw(rotate(alpha,X)*s,color,render); xaxis3(Label("$x$",1),xmax=1.25,dashed,Arrow3); yaxis3(Label("$y$",1),Arrow3); diff --git a/Build/source/utils/asymptote/examples/sin3.asy b/Build/source/utils/asymptote/examples/sin3.asy index d35cd271808..76551dacb95 100644 --- a/Build/source/utils/asymptote/examples/sin3.asy +++ b/Build/source/utils/asymptote/examples/sin3.asy @@ -6,15 +6,12 @@ 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); -} +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); +draw(s,render(compression=Low,merge=true)); real xmin=point((-1,-1,-1)).x; real xmax=point((1,1,1)).x; diff --git a/Build/source/utils/asymptote/examples/sinc.asy b/Build/source/utils/asymptote/examples/sinc.asy index cd0d377e633..352585bdbe4 100644 --- a/Build/source/utils/asymptote/examples/sinc.asy +++ b/Build/source/utils/asymptote/examples/sinc.asy @@ -2,7 +2,7 @@ import graph3; import contour; currentprojection=orthographic(1,-2,1); -currentlight=(1,-1,0.5); +currentlight=White; size(12cm,0); @@ -11,8 +11,13 @@ real sinc(pair z) { return r != 0 ? sin(r)/r : 1; } +render render=render(compression=Low,merge=true); + draw(lift(sinc,contour(sinc,(-2,-2),(2,2),new real[] {0})),red); -draw(surface(sinc,(-2,-2),(2,2),Spline),lightgray+opacity(0.5)); +draw(surface(sinc,(-2,-2),(2,2),Spline),lightgray,render); + +draw(scale3(2*sqrt(2))*unitdisk,paleyellow+opacity(0.25),nolight,render); +draw(scale3(2*sqrt(2))*unitcircle3,red,render); xaxis3("$x$",Bounds,InTicks); yaxis3("$y$",Bounds,InTicks(beginlabel=false)); diff --git a/Build/source/utils/asymptote/examples/slidedemo.asy b/Build/source/utils/asymptote/examples/slidedemo.asy index 52ede757b47..7a753a54d61 100644 --- a/Build/source/utils/asymptote/examples/slidedemo.asy +++ b/Build/source/utils/asymptote/examples/slidedemo.asy @@ -93,11 +93,12 @@ triple F3(real x) {return (x,f(x),0);} path p=graph(pic,F,0,1,n=30,operator ..)--(1,0)--cycle; path3 p3=path3(p); revolution a=revolution(p3,X,alpha,0); -draw(pic,surface(a),color); +render render=render(compression=0,merge=true); +draw(pic,surface(a),color,render); draw(pic,p3,blue); surface s=surface(p); -draw(pic,s,color); -draw(pic,rotate(alpha,X)*s,color); +draw(pic,s,color,render); +draw(pic,rotate(alpha,X)*s,color,render); xaxis3(pic,Label("$x$",1),xmax=1.25,dashed,Arrow3); yaxis3(pic,Label("$y$",1),Arrow3); dot(pic,"$(1,1)$",(1,1,0)); diff --git a/Build/source/utils/asymptote/examples/soccerball.asy b/Build/source/utils/asymptote/examples/soccerball.asy index f481ef1b7ff..a37063dbb29 100644 --- a/Build/source/utils/asymptote/examples/soccerball.asy +++ b/Build/source/utils/asymptote/examples/soccerball.asy @@ -2,6 +2,8 @@ import graph3; size(400); currentlight.background=palegreen; +defaultrender=render(compression=Zero,merge=true); + real c=(1+sqrt(5))/2; triple[] z={(c,1,0),(-c,1,0),(-c,-1,0),(c,-1,0)}; diff --git a/Build/source/utils/asymptote/examples/sphere.asy b/Build/source/utils/asymptote/examples/sphere.asy index 41f3f548895..8d1b5fe50cd 100644 --- a/Build/source/utils/asymptote/examples/sphere.asy +++ b/Build/source/utils/asymptote/examples/sphere.asy @@ -3,4 +3,4 @@ import three; size(200); currentprojection=orthographic(5,4,3); -draw(unitsphere,green,render(compression=Zero)); +draw(unitsphere,green,render(compression=Zero,merge=true)); diff --git a/Build/source/utils/asymptote/examples/sphericalharmonic.asy b/Build/source/utils/asymptote/examples/sphericalharmonic.asy index d89d81aee86..9fbb16f624d 100644 --- a/Build/source/utils/asymptote/examples/sphericalharmonic.asy +++ b/Build/source/utils/asymptote/examples/sphericalharmonic.asy @@ -11,4 +11,4 @@ triple f(pair z) {return r(z.x,z.y)*expi(z.x,z.y);} surface s=surface(f,(0,0),(pi,2pi),50,Spline); s.colors(palette(s.map(abs),Gradient(yellow,red))); -draw(s); +draw(s,render(compression=Low,merge=true)); diff --git a/Build/source/utils/asymptote/examples/spiral3.asy b/Build/source/utils/asymptote/examples/spiral3.asy index cea9665a951..727ca3f6d3a 100644 --- a/Build/source/utils/asymptote/examples/spiral3.asy +++ b/Build/source/utils/asymptote/examples/spiral3.asy @@ -4,6 +4,7 @@ import palette; size3(10cm); currentprojection=orthographic(5,4,2); +viewportmargin=(2cm,0); real r(real t) {return 3exp(-0.1*t);} real x(real t) {return r(t)*cos(t);} @@ -15,5 +16,5 @@ path3 p=graph(x,y,z,0,6*pi,50,operator ..); tube T=tube(p,2); surface s=T.s; s.colors(palette(s.map(zpart),BWRainbow())); -draw(s); +draw(s,render(merge=true)); draw(T.center,thin()); diff --git a/Build/source/utils/asymptote/examples/splitpatch.asy b/Build/source/utils/asymptote/examples/splitpatch.asy index cfd5c9a4c93..200fb2c4c44 100644 --- a/Build/source/utils/asymptote/examples/splitpatch.asy +++ b/Build/source/utils/asymptote/examples/splitpatch.asy @@ -19,6 +19,8 @@ triple[][] B={ split S=split(A,B,10); //write(S.T.length); +defaultrender.merge=true; + for(int i=0; i < S.T.length; ++i) draw(surface(patch(S.T[i])),Pen(i)); draw(surface(patch(B)),blue); diff --git a/Build/source/utils/asymptote/examples/sqrtx01.asy b/Build/source/utils/asymptote/examples/sqrtx01.asy index 2ca9ac697d6..4d2b0a45dce 100644 --- a/Build/source/utils/asymptote/examples/sqrtx01.asy +++ b/Build/source/utils/asymptote/examples/sqrtx01.asy @@ -12,7 +12,7 @@ path p=graph(F,0,1,n=20,operator ..); path3 p3=path3(p); revolution a=revolution(p3,X,0,360); -draw(surface(a),color); +draw(surface(a),color,render(compression=Low,merge=true)); draw(p3,blue); real x=relpoint(p,0.5).x; diff --git a/Build/source/utils/asymptote/examples/sqrtx01y1.asy b/Build/source/utils/asymptote/examples/sqrtx01y1.asy index c944f43d268..dcb247f572e 100644 --- a/Build/source/utils/asymptote/examples/sqrtx01y1.asy +++ b/Build/source/utils/asymptote/examples/sqrtx01y1.asy @@ -2,6 +2,7 @@ import graph3; import solids; size(0,150); currentprojection=perspective(0,1,10,up=Y); +currentlight=White; real f(real x) {return sqrt(x);} pair F(real x) {return (x,f(x));} @@ -11,7 +12,7 @@ path p=graph(F,0,1,n=25,operator ..); path3 p3=path3(p); revolution a=revolution(p3,Y,0,360); -draw(surface(a),green); +draw(surface(a),green,render(compression=Low,merge=true)); draw(p3,blue); xtick((0,0,0)); diff --git a/Build/source/utils/asymptote/examples/stroke3.asy b/Build/source/utils/asymptote/examples/stroke3.asy index 6b386c3a0c9..75824d41dd3 100644 --- a/Build/source/utils/asymptote/examples/stroke3.asy +++ b/Build/source/utils/asymptote/examples/stroke3.asy @@ -1,2 +1,4 @@ import three; -draw(O--X,red,currentlight); +size(5cm); + +draw(O--X,red+1cm,currentlight); diff --git a/Build/source/utils/asymptote/examples/threeviews.asy b/Build/source/utils/asymptote/examples/threeviews.asy index 05c89e650ca..1bcc36ae8d7 100644 --- a/Build/source/utils/asymptote/examples/threeviews.asy +++ b/Build/source/utils/asymptote/examples/threeviews.asy @@ -8,7 +8,7 @@ settings.render=4; settings.toolbar=false; viewportmargin=(1cm,1cm); -draw(pic,scale3(0.5)*unitsphere,green); +draw(pic,scale3(0.5)*unitsphere,green,render(compression=Low,merge=true)); draw(pic,Label("$x$",1),O--X); draw(pic,Label("$y$",1),O--Y); draw(pic,Label("$z$",1),O--Z); diff --git a/Build/source/utils/asymptote/examples/torus.asy b/Build/source/utils/asymptote/examples/torus.asy index c64c16701ad..f89c82cde8b 100644 --- a/Build/source/utils/asymptote/examples/torus.asy +++ b/Build/source/utils/asymptote/examples/torus.asy @@ -17,4 +17,4 @@ triple f(pair t) { } surface s=surface(f,(radians(90),0),(radians(345),2pi),8,8,Spline); -draw(s,green); +draw(s,green,render(merge=true)); diff --git a/Build/source/utils/asymptote/examples/trefoilknot.asy b/Build/source/utils/asymptote/examples/trefoilknot.asy index 3c5e4aecc5a..8ea5b264b48 100644 --- a/Build/source/utils/asymptote/examples/trefoilknot.asy +++ b/Build/source/utils/asymptote/examples/trefoilknot.asy @@ -20,4 +20,4 @@ for (int i=pens.length-2; i >= 0 ; --i) path sec=scale(0.25)*texpath("$\pi$")[0]; coloredpath colorsec=coloredpath(sec, pens,colortype=coloredNodes); -draw(tube(p,colorsec)); +draw(tube(p,colorsec),render(merge=true)); diff --git a/Build/source/utils/asymptote/examples/trumpet.asy b/Build/source/utils/asymptote/examples/trumpet.asy index 032f8a7ffd6..842af2b23c2 100644 --- a/Build/source/utils/asymptote/examples/trumpet.asy +++ b/Build/source/utils/asymptote/examples/trumpet.asy @@ -4,9 +4,9 @@ size(200,0); currentlight=Viewport; triple f(pair t) { - return(10*sin(t.y),cos(t.x)*(cos(t.y)+log(abs(tan(t.y/2)))), - sin(t.x)*(cos(t.y)+log(abs(tan(t.y/2))))); + real u=log(abs(tan(t.y/2))); + return (10*sin(t.y),cos(t.x)*(cos(t.y)+u),sin(t.x)*(cos(t.y)+u)); } surface s=surface(f,(0,pi/2),(2pi,pi-0.1),7,15,Spline); -draw(s,olive); +draw(s,olive+0.25*white,render(compression=Low,merge=true)); diff --git a/Build/source/utils/asymptote/examples/truncatedIcosahedron.asy b/Build/source/utils/asymptote/examples/truncatedIcosahedron.asy index 436c6121b9f..e4d07a49e5b 100644 --- a/Build/source/utils/asymptote/examples/truncatedIcosahedron.asy +++ b/Build/source/utils/asymptote/examples/truncatedIcosahedron.asy @@ -2,6 +2,8 @@ import graph3; size(200); +defaultrender.merge=true; + real c=(1+sqrt(5))/2; triple[] z={(c,1,0),(-c,1,0),(-c,-1,0),(c,-1,0)}; diff --git a/Build/source/utils/asymptote/examples/twistedtubes.asy b/Build/source/utils/asymptote/examples/twistedtubes.asy index 4d38d86f4df..9121ad6444d 100644 --- a/Build/source/utils/asymptote/examples/twistedtubes.asy +++ b/Build/source/utils/asymptote/examples/twistedtubes.asy @@ -22,6 +22,8 @@ s2.colors(palette(s2.map(f),Rainbow)); s3.colors(palette(s3.map(f),Rainbow)); s4.colors(palette(s4.map(f),Rainbow)); +defaultrender.merge=true; + draw(s1); draw(s2); draw(s3); diff --git a/Build/source/utils/asymptote/examples/vectorfieldsphere.asy b/Build/source/utils/asymptote/examples/vectorfieldsphere.asy index 2348e09f855..7f1e49057a5 100644 --- a/Build/source/utils/asymptote/examples/vectorfieldsphere.asy +++ b/Build/source/utils/asymptote/examples/vectorfieldsphere.asy @@ -12,6 +12,6 @@ path3 vector(pair z) { return O--(v.y,v.z,v.x); } -add(vectorfield(vector,f,(0,0),(pi,2pi),10,0.25,red)); +add(vectorfield(vector,f,(0,0),(pi,2pi),10,0.25,red,render(merge=true))); -draw(unitsphere,gray+opacity(0.5)); +draw(unitsphere,gray+opacity(0.5),render(compression=0,merge=true)); diff --git a/Build/source/utils/asymptote/examples/washer.asy b/Build/source/utils/asymptote/examples/washer.asy index 083039e55a3..457ae69fb83 100644 --- a/Build/source/utils/asymptote/examples/washer.asy +++ b/Build/source/utils/asymptote/examples/washer.asy @@ -5,8 +5,9 @@ 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)); +render render=render(merge=true); +draw(surface(p,planar=true),render); +draw(surface(shift(H)*p,planar=true),render); material m=material(lightgray,shininess=1.0); for(path pp : g) draw(extrude(pp,H),m); diff --git a/Build/source/utils/asymptote/examples/washermethod.asy b/Build/source/utils/asymptote/examples/washermethod.asy index 032ed6cbc85..9a18b871414 100644 --- a/Build/source/utils/asymptote/examples/washermethod.asy +++ b/Build/source/utils/asymptote/examples/washermethod.asy @@ -18,13 +18,15 @@ path[] p={graph(F,0.7476,1.8043,Spline)--cycle, pen[] pn=new pen[] {color1,color2,color1}; +render render=render(compression=0); + for(int i=0; i < p.length; ++i) { revolution a=revolution(path3(p[i]),Y,0,alpha); - draw(surface(a),pn[i]); + draw(surface(a),pn[i],render); surface s=surface(p[i]); - draw(s,pn[i]); - draw(rotate(alpha,Y)*s,pn[i]); + draw(s,pn[i],render); + draw(rotate(alpha,Y)*s,pn[i],render); } draw((4/3,0,0)--F3(4/3),dashed); diff --git a/Build/source/utils/asymptote/examples/wedge.asy b/Build/source/utils/asymptote/examples/wedge.asy index 6cf6a58975f..41b4326cf42 100644 --- a/Build/source/utils/asymptote/examples/wedge.asy +++ b/Build/source/utils/asymptote/examples/wedge.asy @@ -10,11 +10,13 @@ draw(shift(-4Z)*scale(4,4,8)*unitcylinder,green+opacity(0.2)); triple F(real x){return (x,sqrt(16-x^2),sqrt((16-x^2)/3));} path3 p=graph(F,0,4,operator ..); path3 q=reverse(p)--rotate(180,(0,4,4/sqrt(3)))*p--cycle; -draw(surface(q--cycle),red); + +render render=render(merge=true); +draw(surface(q--cycle),red,render); real t=2; path3 triangle=(t,0,0)--(t,sqrt(16-t^2),0)--F(t)--cycle; -draw(surface(triangle),blue); +draw(surface(triangle),blue,render); xaxis3("$x$",Arrow3,PenMargin3(0,0.25)); yaxis3("$y$",Arrow3,PenMargin3(0,0.25)); diff --git a/Build/source/utils/asymptote/examples/xxsq01.asy b/Build/source/utils/asymptote/examples/xxsq01.asy index 11a035f0418..23a38393a94 100644 --- a/Build/source/utils/asymptote/examples/xxsq01.asy +++ b/Build/source/utils/asymptote/examples/xxsq01.asy @@ -14,11 +14,11 @@ path p=graph(F,0,1,n=10,operator ..)--cycle; path3 p3=path3(p); revolution a=revolution(p3,X,-alpha,0); -draw(surface(a),color); - +render render=render(compression=0,merge=true); +draw(surface(a),color,render); surface s=surface(p); -draw(s,color); -draw(rotate(-alpha,X)*s,color); +draw(s,color,render); +draw(rotate(-alpha,X)*s,color,render); draw(p3,blue); diff --git a/Build/source/utils/asymptote/examples/xxsq01x-1.asy b/Build/source/utils/asymptote/examples/xxsq01x-1.asy index 2c4c9ec363c..6d645a49664 100644 --- a/Build/source/utils/asymptote/examples/xxsq01x-1.asy +++ b/Build/source/utils/asymptote/examples/xxsq01x-1.asy @@ -2,7 +2,7 @@ import graph3; import solids; size(300); currentprojection=perspective(0,2,10,up=Y); -currentlight=(0.25,-0.25,5); +currentlight=Viewport; pen color=green; @@ -14,6 +14,7 @@ path p=graph(F,0,1,n=10,operator ..)--cycle; path3 p3=path3(p); revolution a=revolution(-X,p3,Y,0,180); +render render=render(merge=true); draw(surface(a),color); surface s=surface(p); draw(s,color); diff --git a/Build/source/utils/asymptote/examples/xxsq01y.asy b/Build/source/utils/asymptote/examples/xxsq01y.asy index 53f77d1f9bb..770f4fc22cf 100644 --- a/Build/source/utils/asymptote/examples/xxsq01y.asy +++ b/Build/source/utils/asymptote/examples/xxsq01y.asy @@ -11,11 +11,13 @@ triple F3(real x) {return (x,f(x),0);} path p=graph(F,0,1,n=10,operator ..)--cycle; path3 p3=path3(p); -draw(surface(revolution(p3,Y,0,alpha)),color); +render render=render(compression=0,merge=true); + +draw(surface(revolution(p3,Y,0,alpha)),color,render); surface s=surface(p); -draw(s,color); -draw(rotate(alpha,Y)*s,color); +draw(s,color,render); +draw(rotate(alpha,Y)*s,color,render); draw(p3,blue); diff --git a/Build/source/utils/asymptote/exp.cc b/Build/source/utils/asymptote/exp.cc index dc9533e2036..72d947198ee 100644 --- a/Build/source/utils/asymptote/exp.cc +++ b/Build/source/utils/asymptote/exp.cc @@ -10,6 +10,7 @@ #include "exp.h" #include "errormsg.h" #include "runtime.h" +#include "runmath.h" #include "runpicture.h" #include "runarray.h" #include "runpair.h" @@ -20,6 +21,7 @@ #include "dec.h" #include "stm.h" #include "inst.h" +#include "opsymbols.h" namespace absyntax { @@ -126,6 +128,10 @@ types::ty *varEntryExp::trans(coenv &e) { return getType(e); } +trans::varEntry *varEntryExp::getCallee(coenv &e, types::signature *sig) { + return equivalent(sig, v->getType()->getSignature()) ? v : 0; +} + void varEntryExp::transAct(action act, coenv &e, types::ty *target) { assert(equivalent(getType(e),target)); v->encode(act, getPos(), e.c); @@ -161,7 +167,7 @@ void fieldExp::pseudoName::prettyprint(ostream &out, Int indent) void fieldExp::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "fieldExp '" << *field << "'\n"; + out << "fieldExp '" << field << "'\n"; object->prettyprint(out, indent+1); } @@ -365,6 +371,126 @@ types::ty *thisExp::getType(coenv &e) return e.c.thisType(); } +void equalityExp::prettyprint(ostream &out, Int indent) +{ + prettyname(out, "equalityExp", indent); + callExp::prettyprint(out, indent+1); +} + +#ifdef NO_FUNC_OPS +types::ty *equalityExp::getType(coenv &e) { + if (resolved(e)) { + assert(ct); + return ct; + } else { + return primBoolean(); + } +} +#endif + +// From a possibly overloaded type, if there is a unique function type, return +// it, otherwise 0. +types::ty *uniqueFunction(types::ty *t) { + if (t->kind == types::ty_function) + return t; + + if (t->isOverloaded()) { + types::ty *ft = 0; + for (ty_iterator i = t->begin(); i != t->end(); ++i) + { + if ((*i)->kind != types::ty_function) + continue; + + if (ft) { + // Multiple function types. + return 0; + } + + ft = *i; + } + + return ft; + } + + // Not a function. + return 0; +} + +// From two possibly overloaded types, if there is a unique function type +// common to both, return it, otherwise 0. +types::ty *uniqueFunction(types::ty *t1, types::ty *t2) { + if (t1->kind == types::ty_function) + return equivalent(t1, t2) ? t1 : 0; + + if (t1->isOverloaded()) { + types::ty *ft = 0; + for (ty_iterator i = t1->begin(); i != t1->end(); ++i) + { + if ((*i)->kind != types::ty_function) + continue; + + if (!equivalent(*i, t2)) + continue; + + if (ft) { + // Multiple function types. + return 0; + } + + ft = *i; + } + + return ft; + } + + // Not a function. + return 0; +} + +bltin bltinFromName(symbol name) { + if (name == SYM_EQ) + return run::boolFuncEq; + assert(name == SYM_NEQ); + return run::boolFuncNeq; +} + +#ifdef NO_FUNC_OPS +types::ty *equalityExp::trans(coenv &e) { + if (resolved(e)) + return callExp::trans(e); + + exp *left = (*this->args)[0].val; + exp *right = (*this->args)[1].val; + + types::ty *lt = left->getType(e); + types::ty *rt = right->getType(e); + + // TODO: decide what null == null should do. + + // Check for function == null and null == function + types::ty *ft = 0; + if (rt->kind == types::ty_null) + ft = uniqueFunction(lt); + else if (lt->kind == types::ty_null) + ft = uniqueFunction(rt); + else + ft = uniqueFunction(lt, rt); + + + if (ft) { + assert(ft->kind == ty_function); + + left->transToType(e, ft); + right->transToType(e, ft); + e.c.encode(inst::builtin, bltinFromName(callee->getName())); + return primBoolean(); + } else { + // Let callExp report a "no such function" error. + return callExp::trans(e); + } +} +#endif + void scaleExp::prettyprint(ostream &out, Int indent) { exp *left=getLeft(); exp *right=getRight(); @@ -528,7 +654,7 @@ void argument::prettyprint(ostream &out, Int indent) prettyindent(out, indent); out << "explist"; if (name) - out << " '" << *name << "'"; + out << " '" << name << "'"; out << '\n'; val->prettyprint(out, indent+1); @@ -591,9 +717,9 @@ application *callExp::resolve(coenv &e, overloaded *o, signature *source, if (!tacit) { em.error(getPos()); - symbol *s = callee->getName(); + symbol s = callee->getName(); if (s) - em << "no matching function \'" << *s; + em << "no matching function \'" << s; else em << "no matching function for signature \'"; em << *source << "\'"; @@ -606,9 +732,9 @@ application *callExp::resolve(coenv &e, overloaded *o, signature *source, if (!tacit) { em.error(getPos()); - symbol *s = callee->getName(); + symbol s = callee->getName(); if(s) - em << "call of function \'" << *s; + em << "call of function \'" << s; else em << "call with signature \'"; em << *source << "\' is ambiguous"; @@ -631,13 +757,13 @@ bool hasNamedParameters(signature *sig) { void callExp::reportMismatch(function *ft, signature *source) { - symbol *s = callee->getName(); + symbol s = callee->getName(); const char *separator=ft->getSignature()->getNumFormals() > 1 ? "\n" : " "; em.error(getPos()); em << "cannot call" << separator << "'" << *ft->getResult() << " "; if(s) - em << *s; + em << s; em << *ft->getSignature() << "'" << separator; if (ft->getSignature()->isOpen && hasNamedParameters(source)) @@ -668,9 +794,9 @@ void callExp::reportArgErrors(coenv &e) void callExp::reportNonFunction() { em.error(getPos()); - symbol *s = callee->getName(); + symbol s = callee->getName(); if (s) - em << "\'" << *s << "\' is not a function"; + em << "\'" << s << "\' is not a function"; else em << "called expression is not a function"; } @@ -700,7 +826,7 @@ void callExp::cacheAppOrVarEntry(coenv &e, bool tacit) // An attempt at speeding up compilation: See if the source arguments match // the (possibly overloaded) function exactly. -#if 0 +#if CALLEE_SEARCH if (searchable) { varEntry *ve = callee->getCallee(e, source); @@ -709,13 +835,14 @@ void callExp::cacheAppOrVarEntry(coenv &e, bool tacit) #endif if (ve) { -#if 0 - cachedApp = application::match(e.e, - (function *)ve->getType(), source, *args); -#endif cachedVarEntry = ve; +#ifndef DEBUG_CACHE + // Normally DEBUG_CACHE is not defined and we return here for efficiency + // reasons. If DEBUG_CACHE is defined, also resolve the function by the + // normal techniques and make sure we get the same result. ct = ((function *)ve->getType())->getResult(); return; +#endif } } #endif @@ -724,7 +851,8 @@ void callExp::cacheAppOrVarEntry(coenv &e, bool tacit) types::ty *ft = callee->cgetType(e); #ifdef DEBUG_GETAPP - string name = callee->getName() ? string(*callee->getName()) : string("unnamed"); + string name = callee->getName() ? string(*callee->getName()) : + string("unnamed"); if (!callee->getName()) cout << getPos() << endl; #endif @@ -763,6 +891,12 @@ void callExp::cacheAppOrVarEntry(coenv &e, bool tacit) << *cachedApp->getType()->getSignature() << endl; #endif +#if DEBUG_CACHE + // Make sure cachedVarEntry is giving us the right function. + if (cachedVarEntry) + assert(equivalent(cachedVarEntry->getType(), cachedApp->getType())); +#endif + // Get type relies on this method setting the cached type. ct = cachedApp ? cachedApp->getType()->getResult() : primError(); } @@ -836,34 +970,14 @@ types::ty *callExp::getType(coenv &e) assert(ct); return ct; - -#if 0 - // First figure out the signature of what we want to call. - signature *source=argTypes(e); - if (!source) - return types::primError(); - - // Figure out what function types we can call. - trans::ty *ft = callee->cgetType(e); +} - switch (ft->kind) { - case ty_function: - return ((function *)ft)->result; - case ty_overloaded: { - application *a=resolve(e, (overloaded *)ft, source, true); - if (a) { - // Cache the application to avoid calling multimatch again later. - ca=a; - return ca->getType()->result; - } - else - return primError(); - } - default: - return primError(); - } -#endif +bool callExp::resolved(coenv &e) { + if (cachedApp == 0 && cachedVarEntry == 0) + cacheAppOrVarEntry(e, true); + return cachedApp || cachedVarEntry; } + void pairExp::prettyprint(ostream &out, Int indent) { @@ -938,7 +1052,7 @@ void castExp::prettyprint(ostream &out, Int indent) } types::ty *castExp::tryCast(coenv &e, types::ty *t, types::ty *s, - symbol *csym) + symbol csym) { types::ty *ss=e.e.castSource(t, s, csym); if (ss == 0) { @@ -1149,7 +1263,7 @@ void joinExp::prettyprint(ostream &out, Int indent) void specExp::prettyprint(ostream &out, Int indent) { prettyindent(out,indent); - out << "specExp '" << *op << "' " + out << "specExp '" << op << "' " << (s==camp::OUT ? "out" : s==camp::IN ? "in" : "invalid side") << '\n'; @@ -1229,7 +1343,7 @@ types::ty *assignExp::getType(coenv &e) void selfExp::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "selfExp '" << *op << "'\n"; + out << "selfExp '" << op << "'\n"; dest->prettyprint(out, indent+1); value->prettyprint(out, indent+1); @@ -1239,7 +1353,7 @@ void selfExp::prettyprint(ostream &out, Int indent) void prefixExp::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "prefixExp '" << *op << "'\n"; + out << "prefixExp '" << op << "'\n"; dest->prettyprint(out, indent+1); } @@ -1266,8 +1380,7 @@ types::ty *prefixExp::getType(coenv &e) void postfixExp::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "postfixExp <illegal>"; - out << "postfixExp <illegal> '" << *op << "'\n"; + out << "postfixExp <illegal> '" << op << "'\n"; dest->prettyprint(out, indent+1); } diff --git a/Build/source/utils/asymptote/exp.h b/Build/source/utils/asymptote/exp.h index 425bcc91788..f3d086dcba3 100644 --- a/Build/source/utils/asymptote/exp.h +++ b/Build/source/utils/asymptote/exp.h @@ -45,9 +45,9 @@ public: // function f(int)" instead of "no function matching signature // (int)." Hence, this method returns the name of the expression if // there is one. - virtual symbol *getName() + virtual symbol getName() { - return 0; + return symbol::nullsym; } // Checks if the expression can be used as the right side of a scale @@ -101,12 +101,21 @@ public: // error. virtual types::ty *getType(coenv &) = 0; - // TODO: Explain what this is! + // This is an optimization which works in some cases to by-pass the slow + // overloaded function resolution provided by the application class. + // + // If an expression is called with arguments given by sig, getCallee must + // either return 0 (the default), or if it returns a varEntry, the varEntry + // must correspond to the function which would be called after normal + // function resolution. + // + // The callee must produce no side effects as there are no guarantees when + // the varEntry will be translated. virtual trans::varEntry *getCallee(coenv &e, types::signature *sig) { //#define DEBUG_GETAPP #if DEBUG_GETAPP cout << "exp fail" << endl; - cout << "at " << getPos() << endl; + cout << "exp fail at " << getPos() << endl; prettyprint(cout, 2); #endif return 0; @@ -177,6 +186,7 @@ public: }; // Wrap a varEntry so that it can be used as an expression. +// Translating the varEntry must cause no side-effects. class varEntryExp : public exp { trans::varEntry *v; public: @@ -189,6 +199,7 @@ public: types::ty *getType(coenv &); types::ty *trans(coenv &e); + trans::varEntry *getCallee(coenv &e, types::signature *sig); void transAct(action act, coenv &e, types::ty *target); void transAsType(coenv &e, types::ty *target); @@ -203,7 +214,7 @@ public: nameExp(position pos, name *value) : exp(pos), value(value) {} - nameExp(position pos, symbol *id) + nameExp(position pos, symbol id) : exp(pos), value(new simpleName(pos, id)) {} nameExp(position pos, string s) @@ -211,7 +222,7 @@ public: void prettyprint(ostream &out, Int indent); - symbol *getName() + symbol getName() { return value->getName(); } @@ -278,7 +289,7 @@ public: // like f().x or (new t).x, a separate expression is needed. class fieldExp : public nameExp { exp *object; - symbol *field; + symbol field; // fieldExp has a lot of common functionality with qualifiedName, so we // essentially hack qualifiedName, by making our object expression look @@ -334,7 +345,7 @@ class fieldExp : public nameExp { void print(ostream& out) const { out << "<exp>"; } - symbol *getName() { + symbol getName() { return object->getName(); } }; @@ -343,7 +354,7 @@ class fieldExp : public nameExp { types::ty *getObject(coenv &e); public: - fieldExp(position pos, exp *object, symbol *field) + fieldExp(position pos, exp *object, symbol field) : nameExp(pos, new qualifiedName(pos, new pseudoName(object), field)), @@ -351,7 +362,7 @@ public: void prettyprint(ostream &out, Int indent); - symbol *getName() + symbol getName() { return field; } @@ -512,6 +523,8 @@ public: types::ty *trans(coenv &e); types::ty *getType(coenv &) { return types::primString(); } + + const string& getString() { return str; } }; class booleanExp : public literalExp { @@ -616,10 +629,11 @@ public: struct argument { exp *val; - symbol *name; + symbol name; + // No constructor due to the union in camp.y #if 0 - argument(exp *val=0, symbol *name=0) + argument(exp *val=0, symbol name=0) : val(val), name(name) {} #endif @@ -641,7 +655,7 @@ public: args.insert(args.begin(), a); } - virtual void addFront(exp *val, symbol *name=0) { + virtual void addFront(exp *val, symbol name=symbol::nullsym) { argument a; a.val=val; a.name=name; addFront(a); } @@ -650,7 +664,7 @@ public: args.push_back(a); } - virtual void add(exp *val, symbol *name=0) { + virtual void add(exp *val, symbol name=symbol::nullsym) { argument a; a.val=val; a.name=name; add(a); } @@ -703,8 +717,8 @@ private: void reportNonFunction(); // Caches either the application object used to apply the function to the - // arguments, or in special cases where the arguments match the function - // perfectly, the varEntry of the callee. + // arguments, or in cases where the arguments match the function perfectly, + // the varEntry of the callee. void cacheAppOrVarEntry(coenv &e, bool tacit); types::ty *transPerfectMatch(coenv &e); @@ -742,6 +756,10 @@ public: types::ty *trans(coenv &e); types::ty *getType(coenv &e); + + // Returns true if the function call resolves uniquely without error. Used + // in implementing the special == and != operators for functions. + virtual bool resolved(coenv &e); }; @@ -795,7 +813,7 @@ class castExp : public exp { exp *castee; types::ty *tryCast(coenv &e, types::ty *t, types::ty *s, - symbol *csym); + symbol csym); public: castExp(position pos, ty *target, exp *castee) : exp(pos), target(target), castee(castee) {} @@ -808,22 +826,36 @@ public: class nullaryExp : public callExp { public: - nullaryExp(position pos, symbol *op) + nullaryExp(position pos, symbol op) : callExp(pos, new nameExp(pos, op)) {} }; class unaryExp : public callExp { public: - unaryExp(position pos, exp *base, symbol *op) + unaryExp(position pos, exp *base, symbol op) : callExp(pos, new nameExp(pos, op), base) {} }; class binaryExp : public callExp { public: - binaryExp(position pos, exp *left, symbol *op, exp *right) + binaryExp(position pos, exp *left, symbol op, exp *right) + : callExp(pos, new nameExp(pos, op), left, right) {} +}; + +class equalityExp : public callExp { +public: + equalityExp(position pos, exp *left, symbol op, exp *right) : callExp(pos, new nameExp(pos, op), left, right) {} + + void prettyprint(ostream &out, Int indent); + +#ifdef NO_FUNC_OPS + types::ty *trans(coenv &e); + types::ty *getType(coenv &e); +#endif }; + // Scaling expressions such as 3sin(x). class scaleExp : public binaryExp { exp *getLeft() { @@ -848,7 +880,7 @@ public: // is a tension atleast case. class ternaryExp : public callExp { public: - ternaryExp(position pos, exp *left, symbol *op, exp *right, exp *last) + ternaryExp(position pos, exp *left, symbol op, exp *right, exp *last) : callExp(pos, new nameExp(pos, op), left, right, last) {} }; @@ -875,11 +907,11 @@ public: class andOrExp : public exp { protected: exp *left; - symbol *op; + symbol op; exp *right; public: - andOrExp(position pos, exp *left, symbol *op, exp *right) + andOrExp(position pos, exp *left, symbol op, exp *right) : exp(pos), left(left), op(op), right(right) {} virtual types::ty *trans(coenv &e) = 0; @@ -890,7 +922,7 @@ public: class orExp : public andOrExp { public: - orExp(position pos, exp *left, symbol *op, exp *right) + orExp(position pos, exp *left, symbol op, exp *right) : andOrExp(pos, left, op, right) {} void prettyprint(ostream &out, Int indent); @@ -900,7 +932,7 @@ public: class andExp : public andOrExp { public: - andExp(position pos, exp *left, symbol *op, exp *right) + andExp(position pos, exp *left, symbol op, exp *right) : andOrExp(pos, left, op, right) {} void prettyprint(ostream &out, Int indent); @@ -910,7 +942,7 @@ public: class joinExp : public callExp { public: - joinExp(position pos, symbol *op) + joinExp(position pos, symbol op) : callExp(pos, new nameExp(pos, op)) {} void pushFront(exp *e) { @@ -924,12 +956,12 @@ public: }; class specExp : public exp { - symbol *op; + symbol op; exp *arg; camp::side s; public: - specExp(position pos, symbol *op, exp *arg, camp::side s=camp::OUT) + specExp(position pos, symbol op, exp *arg, camp::side s=camp::OUT) : exp(pos), op(op), arg(arg), s(s) {} void setSide(camp::side ss) { @@ -969,14 +1001,14 @@ public: }; class selfExp : public assignExp { - symbol *op; + symbol op; exp *ultimateValue(exp *dest) { return new binaryExp(getPos(), dest, op, value); } public: - selfExp(position pos, exp *dest, symbol *op, exp *value) + selfExp(position pos, exp *dest, symbol op, exp *value) : assignExp(pos, dest, value), op(op) {} void prettyprint(ostream &out, Int indent); @@ -984,10 +1016,10 @@ public: class prefixExp : public exp { exp *dest; - symbol *op; + symbol op; public: - prefixExp(position pos, exp *dest, symbol *op) + prefixExp(position pos, exp *dest, symbol op) : exp(pos), dest(dest), op(op) {} void prettyprint(ostream &out, Int indent); @@ -1006,10 +1038,10 @@ public: // error." class postfixExp : public exp { exp *dest; - symbol *op; + symbol op; public: - postfixExp(position pos, exp *dest, symbol *op) + postfixExp(position pos, exp *dest, symbol op) : exp(pos), dest(dest), op(op) {} void prettyprint(ostream &out, Int indent); diff --git a/Build/source/utils/asymptote/findsym.pl b/Build/source/utils/asymptote/findsym.pl index 38c3865a7af..59e3ce79a2d 100755 --- a/Build/source/utils/asymptote/findsym.pl +++ b/Build/source/utils/asymptote/findsym.pl @@ -26,11 +26,11 @@ print header <<END; // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/fundec.cc b/Build/source/utils/asymptote/fundec.cc index 07369c7e1c5..aff8a741c63 100644 --- a/Build/source/utils/asymptote/fundec.cc +++ b/Build/source/utils/asymptote/fundec.cc @@ -153,7 +153,7 @@ void transDefault(coenv &e, position pos, varEntry *v, varinit *init) { } void formal::transAsVar(coenv &e, Int index) { - symbol *name = getName(); + symbol name = getName(); if (name) { trans::access *a = e.c.accessFormal(index); assert(a); @@ -234,7 +234,7 @@ varinit *fundef::makeVarInit(function *ft) { void fundef::baseTrans(coenv &e, types::function *ft) { - string name = id ? string(*id) : string("<anonymous function>"); + string name = id ? string(id) : string("<anonymous function>"); // Create a new function environment. coder fc = e.c.newFunction(name, ft); @@ -290,7 +290,7 @@ types::ty *fundef::trans(coenv &e) { void fundec::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "fundec '" << *id << "'\n"; + out << "fundec '" << id << "'\n"; fun.prettyprint(out, indent); } diff --git a/Build/source/utils/asymptote/fundec.h b/Build/source/utils/asymptote/fundec.h index 98ff2e3f51f..499505d765d 100644 --- a/Build/source/utils/asymptote/fundec.h +++ b/Build/source/utils/asymptote/fundec.h @@ -43,8 +43,8 @@ public: return defval; } - symbol *getName() { - return start ? start->getName() : 0; + symbol getName() { + return start ? start->getName() : symbol::nullsym; } bool getExplicit() { @@ -103,13 +103,13 @@ class fundef : public exp { // If the fundef is part of a fundec, the name of the function is stored // here for debugging purposes. - symbol *id; + symbol id; friend class fundec; public: fundef(position pos, ty *result, formals *params, stm *body) - : exp(pos), result(result), params(params), body(body), id(0) {} + : exp(pos), result(result), params(params), body(body), id() {} virtual void prettyprint(ostream &out, Int indent); @@ -125,11 +125,11 @@ public: }; class fundec : public dec { - symbol *id; + symbol id; fundef fun; public: - fundec(position pos, ty *result, symbol *id, formals *params, stm *body) + fundec(position pos, ty *result, symbol id, formals *params, stm *body) : dec(pos), id(id), fun(pos, result, params, body) { fun.id = id; } diff --git a/Build/source/utils/asymptote/genv.cc b/Build/source/utils/asymptote/genv.cc index df223ef4af7..ba0aea10d2f 100644 --- a/Build/source/utils/asymptote/genv.cc +++ b/Build/source/utils/asymptote/genv.cc @@ -57,7 +57,7 @@ genv::genv() #endif } -record *genv::loadModule(symbol *id, string filename) { +record *genv::loadModule(symbol id, string filename) { // Get the abstract syntax tree. absyntax::file *ast = parser::parseFile(filename,"Loading"); @@ -82,7 +82,7 @@ void genv::checkRecursion(string filename) { } } -record *genv::getModule(symbol *id, string filename) { +record *genv::getModule(symbol id, string filename) { checkRecursion(filename); record *r=imap[filename]; diff --git a/Build/source/utils/asymptote/genv.h b/Build/source/utils/asymptote/genv.h index c706f0c109c..014896e3e26 100644 --- a/Build/source/utils/asymptote/genv.h +++ b/Build/source/utils/asymptote/genv.h @@ -43,13 +43,13 @@ class genv : public gc { void checkRecursion(string filename); // Translate a module to build the record type. - record *loadModule(symbol *name, string s); + record *loadModule(symbol name, string s); public: genv(); // Get an imported module, translating if necessary. - record *getModule(symbol *name, string s); + record *getModule(symbol name, string s); // Uses the filename->record map to build a filename->initializer map to be // used at runtime. diff --git a/Build/source/utils/asymptote/glrender.cc b/Build/source/utils/asymptote/glrender.cc index ce7554e39f5..c56a8b82219 100644 --- a/Build/source/utils/asymptote/glrender.cc +++ b/Build/source/utils/asymptote/glrender.cc @@ -34,6 +34,10 @@ #include <GL/freeglut_ext.h> #endif +namespace camp { +billboard BB; +} + namespace gl { bool glthread=false; @@ -699,11 +703,11 @@ void zoom(int x, int y) if(zoomFactor > 0.0) { double zoomStep=getSetting<double>("zoomstep"); const double limit=log(0.1*DBL_MAX)/log(zoomFactor); - lastzoom=Zoom; double s=zoomStep*(y0-y); if(fabs(s) < limit) { Zoom *= pow(zoomFactor,s); capzoom(); + lastzoom=Zoom; y0=y; setProjection(); glutPostRedisplay(); @@ -716,13 +720,12 @@ void mousewheel(int wheel, int direction, int x, int y) { double zoomFactor=getSetting<double>("zoomfactor"); if(zoomFactor > 0.0) { - lastzoom=Zoom; if(direction > 0) Zoom *= zoomFactor; else Zoom /= zoomFactor; - capzoom(); + lastzoom=Zoom; setProjection(); glutPostRedisplay(); } @@ -1482,8 +1485,8 @@ void glrender(const string& prefix, const picture *pic, const string& format, gluNurbsProperty(nurb,GLU_PARAMETRIC_TOLERANCE,1.0); gluNurbsProperty(nurb,GLU_CULLING,GLU_TRUE); - // The callback tesselation algorithm avoids artifacts at degenerate control - // points. + // The callback tessellation algorithm avoids artifacts at degenerate + // control points. gluNurbsProperty(nurb,GLU_NURBS_MODE,GLU_NURBS_TESSELLATOR); gluNurbsCallback(nurb,GLU_NURBS_BEGIN,(_GLUfuncptr) glBegin); gluNurbsCallback(nurb,GLU_NURBS_VERTEX,(_GLUfuncptr) glVertex3fv); diff --git a/Build/source/utils/asymptote/glrender.h b/Build/source/utils/asymptote/glrender.h index 7d37e3dfdb2..22b52fe95ce 100644 --- a/Build/source/utils/asymptote/glrender.h +++ b/Build/source/utils/asymptote/glrender.h @@ -89,6 +89,36 @@ void glrender(const string& prefix, const camp::picture* pic, bool view, int oldpid=0); } +namespace camp { + +struct billboard +{ + triple u,v,w; + + void init() { + gl::projection P=gl::camera(false); + w=unit(P.camera-P.target); + v=unit(perp(P.up,w)); + u=cross(v,w); + } + + void store(GLfloat* C, const triple& V, const triple ¢er) { + double cx=center.getx(); + double cy=center.gety(); + double cz=center.getz(); + double x=V.getx()-cx; + double y=V.gety()-cy; + double z=V.getz()-cz; + C[0]=cx+u.getx()*x+v.getx()*y+w.getx()*z; + C[1]=cy+u.gety()*x+v.gety()*y+w.gety()*z; + C[2]=cz+u.getz()*x+v.getz()*y+w.getz()*z; + } +}; + +extern billboard BB; + +} + #else typedef void GLUnurbs; typedef float GLfloat; diff --git a/Build/source/utils/asymptote/interact.cc b/Build/source/utils/asymptote/interact.cc index f185fbe6559..dd0bfd68a20 100644 --- a/Build/source/utils/asymptote/interact.cc +++ b/Build/source/utils/asymptote/interact.cc @@ -17,6 +17,7 @@ #include "runhistory.h" #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) +#include <cstdio> #include <readline/readline.h> #include <readline/history.h> #endif diff --git a/Build/source/utils/asymptote/item.h b/Build/source/utils/asymptote/item.h index 14caea884b0..6c2f6e7fbee 100644 --- a/Build/source/utils/asymptote/item.h +++ b/Build/source/utils/asymptote/item.h @@ -9,7 +9,10 @@ #define ITEM_H #include "common.h" +#include <cfloat> +#include <cmath> #include <typeinfo> +#include <cassert> namespace vm { @@ -19,18 +22,83 @@ class bad_item_value {}; template<typename T> T get(const item&); +#if COMPACT +// Identify a default argument. +extern const Int DefaultValue; + +// Identify an undefined item. +extern const Int Undefined; +#endif + +extern const item Default; + class item : public gc { +private: + +#if !COMPACT + const std::type_info *kind; +#endif + + union { + Int i; + double x; + bool b; + void *p; + }; + public: +#if COMPACT + bool empty() const + {return i == Undefined;} + + item() : i(Undefined) {} + + item(Int i) + : i(i) {} + item(int i) + : i(i) {} + item(double x) + : x(x) {} + item(bool b) + : b(b) {} + + item& operator= (int a) + { i=a; return *this; } + item& operator= (Int a) + { i=a; return *this; } + item& operator= (double a) + { x=a; return *this; } + item& operator= (bool a) + { b=a; return *this; } + + template<class T> + item(T *p) + : p((void *) p) { + assert(p < (void *) Undefined); + } + + template<class T> + item(const T &P) + : p(new(UseGC) T(P)) { + assert(p < (void *) Undefined); + } + + template<class T> + item& operator= (T *a) + { p=(void *) a; return *this; } + + template<class T> + item& operator= (const T &it) + { p=new(UseGC) T(it); return *this; } +#else bool empty() const - { return *kind == typeid(void); } + {return *kind == typeid(void);} item() : kind(&typeid(void)) {} -#ifndef Int item(Int i) : kind(&typeid(Int)), i(i) {} -#endif item(int i) : kind(&typeid(Int)), i(i) {} item(double x) @@ -38,10 +106,8 @@ public: item(bool b) : kind(&typeid(bool)), b(b) {} -#ifndef Int item& operator= (int a) { kind=&typeid(Int); i=a; return *this; } -#endif item& operator= (Int a) { kind=&typeid(Int); i=a; return *this; } item& operator= (double a) @@ -65,28 +131,18 @@ public: item& operator= (const T &it) { kind=&typeid(T); p=new(UseGC) T(it); return *this; } + const std::type_info &type() const + { return *kind; } +#endif + template<typename T> friend inline T get(const item&); friend inline bool isdefault(const item&); - friend inline bool isarray(const item&); - const std::type_info &type() const - { return *kind; } - friend ostream& operator<< (ostream& out, const item& i); private: - - const std::type_info *kind; - - union { - Int i; - double x; - bool b; - void *p; - }; - template <typename T> struct help; @@ -94,8 +150,13 @@ private: struct help<T*> { static T* unwrap(const item& it) { - if (*it.kind == typeid(T)) +#if COMPACT + if(!it.empty()) return (T*) it.p; +#else + if(*it.kind == typeid(T)) + return (T*) it.p; +#endif throw vm::bad_item_value(); } }; @@ -104,8 +165,13 @@ private: struct help { static T& unwrap(const item& it) { - if (*it.kind == typeid(T)) +#if COMPACT + if(!it.empty()) + return *(T*) it.p; +#else + if(*it.kind == typeid(T)) return *(T*) it.p; +#endif throw vm::bad_item_value(); } }; @@ -140,7 +206,7 @@ public: // Extends vars to ensure it has a place for any variable indexed up to n. void extend(size_t n) { - if (vars.size() < n) + if(vars.size() < n) vars.resize(n); } }; @@ -151,50 +217,67 @@ inline T get(const item& it) return item::help<T>::unwrap(it); } -#ifndef Int template <> inline int get<int>(const item&) { throw vm::bad_item_value(); } -#endif template <> inline Int get<Int>(const item& it) { - if (*it.kind == typeid(Int)) +#if COMPACT + if(!it.empty()) + return it.i; +#else + if(*it.kind == typeid(Int)) return it.i; +#endif throw vm::bad_item_value(); } template <> inline double get<double>(const item& it) { - if (*it.kind == typeid(double)) +#if COMPACT + if(!it.empty()) return it.x; +#else + if(*it.kind == typeid(double)) + return it.x; +#endif throw vm::bad_item_value(); } template <> inline bool get<bool>(const item& it) { - if (*it.kind == typeid(bool)) +#if COMPACT + if(!it.empty()) + return it.b; +#else + if(*it.kind == typeid(bool)) return it.b; +#endif throw vm::bad_item_value(); } +#if !COMPACT // This serves as the object for representing a default argument. struct default_t : public gc {}; - +#endif + inline bool isdefault(const item& it) { +#if COMPACT + return it.i == DefaultValue; +#else return *it.kind == typeid(default_t); +#endif } ostream& operator<< (ostream& out, const item& i); } // namespace vm -GC_DECLARE_PTRFREE(vm::default_t); - #endif // ITEM_H diff --git a/Build/source/utils/asymptote/lex.yy.cc b/Build/source/utils/asymptote/lex.yy.cc index 20336cd2c40..935c7b382dd 100644 --- a/Build/source/utils/asymptote/lex.yy.cc +++ b/Build/source/utils/asymptote/lex.yy.cc @@ -767,20 +767,20 @@ int yy_flex_debug = 1; static yyconst flex_int16_t yy_rule_linenum[122] = { 0, - 201, 202, 204, 210, 214, 215, 225, 226, 227, 228, - 232, 233, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 257, 262, 268, 274, 282, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 328, 329, - 330, 331, 332, 333, 335, 336, 337, 338, 339, 341, - 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 360, 361, 362, - - 363, 364, 367, 374, 381, 383, 385, 387, 389, 392, - 394, 395, 401, 405, 409, 413, 416, 420, 421, 422, - 426 + 204, 205, 207, 213, 217, 218, 228, 229, 230, 231, + 235, 236, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 260, 265, 271, 277, 285, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 331, 332, + 333, 334, 335, 336, 338, 339, 340, 341, 342, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 363, 364, 365, + + 366, 367, 370, 377, 384, 386, 388, 390, 392, 395, + 397, 398, 404, 408, 412, 416, 419, 423, 424, 425, + 429 } ; /* The intent behind this definition is that it'll catch @@ -803,6 +803,7 @@ char *yytext; #include <iostream> #include <fstream> #include <sstream> +#include <cstring> #include "util.h" #include "modifier.h" @@ -877,7 +878,7 @@ void adjust() yylval.pos = here(); } -void savesymbol(symbol *name) +void savesymbol(symbol name) { adjust(); yylval.ps.pos=here(); @@ -895,20 +896,15 @@ void savesymbol(symbol *name) #define DEFSYMBOL(name) \ savesymbol(name) -void makesymbol(bool op=true, string text = yytext) +void makesymbol() { - // TODO: Refactor to a call to savesymbol. - adjust(); - yylval.ps.pos=here(); - yylval.ps.sym=op ? symbol::opTrans(text) : symbol::literalTrans(text); + assert(strlen(yytext) == (size_t)yyleng); + savesymbol(symbol::rawTrans(yytext, yyleng+1)); } -void makeselfsymbol(bool op=true, string text = yytext) +void makeopsymbol() { - /* Copy all but the last digit, which should be an =. */ - assert(text[text.length()-1] == '='); - text.erase(text.length()-1); - makesymbol(op,text); + savesymbol(symbol::opTrans(yytext)); } void makemod(trans::modifier mod) { @@ -959,9 +955,16 @@ void reportEOF() { em.sync(); } -string stringbuild; +position stringpos; // The position of the start of the string. +string stringbuild; // Stores the string literal as it is read. namespace { +void startstring() +{ + adjust(); + stringpos = here(); +} + void append(char c) { stringbuild.push_back(c); @@ -971,7 +974,7 @@ void append(char c) void getstring(void) { // NOTE: Replace here() with a position at the start of the string. - makesymbol(false,stringbuild); + yylval.stre = new stringExp(stringpos, stringbuild); string().swap(stringbuild); } } @@ -981,7 +984,7 @@ void getstring(void) -#line 985 "lex.yy.cc" +#line 988 "lex.yy.cc" #define INITIAL 0 #define lexcomment 1 @@ -1228,10 +1231,10 @@ YY_DECL register int yy_act; /* %% [7.0] user's declarations go here */ -#line 198 "camp.l" +#line 201 "camp.l" -#line 1235 "lex.yy.cc" +#line 1238 "lex.yy.cc" if ( !(yy_init) ) { @@ -1347,23 +1350,23 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 201 "camp.l" +#line 204 "camp.l" {adjust(); /*commentDepth++;*/} YY_BREAK case 2: YY_RULE_SETUP -#line 202 "camp.l" +#line 205 "camp.l" {adjust(); /*commentDepth--;*/ /*if (commentDepth == 0)*/ BEGIN INITIAL; } YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 204 "camp.l" +#line 207 "camp.l" {adjust(); newline(); continue; } YY_BREAK case YY_STATE_EOF(lexcomment): -#line 205 "camp.l" +#line 208 "camp.l" {adjust(); setEOF("comment not terminated"); BEGIN INITIAL; @@ -1372,7 +1375,7 @@ case YY_STATE_EOF(lexcomment): YY_BREAK case 4: YY_RULE_SETUP -#line 210 "camp.l" +#line 213 "camp.l" {adjust(); continue; } YY_BREAK @@ -1383,19 +1386,19 @@ case 5: (yy_c_buf_p) = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 214 "camp.l" +#line 217 "camp.l" {adjust(); BEGIN INITIAL;} YY_BREAK case 6: YY_RULE_SETUP -#line 215 "camp.l" +#line 218 "camp.l" {adjust(); BEGIN INITIAL; getstring(); return STRING; } YY_BREAK case YY_STATE_EOF(texstring): -#line 219 "camp.l" +#line 222 "camp.l" {adjust(); setEOF("string not terminated"); BEGIN INITIAL; @@ -1406,22 +1409,22 @@ case YY_STATE_EOF(texstring): case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 225 "camp.l" +#line 228 "camp.l" {adjust(); newline(); append('\n'); continue; } YY_BREAK case 8: YY_RULE_SETUP -#line 226 "camp.l" +#line 229 "camp.l" {adjust(); append('\\'); append('\\'); continue; } YY_BREAK case 9: YY_RULE_SETUP -#line 227 "camp.l" +#line 230 "camp.l" {adjust(); append('\"'); continue; } YY_BREAK case 10: YY_RULE_SETUP -#line 228 "camp.l" +#line 231 "camp.l" {adjust(); append(*yytext); } YY_BREAK @@ -1432,19 +1435,19 @@ case 11: (yy_c_buf_p) = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 232 "camp.l" +#line 235 "camp.l" {adjust(); BEGIN INITIAL;} YY_BREAK case 12: YY_RULE_SETUP -#line 233 "camp.l" +#line 236 "camp.l" {adjust(); BEGIN INITIAL; getstring(); return STRING; } YY_BREAK case YY_STATE_EOF(cstring): -#line 237 "camp.l" +#line 240 "camp.l" {adjust(); setEOF("string not terminated"); BEGIN INITIAL; @@ -1455,52 +1458,52 @@ case YY_STATE_EOF(cstring): case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 243 "camp.l" +#line 246 "camp.l" {adjust(); newline(); append('\n'); continue; } YY_BREAK case 14: YY_RULE_SETUP -#line 244 "camp.l" +#line 247 "camp.l" {adjust(); append(yytext[1]); continue; } YY_BREAK case 15: YY_RULE_SETUP -#line 245 "camp.l" +#line 248 "camp.l" {adjust(); append('\a'); continue; } YY_BREAK case 16: YY_RULE_SETUP -#line 246 "camp.l" +#line 249 "camp.l" {adjust(); append('\b'); continue; } YY_BREAK case 17: YY_RULE_SETUP -#line 247 "camp.l" +#line 250 "camp.l" {adjust(); append('\f'); continue; } YY_BREAK case 18: YY_RULE_SETUP -#line 248 "camp.l" +#line 251 "camp.l" {adjust(); append('\n'); continue; } YY_BREAK case 19: YY_RULE_SETUP -#line 249 "camp.l" +#line 252 "camp.l" {adjust(); append('\r'); continue; } YY_BREAK case 20: YY_RULE_SETUP -#line 250 "camp.l" +#line 253 "camp.l" {adjust(); append('\t'); continue; } YY_BREAK case 21: YY_RULE_SETUP -#line 251 "camp.l" +#line 254 "camp.l" {adjust(); append('\v'); continue; } YY_BREAK case 22: YY_RULE_SETUP -#line 252 "camp.l" +#line 255 "camp.l" {adjust(); char x=(char)(yytext[1]-'0'); append(x); @@ -1509,7 +1512,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 257 "camp.l" +#line 260 "camp.l" {adjust(); char x=(char)((yytext[1]-'0')*8+yytext[2]-'0'); append(x); @@ -1518,7 +1521,7 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 262 "camp.l" +#line 265 "camp.l" {adjust(); char x=(char)((yytext[1]-'0')*64+(yytext[2]-'0')*8 +yytext[3]-'0'); @@ -1528,7 +1531,7 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 268 "camp.l" +#line 271 "camp.l" {adjust(); char x=(char) (yytext[2] <= '9' ? yytext[2]-'0' : 10+yytext[2]-'A'); @@ -1538,7 +1541,7 @@ YY_RULE_SETUP YY_BREAK case 26: YY_RULE_SETUP -#line 274 "camp.l" +#line 277 "camp.l" {adjust(); char x=(char) ((yytext[2] <= '9' ? yytext[2]-'0' : 10+yytext[2]-'A')*16 @@ -1550,390 +1553,390 @@ YY_RULE_SETUP YY_BREAK case 27: YY_RULE_SETUP -#line 282 "camp.l" +#line 285 "camp.l" {adjust(); append(*yytext); } YY_BREAK case 28: YY_RULE_SETUP -#line 285 "camp.l" +#line 288 "camp.l" {adjust(); continue;} YY_BREAK case 29: /* rule 29 can match eol */ YY_RULE_SETUP -#line 286 "camp.l" +#line 289 "camp.l" {adjust(); newline(); continue;} YY_BREAK case 30: YY_RULE_SETUP -#line 287 "camp.l" +#line 290 "camp.l" {adjust(); continue;} YY_BREAK case 31: YY_RULE_SETUP -#line 288 "camp.l" +#line 291 "camp.l" {adjust(); return ','; } YY_BREAK case 32: YY_RULE_SETUP -#line 289 "camp.l" +#line 292 "camp.l" {adjust(); return ':'; } YY_BREAK case 33: YY_RULE_SETUP -#line 290 "camp.l" +#line 293 "camp.l" {adjust(); return ';'; } YY_BREAK case 34: YY_RULE_SETUP -#line 291 "camp.l" +#line 294 "camp.l" {adjust(); return '('; } YY_BREAK case 35: YY_RULE_SETUP -#line 292 "camp.l" +#line 295 "camp.l" {adjust(); return ')'; } YY_BREAK case 36: YY_RULE_SETUP -#line 293 "camp.l" +#line 296 "camp.l" {adjust(); return '['; } YY_BREAK case 37: YY_RULE_SETUP -#line 294 "camp.l" +#line 297 "camp.l" {adjust(); return ']'; } YY_BREAK case 38: YY_RULE_SETUP -#line 295 "camp.l" +#line 298 "camp.l" {adjust(); return '{'; } YY_BREAK case 39: YY_RULE_SETUP -#line 296 "camp.l" +#line 299 "camp.l" {adjust(); return '}'; } YY_BREAK case 40: YY_RULE_SETUP -#line 297 "camp.l" +#line 300 "camp.l" {adjust(); return '.'; } YY_BREAK case 41: YY_RULE_SETUP -#line 298 "camp.l" +#line 301 "camp.l" {adjust(); return ELLIPSIS; } YY_BREAK case 42: YY_RULE_SETUP -#line 300 "camp.l" +#line 303 "camp.l" {DEFSYMBOL(SYM_PLUS); return '+'; } YY_BREAK case 43: YY_RULE_SETUP -#line 301 "camp.l" +#line 304 "camp.l" {DEFSYMBOL(SYM_MINUS); return '-'; } YY_BREAK case 44: YY_RULE_SETUP -#line 302 "camp.l" +#line 305 "camp.l" {DEFSYMBOL(SYM_TIMES); return '*'; } YY_BREAK case 45: YY_RULE_SETUP -#line 303 "camp.l" +#line 306 "camp.l" {DEFSYMBOL(SYM_DIVIDE); return '/'; } YY_BREAK case 46: YY_RULE_SETUP -#line 304 "camp.l" +#line 307 "camp.l" {DEFSYMBOL(SYM_MOD); return '%'; } YY_BREAK case 47: YY_RULE_SETUP -#line 305 "camp.l" +#line 308 "camp.l" {DEFSYMBOL(SYM_CARET); return '^'; } YY_BREAK case 48: YY_RULE_SETUP -#line 306 "camp.l" +#line 309 "camp.l" {savesymbol(SYM_CARET); return '^'; } YY_BREAK case 49: YY_RULE_SETUP -#line 307 "camp.l" +#line 310 "camp.l" {adjust(); return '?'; } YY_BREAK case 50: YY_RULE_SETUP -#line 308 "camp.l" +#line 311 "camp.l" {adjust(); return ASSIGN; } YY_BREAK case 51: YY_RULE_SETUP -#line 309 "camp.l" +#line 312 "camp.l" {DEFSYMBOL(SYM_EQ); return EQ; } YY_BREAK case 52: YY_RULE_SETUP -#line 310 "camp.l" +#line 313 "camp.l" {DEFSYMBOL(SYM_NEQ); return NEQ; } YY_BREAK case 53: YY_RULE_SETUP -#line 311 "camp.l" +#line 314 "camp.l" {DEFSYMBOL(SYM_LT); return LT; } YY_BREAK case 54: YY_RULE_SETUP -#line 312 "camp.l" +#line 315 "camp.l" {DEFSYMBOL(SYM_LE); return LE; } YY_BREAK case 55: YY_RULE_SETUP -#line 313 "camp.l" +#line 316 "camp.l" {DEFSYMBOL(SYM_GT); return GT; } YY_BREAK case 56: YY_RULE_SETUP -#line 314 "camp.l" +#line 317 "camp.l" {DEFSYMBOL(SYM_GE); return GE; } YY_BREAK case 57: YY_RULE_SETUP -#line 315 "camp.l" +#line 318 "camp.l" {DEFSYMBOL(SYM_CAND); return CAND; } YY_BREAK case 58: YY_RULE_SETUP -#line 316 "camp.l" +#line 319 "camp.l" {DEFSYMBOL(SYM_COR); return COR; } YY_BREAK case 59: YY_RULE_SETUP -#line 317 "camp.l" +#line 320 "camp.l" {DEFSYMBOL(SYM_LOGNOT); return LOGNOT; } YY_BREAK case 60: YY_RULE_SETUP -#line 318 "camp.l" +#line 321 "camp.l" {DEFSYMBOL(SYM_CARETS); return CARETS; } YY_BREAK case 61: YY_RULE_SETUP -#line 319 "camp.l" +#line 322 "camp.l" {DEFSYMBOL(SYM_COLONS); return COLONS; } YY_BREAK case 62: YY_RULE_SETUP -#line 320 "camp.l" +#line 323 "camp.l" {DEFSYMBOL(SYM_INCR); return INCR; } YY_BREAK case 63: YY_RULE_SETUP -#line 321 "camp.l" +#line 324 "camp.l" {DEFSYMBOL(SYM_DOTS); return DOTS; } YY_BREAK case 64: YY_RULE_SETUP -#line 322 "camp.l" +#line 325 "camp.l" {DEFSYMBOL(SYM_DASHES); return DASHES; } YY_BREAK case 65: YY_RULE_SETUP -#line 323 "camp.l" +#line 326 "camp.l" {DEFSYMBOL(SYM_LONGDASH); return LONGDASH; } YY_BREAK case 66: YY_RULE_SETUP -#line 324 "camp.l" +#line 327 "camp.l" {DEFSYMBOL(SYM_AMPERSAND); return AMPERSAND; } YY_BREAK case 67: YY_RULE_SETUP -#line 325 "camp.l" +#line 328 "camp.l" {DEFSYMBOL(SYM_BAR); return BAR; } YY_BREAK case 68: YY_RULE_SETUP -#line 326 "camp.l" -{makesymbol(); return OPERATOR; } +#line 329 "camp.l" +{makeopsymbol(); return OPERATOR; } YY_BREAK case 69: YY_RULE_SETUP -#line 328 "camp.l" -{makeselfsymbol(); return ADD; } +#line 331 "camp.l" +{savesymbol(SYM_PLUS); return SELFOP; } YY_BREAK case 70: YY_RULE_SETUP -#line 329 "camp.l" -{makeselfsymbol(); return SUBTRACT; } +#line 332 "camp.l" +{savesymbol(SYM_MINUS); return SELFOP; } YY_BREAK case 71: YY_RULE_SETUP -#line 330 "camp.l" -{makeselfsymbol(); return TIMES; } +#line 333 "camp.l" +{savesymbol(SYM_TIMES); return SELFOP; } YY_BREAK case 72: YY_RULE_SETUP -#line 331 "camp.l" -{makeselfsymbol(); return DIVIDE; } +#line 334 "camp.l" +{savesymbol(SYM_DIVIDE); return SELFOP; } YY_BREAK case 73: YY_RULE_SETUP -#line 332 "camp.l" -{makeselfsymbol(); return MOD; } +#line 335 "camp.l" +{savesymbol(SYM_MOD); return SELFOP; } YY_BREAK case 74: YY_RULE_SETUP -#line 333 "camp.l" -{makeselfsymbol(); return EXPONENT; } +#line 336 "camp.l" +{savesymbol(SYM_CARET); return SELFOP; } YY_BREAK case 75: YY_RULE_SETUP -#line 335 "camp.l" +#line 338 "camp.l" {adjust(); return AND; } YY_BREAK case 76: YY_RULE_SETUP -#line 336 "camp.l" +#line 339 "camp.l" {DEFSYMBOL(SYM_CONTROLS); return CONTROLS; } YY_BREAK case 77: YY_RULE_SETUP -#line 337 "camp.l" +#line 340 "camp.l" {DEFSYMBOL(SYM_TENSION); return TENSION; } YY_BREAK case 78: YY_RULE_SETUP -#line 338 "camp.l" +#line 341 "camp.l" {DEFSYMBOL(SYM_ATLEAST); return ATLEAST; } YY_BREAK case 79: YY_RULE_SETUP -#line 339 "camp.l" +#line 342 "camp.l" {DEFSYMBOL(SYM_CURL); return CURL; } YY_BREAK case 80: YY_RULE_SETUP -#line 341 "camp.l" +#line 344 "camp.l" {adjust(); return IF; } YY_BREAK case 81: YY_RULE_SETUP -#line 342 "camp.l" +#line 345 "camp.l" {adjust(); return ELSE; } YY_BREAK case 82: YY_RULE_SETUP -#line 343 "camp.l" +#line 346 "camp.l" {adjust(); return WHILE; } YY_BREAK case 83: YY_RULE_SETUP -#line 344 "camp.l" +#line 347 "camp.l" {adjust(); return FOR; } YY_BREAK case 84: YY_RULE_SETUP -#line 345 "camp.l" +#line 348 "camp.l" {adjust(); return DO; } YY_BREAK case 85: YY_RULE_SETUP -#line 346 "camp.l" +#line 349 "camp.l" {adjust(); return RETURN_; } YY_BREAK case 86: YY_RULE_SETUP -#line 347 "camp.l" +#line 350 "camp.l" {adjust(); return BREAK; } YY_BREAK case 87: YY_RULE_SETUP -#line 348 "camp.l" +#line 351 "camp.l" {adjust(); return CONTINUE; } YY_BREAK case 88: YY_RULE_SETUP -#line 349 "camp.l" +#line 352 "camp.l" {adjust(); return STRUCT; } YY_BREAK case 89: YY_RULE_SETUP -#line 350 "camp.l" +#line 353 "camp.l" {adjust(); return TYPEDEF; } YY_BREAK case 90: YY_RULE_SETUP -#line 351 "camp.l" +#line 354 "camp.l" {adjust(); return NEW; } YY_BREAK case 91: YY_RULE_SETUP -#line 352 "camp.l" +#line 355 "camp.l" {adjust(); return ACCESS; } YY_BREAK case 92: YY_RULE_SETUP -#line 353 "camp.l" +#line 356 "camp.l" {adjust(); return IMPORT; } YY_BREAK case 93: YY_RULE_SETUP -#line 354 "camp.l" +#line 357 "camp.l" {adjust(); return UNRAVEL; } YY_BREAK case 94: YY_RULE_SETUP -#line 355 "camp.l" +#line 358 "camp.l" {adjust(); return FROM; } YY_BREAK case 95: YY_RULE_SETUP -#line 356 "camp.l" +#line 359 "camp.l" {adjust(); return INCLUDE; } YY_BREAK case 96: YY_RULE_SETUP -#line 357 "camp.l" +#line 360 "camp.l" {adjust(); return QUOTE; } YY_BREAK case 97: YY_RULE_SETUP -#line 358 "camp.l" +#line 361 "camp.l" {adjust(); makemod(trans::EXPLICIT_STATIC); return MODIFIER; } YY_BREAK case 98: YY_RULE_SETUP -#line 360 "camp.l" +#line 363 "camp.l" {adjust(); makeperm(trans::PUBLIC); return PERM; } YY_BREAK case 99: YY_RULE_SETUP -#line 361 "camp.l" +#line 364 "camp.l" {adjust(); makeperm(trans::PRIVATE); return PERM; } YY_BREAK case 100: YY_RULE_SETUP -#line 362 "camp.l" +#line 365 "camp.l" {adjust(); makeperm(trans::RESTRICTED); return PERM; } YY_BREAK case 101: YY_RULE_SETUP -#line 363 "camp.l" +#line 366 "camp.l" {adjust(); return THIS; } YY_BREAK case 102: YY_RULE_SETUP -#line 364 "camp.l" +#line 367 "camp.l" {adjust(); return EXPLICIT; } YY_BREAK case 103: YY_RULE_SETUP -#line 367 "camp.l" +#line 370 "camp.l" try { adjust(); yylval.e= new intExp(here(), lexical::cast<Int>(yytext)); } catch (lexical::bad_cast&) { @@ -1944,7 +1947,7 @@ try { YY_BREAK case 104: YY_RULE_SETUP -#line 374 "camp.l" +#line 377 "camp.l" try { adjust(); yylval.e= new realExp(here(), lexical::cast<double>(yytext)); } catch (lexical::bad_cast&) { @@ -1955,53 +1958,53 @@ try { YY_BREAK case 105: YY_RULE_SETUP -#line 381 "camp.l" +#line 384 "camp.l" { adjust(); yylval.e= new booleanExp(here(), true); return LIT; } YY_BREAK case 106: YY_RULE_SETUP -#line 383 "camp.l" +#line 386 "camp.l" { adjust(); yylval.e= new booleanExp(here(), false); return LIT; } YY_BREAK case 107: YY_RULE_SETUP -#line 385 "camp.l" +#line 388 "camp.l" { adjust(); yylval.e= new nullExp(here()); return LIT; } YY_BREAK case 108: YY_RULE_SETUP -#line 387 "camp.l" +#line 390 "camp.l" { adjust(); yylval.e= new cycleExp(here()); return LIT; } YY_BREAK case 109: YY_RULE_SETUP -#line 389 "camp.l" +#line 392 "camp.l" { adjust(); yylval.e= new newPictureExp(here()); return LIT; } YY_BREAK case 110: YY_RULE_SETUP -#line 392 "camp.l" +#line 395 "camp.l" {adjust(); BEGIN opname; } YY_BREAK case 111: YY_RULE_SETUP -#line 394 "camp.l" +#line 397 "camp.l" {adjust(); continue;} YY_BREAK case 112: /* rule 112 can match eol */ YY_RULE_SETUP -#line 395 "camp.l" +#line 398 "camp.l" {adjust(); newline(); continue;} YY_BREAK case YY_STATE_EOF(opname): -#line 396 "camp.l" +#line 399 "camp.l" {adjust(); setEOF("missing operator name"); BEGIN INITIAL; @@ -2010,73 +2013,77 @@ case YY_STATE_EOF(opname): YY_BREAK case 113: YY_RULE_SETUP -#line 401 "camp.l" -{ makesymbol(true, "^"); +#line 404 "camp.l" +{ savesymbol(SYM_CARET); BEGIN INITIAL; return ID; } YY_BREAK case 114: YY_RULE_SETUP -#line 405 "camp.l" +#line 408 "camp.l" { - makesymbol(); + makeopsymbol(); BEGIN INITIAL; return ID;} YY_BREAK case 115: YY_RULE_SETUP -#line 409 "camp.l" +#line 412 "camp.l" { - makesymbol(true); + makeopsymbol(); BEGIN INITIAL; return ID; } YY_BREAK case 116: YY_RULE_SETUP -#line 413 "camp.l" +#line 416 "camp.l" {} YY_BREAK case 117: YY_RULE_SETUP -#line 416 "camp.l" +#line 419 "camp.l" { - makesymbol(false); + makesymbol(); return ID; } YY_BREAK case 118: YY_RULE_SETUP -#line 420 "camp.l" +#line 423 "camp.l" {adjust(); /*commentDepth = 1;*/ BEGIN lexcomment; } YY_BREAK case 119: YY_RULE_SETUP -#line 421 "camp.l" -{adjust(); BEGIN texstring; } +#line 424 "camp.l" +{startstring(); BEGIN texstring; } YY_BREAK case 120: YY_RULE_SETUP -#line 422 "camp.l" -{adjust(); BEGIN cstring; } +#line 425 "camp.l" +{startstring(); BEGIN cstring; } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(lexformat): -#line 424 "camp.l" +#line 427 "camp.l" { setEOF("unexpected end of input"); yyterminate(); } YY_BREAK case 121: YY_RULE_SETUP -#line 426 "camp.l" -{ - adjust(); error(); em <<"invalid token '" << yytext << "'"; } +#line 429 "camp.l" +{adjust(); + error(); + em << "invalid token"; + if (isgraph(yytext[0])) + em << " '" << yytext[0] << "'"; + } YY_BREAK case 122: YY_RULE_SETUP -#line 429 "camp.l" +#line 435 "camp.l" ECHO; YY_BREAK -#line 2080 "lex.yy.cc" +#line 2087 "lex.yy.cc" case YY_END_OF_BUFFER: { @@ -3209,4 +3216,4 @@ void yyfree (void * ptr ) /* %ok-for-header */ -#line 429 "camp.l" +#line 435 "camp.l" diff --git a/Build/source/utils/asymptote/name.cc b/Build/source/utils/asymptote/name.cc index ac3ad8e70df..b3853b5a91c 100644 --- a/Build/source/utils/asymptote/name.cc +++ b/Build/source/utils/asymptote/name.cc @@ -87,7 +87,7 @@ void simpleName::varTrans(action act, coenv &e, types::ty *target) } else { em.error(getPos()); - em << "no matching variable of name \'" << *id << "\'"; + em << "no matching variable of name \'" << id << "\'"; } } @@ -111,7 +111,7 @@ types::ty *simpleName::typeTrans(coenv &e, bool tacit) else { if (!tacit) { em.error(getPos()); - em << "no type of name \'" << *id << "\'"; + em << "no type of name \'" << id << "\'"; } return primError(); } @@ -122,7 +122,7 @@ tyEntry *simpleName::tyEntryTrans(coenv &e) tyEntry *ent = e.e.lookupTyEntry(id); if (!ent) { em.error(getPos()); - em << "no type of name \'" << *id << "\'"; + em << "no type of name \'" << id << "\'"; return new tyEntry(primError(), 0, 0, position()); } return ent; @@ -142,7 +142,7 @@ frame *simpleName::tyFrameTrans(coenv &e) void simpleName::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "simpleName '" << *id << "'\n"; + out << "simpleName '" << id << "'\n"; } @@ -202,7 +202,7 @@ void qualifiedName::varTransField(action act, coenv &e, } else { em.error(getPos()); - em << "no matching field of name \'" << *id << "\' in \'" << *r << "\'"; + em << "no matching field of name \'" << id << "\' in \'" << *r << "\'"; } } @@ -237,6 +237,7 @@ trans::varEntry *qualifiedName::getCallee(coenv &e, signature *sig) // getTypeAsCallee is an optimization attempt. We don't try optimizing the // rarer qualifiedName call case. // TODO: See if this is worth implementing. + //cout << "FAIL BY QUALIFIED NAME" << endl; return 0; } @@ -272,7 +273,7 @@ types::ty *qualifiedName::typeTrans(coenv &e, bool tacit) else { if (!tacit) { em.error(getPos()); - em << "no matching field or type of name \'" << *id << "\' in \'" + em << "no matching field or type of name \'" << id << "\' in \'" << *r << "\'"; } return primError(); @@ -290,7 +291,7 @@ tyEntry *qualifiedName::tyEntryTrans(coenv &e) tyEntry *ent = r->e.lookupTyEntry(id); if (!ent) { em.error(getPos()); - em << "no matching type of name \'" << *id << "\' in \'" + em << "no matching type of name \'" << id << "\' in \'" << *r << "\'"; return new tyEntry(primError(), 0, 0, position()); } @@ -317,7 +318,7 @@ frame *qualifiedName::tyFrameTrans(coenv &e) void qualifiedName::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "qualifiedName '" << *id << "'\n"; + out << "qualifiedName '" << id << "'\n"; qualifier->prettyprint(out, indent+1); } diff --git a/Build/source/utils/asymptote/name.h b/Build/source/utils/asymptote/name.h index b72111d33b2..a10168d9f46 100644 --- a/Build/source/utils/asymptote/name.h +++ b/Build/source/utils/asymptote/name.h @@ -87,7 +87,7 @@ public: out << "<base name>"; } - virtual symbol *getName() = 0; + virtual symbol getName() = 0; }; inline ostream& operator<< (ostream& out, const name& n) { @@ -96,10 +96,10 @@ inline ostream& operator<< (ostream& out, const name& n) { } class simpleName : public name { - symbol *id; + symbol id; public: - simpleName(position pos, symbol *id) + simpleName(position pos, symbol id) : name(pos), id(id) {} trans::varEntry *getVarEntry(coenv &e); @@ -116,9 +116,9 @@ public: void prettyprint(ostream &out, Int indent); void print(ostream& out) const { - out << *id; + out << id; } - symbol *getName() { + symbol getName() { return id; } }; @@ -126,7 +126,7 @@ public: class qualifiedName : public name { name *qualifier; - symbol *id; + symbol id; // Gets the record type associated with the qualifier. Reports an // error and returns null if the type is not a record. @@ -141,7 +141,7 @@ class qualifiedName : public name { void varTransField(action act, coenv &e, types::ty *target, record *r); public: - qualifiedName(position pos, name *qualifier, symbol *id) + qualifiedName(position pos, name *qualifier, symbol id) : name(pos), qualifier(qualifier), id(id) {} trans::varEntry *getVarEntry(coenv &e); @@ -158,9 +158,9 @@ public: void prettyprint(ostream &out, Int indent); void print(ostream& out) const { - out << *qualifier << "." << *id; + out << *qualifier << "." << id; } - symbol *getName() { + symbol getName() { return id; } }; diff --git a/Build/source/utils/asymptote/opsymbols.h b/Build/source/utils/asymptote/opsymbols.h index a385529ae29..94f3878dcb8 100644 --- a/Build/source/utils/asymptote/opsymbols.h +++ b/Build/source/utils/asymptote/opsymbols.h @@ -8,114 +8,114 @@ // symbols. #ifndef OPSYMBOL -#define OPSYMBOL(str, name) extern symbol *name +#define OPSYMBOL(str, name) extern sym::symbol name #endif OPSYMBOL("+", SYM_PLUS); #ifndef PRESYM -#define SYM_PLUS symbol::opTrans("+") +#define SYM_PLUS sym::symbol::opTrans("+") #endif OPSYMBOL("-", SYM_MINUS); #ifndef PRESYM -#define SYM_MINUS symbol::opTrans("-") +#define SYM_MINUS sym::symbol::opTrans("-") #endif OPSYMBOL("*", SYM_TIMES); #ifndef PRESYM -#define SYM_TIMES symbol::opTrans("*") +#define SYM_TIMES sym::symbol::opTrans("*") #endif OPSYMBOL("/", SYM_DIVIDE); #ifndef PRESYM -#define SYM_DIVIDE symbol::opTrans("/") +#define SYM_DIVIDE sym::symbol::opTrans("/") #endif OPSYMBOL("%", SYM_MOD); #ifndef PRESYM -#define SYM_MOD symbol::opTrans("%") +#define SYM_MOD sym::symbol::opTrans("%") #endif OPSYMBOL("^", SYM_CARET); #ifndef PRESYM -#define SYM_CARET symbol::opTrans("^") +#define SYM_CARET sym::symbol::opTrans("^") #endif OPSYMBOL("==", SYM_EQ); #ifndef PRESYM -#define SYM_EQ symbol::opTrans("==") +#define SYM_EQ sym::symbol::opTrans("==") #endif OPSYMBOL("!=", SYM_NEQ); #ifndef PRESYM -#define SYM_NEQ symbol::opTrans("!=") +#define SYM_NEQ sym::symbol::opTrans("!=") #endif OPSYMBOL("<", SYM_LT); #ifndef PRESYM -#define SYM_LT symbol::opTrans("<") +#define SYM_LT sym::symbol::opTrans("<") #endif OPSYMBOL("<=", SYM_LE); #ifndef PRESYM -#define SYM_LE symbol::opTrans("<=") +#define SYM_LE sym::symbol::opTrans("<=") #endif OPSYMBOL(">", SYM_GT); #ifndef PRESYM -#define SYM_GT symbol::opTrans(">") +#define SYM_GT sym::symbol::opTrans(">") #endif OPSYMBOL(">=", SYM_GE); #ifndef PRESYM -#define SYM_GE symbol::opTrans(">=") +#define SYM_GE sym::symbol::opTrans(">=") #endif OPSYMBOL("&&", SYM_CAND); #ifndef PRESYM -#define SYM_CAND symbol::opTrans("&&") +#define SYM_CAND sym::symbol::opTrans("&&") #endif OPSYMBOL("||", SYM_COR); #ifndef PRESYM -#define SYM_COR symbol::opTrans("||") +#define SYM_COR sym::symbol::opTrans("||") #endif OPSYMBOL("!", SYM_LOGNOT); #ifndef PRESYM -#define SYM_LOGNOT symbol::opTrans("!") +#define SYM_LOGNOT sym::symbol::opTrans("!") #endif OPSYMBOL("^^", SYM_CARETS); #ifndef PRESYM -#define SYM_CARETS symbol::opTrans("^^") +#define SYM_CARETS sym::symbol::opTrans("^^") #endif OPSYMBOL("::", SYM_COLONS); #ifndef PRESYM -#define SYM_COLONS symbol::opTrans("::") +#define SYM_COLONS sym::symbol::opTrans("::") #endif OPSYMBOL("++", SYM_INCR); #ifndef PRESYM -#define SYM_INCR symbol::opTrans("++") +#define SYM_INCR sym::symbol::opTrans("++") #endif OPSYMBOL("..", SYM_DOTS); #ifndef PRESYM -#define SYM_DOTS symbol::opTrans("..") +#define SYM_DOTS sym::symbol::opTrans("..") #endif OPSYMBOL("--", SYM_DASHES); #ifndef PRESYM -#define SYM_DASHES symbol::opTrans("--") +#define SYM_DASHES sym::symbol::opTrans("--") #endif OPSYMBOL("---", SYM_LONGDASH); #ifndef PRESYM -#define SYM_LONGDASH symbol::opTrans("---") +#define SYM_LONGDASH sym::symbol::opTrans("---") #endif OPSYMBOL("&", SYM_AMPERSAND); #ifndef PRESYM -#define SYM_AMPERSAND symbol::opTrans("&") +#define SYM_AMPERSAND sym::symbol::opTrans("&") #endif OPSYMBOL("|", SYM_BAR); #ifndef PRESYM -#define SYM_BAR symbol::opTrans("|") +#define SYM_BAR sym::symbol::opTrans("|") #endif OPSYMBOL("controls", SYM_CONTROLS); #ifndef PRESYM -#define SYM_CONTROLS symbol::opTrans("controls") +#define SYM_CONTROLS sym::symbol::opTrans("controls") #endif OPSYMBOL("tension", SYM_TENSION); #ifndef PRESYM -#define SYM_TENSION symbol::opTrans("tension") +#define SYM_TENSION sym::symbol::opTrans("tension") #endif OPSYMBOL("atleast", SYM_ATLEAST); #ifndef PRESYM -#define SYM_ATLEAST symbol::opTrans("atleast") +#define SYM_ATLEAST sym::symbol::opTrans("atleast") #endif OPSYMBOL("curl", SYM_CURL); #ifndef PRESYM -#define SYM_CURL symbol::opTrans("curl") +#define SYM_CURL sym::symbol::opTrans("curl") #endif diff --git a/Build/source/utils/asymptote/opsymbols.pl b/Build/source/utils/asymptote/opsymbols.pl index 16ade5374ac..3f18388bc53 100644 --- a/Build/source/utils/asymptote/opsymbols.pl +++ b/Build/source/utils/asymptote/opsymbols.pl @@ -20,7 +20,7 @@ print header <<END; // symbols. #ifndef OPSYMBOL -#define OPSYMBOL(str, name) extern symbol *name +#define OPSYMBOL(str, name) extern sym::symbol name #endif END @@ -31,7 +31,7 @@ sub add { my $name = $_[1]; print header <<END; #ifndef PRESYM -#define $name symbol::opTrans("$sym") +#define $name sym::symbol::opTrans("$sym") #endif END } @@ -40,14 +40,10 @@ open(lexer, "camp.l") || die("Couldn't open camp.l"); while (<lexer>) { - #print $_; - #if (m/^"(\S+)"\s+\{\s+DEFSYMBOL\((\w+)\);/) { if (m/^"(\S+)"\s*{\s*DEFSYMBOL\((\w+)\);/) { - print $1 . " " . $2 . "\n"; add($1, $2); } if (m/^(\w+)\s*{\s*DEFSYMBOL\((\w+)\);/) { - print $1 . " " . $2 . "\n"; add($1, $2); } } diff --git a/Build/source/utils/asymptote/patches/README b/Build/source/utils/asymptote/patches/README index d0bf81e8bc1..0c9e0302f2d 100644 --- a/Build/source/utils/asymptote/patches/README +++ b/Build/source/utils/asymptote/patches/README @@ -20,3 +20,8 @@ http://cvs.ktug.or.kr/viewcvs/dvipdfmx/contrib/latex/movie15.sty.sample?revision up-to-date with the official 2008/10/08 version. For convenience the patched version is also included as movie15_dvipdfmx.sty; it should be renamed to movie15.sty and installed in the local latex directory. + +The fixmem.reg patches the Microsoft Windows registry so that the cygwin1.dll +library can allocate more than 384MB. It is applied automatically by the +Asymptote setup.exe file but may also be applied manually: +regedit/s fixmem.reg diff --git a/Build/source/utils/asymptote/patches/fixmem.reg b/Build/source/utils/asymptote/patches/fixmem.reg new file mode 100644 index 00000000000..bdf09d9ad11 --- /dev/null +++ b/Build/source/utils/asymptote/patches/fixmem.reg @@ -0,0 +1,4 @@ +Windows Registry Editor Version 5.00
+
+[HKEY_LOCAL_MACHINE\Software\Cygwin]
+"heap_chunk_in_mb"=dword:ffffff00
diff --git a/Build/source/utils/asymptote/path.cc b/Build/source/utils/asymptote/path.cc index e531e207b80..8e05603f05c 100644 --- a/Build/source/utils/asymptote/path.cc +++ b/Build/source/utils/asymptote/path.cc @@ -1248,7 +1248,7 @@ bool checkcurve(const pair& z0, const pair& c0, const pair& c1, // the path. Int path::windingnumber(const pair& z) const { - static const Int undefined=Int_MAX+((Int_MAX % 2)-1);; + static const Int undefined=Int_MAX % 2 ? Int_MAX : Int_MAX-1; if(!cycles) reportError("path is not cyclic"); diff --git a/Build/source/utils/asymptote/prc/PRC.h b/Build/source/utils/asymptote/prc/PRC.h index da1aff7ef9c..eee8dcf928d 100644 --- a/Build/source/utils/asymptote/prc/PRC.h +++ b/Build/source/utils/asymptote/prc/PRC.h @@ -3,6 +3,7 @@ #include <stdint.h> +//const uint32_t PRCVersion=7094; // For Adobe Reader 8 or later const uint32_t PRCVersion=8137; // For Adobe Reader 9 or later // from Adobe's documentation diff --git a/Build/source/utils/asymptote/prc/PRCbitStream.cc b/Build/source/utils/asymptote/prc/PRCbitStream.cc index 5df27320e45..6ee4d8b45e7 100644 --- a/Build/source/utils/asymptote/prc/PRCbitStream.cc +++ b/Build/source/utils/asymptote/prc/PRCbitStream.cc @@ -270,6 +270,11 @@ PRCbitStream& PRCbitStream::operator <<(double value) PRCbitStream& PRCbitStream::operator <<(const char* s) { + if (s == NULL) + { + writeBit(false); // string is NULL + return *this; + } string str(s); *this << str; return *this; diff --git a/Build/source/utils/asymptote/prc/oPRCFile.cc b/Build/source/utils/asymptote/prc/oPRCFile.cc index 37397b1e675..bef8191d703 100644 --- a/Build/source/utils/asymptote/prc/oPRCFile.cc +++ b/Build/source/utils/asymptote/prc/oPRCFile.cc @@ -50,7 +50,6 @@ using std::string; using namespace std; -using namespace std::tr1; void PRCCompressedSection::write(ostream &out) { @@ -81,12 +80,12 @@ void PRCGlobalsSection::writeData() uint32_t i=0; // universal index for PRC standard compatibility out << (uint32_t)PRC_TYPE_ASM_FileStructureGlobals; - SingleAttributeData value = {PRCVersion}; - SingleAttribute sa(false,EMPTY_ATTRIBUTE_TITLE,KEPRCModellerAttributeTypeInt,value); - AttributeTitle iv; iv.text = "__PRC_RESERVED_ATTRIBUTE_PRCInternalVersion"; - Attribute a(false,iv,1,&sa); - Attributes as(1,&a); - ContentPRCBase(&as).write(out); + PRCSingleAttribute sa((int32_t)PRCVersion); + PRCAttribute a("__PRC_RESERVED_ATTRIBUTE_PRCInternalVersion"); + a.addKey(sa); + ContentPRCBase cb; + cb.addAttribute(a); + cb.serializeContentPRCBase(out); out << numberOfReferencedFileStructures; // no referencing of file structures out << tessellationChordHeightRatio; out << tessellationAngleDegrees; @@ -122,7 +121,7 @@ void PRCGlobalsSection::writeData() out << (uint32_t)1 // number of line patterns hard coded for now << (uint32_t)PRC_TYPE_GRAPH_LinePattern; - ContentPRCBase(&EMPTY_ATTRIBUTES,"",true,makeCADID(),0,makePRCID()).write(out); + ContentPRCBase("",true,makeCADID(),0,makePRCID()).serializeContentPRCBase(out); out << (uint32_t)0 // number of lengths << 0.0 // phase << false; // is real length @@ -146,7 +145,7 @@ void PRCTreeSection::writeData() { out << (uint32_t)(PRC_TYPE_ASM_FileStructureTree); - EMPTY_CONTENTPRCBASE.write(out); + EMPTY_CONTENTPRCBASE.serializeContentPRCBase(out); uint32_t number_of_part_definitions = part_definitions.size(); WriteUnsignedInteger (number_of_part_definitions) @@ -164,7 +163,7 @@ void PRCTreeSection::writeData() // File Structure Internal Data out << (uint32_t)(PRC_TYPE_ASM_FileStructure); - EMPTY_CONTENTPRCBASE.write(out); + EMPTY_CONTENTPRCBASE.serializeContentPRCBase(out); out << makePRCID(); // next available index out << (uint32_t)1; // product occurrence index @@ -175,7 +174,7 @@ void PRCTessellationSection::writeData() { out << (uint32_t)(PRC_TYPE_ASM_FileStructureTessellation); - EMPTY_CONTENTPRCBASE.write(out); + EMPTY_CONTENTPRCBASE.serializeContentPRCBase(out); const uint32_t number_of_tessellations = tessellations.size(); WriteUnsignedInteger (number_of_tessellations) for (uint32_t i=0;i<number_of_tessellations;i++) @@ -187,7 +186,7 @@ void PRCGeometrySection::writeData() { WriteUnsignedInteger (PRC_TYPE_ASM_FileStructureGeometry) - EMPTY_CONTENTPRCBASE.write(out); + EMPTY_CONTENTPRCBASE.serializeContentPRCBase(out); const uint32_t number_of_contexts = fileStructure->contexts.size(); WriteUnsignedInteger (number_of_contexts) for (uint32_t i=0;i<number_of_contexts;i++) @@ -200,7 +199,7 @@ void PRCExtraGeometrySection::writeData() { WriteUnsignedInteger (PRC_TYPE_ASM_FileStructureExtraGeometry) - EMPTY_CONTENTPRCBASE.write(out); + EMPTY_CONTENTPRCBASE.serializeContentPRCBase(out); const uint32_t number_of_contexts = fileStructure->contexts.size(); WriteUnsignedInteger (number_of_contexts) for (uint32_t i=0;i<number_of_contexts;i++) @@ -219,12 +218,12 @@ void PRCModelFile::writeData() out << (uint32_t)(0); // number of schemas out << (uint32_t)(PRC_TYPE_ASM_ModelFile); - SingleAttributeData value = {PRCVersion}; - SingleAttribute sa(false,EMPTY_ATTRIBUTE_TITLE,KEPRCModellerAttributeTypeInt,value); - AttributeTitle at; at.text = "__PRC_RESERVED_ATTRIBUTE_PRCInternalVersion"; - Attribute a(false,at,1,&sa); - Attributes as(1,&a); - ContentPRCBase(&as,"PRC file").write(out); + PRCSingleAttribute sa((int32_t)PRCVersion); + PRCAttribute a("__PRC_RESERVED_ATTRIBUTE_PRCInternalVersion"); + a.addKey(sa); + ContentPRCBase cb("PRC file"); + cb.addAttribute(a); + cb.serializeContentPRCBase(out); writeUnit(out,true,unit); // unit is specified, and happens to come from a CAD file @@ -410,7 +409,7 @@ uint32_t PRCHeader::getSize() return size; } -void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_definition, PRCProductOccurrence *parent_product_occurrence) +void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definition, PRCProductOccurrence *parent_product_occurrence) { const string& name = group.name; @@ -550,15 +549,15 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def if(!group.wires.empty()) { - PRCTopoContext *wireContext = new PRCTopoContext; - uint32_t context_index = addTopoContext(wireContext); - for(PRCwireList::const_iterator wit=group.wires.begin(); wit!=group.wires.end(); wit++) + PRCTopoContext *wireContext = NULL; + uint32_t context_index = getTopoContext(wireContext); + for(PRCwireList::iterator wit=group.wires.begin(); wit!=group.wires.end(); wit++) { - PRCSingleWireBody *wireBody = new PRCSingleWireBody; - const uint32_t wire_body_index = wireContext->addSingleWireBody(wireBody); PRCWireEdge *wireEdge = new PRCWireEdge; + wireEdge->curve_3d = wit->curve; + PRCSingleWireBody *wireBody = new PRCSingleWireBody; wireBody->setWireEdge(wireEdge); - wireEdge->setCurve(wit->curve); + const uint32_t wire_body_index = wireContext->addSingleWireBody(wireBody); PRCWire *wire = new PRCWire(); wire->index_of_line_style = wit->style; wire->context_id = context_index; @@ -569,7 +568,7 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def } } - const PRCfaceList &faces = group.faces; + PRCfaceList &faces = group.faces; if(!faces.empty()) { bool same_color = true; @@ -580,23 +579,27 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def same_color = false; break; } - PRCTopoContext *context = new PRCTopoContext; + PRCTopoContext *context = NULL; + const uint32_t context_index = getTopoContext(context); context->granularity = group.options.granularity; - const uint32_t context_index = addTopoContext(context); + // Acrobat 9 also does the following: + // context->tolerance = group.options.granularity; + // context->have_smallest_face_thickness = true; + // context->smallest_thickness = group.options.granularity; PRCShell *shell = new PRCShell; - for(PRCfaceList::const_iterator fit=faces.begin(); fit!=faces.end(); fit++) + for(PRCfaceList::iterator fit=faces.begin(); fit!=faces.end(); fit++) { if(fit->transform || group.options.do_break || (fit->transparent && !group.options.no_break)) { - PRCBrepData *body = new PRCBrepData; - const uint32_t body_index = context->addBrepData(body); - PRCConnex *connex = new PRCConnex; - body->addConnex(connex); PRCShell *shell = new PRCShell; - connex->addShell(shell); shell->addFace(fit->face); + PRCConnex *connex = new PRCConnex; + connex->addShell(shell); + PRCBrepData *body = new PRCBrepData; + body->addConnex(connex); + const uint32_t body_index = context->addBrepData(body); PRCBrepModel *brepmodel = new PRCBrepModel(); brepmodel->index_of_line_style = fit->style; @@ -621,11 +624,11 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def } else { - PRCBrepData *body = new PRCBrepData; - const uint32_t body_index = context->addBrepData(body); PRCConnex *connex = new PRCConnex; - body->addConnex(connex); connex->addShell(shell); + PRCBrepData *body = new PRCBrepData; + body->addConnex(connex); + const uint32_t body_index = context->addBrepData(body); PRCBrepModel *brepmodel = new PRCBrepModel(); if(same_color) brepmodel->index_of_line_style = style; @@ -636,7 +639,7 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def } } - const PRCcompfaceList &compfaces = group.compfaces; + PRCcompfaceList &compfaces = group.compfaces; if(!compfaces.empty()) { bool same_color = true; @@ -647,9 +650,8 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def same_color = false; break; } - PRCTopoContext *context = new PRCTopoContext; - context->granularity = group.options.granularity; - const uint32_t context_index = addTopoContext(context); + PRCTopoContext *context = NULL; + const uint32_t context_index = getTopoContext(context); PRCCompressedBrepData *body = new PRCCompressedBrepData; body->serial_tolerance=group.options.compression; @@ -661,12 +663,12 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def (fit->transparent && !group.options.no_break)) { PRCCompressedBrepData *body = new PRCCompressedBrepData; - const uint32_t body_index = context->addCompressedBrepData(body); body->face.push_back(fit->face); body->serial_tolerance=group.options.compression; body->brep_data_compressed_tolerance=2.8346456* group.options.compression; + const uint32_t body_index = context->addCompressedBrepData(body); PRCBrepModel *brepmodel = new PRCBrepModel(); brepmodel->index_of_line_style = fit->style; @@ -702,7 +704,7 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def PRCProductOccurrence *product_occurrence = new PRCProductOccurrence(name); - for(PRCgroupList::const_iterator it=group.groupList.begin(); it!=group.groupList.end(); it++) + for(PRCgroupList::iterator it=group.groupList.begin(); it!=group.groupList.end(); it++) { doGroup(*it, part_definition, product_occurrence); } @@ -719,6 +721,7 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def if(part_definition->representation_item.front()->index_local_coordinate_system==m1) part_definition->representation_item.front()->index_local_coordinate_system = addTransform(group.transform); parent_part_definition->addRepresentationItem(part_definition->representation_item.front()); + part_definition->representation_item.clear(); delete product_occurrence; delete part_definition; } @@ -729,14 +732,15 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def { PRCSet *set = new PRCSet(name); set->index_local_coordinate_system = addTransform(group.transform); - for(PRCRepresentationItemList::const_iterator it=part_definition->representation_item.begin(); it!=part_definition->representation_item.end(); it++) + for(PRCRepresentationItemList::iterator it=part_definition->representation_item.begin(); it!=part_definition->representation_item.end(); it++) set->addRepresentationItem(*it); + part_definition->representation_item.clear(); parent_part_definition->addSet(set); delete product_occurrence; delete part_definition; } // Third option - create product - else + else if ( !product_occurrence->index_son_occurrence.empty() || !part_definition->representation_item.empty()) { if (part_definition->representation_item.empty()) delete part_definition; @@ -744,7 +748,7 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def product_occurrence->index_part = addPartDefinition(part_definition); if (group.transform) { product_occurrence->location = group.transform; - product_occurrence->has_location = true; + group.transform = NULL; } if (parent_product_occurrence) { parent_product_occurrence->index_son_occurrence.push_back(addProductOccurrence(product_occurrence)); @@ -753,6 +757,12 @@ void oPRCFile::doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_def addProductOccurrence(product_occurrence); } } + // Last case - absolutely nothing to do + else + { + delete product_occurrence; + delete part_definition; + } } @@ -944,7 +954,7 @@ uint32_t PRCFileStructure::addPicture(EPRCPictureDataFormat format, uint32_t siz uint32_t PRCFileStructure::addTextureDefinition(PRCTextureDefinition *pTextureDefinition) { - globals.texture_definitions.push_back(PRCpTextureDefinition(pTextureDefinition)); + globals.texture_definitions.push_back(pTextureDefinition); return globals.texture_definitions.size()-1; } @@ -997,7 +1007,7 @@ uint32_t oPRCFile::addColour(const RGBAColour &colour) return style_index; } -uint32_t oPRCFile::addTransform(const PRCpGeneralTransformation3d &transform) +uint32_t oPRCFile::addTransform(PRCGeneralTransformation3d*& transform) { if(!transform) return m1; @@ -1008,6 +1018,7 @@ uint32_t oPRCFile::addTransform(const PRCpGeneralTransformation3d &transform) coordinateSystem->axis_set = transform; const uint32_t coordinate_system_index = fileStructures[0]->addCoordinateSystem(coordinateSystem); transformMap.insert(make_pair(*transform,coordinate_system_index)); + transform = NULL; return coordinate_system_index; } @@ -1047,13 +1058,18 @@ uint32_t oPRCFile::addMaterial(const PRCmaterial &material) bool isid(const double t[][4]) { - return( - t[0][0]==1 && t[0][1]==0 && t[0][2]==0 && t[0][3]==0 && - t[1][0]==0 && t[1][1]==1 && t[1][2]==0 && t[1][3]==0 && - t[2][0]==0 && t[2][1]==0 && t[2][2]==1 && t[2][3]==0 && - t[3][0]==0 && t[3][1]==0 && t[3][2]==0 && t[3][3]==1 ); + return t == NULL || + (t[0][0]==1 && t[0][1]==0 && t[0][2]==0 && t[0][3]==0 && + t[1][0]==0 && t[1][1]==1 && t[1][2]==0 && t[1][3]==0 && + t[2][0]==0 && t[2][1]==0 && t[2][2]==1 && t[2][3]==0 && + t[3][0]==0 && t[3][1]==0 && t[3][2]==0 && t[3][3]==1); +} +bool isid(const double t[]) +{ + return(isid((double (*)[4])t)); } + void oPRCFile::begingroup(const char *name, PRCoptions *options, const double t[][4]) { @@ -1065,7 +1081,7 @@ void oPRCFile::begingroup(const char *name, PRCoptions *options, group.name=name; if(options) group.options=*options; if(t&&!isid(t)) - group.transform.reset(new PRCGeneralTransformation3d(t)); + group.transform = new PRCGeneralTransformation3d(t); } void oPRCFile::endgroup() @@ -1087,7 +1103,7 @@ PRCgroup& oPRCFile::findGroup() group.wires.push_back(PRCwire()); \ PRCwire &wire = group.wires.back(); \ curvtype *curve = new curvtype; \ - wire.curve.reset(curve); \ + wire.curve = curve; \ wire.style = addColour(c); #define ADDFACE(surftype) \ @@ -1095,8 +1111,8 @@ PRCgroup& oPRCFile::findGroup() group.faces.push_back(PRCface()); \ PRCface& face = group.faces.back(); \ surftype *surface = new surftype; \ - face.face.reset(new PRCFace); \ - face.face->setSurface(surface); \ + face.face = new PRCFace; \ + face.face->base_surface = surface; \ face.transparent = m.alpha < 1.0; \ face.style = addMaterial(m); @@ -1105,7 +1121,7 @@ PRCgroup& oPRCFile::findGroup() group.compfaces.push_back(PRCcompface()); \ PRCcompface& face = group.compfaces.back(); \ PRCCompressedFace *compface = new PRCCompressedFace; \ - face.face.reset(compface); \ + face.face = compface; \ face.transparent = m.alpha < 1.0; \ face.style = addMaterial(m); @@ -1288,7 +1304,7 @@ void oPRCFile::addSurface(uint32_t dU, uint32_t dV, uint32_t nU, uint32_t nV, #define SETTRANSF \ if(t&&!isid(t)) \ - face.transform.reset(new PRCGeneralTransformation3d(t)); \ + face.transform = new PRCGeneralTransformation3d(t); \ if(origin) surface->origin.Set(origin[0],origin[1],origin[2]); \ if(x_axis) surface->x_axis.Set(x_axis[0],x_axis[1],x_axis[2]); \ if(y_axis) surface->y_axis.Set(y_axis[0],y_axis[1],y_axis[2]); \ @@ -1316,7 +1332,7 @@ void oPRCFile::addTube(uint32_t n, const double cP[][3], const double oP[][3], b center_curve->point[i].Set(cP[i][0],cP[i][1],cP[i][2]); center_curve->interval.min = 0; center_curve->interval.max = center_curve->point.size()-1; - surface->setCenterCurve(center_curve); + surface->center_curve = center_curve; PRCPolyLine *origin_curve = new PRCPolyLine; origin_curve->point.resize(n); @@ -1324,12 +1340,12 @@ void oPRCFile::addTube(uint32_t n, const double cP[][3], const double oP[][3], b origin_curve->point[i].Set(oP[i][0],oP[i][1],oP[i][2]); origin_curve->interval.min = 0; origin_curve->interval.max = origin_curve->point.size()-1; - surface->setOriginCurve(origin_curve); + surface->origin_curve = origin_curve; surface->uv_domain.min.x = 0; surface->uv_domain.max.x = 2*pi; - surface->uv_domain.min.y = center_curve->interval.min; - surface->uv_domain.max.y = center_curve->interval.max; + surface->uv_domain.min.y = 0; + surface->uv_domain.max.y = n-1; } else { @@ -1345,7 +1361,7 @@ void oPRCFile::addTube(uint32_t n, const double cP[][3], const double oP[][3], b for(uint32_t i = 1; i < 3+CENTER_NUMBER_OF_POINTS; ++i) center_curve->knot[i] = (i+2)/3; // integer division is intentional center_curve->knot[3+CENTER_NUMBER_OF_POINTS] = (3+CENTER_NUMBER_OF_POINTS+1)/3; - surface->setCenterCurve(center_curve); + surface->center_curve = center_curve; PRCNURBSCurve *origin_curve = new PRCNURBSCurve; origin_curve->is_rational = false; @@ -1359,7 +1375,7 @@ void oPRCFile::addTube(uint32_t n, const double cP[][3], const double oP[][3], b for(size_t i = 1; i < 3+ORIGIN_NUMBER_OF_POINTS; ++i) origin_curve->knot[i] = (i+2)/3; // integer division is intentional origin_curve->knot[3+ORIGIN_NUMBER_OF_POINTS] = (3+ORIGIN_NUMBER_OF_POINTS+1)/3; - surface->setOriginCurve(origin_curve); + surface->origin_curve = origin_curve; surface->uv_domain.min.x = 0; surface->uv_domain.max.x = 2*pi; @@ -1396,10 +1412,10 @@ void oPRCFile::addDisk(double radius, const PRCmaterial &m, PRCFACETRANSFORM) SETTRANSF PRCCircle *first_curve = new PRCCircle; first_curve->radius = radius; - surface->setFirstCurve(first_curve); + surface->first_curve = first_curve; PRCCircle *second_curve = new PRCCircle; second_curve->radius = 0; - surface->setSecondCurve(second_curve); + surface->second_curve = second_curve; surface->uv_domain.min.x = 0; surface->uv_domain.max.x = 1; @@ -1437,85 +1453,107 @@ void oPRCFile::addTorus(double major_radius, double minor_radius, double angle1, #undef ADDWIRE #undef SETTRANSF -uint32_t PRCFileStructure::addMaterialGeneric(PRCMaterialGeneric *pMaterialGeneric) +uint32_t PRCFileStructure::addMaterialGeneric(PRCMaterialGeneric*& pMaterialGeneric) { - globals.materials.push_back(PRCpMaterial(pMaterialGeneric)); + globals.materials.push_back(pMaterialGeneric); + pMaterialGeneric = NULL; return globals.materials.size()-1; } -uint32_t PRCFileStructure::addTextureApplication(PRCTextureApplication *pTextureApplication) +uint32_t PRCFileStructure::addTextureApplication(PRCTextureApplication*& pTextureApplication) { - globals.materials.push_back(PRCpMaterial(pTextureApplication)); + globals.materials.push_back(pTextureApplication); + pTextureApplication = NULL; return globals.materials.size()-1; } -uint32_t PRCFileStructure::addStyle(PRCStyle *pStyle) +uint32_t PRCFileStructure::addStyle(PRCStyle*& pStyle) { - globals.styles.push_back(PRCpStyle(pStyle)); + globals.styles.push_back(pStyle); + pStyle = NULL; return globals.styles.size()-1; } -uint32_t PRCFileStructure::addPartDefinition(PRCPartDefinition *pPartDefinition) +uint32_t PRCFileStructure::addPartDefinition(PRCPartDefinition*& pPartDefinition) { - tree.part_definitions.push_back(PRCpPartDefinition(pPartDefinition)); + tree.part_definitions.push_back(pPartDefinition); + pPartDefinition = NULL; return tree.part_definitions.size()-1; } -uint32_t PRCFileStructure::addProductOccurrence(PRCProductOccurrence *pProductOccurrence) +uint32_t PRCFileStructure::addProductOccurrence(PRCProductOccurrence*& pProductOccurrence) { - tree.product_occurrences.push_back(PRCpProductOccurrence(pProductOccurrence)); + tree.product_occurrences.push_back(pProductOccurrence); + pProductOccurrence = NULL; return tree.product_occurrences.size()-1; } -uint32_t PRCFileStructure::addTopoContext(PRCTopoContext *pTopoContext) +uint32_t PRCFileStructure::addTopoContext(PRCTopoContext*& pTopoContext) { - contexts.push_back(PRCpTopoContext(pTopoContext)); + contexts.push_back(pTopoContext); + pTopoContext = NULL; return contexts.size()-1; } -uint32_t PRCFileStructure::add3DTess(PRC3DTess *p3DTess) +uint32_t PRCFileStructure::getTopoContext(PRCTopoContext*& pTopoContext) { - tessellations.tessellations.push_back(PRCpTess(p3DTess)); + pTopoContext = new PRCTopoContext; + contexts.push_back(pTopoContext); + return contexts.size()-1; +} + +uint32_t PRCFileStructure::add3DTess(PRC3DTess*& p3DTess) +{ + tessellations.tessellations.push_back(p3DTess); + p3DTess = NULL; return tessellations.tessellations.size()-1; } -uint32_t PRCFileStructure::add3DWireTess(PRC3DWireTess *p3DWireTess) +uint32_t PRCFileStructure::add3DWireTess(PRC3DWireTess*& p3DWireTess) { - tessellations.tessellations.push_back(PRCpTess(p3DWireTess)); + tessellations.tessellations.push_back(p3DWireTess); + p3DWireTess = NULL; return tessellations.tessellations.size()-1; } /* -uint32_t PRCFileStructure::addMarkupTess(PRCMarkupTess *pMarkupTess) +uint32_t PRCFileStructure::addMarkupTess(PRCMarkupTess*& pMarkupTess) { - tessellations.tessellations.push_back(PRCpTess(pMarkupTess)); + tessellations.tessellations.push_back(pMarkupTess); + pMarkupTess = NULL; return tessellations.tessellations.size()-1; } -uint32_t PRCFileStructure::addMarkup(PRCMarkup *pMarkup) +uint32_t PRCFileStructure::addMarkup(PRCMarkup*& pMarkup) { - tree.markups.push_back(PRCpMarkup(pMarkup)); + tree.markups.push_back(pMarkup); + pMarkup = NULL; return tree.markups.size()-1; } -uint32_t PRCFileStructure::addAnnotationItem(PRCAnnotationItem *pAnnotationItem) +uint32_t PRCFileStructure::addAnnotationItem(PRCAnnotationItem*& pAnnotationItem) { - tree.annotation_entities.push_back(PRCpAnnotationItem(pAnnotationItem)); + tree.annotation_entities.push_back(pAnnotationItem); + pAnnotationItem = NULL; return tree.annotation_entities.size()-1; } */ -uint32_t PRCFileStructure::addCoordinateSystem(PRCCoordinateSystem *pCoordinateSystem) +uint32_t PRCFileStructure::addCoordinateSystem(PRCCoordinateSystem*& pCoordinateSystem) { - globals.reference_coordinate_systems.push_back(PRCpCoordinateSystem(pCoordinateSystem)); + globals.reference_coordinate_systems.push_back(pCoordinateSystem); + pCoordinateSystem = NULL; return globals.reference_coordinate_systems.size()-1; } -uint32_t PRCFileStructure::addCoordinateSystemUnique(PRCCoordinateSystem *pCoordinateSystem) +uint32_t PRCFileStructure::addCoordinateSystemUnique(PRCCoordinateSystem*& pCoordinateSystem) { for(uint32_t i = 0; i < globals.reference_coordinate_systems.size(); ++i) { - if(*(globals.reference_coordinate_systems[i])==*pCoordinateSystem) + if(*(globals.reference_coordinate_systems[i])==*pCoordinateSystem) { + pCoordinateSystem = NULL; return i; + } } - globals.reference_coordinate_systems.push_back(PRCpCoordinateSystem(pCoordinateSystem)); + globals.reference_coordinate_systems.push_back(pCoordinateSystem); + pCoordinateSystem = NULL; return globals.reference_coordinate_systems.size()-1; } diff --git a/Build/source/utils/asymptote/prc/oPRCFile.h b/Build/source/utils/asymptote/prc/oPRCFile.h index 647f57c7d52..48683bf36da 100644 --- a/Build/source/utils/asymptote/prc/oPRCFile.h +++ b/Build/source/utils/asymptote/prc/oPRCFile.h @@ -115,30 +115,30 @@ typedef std::list<PRCtessline> PRCtesslineList; struct PRCface { + PRCface() : transform(NULL), face(NULL) {} uint32_t style; bool transparent; - PRCpGeneralTransformation3d transform; - PRCpFace face; + PRCGeneralTransformation3d* transform; + PRCFace* face; }; -typedef std::tr1::shared_ptr <PRCface> PRCpface; typedef std::vector <PRCface> PRCfaceList; struct PRCcompface { + PRCcompface() : face(NULL) {} uint32_t style; bool transparent; - PRCpCompressedFace face; + PRCCompressedFace* face; }; -typedef std::tr1::shared_ptr <PRCcompface> PRCpcompface; typedef std::vector <PRCcompface> PRCcompfaceList; struct PRCwire { + PRCwire() : style(m1), transform(NULL), curve(NULL) {} uint32_t style; - PRCpGeneralTransformation3d transform; - PRCpCurve curve; + PRCGeneralTransformation3d* transform; + PRCCurve* curve; }; -typedef std::tr1::shared_ptr <PRCwire> PRCpwire; typedef std::vector <PRCwire> PRCwireList; typedef std::map <uint32_t,std::vector<PRCVector3d> > PRCpointsetMap; @@ -163,8 +163,8 @@ public: class PRCgroup { public: - PRCgroup() {} - PRCgroup(const std::string &name) : name(name) {} + PRCgroup() : transform(NULL) {} + PRCgroup(const std::string &name) : name(name), transform(NULL) {} PRCfaceList faces; PRCcompfaceList compfaces; PRCtessrectangleList rectangles; @@ -173,7 +173,7 @@ class PRCgroup PRCpointsetMap points; std::string name; std::list<PRCgroup> groupList; - PRCpGeneralTransformation3d transform; + PRCGeneralTransformation3d* transform; PRCoptions options; }; typedef std::list<PRCgroup> PRCgroupList; @@ -216,6 +216,21 @@ class PRCGlobalsSection : public PRCCompressedSection defaultFontFamilyName(""), numberOfFillPatterns(0), userData(0,0),index(i) {} + virtual ~PRCGlobalsSection() { + for(PRCTextureDefinitionList::iterator i = texture_definitions.begin(); + i != texture_definitions.end(); i++) + delete *i; + for(PRCMaterialList::iterator i = materials.begin(); + i != materials.end(); i++) + delete *i; + for(PRCStyleList::iterator i = styles.begin(); + i != styles.end(); i++) + delete *i; + for(PRCCoordinateSystemList::iterator i = + reference_coordinate_systems.begin(); + i != reference_coordinate_systems.end(); i++) + delete *i; + } uint32_t numberOfReferencedFileStructures; double tessellationChordHeightRatio; double tessellationAngleDegrees; @@ -239,6 +254,12 @@ class PRCTreeSection : public PRCCompressedSection public: PRCTreeSection(PRCFileStructure *fs, uint32_t i) : PRCCompressedSection(fs),unit(1),index(i) {} + virtual ~PRCTreeSection() + { + for(PRCPartDefinitionList::iterator it=part_definitions.begin(); it!=part_definitions.end(); ++it) delete *it; + for(PRCProductOccurrenceList::iterator it=product_occurrences.begin(); it!=product_occurrences.end(); ++it) delete *it; + } + PRCPartDefinitionList part_definitions; PRCProductOccurrenceList product_occurrences; /* @@ -256,6 +277,11 @@ class PRCTessellationSection : public PRCCompressedSection public: PRCTessellationSection(PRCFileStructure *fs, uint32_t i) : PRCCompressedSection(fs),index(i) {} + virtual ~PRCTessellationSection() { + for(PRCTessList::iterator it=tessellations.begin(); + it!=tessellations.end(); ++it) + delete *it; + } PRCTessList tessellations; private: uint32_t index; @@ -267,6 +293,7 @@ class PRCGeometrySection : public PRCCompressedSection public: PRCGeometrySection(PRCFileStructure *fs, uint32_t i) : PRCCompressedSection(fs),index(i) {} + virtual ~PRCGeometrySection() {} private: uint32_t index; virtual void writeData(); @@ -277,6 +304,7 @@ class PRCExtraGeometrySection : public PRCCompressedSection public: PRCExtraGeometrySection(PRCFileStructure *fs, uint32_t i) : PRCCompressedSection(fs),index(i) {} + virtual ~PRCExtraGeometrySection() {} private: uint32_t index; virtual void writeData(); @@ -287,6 +315,7 @@ class PRCModelFile : public PRCCompressedSection public: PRCModelFile(oPRCFile *p) : PRCCompressedSection(p), unit(1) {} double unit; + virtual ~PRCModelFile() {} private: virtual void writeData(); }; @@ -333,6 +362,12 @@ class PRCFileStructure std::list<PRCUncompressedFile> uncompressedFiles; PRCTopoContextList contexts; + ~PRCFileStructure () { + for(PRCTopoContextList::iterator i = contexts.begin(); + i != contexts.end(); i++) + delete *i; + } + PRCGlobalsSection globals; PRCTreeSection tree; PRCTessellationSection tessellations; @@ -349,21 +384,22 @@ class PRCFileStructure uint32_t addTextureDefinition(PRCTextureDefinition *pTextureDefinition); uint32_t addRgbColor(const PRCRgbColor &color); uint32_t addRgbColorUnique(const PRCRgbColor &color); - uint32_t addMaterialGeneric(PRCMaterialGeneric *pMaterialGeneric); - uint32_t addTextureApplication(PRCTextureApplication *pTextureApplication); - uint32_t addStyle(PRCStyle *pStyle); - uint32_t addPartDefinition(PRCPartDefinition *pPartDefinition); - uint32_t addProductOccurrence(PRCProductOccurrence *pProductOccurrence); - uint32_t addTopoContext(PRCTopoContext *pTopoContext); - uint32_t add3DTess(PRC3DTess *p3DTess); - uint32_t add3DWireTess(PRC3DWireTess *p3DWireTess); + uint32_t addMaterialGeneric(PRCMaterialGeneric*& pMaterialGeneric); + uint32_t addTextureApplication(PRCTextureApplication*& pTextureApplication); + uint32_t addStyle(PRCStyle*& pStyle); + uint32_t addPartDefinition(PRCPartDefinition*& pPartDefinition); + uint32_t addProductOccurrence(PRCProductOccurrence*& pProductOccurrence); + uint32_t addTopoContext(PRCTopoContext*& pTopoContext); + uint32_t getTopoContext(PRCTopoContext*& pTopoContext); + uint32_t add3DTess(PRC3DTess*& p3DTess); + uint32_t add3DWireTess(PRC3DWireTess*& p3DWireTess); /* - uint32_t addMarkupTess(PRCMarkupTess *pMarkupTess); - uint32_t addMarkup(PRCMarkup *pMarkup); - uint32_t addAnnotationItem(PRCAnnotationItem *pAnnotationItem); + uint32_t addMarkupTess(PRCMarkupTess*& pMarkupTess); + uint32_t addMarkup(PRCMarkup*& pMarkup); + uint32_t addAnnotationItem(PRCAnnotationItem*& pAnnotationItem); */ - uint32_t addCoordinateSystem(PRCCoordinateSystem *pCoordinateSystem); - uint32_t addCoordinateSystemUnique(PRCCoordinateSystem *pCoordinateSystem); + uint32_t addCoordinateSystem(PRCCoordinateSystem*& pCoordinateSystem); + uint32_t addCoordinateSystemUnique(PRCCoordinateSystem*& pCoordinateSystem); }; class PRCFileStructureInformation @@ -461,11 +497,11 @@ class oPRCFile PRCtransformMap transformMap; std::stack<PRCgroupList::iterator> currentGroups; PRCgroup& findGroup(); - void doGroup(const PRCgroup& group, PRCPartDefinition *parent_part_definition, PRCProductOccurrence *parent_product_occurrence); + void doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definition, PRCProductOccurrence *parent_product_occurrence); uint32_t addColor(const PRCRgbColor &color); uint32_t addColour(const RGBAColour &colour); uint32_t addMaterial(const PRCmaterial &material); - uint32_t addTransform(const PRCpGeneralTransformation3d &transform); + uint32_t addTransform(PRCGeneralTransformation3d*& transform); void addPoint(const double P[3], const RGBAColour &c); void addLine(uint32_t n, const double P[][3], const RGBAColour &c); void addBezierCurve(uint32_t n, const double cP[][3], const RGBAColour &c); @@ -488,11 +524,11 @@ class oPRCFile uint32_t addPicture(EPRCPictureDataFormat format, uint32_t size, const uint8_t *picture, uint32_t width=0, uint32_t height=0, std::string name="", uint32_t fileStructure=0) { return fileStructures[fileStructure]->addPicture(format, size, picture, width, height, name); } - uint32_t addTextureDefinition(PRCTextureDefinition *pTextureDefinition, uint32_t fileStructure=0) + uint32_t addTextureDefinition(PRCTextureDefinition*& pTextureDefinition, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addTextureDefinition(pTextureDefinition); } - uint32_t addTextureApplication(PRCTextureApplication *pTextureApplication, uint32_t fileStructure=0) + uint32_t addTextureApplication(PRCTextureApplication*& pTextureApplication, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addTextureApplication(pTextureApplication); } @@ -506,54 +542,58 @@ class oPRCFile { return fileStructures[fileStructure]->addRgbColorUnique(color); } - uint32_t addMaterialGeneric(PRCMaterialGeneric *pMaterialGeneric, + uint32_t addMaterialGeneric(PRCMaterialGeneric*& pMaterialGeneric, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addMaterialGeneric(pMaterialGeneric); } - uint32_t addStyle(PRCStyle *pStyle, uint32_t fileStructure=0) + uint32_t addStyle(PRCStyle*& pStyle, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addStyle(pStyle); } - uint32_t addPartDefinition(PRCPartDefinition *pPartDefinition, uint32_t fileStructure=0) + uint32_t addPartDefinition(PRCPartDefinition*& pPartDefinition, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addPartDefinition(pPartDefinition); } - uint32_t addProductOccurrence(PRCProductOccurrence *pProductOccurrence, uint32_t fileStructure=0) + uint32_t addProductOccurrence(PRCProductOccurrence*& pProductOccurrence, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addProductOccurrence(pProductOccurrence); } - uint32_t addTopoContext(PRCTopoContext *pTopoContext, uint32_t fileStructure=0) + uint32_t addTopoContext(PRCTopoContext*& pTopoContext, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addTopoContext(pTopoContext); } - uint32_t add3DTess(PRC3DTess *p3DTess, uint32_t fileStructure=0) + uint32_t getTopoContext(PRCTopoContext*& pTopoContext, uint32_t fileStructure=0) + { + return fileStructures[fileStructure]->getTopoContext(pTopoContext); + } + uint32_t add3DTess(PRC3DTess*& p3DTess, uint32_t fileStructure=0) { return fileStructures[fileStructure]->add3DTess(p3DTess); } - uint32_t add3DWireTess(PRC3DWireTess *p3DWireTess, uint32_t fileStructure=0) + uint32_t add3DWireTess(PRC3DWireTess*& p3DWireTess, uint32_t fileStructure=0) { return fileStructures[fileStructure]->add3DWireTess(p3DWireTess); } /* - uint32_t addMarkupTess(PRCMarkupTess *pMarkupTess, uint32_t fileStructure=0) + uint32_t addMarkupTess(PRCMarkupTess*& pMarkupTess, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addMarkupTess(pMarkupTess); } - uint32_t addMarkup(PRCMarkup *pMarkup, uint32_t fileStructure=0) + uint32_t addMarkup(PRCMarkup*& pMarkup, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addMarkup(pMarkup); } - uint32_t addAnnotationItem(PRCAnnotationItem *pAnnotationItem, uint32_t fileStructure=0) + uint32_t addAnnotationItem(PRCAnnotationItem*& pAnnotationItem, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addAnnotationItem(pAnnotationItem); } */ - uint32_t addCoordinateSystem(PRCCoordinateSystem *pCoordinateSystem, uint32_t fileStructure=0) + uint32_t addCoordinateSystem(PRCCoordinateSystem*& pCoordinateSystem, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addCoordinateSystem(pCoordinateSystem); } - uint32_t addCoordinateSystemUnique(PRCCoordinateSystem *pCoordinateSystem, uint32_t fileStructure=0) + uint32_t addCoordinateSystemUnique(PRCCoordinateSystem*& pCoordinateSystem, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addCoordinateSystemUnique(pCoordinateSystem); } diff --git a/Build/source/utils/asymptote/prc/test.cc b/Build/source/utils/asymptote/prc/test.cc index 4b0cadfc8a8..98a6c226c43 100644 --- a/Build/source/utils/asymptote/prc/test.cc +++ b/Build/source/utils/asymptote/prc/test.cc @@ -27,6 +27,8 @@ using namespace std; +extern const double pi; + int main() { oPRCFile file("test.prc"); @@ -296,8 +298,8 @@ if(1) { double points[NUMBER_OF_POINTS][3]; for(size_t i = 0; i < NUMBER_OF_POINTS; ++i) { - points[i][0] = 3.5*cos(3.0*i/NUMBER_OF_POINTS*2.0*M_PI); - points[i][1] = 3.5*sin(3.0*i/NUMBER_OF_POINTS*2.0*M_PI); + points[i][0] = 3.5*cos(3.0*i/NUMBER_OF_POINTS*2.0*pi); + points[i][1] = 3.5*sin(3.0*i/NUMBER_OF_POINTS*2.0*pi); points[i][2] = 5.0*i/NUMBER_OF_POINTS-1.0; } const size_t NUMBER_OF_WIRES = 2; @@ -472,21 +474,21 @@ if(1) { PRCFace *face = new PRCFace; shell->addFace(face,2); PRCRuled *surface = new PRCRuled; - face->setSurface(surface); + face->base_surface=surface; PRCCircle *first_curve = new PRCCircle; first_curve->radius = 1; - surface->setFirstCurve(first_curve); + surface->first_curve=first_curve; PRCCircle *second_curve = new PRCCircle; second_curve->radius = 0; - surface->setSecondCurve(second_curve); + surface->second_curve=second_curve; surface->uv_domain.min.x = 0; surface->uv_domain.max.x = 1; surface->uv_domain.min.y = 0; - surface->uv_domain.max.y = 2*M_PI; + surface->uv_domain.max.y = 2*pi; surface->parameterization_on_v_coeff_a = -1; - surface->parameterization_on_v_coeff_b = 2*M_PI; + surface->parameterization_on_v_coeff_b = 2*pi; surface->has_transformation = true; surface->geometry_is_2D = false; @@ -573,8 +575,8 @@ if(1) { qoints[3][0] = 0; qoints[3][1] = 0; qoints[3][2] = 1; // for(size_t i = 0; i < NUMBER_OF_POINTS; ++i) // { -// points[i][0] = 3.5*cos(3.0*i/NUMBER_OF_POINTS*2.0*M_PI); -// points[i][1] = 3.5*sin(3.0*i/NUMBER_OF_POINTS*2.0*M_PI); +// points[i][0] = 3.5*cos(3.0*i/NUMBER_OF_POINTS*2.0*pi); +// points[i][1] = 3.5*sin(3.0*i/NUMBER_OF_POINTS*2.0*pi); // points[i][2] = 5.0*i/NUMBER_OF_POINTS-1.0; // } @@ -598,7 +600,7 @@ if(1) { PRCFace *face = new PRCFace; shell->addFace(face); PRCBlend01 *surface = new PRCBlend01; - face->setSurface(surface); + face->base_surface=surface; PRCNURBSCurve *center_curve = new PRCNURBSCurve; center_curve->is_rational = false; @@ -607,7 +609,7 @@ if(1) { center_curve->control_point.push_back(PRCControlPoint(points[i][0]+0.0,points[i][1],points[i][2])); for(size_t i = 0; i < 3+NUMBER_OF_POINTS+1; ++i) center_curve->knot.push_back(knots[i]); - surface->setCenterCurve(center_curve); + surface->center_curve=center_curve; PRCNURBSCurve *origin_curve = new PRCNURBSCurve; origin_curve->is_rational = false; @@ -616,10 +618,10 @@ if(1) { origin_curve->control_point.push_back(PRCControlPoint(points[i][0]*1.01+0.0,points[i][1]*1.01,points[i][2])); for(size_t i = 0; i < 3+NUMBER_OF_POINTS+1; ++i) origin_curve->knot.push_back(knots[i]); - surface->setOriginCurve(origin_curve); + surface->origin_curve=origin_curve; surface->uv_domain.min.x = 0; - surface->uv_domain.max.x = 2*M_PI; + surface->uv_domain.max.x = 2*pi; surface->uv_domain.min.y = 1; // first knot surface->uv_domain.max.y = 2; // last knot PRCBrepModel *brepmodel = new PRCBrepModel("Tube"); @@ -671,7 +673,7 @@ if(1) { uint32_t Origin_curve_body_index = tubeContext->addSingleWireBody(OriginCurveBody); PRCWireEdge *OriginCurveEdge = new PRCWireEdge; OriginCurveBody->setWireEdge(OriginCurveEdge); - OriginCurveEdge->setCurve(Origin_curve); +// OriginCurveEdge->origin_curve=Origin_curve; PRCWire *OriginCurveWire = new PRCWire("OriginCurveWire"); OriginCurveWire->index_of_line_style = 0; OriginCurveWire->context_id = context_index; @@ -682,7 +684,7 @@ if(1) { uint32_t Center_curve_body_index = tubeContext->addSingleWireBody(CenterCurveBody); PRCWireEdge *CenterCurveEdge = new PRCWireEdge; CenterCurveBody->setWireEdge(CenterCurveEdge); - CenterCurveEdge->setCurve(Center_curve); +// CenterCurveEdge->setCurve(Center_curve); PRCWire *CenterCurveWire = new PRCWire("CenterCurveWire"); CenterCurveWire->index_of_line_style = 0; CenterCurveWire->context_id = context_index; @@ -702,7 +704,7 @@ if(1) { uint32_t compositeCenter_curve_body_index = tubeContext->addSingleWireBody(compositeCenterCurveBody); PRCWireEdge *compositeCenterCurveEdge = new PRCWireEdge; compositeCenterCurveBody->setWireEdge(compositeCenterCurveEdge); - compositeCenterCurveEdge->setCurve(compositeCenter_curve); +// compositeCenterCurveEdge->setCurve(compositeCenter_curve); PRCWire *compositeCenterCurveWire = new PRCWire("compositeCenterCurveWire"); compositeCenterCurveWire->index_of_line_style = 0; compositeCenterCurveWire->context_id = context_index; @@ -722,7 +724,7 @@ if(1) { uint32_t compositeOrigin_curve_body_index = tubeContext->addSingleWireBody(compositeOriginCurveBody); PRCWireEdge *compositeOriginCurveEdge = new PRCWireEdge; compositeOriginCurveBody->setWireEdge(compositeOriginCurveEdge); - compositeOriginCurveEdge->setCurve(compositeOrigin_curve); +// compositeOriginCurveEdge->setCurve(compositeOrigin_curve); PRCWire *compositeOriginCurveWire = new PRCWire("compositeOriginCurveWire"); compositeOriginCurveWire->index_of_line_style = 0; compositeOriginCurveWire->context_id = context_index; @@ -738,10 +740,10 @@ if(1) { PRCFace *cface = new PRCFace; cshell->addFace(cface); PRCBlend01 *csurface = new PRCBlend01; - cface->setSurface(csurface); + cface->base_surface=csurface; csurface->uv_domain.min.x = 0; - csurface->uv_domain.max.x = 2*M_PI; + csurface->uv_domain.max.x = 2*pi; csurface->uv_domain.min.y = 0; // first knot csurface->uv_domain.max.y = 2; // last knot csurface->center_curve = compositeCenterCurveEdge->curve_3d; diff --git a/Build/source/utils/asymptote/prc/writePRC.cc b/Build/source/utils/asymptote/prc/writePRC.cc index eb7141d3315..1f3175053fc 100644 --- a/Build/source/utils/asymptote/prc/writePRC.cc +++ b/Build/source/utils/asymptote/prc/writePRC.cc @@ -31,6 +31,85 @@ using namespace std; +// Count leading zeros. +uint32_t CLZ(uint32_t a) +{ +#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 +} + +// Portable integer implementation of ceil(log2(x)). +uint32_t Log2(uint32_t x) +{ + assert(x != 0); + uint32_t L=31-CLZ(x); + return ((uint32_t) 1 << L == x) ? L : L+1; +} + +#define WriteUnsignedInteger( value ) pbs << (uint32_t)(value); +#define WriteInteger( value ) pbs << (int32_t)(value); +#define WriteCharacter( value ) pbs << (uint8_t)(value); +#define WriteDouble( value ) pbs << (double)(value); +#define WriteBit( value ) pbs << (bool)(value); +#define WriteBoolean( value ) pbs << (bool)(value); +#define WriteString( value ) pbs << (value); +#define SerializeContentPRCBase serializeContentPRCBase(pbs); +#define SerializeGraphics serializeGraphics(pbs); +#define SerializePRCBaseWithGraphics { serializeContentPRCBase(pbs); serializeGraphics(pbs); } +#define SerializeRepresentationItemContent serializeRepresentationItemContent(pbs); +#define SerializeRepresentationItem( value ) (value)->serializeRepresentationItem(pbs); +#define SerializeMarkup( value ) (value).serializeMarkup(pbs); +#define SerializeReferenceUniqueIdentifier( value ) (value).serializeReferenceUniqueIdentifier(pbs); +#define SerializeContentBaseTessData serializeContentBaseTessData(pbs); +#define SerializeTessFace( value ) (value)->serializeTessFace(pbs); +#define SerializeUserData UserData(0,0).write(pbs); +#define SerializeLineAttr( value ) pbs << (uint32_t)((value)+1); +#define SerializeVector3d( value ) (value).serializeVector3d(pbs); +#define SerializeVector2d( value ) (value).serializeVector2d(pbs); +#define SerializeName( value ) writeName(pbs, (value)); +#define SerializeInterval( value ) (value).serializeInterval(pbs); +// #define SerializeBoundingBox( value ) (value).serializeBoundingBox(pbs); +#define SerializeDomain( value ) (value).serializeDomain(pbs); +#define SerializeParameterization serializeParameterization(pbs); +#define SerializeUVParameterization serializeUVParameterization(pbs); +#define SerializeTransformation serializeTransformation(pbs); +#define SerializeBaseTopology serializeBaseTopology(pbs); +#define SerializeBaseGeometry serializeBaseGeometry(pbs); +#define SerializePtrCurve( value ) {WriteBoolean( false ); if((value)==NULL) pbs << (uint32_t)PRC_TYPE_ROOT; else (value)->serializeCurve(pbs);} +#define SerializePtrSurface( value ) {WriteBoolean( false ); if((value)==NULL) pbs << (uint32_t)PRC_TYPE_ROOT; else (value)->serializeSurface(pbs);} +#define SerializePtrTopology( value ) {WriteBoolean( false ); if((value)==NULL) pbs << (uint32_t)PRC_TYPE_ROOT; else (value)->serializeTopoItem(pbs);} +#define SerializeContentCurve serializeContentCurve(pbs); +#define SerializeContentWireEdge serializeContentWireEdge(pbs); +#define SerializeContentBody serializeContentBody(pbs); +#define SerializeTopoContext serializeTopoContext(pbs); +#define SerializeContextAndBodies( value ) (value).serializeContextAndBodies(pbs); +#define SerializeBody( value ) (value)->serializeBody(pbs); +#define ResetCurrentGraphics resetGraphics(); +#define SerializeContentSurface serializeContentSurface(pbs); +#define SerializeCompressedUniqueId( value ) (value).serializeCompressedUniqueId(pbs); +#define SerializeUnit( value ) (value).serializeUnit(pbs); +#define SerializeBoundingBox serializeBoundingBox(pbs); +#define SerializeAttributeEntry serializeAttributeEntry(pbs); +#define SerializeContentSingleAttribute( value ) (value).serializeSingleAttribute(pbs); +#define SerializeAttribute( value ) (value).serializeAttribute(pbs); +#define SerializeAttributeData serializeAttributes(pbs); + + double PRCVector3d::Length() { return sqrt(x*x+y*y+z*z); @@ -60,111 +139,77 @@ void UserData::write(PRCbitStream &pbs) } } -void SingleAttribute::write(PRCbitStream &pbs) +void PRCAttributeEntry::serializeAttributeEntry(PRCbitStream &pbs) const { - pbs << titleIsInteger; - if(titleIsInteger) - pbs << title.integer; - else - pbs << title.text; - pbs << type; - switch(type) + WriteBoolean (title_is_integer) + if (title_is_integer) + WriteUnsignedInteger (title_integer) + else + WriteString (title_text) +} + +void PRCSingleAttribute::serializeSingleAttribute(PRCbitStream &pbs) const +{ + SerializeAttributeEntry + WriteUnsignedInteger (type) + switch (type) { case KEPRCModellerAttributeTypeInt: - pbs << data.integer; + WriteInteger (value.integer) break; case KEPRCModellerAttributeTypeReal: - pbs << data.real; + WriteDouble (value.real) break; case KEPRCModellerAttributeTypeTime: - pbs << data.time; + WriteUnsignedInteger (value.time) break; case KEPRCModellerAttributeTypeString: - pbs << data.text; - break; + WriteString (value_text) + break; default: break; } } -void Attribute::write(PRCbitStream &pbs) +void PRCAttribute::serializeAttribute(PRCbitStream &pbs) const { - pbs << (uint32_t)PRC_TYPE_MISC_Attribute; - pbs << titleIsInteger; - if(titleIsInteger) - pbs << title.integer; - else - pbs << title.text; - pbs << sizeOfAttributeKeys; - for(uint32_t i = 0; i < sizeOfAttributeKeys; ++i) - { - singleAttributes[i].write(pbs); - } + WriteUnsignedInteger (PRC_TYPE_MISC_Attribute) + + SerializeAttributeEntry + const uint32_t size_of_attribute_keys = attribute_keys.size(); + WriteUnsignedInteger (size_of_attribute_keys) + for(uint32_t i=0;i<size_of_attribute_keys;i++) + SerializeContentSingleAttribute (attribute_keys[i]) } -void Attributes::write(PRCbitStream &pbs) +void PRCAttributes::serializeAttributes(PRCbitStream &pbs) const { - pbs << numberOfAttributes; - for(uint32_t i = 0; i < numberOfAttributes; ++i) + if (attributes.empty()) { // shortcut for most typical case + const uint32_t number_of_attributes = 0; + WriteUnsignedInteger (number_of_attributes) + return; + } + const uint32_t number_of_attributes = attributes.size(); + WriteUnsignedInteger (number_of_attributes) + for(PRCAttributeList::const_iterator it = attributes.begin(); it != attributes.end(); ++it) { - attributes[i].write(pbs); + SerializeAttribute(*it) } } -void ContentPRCBase::write(PRCbitStream &pbs) +void ContentPRCBase::serializeContentPRCBase(PRCbitStream &pbs) { - attributes->write(pbs); - writeName(pbs,name); - if(eligibleForReference) + SerializeAttributeData + + SerializeName (name) + if (type_eligible_for_reference) { - pbs << CADID << CADPersistentID << PRCID; + WriteUnsignedInteger (CAD_identifier) + WriteUnsignedInteger (CAD_persistent_identifier) + WriteUnsignedInteger (PRC_unique_identifier) } } -#define WriteUnsignedInteger( value ) pbs << (uint32_t)(value); -#define WriteInteger( value ) pbs << (int32_t)(value); -#define WriteCharacter( value ) pbs << (uint8_t)(value); -#define WriteDouble( value ) pbs << (double)(value); -#define WriteBit( value ) pbs << (bool)(value); -#define WriteBoolean( value ) pbs << (bool)(value); -#define WriteString( value ) pbs << (value); -#define SerializeContentPRCBase write(pbs); -#define SerializeGraphics serializeGraphics(pbs); -#define SerializePRCBaseWithGraphics { write(pbs); serializeGraphics(pbs); } -#define SerializeRepresentationItemContent serializeRepresentationItemContent(pbs); -#define SerializeRepresentationItem( value ) (value)->serializeRepresentationItem(pbs); -#define SerializeMarkup( value ) (value).serializeMarkup(pbs); -#define SerializeReferenceUniqueIdentifier( value ) (value).serializeReferenceUniqueIdentifier(pbs); -#define SerializeContentBaseTessData serializeContentBaseTessData(pbs); -#define SerializeTessFace( value ) (value)->serializeTessFace(pbs); -#define SerializeUserData UserData(0,0).write(pbs); -#define SerializeLineAttr( value ) pbs << (uint32_t)((value)+1); -#define SerializeVector3d( value ) (value).serializeVector3d(pbs); -#define SerializeVector2d( value ) (value).serializeVector2d(pbs); -#define SerializeName( value ) writeName(pbs, (value)); -#define SerializeInterval( value ) (value).serializeInterval(pbs); -// #define SerializeBoundingBox( value ) (value).serializeBoundingBox(pbs); -#define SerializeDomain( value ) (value).serializeDomain(pbs); -#define SerializeParameterization serializeParameterization(pbs); -#define SerializeUVParameterization serializeUVParameterization(pbs); -#define SerializeTransformation serializeTransformation(pbs); -#define SerializeAttributeData if(attributes) attributes->write(pbs); else WriteUnsignedInteger (0) -#define SerializeBaseTopology serializeBaseTopology(pbs); -#define SerializeBaseGeometry serializeBaseGeometry(pbs); -#define SerializePtrCurve( value ) {WriteBoolean( false ); if((value)==NULL) pbs << (uint32_t)PRC_TYPE_ROOT; else (value)->serializeCurve(pbs);} -#define SerializePtrSurface( value ) {WriteBoolean( false ); if((value)==NULL) pbs << (uint32_t)PRC_TYPE_ROOT; else (value)->serializeSurface(pbs);} -#define SerializePtrTopology( value ) {WriteBoolean( false ); if((value)==NULL) pbs << (uint32_t)PRC_TYPE_ROOT; else (value)->serializeTopoItem(pbs);} -#define SerializeContentCurve serializeContentCurve(pbs); -#define SerializeContentWireEdge serializeContentWireEdge(pbs); -#define SerializeContentBody serializeContentBody(pbs); -#define SerializeTopoContext serializeTopoContext(pbs); -#define SerializeContextAndBodies( value ) (value).serializeContextAndBodies(pbs); -#define SerializeBody( value ) (value)->serializeBody(pbs); -#define ResetCurrentGraphics resetGraphics(); -#define SerializeContentSurface serializeContentSurface(pbs); -#define SerializeCompressedUniqueId( value ) (value).serializeCompressedUniqueId(pbs); -#define SerializeUnit( value ) (value).serializeUnit(pbs); -#define SerializeBoundingBox serializeBoundingBox(pbs); bool IsCompressedType(uint32_t type) { @@ -341,10 +386,7 @@ void PRCStyle::serializeCategory1LineStyle(PRCbitStream &pbs) WriteCharacter (additional_3) } -AttributeTitle EMPTY_ATTRIBUTE_TITLE = {(char*)""}; -Attribute EMPTY_ATTRIBUTE(false,EMPTY_ATTRIBUTE_TITLE,0,NULL); -Attributes EMPTY_ATTRIBUTES(0,0); -ContentPRCBase EMPTY_CONTENTPRCBASE(&EMPTY_ATTRIBUTES); +ContentPRCBase EMPTY_CONTENTPRCBASE; std::string currentName; void writeName(PRCbitStream &pbs,const std::string &name) @@ -531,51 +573,52 @@ void PRCSet::serializeSet(PRCbitStream &pbs) SerializeUserData } -uint32_t PRCSet::addBrepModel(PRCBrepModel *pBrepModel) -{ - elements.push_back(PRCpRepresentationItem(pBrepModel)); - return elements.size()-1; -} - -uint32_t PRCSet::addPolyBrepModel(PRCPolyBrepModel *pPolyBrepModel) +uint32_t PRCSet::addBrepModel(PRCBrepModel*& pBrepModel) { - elements.push_back(PRCpRepresentationItem(pPolyBrepModel)); + elements.push_back(pBrepModel); + pBrepModel = NULL; return elements.size()-1; } -uint32_t PRCSet::addPointSet(PRCPointSet *pPointSet) +uint32_t PRCSet::addPolyBrepModel(PRCPolyBrepModel*& pPolyBrepModel) { - elements.push_back(PRCpRepresentationItem(pPointSet)); + elements.push_back(pPolyBrepModel); + pPolyBrepModel = NULL; return elements.size()-1; } -uint32_t PRCSet::addSet(PRCSet *pSet) +uint32_t PRCSet::addPointSet(PRCPointSet*& pPointSet) { - elements.push_back(PRCpRepresentationItem(pSet)); + elements.push_back(pPointSet); + pPointSet = NULL; return elements.size()-1; } -uint32_t PRCSet::addWire(PRCWire *pWire) +uint32_t PRCSet::addSet(PRCSet*& pSet) { - elements.push_back(PRCpRepresentationItem(pWire)); + elements.push_back(pSet); + pSet = NULL; return elements.size()-1; } -uint32_t PRCSet::addPolyWire(PRCPolyWire *pPolyWire) +uint32_t PRCSet::addWire(PRCWire*& pWire) { - elements.push_back(PRCpRepresentationItem(pPolyWire)); + elements.push_back(pWire); + pWire = NULL; return elements.size()-1; } -uint32_t PRCSet::addRepresentationItem(PRCRepresentationItem *pRepresentationItem) +uint32_t PRCSet::addPolyWire(PRCPolyWire*& pPolyWire) { - elements.push_back(PRCpRepresentationItem(pRepresentationItem)); + elements.push_back(pPolyWire); + pPolyWire = NULL; return elements.size()-1; } -uint32_t PRCSet::addRepresentationItem(PRCpRepresentationItem pRepresentationItem) +uint32_t PRCSet::addRepresentationItem(PRCRepresentationItem*& pRepresentationItem) { elements.push_back(pRepresentationItem); + pRepresentationItem = NULL; return elements.size()-1; } @@ -850,9 +893,10 @@ void PRC3DTess::serialize3DTess(PRCbitStream &pbs) WriteDouble (texture_coordinate[i]) } -void PRC3DTess::addTessFace(PRCTessFace *pTessFace) +void PRC3DTess::addTessFace(PRCTessFace*& pTessFace) { - face_tessellation.push_back(PRCpTessFace(pTessFace)); + face_tessellation.push_back(pTessFace); + pTessFace = NULL; } void PRC3DWireTess::serialize3DWireTess(PRCbitStream &pbs) @@ -1205,13 +1249,13 @@ void PRCCompressedFace::serializeCompressedNurbs(PRCbitStream &pbs, double brep const uint32_t number_of_knots_in_u = 4; // 0011 or 00001111 knot vector - just 2 spans WriteUnsignedIntegerWithVariableBitNumber (number_of_knots_in_u - 2, 16) - uint32_t number_bit = degree_in_u ? ceil( log2( degree_in_u + 2 ) ) : 2; + uint32_t number_bit = degree_in_u ? Log2( degree_in_u + 2 ) : 2; WriteBoolean (false) // Multiplicity_is_already_stored - no WriteUnsignedIntegerWithVariableBitNumber( degree_in_u+1,number_bit) WriteBoolean (true) // Multiplicity_is_already_stored - yes const uint32_t number_of_knots_in_v = 4; // 0011 or 00001111 knot vector - just 2 spans WriteUnsignedIntegerWithVariableBitNumber (number_of_knots_in_v - 2, 16) - number_bit = degree_in_v ? ceil( log2( degree_in_v + 2 ) ) : 2; + number_bit = degree_in_v ? Log2( degree_in_v + 2 ) : 2; WriteBoolean (false) // Multiplicity_is_already_stored - no WriteUnsignedIntegerWithVariableBitNumber( degree_in_v+1,number_bit) WriteBoolean (true) // Multiplicity_is_already_stored - yes @@ -1499,15 +1543,10 @@ void PRCShell::serializeShell(PRCbitStream &pbs) } } -void PRCShell::addFace(PRCFace *pFace, uint8_t orientation) -{ - face.push_back(PRCpFace(pFace)); - orientation_surface_with_shell.push_back(orientation); -} - -void PRCShell::addFace(const PRCpFace &pFace, uint8_t orientation) +void PRCShell::addFace(PRCFace*& pFace, uint8_t orientation) { face.push_back(pFace); + pFace = NULL; orientation_surface_with_shell.push_back(orientation); } @@ -1525,9 +1564,10 @@ void PRCConnex::serializeConnex(PRCbitStream &pbs) } } -void PRCConnex::addShell(PRCShell *pShell) +void PRCConnex::addShell(PRCShell*& pShell) { - shell.push_back(PRCpShell(pShell)); + shell.push_back(pShell); + pShell = NULL; } #define have_bbox( behavior ) (behavior!=0) @@ -1548,9 +1588,10 @@ void PRCBrepData::serializeBrepData(PRCbitStream &pbs) } #undef have_bbox -void PRCBrepData::addConnex(PRCConnex *pConnex) +void PRCBrepData::addConnex(PRCConnex*& pConnex) { - connex.push_back(PRCpConnex(pConnex)); + connex.push_back(pConnex); + pConnex = NULL; } void PRCContentWireEdge::serializeContentWireEdge(PRCbitStream &pbs) @@ -1699,9 +1740,9 @@ void PRCTopoContext::serializeContextGraphics(PRCbitStream &pbs) bool has_graphics = false; for (i=0;i<number_of_body;i++) { - if ( body[i]->topo_item_type == PRC_TYPE_TOPO_BrepData && dynamic_cast<PRCBrepData*>(body[i].get())) + if ( body[i]->topo_item_type == PRC_TYPE_TOPO_BrepData && dynamic_cast<PRCBrepData*>(body[i])) { - PRCBrepData *body_i = dynamic_cast<PRCBrepData*>(body[i].get()); + PRCBrepData *body_i = dynamic_cast<PRCBrepData*>(body[i]); for (j=0;j<body_i->connex.size();j++) { for(k=0;k<body_i->connex[j]->shell.size();k++) @@ -1714,9 +1755,9 @@ void PRCTopoContext::serializeContextGraphics(PRCbitStream &pbs) } } } - else if ( body[i]->topo_item_type == PRC_TYPE_TOPO_BrepDataCompress && dynamic_cast<PRCCompressedBrepData*>(body[i].get())) + else if ( body[i]->topo_item_type == PRC_TYPE_TOPO_BrepDataCompress && dynamic_cast<PRCCompressedBrepData*>(body[i])) { - PRCCompressedBrepData *body_i = dynamic_cast<PRCCompressedBrepData*>(body[i].get()); + PRCCompressedBrepData *body_i = dynamic_cast<PRCCompressedBrepData*>(body[i]); for( l=0;l<body_i->face.size();l++) { element.push_back( body_i->face[l] ); @@ -1745,29 +1786,27 @@ void PRCTopoContext::serializeContextGraphics(PRCbitStream &pbs) } } -uint32_t PRCTopoContext::addSingleWireBody(PRCSingleWireBody *pSingleWireBody) +uint32_t PRCTopoContext::addSingleWireBody(PRCSingleWireBody*& pSingleWireBody) { - body.push_back(PRCpBody(pSingleWireBody)); + body.push_back(pSingleWireBody); + pSingleWireBody = NULL; return body.size()-1; } -uint32_t PRCTopoContext::addBrepData(PRCBrepData *pBrepData) +uint32_t PRCTopoContext::addBrepData(PRCBrepData*& pBrepData) { - body.push_back(PRCpBody(pBrepData)); + body.push_back(pBrepData); + pBrepData = NULL; return body.size()-1; } -uint32_t PRCTopoContext::addCompressedBrepData(PRCCompressedBrepData *pCompressedBrepData) +uint32_t PRCTopoContext::addCompressedBrepData(PRCCompressedBrepData*& pCompressedBrepData) { - body.push_back(PRCpBody(pCompressedBrepData)); + body.push_back(pCompressedBrepData); + pCompressedBrepData = NULL; return body.size()-1; } -void PRCSingleWireBody::setWireEdge(PRCWireEdge *wireEdge) -{ - wire_edge.reset(wireEdge); -} - void PRCSingleWireBody::serializeSingleWireBody(PRCbitStream &pbs) { WriteUnsignedInteger ( PRC_TYPE_TOPO_SingleWireBody) @@ -1824,6 +1863,7 @@ void PRCProductOccurrence::serializeProductOccurrence(PRCbitStream &pbs) WriteCharacter (product_information_flags) WriteInteger (product_load_status) + const bool has_location = location != NULL; WriteBit (has_location) if (has_location) location->serializeTransformation3d (pbs); @@ -1845,73 +1885,73 @@ void PRCProductOccurrence::serializeProductOccurrence(PRCbitStream &pbs) SerializeUserData } -uint32_t PRCPartDefinition::addBrepModel(PRCBrepModel *pBrepModel) -{ - representation_item.push_back(PRCpRepresentationItem(pBrepModel)); - return representation_item.size()-1; -} - -uint32_t PRCPartDefinition::addPolyBrepModel(PRCPolyBrepModel *pPolyBrepModel) +uint32_t PRCPartDefinition::addBrepModel(PRCBrepModel*& pBrepModel) { - representation_item.push_back(PRCpRepresentationItem(pPolyBrepModel)); - return representation_item.size()-1; + representation_item.push_back(pBrepModel); + pBrepModel = NULL; + return representation_item.size()-1; } -uint32_t PRCPartDefinition::addPointSet(PRCPointSet *pPointSet) +uint32_t PRCPartDefinition::addPolyBrepModel(PRCPolyBrepModel*& pPolyBrepModel) { - representation_item.push_back(PRCpRepresentationItem(pPointSet)); - return representation_item.size()-1; + representation_item.push_back(pPolyBrepModel); + pPolyBrepModel = NULL; + return representation_item.size()-1; } -uint32_t PRCPartDefinition::addSet(PRCSet *pSet) +uint32_t PRCPartDefinition::addPointSet(PRCPointSet*& pPointSet) { - representation_item.push_back(PRCpRepresentationItem(pSet)); - return representation_item.size()-1; + representation_item.push_back(pPointSet); + pPointSet = NULL; + return representation_item.size()-1; } -uint32_t PRCPartDefinition::addWire(PRCWire *pWire) +uint32_t PRCPartDefinition::addSet(PRCSet*& pSet) { - representation_item.push_back(PRCpRepresentationItem(pWire)); - return representation_item.size()-1; + representation_item.push_back(pSet); + pSet = NULL; + return representation_item.size()-1; } -uint32_t PRCPartDefinition::addPolyWire(PRCPolyWire *pPolyWire) +uint32_t PRCPartDefinition::addWire(PRCWire*& pWire) { - representation_item.push_back(PRCpRepresentationItem(pPolyWire)); - return representation_item.size()-1; + representation_item.push_back(pWire); + pWire = NULL; + return representation_item.size()-1; } -uint32_t PRCPartDefinition::addRepresentationItem(PRCRepresentationItem *pRepresentationItem) +uint32_t PRCPartDefinition::addPolyWire(PRCPolyWire*& pPolyWire) { - representation_item.push_back(PRCpRepresentationItem(pRepresentationItem)); - return representation_item.size()-1; + representation_item.push_back(pPolyWire); + pPolyWire = NULL; + return representation_item.size()-1; } -uint32_t PRCPartDefinition::addRepresentationItem(PRCpRepresentationItem pRepresentationItem) +uint32_t PRCPartDefinition::addRepresentationItem(PRCRepresentationItem*& pRepresentationItem) { - representation_item.push_back(pRepresentationItem); - return representation_item.size()-1; + representation_item.push_back(pRepresentationItem); + pRepresentationItem = NULL; + return representation_item.size()-1; } - void PRCPartDefinition::serializePartDefinition(PRCbitStream &pbs) { - WriteUnsignedInteger ( PRC_TYPE_ASM_PartDefinition ) + WriteUnsignedInteger ( PRC_TYPE_ASM_PartDefinition ) - SerializePRCBaseWithGraphics - SerializeBoundingBox + SerializePRCBaseWithGraphics + SerializeBoundingBox - uint32_t number_of_representation_items = representation_item.size(); - WriteUnsignedInteger (number_of_representation_items) - for (uint32_t i=0;i<number_of_representation_items;i++) - SerializeRepresentationItem (representation_item[i]) + uint32_t number_of_representation_items = representation_item.size(); + WriteUnsignedInteger (number_of_representation_items) + for (uint32_t i=0;i<number_of_representation_items;i++) + SerializeRepresentationItem (representation_item[i]) - // SerializeMarkups (markups) - WriteUnsignedInteger (0) // number_of_linked_items - WriteUnsignedInteger (0) // number_of_leaders - WriteUnsignedInteger (0) // number_of_markups - WriteUnsignedInteger (0) // number_of_annotation_entities - - WriteUnsignedInteger (0) // number_of_views - SerializeUserData + // SerializeMarkups (markups) + WriteUnsignedInteger (0) // number_of_linked_items + WriteUnsignedInteger (0) // number_of_leaders + WriteUnsignedInteger (0) // number_of_markups + WriteUnsignedInteger (0) // number_of_annotation_entities + + WriteUnsignedInteger (0) // number_of_views + SerializeUserData } diff --git a/Build/source/utils/asymptote/prc/writePRC.h b/Build/source/utils/asymptote/prc/writePRC.h index 18c616ccfac..2ec5ebc427d 100644 --- a/Build/source/utils/asymptote/prc/writePRC.h +++ b/Build/source/utils/asymptote/prc/writePRC.h @@ -22,13 +22,11 @@ #define __WRITE_PRC_H #include <string> #include <vector> +#include <deque> +#include <list> +#include <ext/slist> #include <map> #include <iostream> -#if defined(_MSC_VER) -#include <memory> -#else -#include <tr1/memory> -#endif #include "PRCbitStream.h" #include "PRC.h" #include <float.h> @@ -132,72 +130,123 @@ class UserData uint8_t* data; }; -union SingleAttributeData -{ - int32_t integer; - double real; - uint32_t time; - const char *text; -}; - -union AttributeTitle +struct PRCAttributeEntry { - const char *text; - uint32_t integer; + PRCAttributeEntry() : title_is_integer(false) {} + PRCAttributeEntry(uint32_t integer) : title_is_integer(true) + { + title_integer = integer; + } + PRCAttributeEntry(const std::string &text) : title_is_integer(false) + { + title_text = text; + } + void serializeAttributeEntry(PRCbitStream&) const; + bool title_is_integer; + std::string title_text; + uint32_t title_integer; }; -class SingleAttribute +class PRCSingleAttribute : public PRCAttributeEntry { public: - SingleAttribute() {} - SingleAttribute(bool b,AttributeTitle t,uint32_t y,SingleAttributeData d) : - titleIsInteger(b), title(t), type(y), data(d) {} - void write(PRCbitStream&); - private: - bool titleIsInteger; - AttributeTitle title; - uint32_t type; - SingleAttributeData data; + PRCSingleAttribute() : type(KEPRCModellerAttributeTypeNull) {} + PRCSingleAttribute(int32_t integer) : PRCAttributeEntry(), type(KEPRCModellerAttributeTypeInt) + { + value.integer = integer; + } + PRCSingleAttribute(double real) : PRCAttributeEntry(), type(KEPRCModellerAttributeTypeReal) + { + value.real = real; + } + PRCSingleAttribute(uint32_t time) : PRCAttributeEntry(), type(KEPRCModellerAttributeTypeTime) + { + value.time = time; + } + PRCSingleAttribute(const std::string &text) : PRCAttributeEntry(), type(KEPRCModellerAttributeTypeString) + { + value_text = text;} + PRCSingleAttribute(uint32_t title, int32_t integer) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeInt) + { + value.integer = integer; + } + PRCSingleAttribute(uint32_t title, double real) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeReal) + { + value.real = real; + } + PRCSingleAttribute(uint32_t title, uint32_t time) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeTime) + { + value.time = time; + } + PRCSingleAttribute(uint32_t title, const std::string &text) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeString) + { + value_text = text; + } + PRCSingleAttribute(const std::string title, int32_t integer) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeInt) + { + value.integer = integer; + } + PRCSingleAttribute(const std::string title, double real) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeReal) + { + value.real = real; + } + PRCSingleAttribute(const std::string title, uint32_t time) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeTime) + { + value.time = time; + } + PRCSingleAttribute(const std::string title, const std::string &text) : PRCAttributeEntry(title), type(KEPRCModellerAttributeTypeString) + { + value_text = text; + } + void serializeSingleAttribute(PRCbitStream&) const; + EPRCModellerAttributeType type; + union PRCSingleAttributeData + { + int32_t integer; + double real; + uint32_t time; + } value; + std::string value_text; }; -class Attribute +class PRCAttribute : public PRCAttributeEntry { public: - Attribute(bool t,AttributeTitle v, uint32_t s, SingleAttribute* sa) : - titleIsInteger(t),title(v), sizeOfAttributeKeys(s), singleAttributes(sa) - {} - void write(PRCbitStream &); - private: - bool titleIsInteger; - AttributeTitle title; - uint32_t sizeOfAttributeKeys; - SingleAttribute *singleAttributes; -}; + PRCAttribute() : PRCAttributeEntry() {} + PRCAttribute(uint32_t title) : PRCAttributeEntry(title) {} + PRCAttribute(const std::string title) : PRCAttributeEntry(title) {} + void serializeAttribute(PRCbitStream &) const; + PRCSingleAttribute& newKey() { attribute_keys.resize(attribute_keys.size()+1); return attribute_keys.back(); } + void addKey(const PRCSingleAttribute &key) { attribute_keys.push_back(key); } + std::deque<PRCSingleAttribute> attribute_keys; +}; +#ifdef __GNUC__ +typedef __gnu_cxx::slist<PRCAttribute> PRCAttributeList; +#else +typedef std::list<PRCAttribute> PRCAttributeList; +#endif -class Attributes +class PRCAttributes { public: - Attributes(uint32_t n, Attribute* a) : numberOfAttributes(n), attributes(a) - {} - void write(PRCbitStream&); - private: - uint32_t numberOfAttributes; - Attribute *attributes; + void serializeAttributes(PRCbitStream&) const; + PRCAttribute& newAttribute() { attributes.push_front(PRCAttribute()); return attributes.front(); } + void addAttribute(const PRCAttribute &attribute) { attributes.push_front(attribute); } + PRCAttributeList attributes; }; -class ContentPRCBase +class ContentPRCBase : public PRCAttributes { public: - ContentPRCBase(Attributes *a, std::string n="",bool efr = false, - uint32_t ci = 0, uint32_t cpi = 0, uint32_t pi = 0) : - attributes(a),name(n),eligibleForReference(efr),CADID(ci), - CADPersistentID(cpi),PRCID(pi) {} - void write(PRCbitStream&); - uint32_t getPRCID() { return PRCID; } - Attributes *attributes; - std::string name; - bool eligibleForReference; - uint32_t CADID, CADPersistentID, PRCID; + ContentPRCBase(std::string n="",bool efr = false, + uint32_t ci = 0, uint32_t cpi = 0, uint32_t pi = 0) : + name(n),type_eligible_for_reference(efr),CAD_identifier(ci), + CAD_persistent_identifier(cpi),PRC_unique_identifier(pi) {} + void serializeContentPRCBase(PRCbitStream&); + uint32_t getPRCID() { return PRC_unique_identifier; } + std::string name; + bool type_eligible_for_reference; + uint32_t CAD_identifier, CAD_persistent_identifier, PRC_unique_identifier; }; class PRCReferenceUniqueIdentifier @@ -212,11 +261,7 @@ public: uint32_t unique_identifier; }; -extern AttributeTitle EMPTY_ATTRIBUTE_TITLE; -extern Attribute EMPTY_ATTRIBUTE; -extern Attributes EMPTY_ATTRIBUTES; extern ContentPRCBase EMPTY_CONTENTPRCBASE; -extern ContentPRCBase EMPTY_CONTENTPRCBASE_WITH_REFERENCE; extern std::string currentName; void writeName(PRCbitStream&,const std::string&); @@ -260,7 +305,7 @@ class PRCPicture : public ContentPRCBase { public: PRCPicture(std::string n="") : - ContentPRCBase(&EMPTY_ATTRIBUTES,n), format(KEPRCPicture_PNG), uncompressed_file_index(m1), pixel_width(0), pixel_height(0) {} + ContentPRCBase(n), format(KEPRCPicture_PNG), uncompressed_file_index(m1), pixel_width(0), pixel_height(0) {} void serializePicture(PRCbitStream&); EPRCPictureDataFormat format; uint32_t uncompressed_file_index; @@ -283,7 +328,7 @@ class PRCTextureDefinition : public ContentPRCBase { public: PRCTextureDefinition(std::string n="") : - ContentPRCBase(&EMPTY_ATTRIBUTES,n,true,makeCADID(),0,makePRCID()), picture_index(m1), texture_mapping_attribute(PRC_TEXTURE_MAPPING_DIFFUSE), + ContentPRCBase(n,true,makeCADID(),0,makePRCID()), picture_index(m1), texture_mapping_attribute(PRC_TEXTURE_MAPPING_DIFFUSE), texture_mapping_attribute_intensity(1.0), texture_mapping_attribute_components(PRC_TEXTURE_MAPPING_COMPONENTS_RGBA), texture_function(KEPRCTextureFunction_Modulate), texture_applying_mode(PRC_TEXTURE_APPLYING_MODE_NONE), texture_wrapping_mode_S(KEPRCTextureWrappingMode_Unknown), texture_wrapping_mode_T(KEPRCTextureWrappingMode_Unknown) // , @@ -312,22 +357,21 @@ public: // double Y_homegeneous_coord; // double origin_homegeneous_coord; }; -typedef std::tr1::shared_ptr <PRCTextureDefinition> PRCpTextureDefinition; -typedef std::vector <PRCpTextureDefinition> PRCTextureDefinitionList; +typedef std::deque <PRCTextureDefinition*> PRCTextureDefinitionList; class PRCMaterial { public: + virtual ~PRCMaterial() {} virtual void serializeMaterial(PRCbitStream&) = 0; }; -typedef std::tr1::shared_ptr <PRCMaterial> PRCpMaterial; -typedef std::vector <PRCpMaterial> PRCMaterialList; +typedef std::deque <PRCMaterial*> PRCMaterialList; class PRCMaterialGeneric : public ContentPRCBase, public PRCMaterial { public: PRCMaterialGeneric(std::string n="") : - ContentPRCBase(&EMPTY_ATTRIBUTES,n,true,makeCADID(),0,makePRCID()), + ContentPRCBase(n,true,makeCADID(),0,makePRCID()), ambient(m1), diffuse(m1), emissive(m1), specular(m1), shininess(0.0), ambient_alpha(1.0), diffuse_alpha(1.0), emissive_alpha(1.0), specular_alpha(1.0) @@ -356,7 +400,7 @@ class PRCTextureApplication : public ContentPRCBase, public PRCMaterial { public: PRCTextureApplication(std::string n="") : - ContentPRCBase(&EMPTY_ATTRIBUTES,n,true,makeCADID(),0,makePRCID()), + ContentPRCBase(n,true,makeCADID(),0,makePRCID()), material_generic_index(m1), texture_definition_index(m1), next_texture_index(m1), UV_coordinates_index(0) {} @@ -372,7 +416,7 @@ class PRCStyle : public ContentPRCBase { public: PRCStyle(std::string n="") : - ContentPRCBase(&EMPTY_ATTRIBUTES,n,true,makeCADID(),0,makePRCID()), line_width(0.0), is_vpicture(false), line_pattern_vpicture_index(m1), + ContentPRCBase(n,true,makeCADID(),0,makePRCID()), line_width(0.0), is_vpicture(false), line_pattern_vpicture_index(m1), is_material(false), color_material_index(m1), is_transparency_defined(false), transparency(255), additional(0) {} void serializeCategory1LineStyle(PRCbitStream&); @@ -385,8 +429,7 @@ public: uint8_t transparency; uint8_t additional; }; -typedef std::tr1::shared_ptr <PRCStyle> PRCpStyle; -typedef std::vector <PRCpStyle> PRCStyleList; +typedef std::deque <PRCStyle*> PRCStyleList; class PRCTessFace { @@ -408,8 +451,7 @@ public: std::vector<uint8_t> rgba_vertices; uint32_t behaviour; }; -typedef std::tr1::shared_ptr <PRCTessFace> PRCpTessFace; -typedef std::vector <PRCpTessFace> PRCTessFaceList; +typedef std::deque <PRCTessFace*> PRCTessFaceList; class PRCContentBaseTessData { @@ -424,10 +466,10 @@ public: class PRCTess : public PRCContentBaseTessData { public: + virtual ~PRCTess() {} virtual void serializeBaseTessData(PRCbitStream &pbs) = 0; }; -typedef std::tr1::shared_ptr <PRCTess> PRCpTess; -typedef std::vector <PRCpTess> PRCTessList; +typedef std::deque <PRCTess*> PRCTessList; class PRC3DTess : public PRCTess { @@ -436,9 +478,10 @@ public: has_faces(false), has_loops(false), crease_angle(25.8419) {} + ~PRC3DTess() { for(PRCTessFaceList::iterator it=face_tessellation.begin(); it!=face_tessellation.end(); ++it) delete *it; } void serialize3DTess(PRCbitStream&); void serializeBaseTessData(PRCbitStream &pbs) { serialize3DTess(pbs); } - void addTessFace(PRCTessFace *pTessFace); + void addTessFace(PRCTessFace*& pTessFace); bool has_faces; bool has_loops; @@ -490,8 +533,7 @@ public: uint32_t index_of_line_style; uint16_t behaviour_bit_field; }; -typedef std::tr1::shared_ptr <PRCGraphics> PRCpGraphics; -typedef std::vector <PRCpGraphics> PRCGraphicsList; +typedef std::deque <PRCGraphics*> PRCGraphicsList; void writeGraphics(PRCbitStream&,const PRCGraphics&,bool=false); @@ -499,7 +541,7 @@ class PRCMarkup: public PRCGraphics, public ContentPRCBase { public: PRCMarkup(std::string n="") : - ContentPRCBase(&EMPTY_ATTRIBUTES,n,true,makeCADID(),0,makePRCID()), + ContentPRCBase(n,true,makeCADID(),0,makePRCID()), type(KEPRCMarkupType_Unknown), sub_type(KEPRCMarkupSubType_Unknown), index_tessellation(m1) {} void serializeMarkup(PRCbitStream&); EPRCMarkupType type; @@ -508,26 +550,24 @@ public: // vector<PRCReferenceUniqueIdentifier> leaders; uint32_t index_tessellation; }; -typedef std::tr1::shared_ptr <PRCMarkup> PRCpMarkup; -typedef std::vector <PRCpMarkup> PRCMarkupList; +typedef std::deque <PRCMarkup*> PRCMarkupList; class PRCAnnotationItem: public PRCGraphics, public ContentPRCBase { public: PRCAnnotationItem(std::string n="") : - ContentPRCBase(&EMPTY_ATTRIBUTES,n,true,makeCADID(),0,makePRCID()) {} + ContentPRCBase(n,true,makeCADID(),0,makePRCID()) {} void serializeAnnotationItem(PRCbitStream&); void serializeAnnotationEntity(PRCbitStream &pbs) { serializeAnnotationItem(pbs); } PRCReferenceUniqueIdentifier markup; }; -typedef std::tr1::shared_ptr <PRCAnnotationItem> PRCpAnnotationItem; -typedef std::vector <PRCpAnnotationItem> PRCAnnotationItemList; +typedef std::deque <PRCAnnotationItem*> PRCAnnotationItemList; class PRCRepresentationItemContent: public PRCGraphics, public ContentPRCBase { public: PRCRepresentationItemContent(std::string n="") : - ContentPRCBase(&EMPTY_ATTRIBUTES,n,true,makeCADID(),0,makePRCID()), + ContentPRCBase(n,true,makeCADID(),0,makePRCID()), index_local_coordinate_system(m1), index_tessellation(m1) {} void serializeRepresentationItemContent(PRCbitStream&); uint32_t index_local_coordinate_system; @@ -539,10 +579,10 @@ class PRCRepresentationItem : public PRCRepresentationItemContent public: PRCRepresentationItem(std::string n="") : PRCRepresentationItemContent(n) {} + virtual ~PRCRepresentationItem() {} virtual void serializeRepresentationItem(PRCbitStream &pbs) = 0; }; -typedef std::tr1::shared_ptr <PRCRepresentationItem> PRCpRepresentationItem; -typedef std::vector <PRCpRepresentationItem> PRCRepresentationItemList; +typedef std::deque <PRCRepresentationItem*> PRCRepresentationItemList; class PRCBrepModel : public PRCRepresentationItem { @@ -576,7 +616,6 @@ public: void serializeRepresentationItem(PRCbitStream &pbs) { serializePointSet(pbs); } std::vector<PRCVector3d> point; }; -typedef std::tr1::shared_ptr <PRCPointSet> PRCpPointSet; class PRCWire : public PRCRepresentationItem { @@ -604,26 +643,26 @@ class PRCSet : public PRCRepresentationItem public: PRCSet(std::string n="") : PRCRepresentationItem(n) {} + ~PRCSet() { for(PRCRepresentationItemList::iterator it=elements.begin(); it!=elements.end(); ++it) delete *it; } void serializeSet(PRCbitStream&); void serializeRepresentationItem(PRCbitStream &pbs) { serializeSet(pbs); } - uint32_t addBrepModel(PRCBrepModel *pBrepModel); - uint32_t addPolyBrepModel(PRCPolyBrepModel *pPolyBrepModel); - uint32_t addPointSet(PRCPointSet *pPointSet); - uint32_t addSet(PRCSet *pSet); - uint32_t addWire(PRCWire *pWire); - uint32_t addPolyWire(PRCPolyWire *pPolyWire); - uint32_t addRepresentationItem(PRCRepresentationItem *pRepresentationItem); - uint32_t addRepresentationItem(PRCpRepresentationItem pRepresentationItem); + uint32_t addBrepModel(PRCBrepModel*& pBrepModel); + uint32_t addPolyBrepModel(PRCPolyBrepModel*& pPolyBrepModel); + uint32_t addPointSet(PRCPointSet*& pPointSet); + uint32_t addSet(PRCSet*& pSet); + uint32_t addWire(PRCWire*& pWire); + uint32_t addPolyWire(PRCPolyWire*& pPolyWire); + uint32_t addRepresentationItem(PRCRepresentationItem*& pRepresentationItem); PRCRepresentationItemList elements; }; class PRCTransformation3d { public: + virtual ~PRCTransformation3d() {} virtual void serializeTransformation3d(PRCbitStream&) const =0; }; -typedef std::tr1::shared_ptr <PRCTransformation3d> PRCpTransformation3d; -typedef std::vector <PRCpTransformation3d> PRCTransformation3dList; +typedef std::deque <PRCTransformation3d*> PRCTransformation3dList; class PRCGeneralTransformation3d : public PRCTransformation3d { @@ -714,8 +753,7 @@ public: mat[3][0]==0 && mat[3][1]==0 && mat[3][2]==0 && mat[3][3]==1 ); } }; -typedef std::tr1::shared_ptr <PRCGeneralTransformation3d> PRCpGeneralTransformation3d; -typedef std::vector <PRCpGeneralTransformation3d> PRCGeneralTransformation3dList; +typedef std::deque <PRCGeneralTransformation3d> PRCGeneralTransformation3dList; class PRCCartesianTransformation3d : public PRCTransformation3d { @@ -765,18 +803,20 @@ class PRCCoordinateSystem : public PRCRepresentationItem { public: PRCCoordinateSystem(std::string n="") : - PRCRepresentationItem(n) {} + PRCRepresentationItem(n), axis_set(NULL) {} + ~PRCCoordinateSystem() { delete axis_set; } void serializeCoordinateSystem(PRCbitStream&); void serializeRepresentationItem(PRCbitStream &pbs) { serializeCoordinateSystem(pbs); } - PRCpTransformation3d axis_set; + void setAxisSet(PRCTransformation3d*& transform) { axis_set = transform; transform = NULL; } + PRCTransformation3d *axis_set; bool operator==(const PRCCoordinateSystem &t) const { if(index_local_coordinate_system!=t.index_local_coordinate_system) return false; - PRCGeneralTransformation3d* axis_set_general = dynamic_cast<PRCGeneralTransformation3d*>(axis_set.get()); - PRCGeneralTransformation3d* t_axis_set_general = dynamic_cast<PRCGeneralTransformation3d*>(t.axis_set.get()); - PRCCartesianTransformation3d* axis_set_cartesian = dynamic_cast<PRCCartesianTransformation3d*>(axis_set.get()); - PRCCartesianTransformation3d* t_axis_set_cartesian = dynamic_cast<PRCCartesianTransformation3d*>(t.axis_set.get()); + PRCGeneralTransformation3d* axis_set_general = dynamic_cast<PRCGeneralTransformation3d*>(axis_set); + PRCGeneralTransformation3d* t_axis_set_general = dynamic_cast<PRCGeneralTransformation3d*>(t.axis_set); + PRCCartesianTransformation3d* axis_set_cartesian = dynamic_cast<PRCCartesianTransformation3d*>(axis_set); + PRCCartesianTransformation3d* t_axis_set_cartesian = dynamic_cast<PRCCartesianTransformation3d*>(t.axis_set); if(axis_set_general!=NULL) return (t_axis_set_general!=NULL?(*axis_set_general==*t_axis_set_general):false); if(axis_set_cartesian!=NULL) @@ -784,8 +824,7 @@ public: return false; } }; -typedef std::tr1::shared_ptr <PRCCoordinateSystem> PRCpCoordinateSystem; -typedef std::vector <PRCpCoordinateSystem> PRCCoordinateSystemList; +typedef std::deque <PRCCoordinateSystem*> PRCCoordinateSystemList; struct PRCFontKey { @@ -804,16 +843,15 @@ public: }; // Topology -class PRCBaseGeometry +class PRCBaseGeometry : public PRCAttributes { public: PRCBaseGeometry() : - base_information(false) {} - PRCBaseGeometry(Attributes *a, std::string n="", uint32_t id = 0) : - base_information(true),attributes(a),name(n),identifier(id) {} + base_information(false), identifier(0) {} + PRCBaseGeometry(std::string n, uint32_t id = 0) : + base_information(true),name(n),identifier(id) {} void serializeBaseGeometry(PRCbitStream&); bool base_information; - Attributes *attributes; std::string name; uint32_t identifier; }; @@ -895,7 +933,7 @@ public: PRCContentSurface() : PRCBaseGeometry(), extend_info(KEPRCExtendTypeNone) {} PRCContentSurface(std::string n) : - PRCBaseGeometry(&EMPTY_ATTRIBUTES,n,makeCADID()),extend_info(KEPRCExtendTypeNone) {} + PRCBaseGeometry(n,makeCADID()),extend_info(KEPRCExtendTypeNone) {} void serializeContentSurface(PRCbitStream&); EPRCExtendType extend_info; }; @@ -907,10 +945,9 @@ public: PRCContentSurface() {} PRCSurface(std::string n) : PRCContentSurface(n) {} + virtual ~PRCSurface() {} virtual void serializeSurface(PRCbitStream &pbs) = 0; }; -typedef std::tr1::shared_ptr <PRCSurface> PRCpSurface; -typedef std::vector <PRCpSurface> PRCSurfaceList; class PRCNURBSSurface : public PRCSurface { @@ -937,7 +974,7 @@ public: PRCContentCurve() : PRCBaseGeometry(), extend_info(KEPRCExtendTypeNone), is_3d(true) {} PRCContentCurve(std::string n) : - PRCBaseGeometry(&EMPTY_ATTRIBUTES,n,makeCADID()),extend_info(KEPRCExtendTypeNone), is_3d(true) {} + PRCBaseGeometry(n,makeCADID()),extend_info(KEPRCExtendTypeNone), is_3d(true) {} void serializeContentCurve(PRCbitStream&); EPRCExtendType extend_info; bool is_3d; @@ -950,10 +987,10 @@ public: PRCContentCurve() {} PRCCurve(std::string n) : PRCContentCurve(n) {} + virtual ~PRCCurve() {} virtual void serializeCurve(PRCbitStream &pbs) = 0; }; -typedef std::tr1::shared_ptr <PRCCurve> PRCpCurve; -typedef std::vector <PRCpCurve> PRCCurveList; +typedef std::deque <PRCCurve*> PRCCurveList; class PRCNURBSCurve : public PRCCurve { @@ -1014,32 +1051,34 @@ class PRCBlend01 : public PRCSurface, public PRCTransformation, public PRCUVPara { public: PRCBlend01() : - PRCSurface() {} + PRCSurface(), center_curve(NULL), origin_curve(NULL), tangent_curve(NULL) {} PRCBlend01(std::string n) : - PRCSurface(n) {} + PRCSurface(n), center_curve(NULL), origin_curve(NULL), tangent_curve(NULL) {} + ~PRCBlend01() { delete center_curve; delete origin_curve; delete tangent_curve; } void serializeBlend01(PRCbitStream &pbs); void serializeSurface(PRCbitStream &pbs) { serializeBlend01(pbs); } - void setCenterCurve(PRCCurve *curve) { center_curve.reset(curve); } - void setOriginCurve(PRCCurve *curve) { origin_curve.reset(curve); } - void setTangentCurve(PRCCurve *curve) { tangent_curve.reset(curve); } - PRCpCurve center_curve; - PRCpCurve origin_curve; - PRCpCurve tangent_curve; +// void setCenterCurve (PRCCurve*& curve) { center_curve = curve; curve = NULL; } +// void setOriginCurve (PRCCurve*& curve) { origin_curve = curve; curve = NULL; } +// void setTangentCurve(PRCCurve*& curve) { tangent_curve = curve; curve = NULL; } + PRCCurve* center_curve; + PRCCurve* origin_curve; + PRCCurve* tangent_curve; }; class PRCRuled : public PRCSurface, public PRCTransformation, public PRCUVParameterization { public: PRCRuled() : - PRCSurface() {} + PRCSurface(), first_curve(NULL), second_curve(NULL) {} PRCRuled(std::string n) : PRCSurface(n) {} + ~PRCRuled() { delete first_curve; delete second_curve; } void serializeRuled(PRCbitStream &pbs); void serializeSurface(PRCbitStream &pbs) { serializeRuled(pbs); } - void setFirstCurve(PRCCurve *curve) { first_curve.reset(curve); } - void setSecondCurve(PRCCurve *curve) { second_curve.reset(curve); } - PRCpCurve first_curve; - PRCpCurve second_curve; +// void setFirstCurve(PRCCurve*& curve) { first_curve = curve; curve = NULL; } +// void setSecondCurve(PRCCurve*& curve) { second_curve = curve; curve = NULL; } + PRCCurve* first_curve; + PRCCurve* second_curve; }; class PRCSphere : public PRCSurface, public PRCTransformation, public PRCUVParameterization @@ -1079,16 +1118,15 @@ public: double minor_radius; }; -class PRCBaseTopology +class PRCBaseTopology : public PRCAttributes { public: PRCBaseTopology() : - base_information(false),attributes(NULL),identifier(0) {} - PRCBaseTopology(Attributes *a, std::string n="", uint32_t id = 0) : - base_information(true),attributes(a),name(n),identifier(id) {} + base_information(false),identifier(0) {} + PRCBaseTopology(std::string n, uint32_t id = 0) : + base_information(true),name(n),identifier(id) {} void serializeBaseTopology(PRCbitStream&); bool base_information; - Attributes *attributes; std::string name; uint32_t identifier; }; @@ -1096,9 +1134,9 @@ public: class PRCTopoItem { public: + virtual ~PRCTopoItem() {} virtual void serializeTopoItem(PRCbitStream&)=0; }; -typedef std::tr1::shared_ptr <PRCTopoItem> PRCpTopoItem; class PRCContentBody: public PRCBaseTopology { @@ -1106,7 +1144,7 @@ public: PRCContentBody() : PRCBaseTopology(), behavior(0) {} PRCContentBody(std::string n) : - PRCBaseTopology(&EMPTY_ATTRIBUTES,n,makeCADID()), behavior(0) {} + PRCBaseTopology(n,makeCADID()), behavior(0) {} void serializeContentBody(PRCbitStream&); uint8_t behavior; }; @@ -1120,26 +1158,26 @@ public: PRCContentBody(), topo_item_type(tit) {} PRCBody(uint32_t tit, std::string n) : PRCContentBody(n), topo_item_type(tit) {} + virtual ~PRCBody() {} virtual void serializeBody(PRCbitStream &pbs) = 0; void serializeTopoItem(PRCbitStream &pbs) { serializeBody(pbs); } uint32_t serialType() { return topo_item_type; } virtual double serialTolerance() { return 0; } const uint32_t topo_item_type; }; -typedef std::tr1::shared_ptr <PRCBody> PRCpBody; -typedef std::vector <PRCpBody> PRCBodyList; +typedef std::deque <PRCBody*> PRCBodyList; class PRCContentWireEdge : public PRCBaseTopology { public: PRCContentWireEdge() : - PRCBaseTopology(), has_curve_trim_interval(false) {} + PRCBaseTopology(), curve_3d(NULL), has_curve_trim_interval(false) {} PRCContentWireEdge(std::string n) : - PRCBaseTopology(&EMPTY_ATTRIBUTES,n,makeCADID()), has_curve_trim_interval(false) {} + PRCBaseTopology(n,makeCADID()), curve_3d(NULL), has_curve_trim_interval(false) {} + ~PRCContentWireEdge() { delete curve_3d; } void serializeContentWireEdge(PRCbitStream &pbs); - void setCurve(PRCCurve *pCurve) { curve_3d.reset(pCurve); } - void setCurve(PRCpCurve pCurve) { curve_3d = pCurve; } - PRCpCurve curve_3d; +// void setCurve(PRCCurve*& curve) { curve_3d = curve; curve = NULL; } + PRCCurve* curve_3d; bool has_curve_trim_interval; PRCInterval curve_trim_interval; }; @@ -1155,27 +1193,28 @@ class PRCSingleWireBody : public PRCBody { public: PRCSingleWireBody() : - PRCBody(PRC_TYPE_TOPO_SingleWireBody) {} + PRCBody(PRC_TYPE_TOPO_SingleWireBody), wire_edge(NULL) {} PRCSingleWireBody(std::string n) : - PRCBody(PRC_TYPE_TOPO_SingleWireBody, n) {} + PRCBody(PRC_TYPE_TOPO_SingleWireBody, n), wire_edge(NULL) {} + ~PRCSingleWireBody() { delete wire_edge; } void serializeSingleWireBody(PRCbitStream &pbs); void serializeBody(PRCbitStream &pbs) { serializeSingleWireBody(pbs); } - void setWireEdge(PRCWireEdge *wireEdge); -// void setEdge(const PRCEdge &edge); - PRCpTopoItem wire_edge; + void setWireEdge(PRCWireEdge*& wireEdge) { wire_edge = wireEdge; wireEdge = NULL; } + PRCWireEdge* wire_edge; }; class PRCFace : public PRCBaseTopology, public PRCTopoItem, public PRCGraphics { public: PRCFace() : - PRCBaseTopology(), have_surface_trim_domain(false), have_tolerance(false), tolerance(0), number_of_loop(0), outer_loop_index(-1) {} + PRCBaseTopology(), base_surface(NULL), have_surface_trim_domain(false), have_tolerance(false), tolerance(0), number_of_loop(0), outer_loop_index(-1) {} PRCFace(std::string n) : - PRCBaseTopology(&EMPTY_ATTRIBUTES,n,makeCADID()), have_surface_trim_domain(false), have_tolerance(false), tolerance(0), number_of_loop(0), outer_loop_index(-1) {} + PRCBaseTopology(n,makeCADID()), base_surface(NULL), have_surface_trim_domain(false), have_tolerance(false), tolerance(0), number_of_loop(0), outer_loop_index(-1) {} + ~PRCFace() { delete base_surface; } void serializeFace(PRCbitStream &pbs); void serializeTopoItem(PRCbitStream &pbs) { serializeFace(pbs); } - void setSurface(PRCSurface *pSurface) { base_surface.reset(pSurface); } - PRCpSurface base_surface; + void setBaseSurface(PRCSurface*& surface) { base_surface = surface; surface = NULL; } + PRCSurface *base_surface; const bool have_surface_trim_domain; PRCDomain surface_trim_domain; const bool have_tolerance; @@ -1184,8 +1223,7 @@ public: const int32_t outer_loop_index; // PRCLoopList loop; }; -typedef std::tr1::shared_ptr <PRCFace> PRCpFace; -typedef std::vector <PRCpFace> PRCFaceList; +typedef std::deque <PRCFace*> PRCFaceList; class PRCShell : public PRCBaseTopology, public PRCTopoItem { @@ -1193,17 +1231,16 @@ public: PRCShell() : PRCBaseTopology(), shell_is_closed(false) {} PRCShell(std::string n) : - PRCBaseTopology(&EMPTY_ATTRIBUTES,n,makeCADID()), shell_is_closed(false) {} + PRCBaseTopology(n,makeCADID()), shell_is_closed(false) {} + ~PRCShell() { for(PRCFaceList::iterator it=face.begin(); it!=face.end(); ++it) delete *it; } void serializeShell(PRCbitStream &pbs); void serializeTopoItem(PRCbitStream &pbs) { serializeShell(pbs); } - void addFace(PRCFace *pFace, uint8_t orientation=2); - void addFace(const PRCpFace &pFace, uint8_t orientation=2); + void addFace(PRCFace*& pFace, uint8_t orientation=2); bool shell_is_closed; PRCFaceList face; std::vector<uint8_t> orientation_surface_with_shell; }; -typedef std::tr1::shared_ptr <PRCShell> PRCpShell; -typedef std::vector <PRCpShell> PRCShellList; +typedef std::deque <PRCShell*> PRCShellList; class PRCConnex : public PRCBaseTopology, public PRCTopoItem { @@ -1211,14 +1248,14 @@ public: PRCConnex() : PRCBaseTopology() {} PRCConnex(std::string n) : - PRCBaseTopology(&EMPTY_ATTRIBUTES,n,makeCADID()) {} + PRCBaseTopology(n,makeCADID()) {} + ~PRCConnex() { for(PRCShellList::iterator it=shell.begin(); it!=shell.end(); ++it) delete *it; } void serializeConnex(PRCbitStream &pbs); void serializeTopoItem(PRCbitStream &pbs) { serializeConnex(pbs); } - void addShell(PRCShell *pShell); + void addShell(PRCShell*& pShell); PRCShellList shell; }; -typedef std::tr1::shared_ptr <PRCConnex> PRCpConnex; -typedef std::vector <PRCpConnex> PRCConnexList; +typedef std::deque <PRCConnex*> PRCConnexList; class PRCBrepData : public PRCBody, public PRCBoundingBox { @@ -1227,9 +1264,10 @@ public: PRCBody(PRC_TYPE_TOPO_BrepData) {} PRCBrepData(std::string n) : PRCBody(PRC_TYPE_TOPO_BrepData, n) {} + ~PRCBrepData() { for(PRCConnexList::iterator it=connex.begin(); it!=connex.end(); ++it) delete *it; } void serializeBrepData(PRCbitStream &pbs); void serializeBody(PRCbitStream &pbs) { serializeBrepData(pbs); } - void addConnex(PRCConnex *pConnex); + void addConnex(PRCConnex*& pConnex); PRCConnexList connex; }; @@ -1240,7 +1278,7 @@ public: PRCCompressedFace() : PRCBaseTopology(), orientation_surface_with_shell(true), degree(0) {} PRCCompressedFace(std::string n) : - PRCBaseTopology(&EMPTY_ATTRIBUTES,n,makeCADID()), orientation_surface_with_shell(true), degree(0) {} + PRCBaseTopology(n,makeCADID()), orientation_surface_with_shell(true), degree(0) {} void serializeCompressedFace(PRCbitStream &pbs, double brep_data_compressed_tolerance); void serializeContentCompressedFace(PRCbitStream &pbs); void serializeCompressedAnaNurbs(PRCbitStream &pbs, double brep_data_compressed_tolerance); @@ -1249,8 +1287,7 @@ public: uint32_t degree; std::vector<PRCVector3d> control_point; }; -typedef std::tr1::shared_ptr <PRCCompressedFace> PRCpCompressedFace; -typedef std::vector <PRCpCompressedFace> PRCCompressedFaceList; +typedef std::deque <PRCCompressedFace*> PRCCompressedFaceList; // For now - treat just the case of one connex/one shell class PRCCompressedBrepData : public PRCBody @@ -1260,6 +1297,7 @@ public: PRCBody(PRC_TYPE_TOPO_BrepDataCompress), serial_tolerance(0), brep_data_compressed_tolerance(0) {} PRCCompressedBrepData(std::string n) : PRCBody(PRC_TYPE_TOPO_BrepDataCompress, n), serial_tolerance(0), brep_data_compressed_tolerance(0) {} + ~PRCCompressedBrepData() { for(PRCCompressedFaceList::iterator it=face.begin(); it!=face.end(); ++it) delete *it; } void serializeCompressedBrepData(PRCbitStream &pbs); void serializeBody(PRCbitStream &pbs) { serializeCompressedBrepData(pbs); } void serializeCompressedShell(PRCbitStream &pbs); @@ -1273,15 +1311,16 @@ class PRCTopoContext : public ContentPRCBase { public: PRCTopoContext(std::string n="") : - ContentPRCBase(&EMPTY_ATTRIBUTES,n), behaviour(0), /* granularity(0), */ tolerance(0), + ContentPRCBase(n), behaviour(0), granularity(1), tolerance(0), have_smallest_face_thickness(false), smallest_thickness(0), have_scale(false), scale(1) {} + ~PRCTopoContext() { for(PRCBodyList::iterator it=body.begin(); it!=body.end(); ++it) delete *it; } void serializeTopoContext(PRCbitStream&); void serializeContextAndBodies(PRCbitStream&); void serializeGeometrySummary(PRCbitStream&); void serializeContextGraphics(PRCbitStream&); - uint32_t addSingleWireBody(PRCSingleWireBody *body); - uint32_t addBrepData(PRCBrepData *body); - uint32_t addCompressedBrepData(PRCCompressedBrepData *body); + uint32_t addSingleWireBody(PRCSingleWireBody*& body); + uint32_t addBrepData(PRCBrepData*& body); + uint32_t addCompressedBrepData(PRCCompressedBrepData*& body); uint8_t behaviour; double granularity; double tolerance; @@ -1291,8 +1330,7 @@ public: double scale; PRCBodyList body; }; -typedef std::tr1::shared_ptr <PRCTopoContext> PRCpTopoContext; -typedef std::vector <PRCpTopoContext> PRCTopoContextList; +typedef std::deque <PRCTopoContext*> PRCTopoContextList; class PRCUniqueId { @@ -1318,12 +1356,14 @@ class PRCProductOccurrence: public PRCGraphics, public ContentPRCBase { public: PRCProductOccurrence(std::string n="") : - ContentPRCBase(&EMPTY_ATTRIBUTES,n,true,makeCADID(),0,makePRCID()), + ContentPRCBase(n,true,makeCADID(),0,makePRCID()), index_part(m1), index_prototype(m1), prototype_in_same_file_structure(true), index_external_data(m1), external_data_in_same_file_structure(true), product_behaviour(0), product_information_flags(0), product_load_status(KEPRCProductLoadStatus_Loaded), - has_location(false) {} + location(NULL) {} + ~PRCProductOccurrence() { delete location; } + void setLocation(PRCGeneralTransformation3d*& transform) { location = transform; transform = NULL; } void serializeProductOccurrence(PRCbitStream&); uint32_t index_part; uint32_t index_prototype; @@ -1337,29 +1377,26 @@ public: PRCUnit unit_information; uint8_t product_information_flags; EPRCProductLoadStatus product_load_status; - bool has_location; - PRCpGeneralTransformation3d location; + PRCGeneralTransformation3d *location; }; -typedef std::tr1::shared_ptr <PRCProductOccurrence> PRCpProductOccurrence; -typedef std::vector <PRCpProductOccurrence> PRCProductOccurrenceList; +typedef std::deque <PRCProductOccurrence*> PRCProductOccurrenceList; class PRCPartDefinition: public PRCGraphics, public ContentPRCBase, public PRCBoundingBox { public: PRCPartDefinition(std::string n="") : - ContentPRCBase(&EMPTY_ATTRIBUTES,n,true,makeCADID(),0,makePRCID()) {} + ContentPRCBase(n,true,makeCADID(),0,makePRCID()) {} + ~PRCPartDefinition() { for(PRCRepresentationItemList::iterator it=representation_item.begin(); it!=representation_item.end(); ++it) delete *it; } void serializePartDefinition(PRCbitStream&); - uint32_t addBrepModel(PRCBrepModel *pBrepModel); - uint32_t addPolyBrepModel(PRCPolyBrepModel *pPolyBrepModel); - uint32_t addPointSet(PRCPointSet *pPointSet); - uint32_t addSet(PRCSet *pSet); - uint32_t addWire(PRCWire *pWire); - uint32_t addPolyWire(PRCPolyWire *pPolyWire); - uint32_t addRepresentationItem(PRCRepresentationItem *pRepresentationItem); - uint32_t addRepresentationItem(PRCpRepresentationItem pRepresentationItem); + uint32_t addBrepModel(PRCBrepModel*& pBrepModel); + uint32_t addPolyBrepModel(PRCPolyBrepModel*& pPolyBrepModel); + uint32_t addPointSet(PRCPointSet*& pPointSet); + uint32_t addSet(PRCSet*& pSet); + uint32_t addWire(PRCWire*& pWire); + uint32_t addPolyWire(PRCPolyWire*& pPolyWire); + uint32_t addRepresentationItem(PRCRepresentationItem*& pRepresentationItem); PRCRepresentationItemList representation_item; }; -typedef std::tr1::shared_ptr <PRCPartDefinition> PRCpPartDefinition; -typedef std::vector <PRCpPartDefinition> PRCPartDefinitionList; +typedef std::deque <PRCPartDefinition*> PRCPartDefinitionList; #endif //__WRITE_PRC_H diff --git a/Build/source/utils/asymptote/program.cc b/Build/source/utils/asymptote/program.cc index 4459362e9b5..244b658057d 100644 --- a/Build/source/utils/asymptote/program.cc +++ b/Build/source/utils/asymptote/program.cc @@ -36,6 +36,7 @@ string lookupBltin(bltin b) { ostream& operator<< (ostream& out, const item& i) { +/* // TODO: Make a data structure mapping typeids to print functions. if (i.empty()) out << "empty"; @@ -57,6 +58,7 @@ ostream& operator<< (ostream& out, const item& i) } else out << "type " << demangle(i.type().name()); +*/ return out; } diff --git a/Build/source/utils/asymptote/record.cc b/Build/source/utils/asymptote/record.cc index a09aff54cf2..191a39267f2 100644 --- a/Build/source/utils/asymptote/record.cc +++ b/Build/source/utils/asymptote/record.cc @@ -14,7 +14,7 @@ namespace types { -record::record(symbol *name, frame *level) +record::record(symbol name, frame *level) : ty(ty_record), name(name), level(level), @@ -23,19 +23,19 @@ record::record(symbol *name, frame *level) { assert(init); #ifdef DEBUG_STACK - init->name = "struct "+string(*name); + init->name = "struct "+string(name); #endif } record::~record() {} -record *record::newRecord(symbol *id, bool statically) +record *record::newRecord(symbol id, bool statically) { frame *underlevel = getLevel(statically); assert(underlevel); - frame *level = new frame(*id, underlevel, 0); + frame *level = new frame(id, underlevel, 0); record *r = new record(id, level); return r; @@ -47,8 +47,8 @@ trans::access *record::initializer() { return &a; } -dummyRecord::dummyRecord(symbol *name) - : record(name, new frame(*name, 0,0)) +dummyRecord::dummyRecord(symbol name) + : record(name, new frame(name, 0,0)) { // Encode the instructions to put an placeholder instance of the record // on the stack. diff --git a/Build/source/utils/asymptote/record.h b/Build/source/utils/asymptote/record.h index 4e7e66a3b92..b11ffcc53b7 100644 --- a/Build/source/utils/asymptote/record.h +++ b/Build/source/utils/asymptote/record.h @@ -26,7 +26,7 @@ namespace types { struct record : public ty { // The base name of this type. - symbol *name; + symbol name; // The frame. Like a frame for a function, it allocates the accesses // for fields and specifies the size of the record. @@ -44,10 +44,10 @@ public: // defined by "operator init" are stored here. protoenv postdefenv; - record(symbol *name, frame *level); + record(symbol name, frame *level); ~record(); - symbol *getName() + symbol getName() { return name; } @@ -89,16 +89,16 @@ public: } // Create a statically enclosed record from this record. - record *newRecord(symbol *id, bool statically); + record *newRecord(symbol id, bool statically); void print(ostream& out) const { - out << *name; + out << name; } void debug(ostream& out) const { - out << "struct " << *name << endl; + out << "struct " << name << endl; out << "types:" << endl; out << "re-implement" << endl; //out << te; @@ -113,7 +113,7 @@ public: // language. class dummyRecord : public record { public: - dummyRecord(symbol *name); + dummyRecord(symbol name); dummyRecord(string s); // Convenient functions for adding fields. diff --git a/Build/source/utils/asymptote/runarray.cc b/Build/source/utils/asymptote/runarray.cc index 0ae52bcf918..5ba123e8616 100644 --- a/Build/source/utils/asymptote/runarray.cc +++ b/Build/source/utils/asymptote/runarray.cc @@ -362,7 +362,7 @@ array *mult(array *a, array *b) array *ci=new array(nb0); (*c)[i]=ci; for(size_t j=0; j < nb0; ++j) { - T sum=0.0; + T sum=T(); size_t kj=j; for(size_t k=0; k < nb; ++k, kj += nb0) sum += Ai[k]*B[kj]; @@ -523,6 +523,13 @@ void integeroverflow(size_t i) buf << "Integer overflow"; error(buf); } + +void checkSize(Int n, Int depth) +{ + if(n < 0) error("cannot create a negative length array"); + if(depth < 0) error("cannot copy to a negative depth"); +} + } // Autogenerated routines: @@ -533,10 +540,10 @@ void integeroverflow(size_t i) namespace run { // Create an empty array. -#line 444 "runarray.in" +#line 451 "runarray.in" void emptyArray(stack *Stack) { -#line 445 "runarray.in" +#line 452 "runarray.in" {Stack->push<array*>(new array(0)); return;} } @@ -545,11 +552,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 454 "runarray.in" +#line 461 "runarray.in" void newDeepArray(stack *Stack) { Int depth=vm::pop<Int>(Stack); -#line 455 "runarray.in" +#line 462 "runarray.in" assert(depth > 0); Int *dims = new Int[depth]; @@ -568,11 +575,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 474 "runarray.in" +#line 481 "runarray.in" void newInitializedArray(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 475 "runarray.in" +#line 482 "runarray.in" assert(n >= 0); array *a = new array(n); @@ -585,12 +592,12 @@ void newInitializedArray(stack *Stack) // Similar to newInitializedArray, but after the n elements, append another // array to it. -#line 488 "runarray.in" +#line 495 "runarray.in" void newAppendedArray(stack *Stack) { Int n=vm::pop<Int>(Stack); array* tail=vm::pop<array*>(Stack); -#line 489 "runarray.in" +#line 496 "runarray.in" assert(n >= 0); array *a = new array(n); @@ -603,28 +610,49 @@ void newAppendedArray(stack *Stack) {Stack->push<array*>(a); return;} } -// 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 504 "runarray.in" -void newDuplicateArray(stack *Stack) +// Produce an array of n deep copies of value. +#line 510 "runarray.in" +void copyArray0(stack *Stack) { Int depth=vm::pop<Int>(Stack,Int_MAX); item value=vm::pop(Stack); Int n=vm::pop<Int>(Stack); -#line 505 "runarray.in" - if(n < 0) error("cannot create a negative length array"); - if(depth < 0) error("cannot copy to a negative depth"); +#line 511 "runarray.in" + checkSize(n,depth); + {Stack->push<array*>(new array((size_t) n, value, (size_t) 0)); return;} +} - {Stack->push<array*>(new array(n, value, depth)); return;} +#line 516 "runarray.in" +void copyArray1(stack *Stack) +{ + Int depth=vm::pop<Int>(Stack,Int_MAX); + item value=vm::pop(Stack); + Int n=vm::pop<Int>(Stack); +#line 517 "runarray.in" + checkSize(n,depth); + if(depth > 1) depth=1; + {Stack->push<array*>(new array((size_t) n, value, (size_t) depth)); return;} +} + +#line 523 "runarray.in" +void copyArray2(stack *Stack) +{ + Int depth=vm::pop<Int>(Stack,Int_MAX); + item value=vm::pop(Stack); + Int n=vm::pop<Int>(Stack); +#line 524 "runarray.in" + checkSize(n,depth); + if(depth > 2) depth=2; + {Stack->push<array*>(new array((size_t) n, value, (size_t) depth)); return;} } // Read an element from an array. Checks for initialization & bounds. -#line 513 "runarray.in" +#line 531 "runarray.in" void arrayRead(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 514 "runarray.in" +#line 532 "runarray.in" item& i=arrayRead(a,n); if (i.empty()) { ostringstream buf; @@ -635,50 +663,50 @@ void arrayRead(stack *Stack) } // Slice a substring from an array. -#line 525 "runarray.in" +#line 543 "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 526 "runarray.in" +#line 544 "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 533 "runarray.in" +#line 551 "runarray.in" void arraySliceReadToEnd(stack *Stack) { Int left=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 534 "runarray.in" +#line 552 "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 541 "runarray.in" +#line 559 "runarray.in" void arrayArrayRead(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); -#line 542 "runarray.in" +#line 560 "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 549 "runarray.in" +#line 567 "runarray.in" void arrayWrite(stack *Stack) { Int n=vm::pop<Int>(Stack); array * a=vm::pop<array *>(Stack); item value=vm::pop(Stack); -#line 550 "runarray.in" +#line 568 "runarray.in" size_t len=checkArray(a); bool cyclic=a->cyclic(); if(cyclic && len > 0) n=imod(n,len); @@ -692,27 +720,27 @@ void arrayWrite(stack *Stack) {Stack->push(value); return;} } -#line 564 "runarray.in" +#line 582 "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 565 "runarray.in" +#line 583 "runarray.in" checkArray(src); checkArray(dest); dest->setSlice(left, right, src); {Stack->push<array*>(src); return;} } -#line 572 "runarray.in" +#line 590 "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 573 "runarray.in" +#line 591 "runarray.in" checkArray(src); size_t len=checkArray(dest); dest->setSlice(left, (Int) len, src); @@ -720,20 +748,20 @@ void arraySliceWriteToEnd(stack *Stack) } // Returns the length of an array. -#line 581 "runarray.in" +#line 599 "runarray.in" void arrayLength(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 582 "runarray.in" +#line 600 "runarray.in" {Stack->push<Int>((Int) checkArray(a)); return;} } // Returns an array of integers representing the keys of the array. -#line 587 "runarray.in" +#line 605 "runarray.in" void arrayKeys(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 588 "runarray.in" +#line 606 "runarray.in" size_t size=checkArray(a); array *keys=new array(); @@ -747,33 +775,33 @@ void arrayKeys(stack *Stack) } // Return the cyclic flag for an array. -#line 602 "runarray.in" +#line 620 "runarray.in" void arrayCyclicFlag(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 603 "runarray.in" +#line 621 "runarray.in" checkArray(a); {Stack->push<bool>(a->cyclic()); return;} } -#line 608 "runarray.in" +#line 626 "runarray.in" void arraySetCyclicFlag(stack *Stack) { array * a=vm::pop<array *>(Stack); bool b=vm::pop<bool>(Stack); -#line 609 "runarray.in" +#line 627 "runarray.in" checkArray(a); a->cyclic(b); {Stack->push<bool>(b); return;} } // Check to see if an array element is initialized. -#line 616 "runarray.in" +#line 634 "runarray.in" void arrayInitializedHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); Int n=vm::pop<Int>(Stack); -#line 617 "runarray.in" +#line 635 "runarray.in" size_t len=checkArray(a); bool cyclic=a->cyclic(); if(cyclic && len > 0) n=imod(n,len); @@ -783,62 +811,62 @@ void arrayInitializedHelper(stack *Stack) } // Returns the initialize method for an array. -#line 627 "runarray.in" +#line 645 "runarray.in" void arrayInitialized(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 628 "runarray.in" +#line 646 "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 633 "runarray.in" +#line 651 "runarray.in" void arrayCyclicHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); bool b=vm::pop<bool>(Stack); -#line 634 "runarray.in" +#line 652 "runarray.in" checkArray(a); a->cyclic(b); } // Set the cyclic flag for an array. -#line 640 "runarray.in" +#line 658 "runarray.in" void arrayCyclic(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 641 "runarray.in" +#line 659 "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 646 "runarray.in" +#line 664 "runarray.in" void arrayPushHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); item x=vm::pop(Stack); -#line 647 "runarray.in" +#line 665 "runarray.in" checkArray(a); a->push(x); {Stack->push(x); return;} } // Returns the push method for an array. -#line 654 "runarray.in" +#line 672 "runarray.in" void arrayPush(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 655 "runarray.in" +#line 673 "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 660 "runarray.in" +#line 678 "runarray.in" void arrayAppendHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); array * b=vm::pop<array *>(Stack); -#line 661 "runarray.in" +#line 679 "runarray.in" checkArray(a); size_t size=checkArray(b); for(size_t i=0; i < size; i++) @@ -846,20 +874,20 @@ void arrayAppendHelper(stack *Stack) } // Returns the append method for an array. -#line 669 "runarray.in" +#line 687 "runarray.in" void arrayAppend(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 670 "runarray.in" +#line 688 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayAppendHelper),a)); return;} } // The helper function for the pop method. -#line 675 "runarray.in" +#line 693 "runarray.in" void arrayPopHelper(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 676 "runarray.in" +#line 694 "runarray.in" size_t asize=checkArray(a); if(asize == 0) error("cannot pop element from empty array"); @@ -867,22 +895,22 @@ void arrayPopHelper(stack *Stack) } // Returns the pop method for an array. -#line 684 "runarray.in" +#line 702 "runarray.in" void arrayPop(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 685 "runarray.in" +#line 703 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayPopHelper),a)); return;} } // The helper function for the insert method. -#line 690 "runarray.in" +#line 708 "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 691 "runarray.in" +#line 709 "runarray.in" size_t asize=checkArray(a); checkArray(x); if(a->cyclic() && asize > 0) i=imod(i,asize); @@ -892,39 +920,39 @@ void arrayInsertHelper(stack *Stack) } // Returns the insert method for an array. -#line 701 "runarray.in" +#line 719 "runarray.in" void arrayInsert(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 702 "runarray.in" +#line 720 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayInsertHelper),a)); return;} } // Returns the delete method for an array. -#line 707 "runarray.in" +#line 725 "runarray.in" void arrayDelete(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 708 "runarray.in" +#line 726 "runarray.in" {Stack->push<callable*>(new thunk(new bfunc(arrayDeleteHelper),a)); return;} } -#line 712 "runarray.in" +#line 730 "runarray.in" void arrayAlias(stack *Stack) { array * b=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 713 "runarray.in" +#line 731 "runarray.in" {Stack->push<bool>(a==b); return;} } // Return array formed by indexing array a with elements of integer array b -#line 718 "runarray.in" +#line 736 "runarray.in" void arrayIntArray(stack *Stack) { array * b=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 719 "runarray.in" +#line 737 "runarray.in" size_t asize=checkArray(a); size_t bsize=checkArray(b); array *r=new array(bsize); @@ -942,13 +970,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 737 "runarray.in" +#line 755 "runarray.in" // Intarray* complement(Intarray *a, Int n); -void gen_runarray31(stack *Stack) +void gen_runarray33(stack *Stack) { Int n=vm::pop<Int>(Stack); Intarray * a=vm::pop<Intarray *>(Stack); -#line 738 "runarray.in" +#line 756 "runarray.in" size_t asize=checkArray(a); array *r=new array(0); bool *keep=new bool[n]; @@ -965,12 +993,12 @@ void gen_runarray31(stack *Stack) } // Generate the sequence {f(i) : i=0,1,...n-1} given a function f and integer n -#line 755 "runarray.in" +#line 773 "runarray.in" void arraySequence(stack *Stack) { Int n=vm::pop<Int>(Stack); callable * f=vm::pop<callable *>(Stack); -#line 756 "runarray.in" +#line 774 "runarray.in" if(n < 0) n=0; array *a=new array(n); for(Int i=0; i < n; ++i) { @@ -982,12 +1010,12 @@ void arraySequence(stack *Stack) } // Return the array {0,1,...n-1} -#line 768 "runarray.in" +#line 786 "runarray.in" // Intarray* sequence(Int n); -void gen_runarray33(stack *Stack) +void gen_runarray35(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 769 "runarray.in" +#line 787 "runarray.in" if(n < 0) n=0; array *a=new array(n); for(Int i=0; i < n; ++i) { @@ -997,12 +1025,12 @@ void gen_runarray33(stack *Stack) } // Apply a function to each element of an array -#line 779 "runarray.in" +#line 797 "runarray.in" void arrayFunction(stack *Stack) { array * a=vm::pop<array *>(Stack); callable * f=vm::pop<callable *>(Stack); -#line 780 "runarray.in" +#line 798 "runarray.in" size_t size=checkArray(a); array *b=new array(size); for(size_t i=0; i < size; ++i) { @@ -1013,12 +1041,12 @@ void arrayFunction(stack *Stack) {Stack->push<array*>(b); return;} } -#line 791 "runarray.in" +#line 809 "runarray.in" void arraySort(stack *Stack) { callable * f=vm::pop<callable *>(Stack); array * a=vm::pop<array *>(Stack); -#line 792 "runarray.in" +#line 810 "runarray.in" array *c=copyArray(a); compareFunc=f; FuncStack=Stack; @@ -1026,12 +1054,12 @@ void arraySort(stack *Stack) {Stack->push<array*>(c); return;} } -#line 800 "runarray.in" +#line 818 "runarray.in" // bool all(boolarray *a); -void gen_runarray36(stack *Stack) +void gen_runarray38(stack *Stack) { boolarray * a=vm::pop<boolarray *>(Stack); -#line 801 "runarray.in" +#line 819 "runarray.in" size_t size=checkArray(a); bool c=true; for(size_t i=0; i < size; i++) @@ -1039,12 +1067,12 @@ void gen_runarray36(stack *Stack) {Stack->push<bool>(c); return;} } -#line 809 "runarray.in" +#line 827 "runarray.in" // boolarray* !(boolarray* a); -void gen_runarray37(stack *Stack) +void gen_runarray39(stack *Stack) { boolarray* a=vm::pop<boolarray*>(Stack); -#line 810 "runarray.in" +#line 828 "runarray.in" size_t size=checkArray(a); array *c=new array(size); for(size_t i=0; i < size; i++) @@ -1052,12 +1080,12 @@ void gen_runarray37(stack *Stack) {Stack->push<boolarray*>(c); return;} } -#line 818 "runarray.in" +#line 836 "runarray.in" // Int sum(boolarray *a); -void gen_runarray38(stack *Stack) +void gen_runarray40(stack *Stack) { boolarray * a=vm::pop<boolarray *>(Stack); -#line 819 "runarray.in" +#line 837 "runarray.in" size_t size=checkArray(a); Int sum=0; for(size_t i=0; i < size; i++) @@ -1065,19 +1093,19 @@ void gen_runarray38(stack *Stack) {Stack->push<Int>(sum); return;} } -#line 827 "runarray.in" +#line 845 "runarray.in" void arrayCopy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 828 "runarray.in" +#line 846 "runarray.in" {Stack->push<array*>(copyArray(a)); return;} } -#line 832 "runarray.in" +#line 850 "runarray.in" void arrayConcat(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 833 "runarray.in" +#line 851 "runarray.in" // a is an array of arrays to be concatenated together. // The signature is // T[] concat(... T[][] a); @@ -1104,27 +1132,27 @@ void arrayConcat(stack *Stack) {Stack->push<array*>(result); return;} } -#line 860 "runarray.in" +#line 878 "runarray.in" void array2Copy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 861 "runarray.in" +#line 879 "runarray.in" {Stack->push<array*>(copyArray2(a)); return;} } -#line 865 "runarray.in" +#line 883 "runarray.in" void array3Copy(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 866 "runarray.in" +#line 884 "runarray.in" {Stack->push<array*>(copyArray3(a)); return;} } -#line 870 "runarray.in" +#line 888 "runarray.in" void array2Transpose(stack *Stack) { array * a=vm::pop<array *>(Stack); -#line 871 "runarray.in" +#line 889 "runarray.in" size_t asize=checkArray(a); array *c=new array(0); for(size_t i=0; i < asize; i++) { @@ -1151,12 +1179,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 898 "runarray.in" +#line 916 "runarray.in" void array3Transpose(stack *Stack) { array * perm=vm::pop<array *>(Stack); array * a=vm::pop<array *>(Stack); -#line 899 "runarray.in" +#line 917 "runarray.in" const size_t DIM=3; if(checkArray(perm) != DIM) { @@ -1240,13 +1268,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 983 "runarray.in" +#line 1001 "runarray.in" // Int find(boolarray *a, Int n=1); -void gen_runarray45(stack *Stack) +void gen_runarray47(stack *Stack) { Int n=vm::pop<Int>(Stack,1); boolarray * a=vm::pop<boolarray *>(Stack); -#line 984 "runarray.in" +#line 1002 "runarray.in" size_t size=checkArray(a); Int j=-1; if(n > 0) @@ -1264,13 +1292,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 1002 "runarray.in" +#line 1020 "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 1003 "runarray.in" +#line 1021 "runarray.in" size_t size=checkArray(a); array *r=new array(size); if(b && c) { @@ -1294,22 +1322,22 @@ void arrayConditional(stack *Stack) } // Return an n x n identity matrix. -#line 1027 "runarray.in" +#line 1045 "runarray.in" // realarray2* identity(Int n); -void gen_runarray47(stack *Stack) +void gen_runarray49(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 1028 "runarray.in" +#line 1046 "runarray.in" {Stack->push<realarray2*>(Identity(n)); return;} } // Return the inverse of an n x n matrix a using Gauss-Jordan elimination. -#line 1033 "runarray.in" +#line 1051 "runarray.in" // realarray2* inverse(realarray2 *a); -void gen_runarray48(stack *Stack) +void gen_runarray50(stack *Stack) { realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1034 "runarray.in" +#line 1052 "runarray.in" a=copyArray2(a); size_t n=checkArray(a); checkSquare(a); @@ -1402,14 +1430,14 @@ void gen_runarray48(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 1127 "runarray.in" +#line 1145 "runarray.in" // realarray* solve(realarray2 *a, realarray *b, bool warn=true); -void gen_runarray49(stack *Stack) +void gen_runarray51(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); realarray * b=vm::pop<realarray *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1128 "runarray.in" +#line 1146 "runarray.in" size_t n=checkArray(a); if(n == 0) {Stack->push<realarray*>(new array(0)); return;} @@ -1461,14 +1489,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 n x m matrix. // If no solution exists, return an empty array. -#line 1180 "runarray.in" +#line 1198 "runarray.in" // realarray2* solve(realarray2 *a, realarray2 *b, bool warn=true); -void gen_runarray50(stack *Stack) +void gen_runarray52(stack *Stack) { bool warn=vm::pop<bool>(Stack,true); realarray2 * b=vm::pop<realarray2 *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1181 "runarray.in" +#line 1199 "runarray.in" size_t n=checkArray(a); if(n == 0) {Stack->push<realarray2*>(new array(0)); return;} @@ -1530,12 +1558,12 @@ void gen_runarray50(stack *Stack) } // Compute the determinant of an n x n matrix. -#line 1243 "runarray.in" +#line 1261 "runarray.in" // real determinant(realarray2 *a); -void gen_runarray51(stack *Stack) +void gen_runarray53(stack *Stack) { realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1244 "runarray.in" +#line 1262 "runarray.in" real *A; copyArray2C(A,a); size_t n=checkArray(a); @@ -1550,13 +1578,13 @@ void gen_runarray51(stack *Stack) {Stack->push<real>(det); return;} } -#line 1259 "runarray.in" +#line 1277 "runarray.in" // realarray* *(realarray2 *a, realarray *b); -void gen_runarray52(stack *Stack) +void gen_runarray54(stack *Stack) { realarray * b=vm::pop<realarray *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1260 "runarray.in" +#line 1278 "runarray.in" size_t n=checkArray(a); size_t m=checkArray(b); array *c=new array(n); @@ -1574,13 +1602,13 @@ void gen_runarray52(stack *Stack) {Stack->push<realarray*>(c); return;} } -#line 1278 "runarray.in" +#line 1296 "runarray.in" // realarray* *(realarray *a, realarray2 *b); -void gen_runarray53(stack *Stack) +void gen_runarray55(stack *Stack) { realarray2 * b=vm::pop<realarray2 *>(Stack); realarray * a=vm::pop<realarray *>(Stack); -#line 1279 "runarray.in" +#line 1297 "runarray.in" size_t n=checkArray(a); if(n != checkArray(b)) error(incommensurate); real *A; @@ -1608,53 +1636,53 @@ void gen_runarray53(stack *Stack) {Stack->push<realarray*>(c); return;} } -#line 1307 "runarray.in" +#line 1325 "runarray.in" // Intarray2* *(Intarray2 *a, Intarray2 *b); -void gen_runarray54(stack *Stack) +void gen_runarray56(stack *Stack) { Intarray2 * b=vm::pop<Intarray2 *>(Stack); Intarray2 * a=vm::pop<Intarray2 *>(Stack); -#line 1308 "runarray.in" +#line 1326 "runarray.in" {Stack->push<Intarray2*>(mult<Int>(a,b)); return;} } -#line 1312 "runarray.in" +#line 1330 "runarray.in" // realarray2* *(realarray2 *a, realarray2 *b); -void gen_runarray55(stack *Stack) +void gen_runarray57(stack *Stack) { realarray2 * b=vm::pop<realarray2 *>(Stack); realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1313 "runarray.in" +#line 1331 "runarray.in" {Stack->push<realarray2*>(mult<real>(a,b)); return;} } -#line 1317 "runarray.in" +#line 1335 "runarray.in" // pairarray2* *(pairarray2 *a, pairarray2 *b); -void gen_runarray56(stack *Stack) +void gen_runarray58(stack *Stack) { pairarray2 * b=vm::pop<pairarray2 *>(Stack); pairarray2 * a=vm::pop<pairarray2 *>(Stack); -#line 1318 "runarray.in" +#line 1336 "runarray.in" {Stack->push<pairarray2*>(mult<pair>(a,b)); return;} } -#line 1322 "runarray.in" +#line 1340 "runarray.in" // triple *(realarray2 *t, triple v); -void gen_runarray57(stack *Stack) +void gen_runarray59(stack *Stack) { triple v=vm::pop<triple>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); -#line 1323 "runarray.in" +#line 1341 "runarray.in" {Stack->push<triple>(*t*v); return;} } -#line 1327 "runarray.in" +#line 1345 "runarray.in" // pair project(triple v, realarray2 *t); -void gen_runarray58(stack *Stack) +void gen_runarray60(stack *Stack) { realarray2 * t=vm::pop<realarray2 *>(Stack); triple v=vm::pop<triple>(Stack); -#line 1328 "runarray.in" +#line 1346 "runarray.in" size_t n=checkArray(t); if(n != 4) error(incommensurate); array *t0=read<array*>(t,0); @@ -1679,13 +1707,13 @@ void gen_runarray58(stack *Stack) } // Compute the dot product of vectors a and b. -#line 1353 "runarray.in" +#line 1371 "runarray.in" // real dot(realarray *a, realarray *b); -void gen_runarray59(stack *Stack) +void gen_runarray61(stack *Stack) { realarray * b=vm::pop<realarray *>(Stack); realarray * a=vm::pop<realarray *>(Stack); -#line 1354 "runarray.in" +#line 1372 "runarray.in" size_t n=checkArrays(a,b); real sum=0.0; for(size_t i=0; i < n; ++i) @@ -1694,13 +1722,13 @@ void gen_runarray59(stack *Stack) } // Compute the complex dot product of vectors a and b. -#line 1363 "runarray.in" +#line 1381 "runarray.in" // pair dot(pairarray *a, pairarray *b); -void gen_runarray60(stack *Stack) +void gen_runarray62(stack *Stack) { pairarray * b=vm::pop<pairarray *>(Stack); pairarray * a=vm::pop<pairarray *>(Stack); -#line 1364 "runarray.in" +#line 1382 "runarray.in" size_t n=checkArrays(a,b); pair sum=zero; for(size_t i=0; i < n; ++i) @@ -1715,15 +1743,15 @@ void gen_runarray60(stack *Stack) // [ a[2] b[2] c[2] ] // [ ... ] // [ c[n-1] a[n-1] b[n-1] ] -#line 1379 "runarray.in" +#line 1397 "runarray.in" // realarray* tridiagonal(realarray *a, realarray *b, realarray *c, realarray *f); -void gen_runarray61(stack *Stack) +void gen_runarray63(stack *Stack) { realarray * f=vm::pop<realarray *>(Stack); realarray * c=vm::pop<realarray *>(Stack); realarray * b=vm::pop<realarray *>(Stack); realarray * a=vm::pop<realarray *>(Stack); -#line 1380 "runarray.in" +#line 1398 "runarray.in" size_t n=checkArrays(a,b); checkEqual(n,checkArray(c)); checkEqual(n,checkArray(f)); @@ -1820,16 +1848,16 @@ void gen_runarray61(stack *Stack) } // Root solve by Newton-Raphson -#line 1477 "runarray.in" +#line 1495 "runarray.in" // real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x, bool verbose=false); -void gen_runarray62(stack *Stack) +void gen_runarray64(stack *Stack) { bool verbose=vm::pop<bool>(Stack,false); real x=vm::pop<real>(Stack); callableReal * fprime=vm::pop<callableReal *>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); Int iterations=vm::pop<Int>(Stack,100); -#line 1479 "runarray.in" +#line 1497 "runarray.in" static const real fuzz=1000.0*DBL_EPSILON; Int i=0; size_t oldPrec=0; @@ -1875,9 +1903,9 @@ void gen_runarray62(stack *Stack) // Root solve by Newton-Raphson bisection // cf. routine rtsafe (Press et al., Numerical Recipes, 1991). -#line 1525 "runarray.in" +#line 1543 "runarray.in" // real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x1, real x2, bool verbose=false); -void gen_runarray63(stack *Stack) +void gen_runarray65(stack *Stack) { bool verbose=vm::pop<bool>(Stack,false); real x2=vm::pop<real>(Stack); @@ -1885,7 +1913,7 @@ void gen_runarray63(stack *Stack) callableReal * fprime=vm::pop<callableReal *>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); Int iterations=vm::pop<Int>(Stack,100); -#line 1527 "runarray.in" +#line 1545 "runarray.in" static const real fuzz=1000.0*DBL_EPSILON; size_t oldPrec=0; if(verbose) @@ -1963,16 +1991,16 @@ void gen_runarray63(stack *Stack) {Stack->push<real>((j == iterations) ? DBL_MAX : x); return;} } -#line 1605 "runarray.in" +#line 1623 "runarray.in" // real simpson(callableReal *f, real a, real b, real acc=DBL_EPSILON, real dxmax=0); -void gen_runarray64(stack *Stack) +void gen_runarray66(stack *Stack) { real dxmax=vm::pop<real>(Stack,0); real acc=vm::pop<real>(Stack,DBL_EPSILON); real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); callableReal * f=vm::pop<callableReal *>(Stack); -#line 1607 "runarray.in" +#line 1625 "runarray.in" real integral; if(dxmax <= 0) dxmax=fabs(b-a); Func=f; @@ -1983,13 +2011,13 @@ void gen_runarray64(stack *Stack) } // Compute the fast Fourier transform of a pair array -#line 1618 "runarray.in" +#line 1636 "runarray.in" // pairarray* fft(pairarray *a, Int sign=1); -void gen_runarray65(stack *Stack) +void gen_runarray67(stack *Stack) { Int sign=vm::pop<Int>(Stack,1); pairarray * a=vm::pop<pairarray *>(Stack); -#line 1619 "runarray.in" +#line 1637 "runarray.in" unsigned n=(unsigned) checkArray(a); #ifdef HAVE_LIBFFTW3 array *c=new array(n); @@ -2018,12 +2046,12 @@ void gen_runarray65(stack *Stack) {Stack->push<pairarray*>(c); return;} } -#line 1648 "runarray.in" +#line 1666 "runarray.in" // Intarray2* triangulate(pairarray *z); -void gen_runarray66(stack *Stack) +void gen_runarray68(stack *Stack) { pairarray * z=vm::pop<pairarray *>(Stack); -#line 1649 "runarray.in" +#line 1667 "runarray.in" size_t nv=checkArray(z); // Call robust version of Gilles Dumoulin's port of Paul Bourke's // triangulation code. @@ -2057,12 +2085,12 @@ void gen_runarray66(stack *Stack) {Stack->push<Intarray2*>(t); return;} } -#line 1683 "runarray.in" +#line 1701 "runarray.in" // real norm(realarray *a); -void gen_runarray67(stack *Stack) +void gen_runarray69(stack *Stack) { realarray * a=vm::pop<realarray *>(Stack); -#line 1684 "runarray.in" +#line 1702 "runarray.in" size_t n=checkArray(a); real M=0.0; for(size_t i=0; i < n; ++i) { @@ -2072,12 +2100,12 @@ void gen_runarray67(stack *Stack) {Stack->push<real>(M); return;} } -#line 1694 "runarray.in" +#line 1712 "runarray.in" // real norm(realarray2 *a); -void gen_runarray68(stack *Stack) +void gen_runarray70(stack *Stack) { realarray2 * a=vm::pop<realarray2 *>(Stack); -#line 1695 "runarray.in" +#line 1713 "runarray.in" size_t n=checkArray(a); real M=0.0; for(size_t i=0; i < n; ++i) { @@ -2091,12 +2119,12 @@ void gen_runarray68(stack *Stack) {Stack->push<real>(M); return;} } -#line 1709 "runarray.in" +#line 1727 "runarray.in" // real norm(triplearray2 *a); -void gen_runarray69(stack *Stack) +void gen_runarray71(stack *Stack) { triplearray2 * a=vm::pop<triplearray2 *>(Stack); -#line 1710 "runarray.in" +#line 1728 "runarray.in" size_t n=checkArray(a); real M=0.0; for(size_t i=0; i < n; ++i) { @@ -2110,12 +2138,12 @@ void gen_runarray69(stack *Stack) {Stack->push<real>(sqrt(M)); return;} } -#line 1724 "runarray.in" +#line 1742 "runarray.in" // real change2(triplearray2 *a); -void gen_runarray70(stack *Stack) +void gen_runarray72(stack *Stack) { triplearray2 * a=vm::pop<triplearray2 *>(Stack); -#line 1725 "runarray.in" +#line 1743 "runarray.in" size_t n=checkArray(a); if(n == 0) {Stack->push<real>(0.0); return;} @@ -2136,13 +2164,13 @@ void gen_runarray70(stack *Stack) {Stack->push<real>(M); return;} } -#line 1746 "runarray.in" +#line 1764 "runarray.in" // triple minbezier(triplearray2 *P, triple b); -void gen_runarray71(stack *Stack) +void gen_runarray73(stack *Stack) { triple b=vm::pop<triple>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1747 "runarray.in" +#line 1765 "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)), @@ -2151,13 +2179,13 @@ void gen_runarray71(stack *Stack) {Stack->push<triple>(b); return;} } -#line 1756 "runarray.in" +#line 1774 "runarray.in" // triple maxbezier(triplearray2 *P, triple b); -void gen_runarray72(stack *Stack) +void gen_runarray74(stack *Stack) { triple b=vm::pop<triple>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1757 "runarray.in" +#line 1775 "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)), @@ -2166,13 +2194,13 @@ void gen_runarray72(stack *Stack) {Stack->push<triple>(b); return;} } -#line 1766 "runarray.in" +#line 1784 "runarray.in" // pair minratio(triplearray2 *P, pair b); -void gen_runarray73(stack *Stack) +void gen_runarray75(stack *Stack) { pair b=vm::pop<pair>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1767 "runarray.in" +#line 1785 "runarray.in" triple *A; copyArray2C(A,P,true,4); real fuzz=sqrtFuzz*norm(A,16); @@ -2182,13 +2210,13 @@ void gen_runarray73(stack *Stack) {Stack->push<pair>(b); return;} } -#line 1777 "runarray.in" +#line 1795 "runarray.in" // pair maxratio(triplearray2 *P, pair b); -void gen_runarray74(stack *Stack) +void gen_runarray76(stack *Stack) { pair b=vm::pop<pair>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); -#line 1778 "runarray.in" +#line 1796 "runarray.in" triple *A; copyArray2C(A,P,true,4); real fuzz=sqrtFuzz*norm(A,16); @@ -2198,11 +2226,11 @@ void gen_runarray74(stack *Stack) {Stack->push<pair>(b); return;} } -#line 1788 "runarray.in" +#line 1806 "runarray.in" // realarray* _projection(); -void gen_runarray75(stack *Stack) +void gen_runarray77(stack *Stack) { -#line 1789 "runarray.in" +#line 1807 "runarray.in" #ifdef HAVE_GL array *a=new array(14); gl::projection P=gl::camera(); @@ -2239,158 +2267,162 @@ namespace trans { void gen_runarray_venv(venv &ve) { -#line 443 "runarray.in" +#line 450 "runarray.in" REGISTER_BLTIN(run::emptyArray,"emptyArray"); -#line 449 "runarray.in" +#line 456 "runarray.in" REGISTER_BLTIN(run::newDeepArray,"newDeepArray"); -#line 471 "runarray.in" +#line 478 "runarray.in" REGISTER_BLTIN(run::newInitializedArray,"newInitializedArray"); -#line 486 "runarray.in" +#line 493 "runarray.in" REGISTER_BLTIN(run::newAppendedArray,"newAppendedArray"); -#line 502 "runarray.in" - REGISTER_BLTIN(run::newDuplicateArray,"newDuplicateArray"); -#line 512 "runarray.in" +#line 509 "runarray.in" + REGISTER_BLTIN(run::copyArray0,"copyArray0"); +#line 516 "runarray.in" + REGISTER_BLTIN(run::copyArray1,"copyArray1"); +#line 523 "runarray.in" + REGISTER_BLTIN(run::copyArray2,"copyArray2"); +#line 530 "runarray.in" REGISTER_BLTIN(run::arrayRead,"arrayRead"); -#line 524 "runarray.in" +#line 542 "runarray.in" REGISTER_BLTIN(run::arraySliceRead,"arraySliceRead"); -#line 531 "runarray.in" +#line 549 "runarray.in" REGISTER_BLTIN(run::arraySliceReadToEnd,"arraySliceReadToEnd"); -#line 539 "runarray.in" +#line 557 "runarray.in" REGISTER_BLTIN(run::arrayArrayRead,"arrayArrayRead"); -#line 548 "runarray.in" +#line 566 "runarray.in" REGISTER_BLTIN(run::arrayWrite,"arrayWrite"); -#line 564 "runarray.in" +#line 582 "runarray.in" REGISTER_BLTIN(run::arraySliceWrite,"arraySliceWrite"); -#line 572 "runarray.in" +#line 590 "runarray.in" REGISTER_BLTIN(run::arraySliceWriteToEnd,"arraySliceWriteToEnd"); -#line 580 "runarray.in" +#line 598 "runarray.in" REGISTER_BLTIN(run::arrayLength,"arrayLength"); -#line 586 "runarray.in" +#line 604 "runarray.in" REGISTER_BLTIN(run::arrayKeys,"arrayKeys"); -#line 601 "runarray.in" +#line 619 "runarray.in" REGISTER_BLTIN(run::arrayCyclicFlag,"arrayCyclicFlag"); -#line 608 "runarray.in" +#line 626 "runarray.in" REGISTER_BLTIN(run::arraySetCyclicFlag,"arraySetCyclicFlag"); -#line 615 "runarray.in" +#line 633 "runarray.in" REGISTER_BLTIN(run::arrayInitializedHelper,"arrayInitializedHelper"); -#line 626 "runarray.in" +#line 644 "runarray.in" REGISTER_BLTIN(run::arrayInitialized,"arrayInitialized"); -#line 632 "runarray.in" +#line 650 "runarray.in" REGISTER_BLTIN(run::arrayCyclicHelper,"arrayCyclicHelper"); -#line 639 "runarray.in" +#line 657 "runarray.in" REGISTER_BLTIN(run::arrayCyclic,"arrayCyclic"); -#line 645 "runarray.in" +#line 663 "runarray.in" REGISTER_BLTIN(run::arrayPushHelper,"arrayPushHelper"); -#line 653 "runarray.in" +#line 671 "runarray.in" REGISTER_BLTIN(run::arrayPush,"arrayPush"); -#line 659 "runarray.in" +#line 677 "runarray.in" REGISTER_BLTIN(run::arrayAppendHelper,"arrayAppendHelper"); -#line 668 "runarray.in" +#line 686 "runarray.in" REGISTER_BLTIN(run::arrayAppend,"arrayAppend"); -#line 674 "runarray.in" +#line 692 "runarray.in" REGISTER_BLTIN(run::arrayPopHelper,"arrayPopHelper"); -#line 683 "runarray.in" +#line 701 "runarray.in" REGISTER_BLTIN(run::arrayPop,"arrayPop"); -#line 689 "runarray.in" +#line 707 "runarray.in" REGISTER_BLTIN(run::arrayInsertHelper,"arrayInsertHelper"); -#line 700 "runarray.in" +#line 718 "runarray.in" REGISTER_BLTIN(run::arrayInsert,"arrayInsert"); -#line 706 "runarray.in" +#line 724 "runarray.in" REGISTER_BLTIN(run::arrayDelete,"arrayDelete"); -#line 712 "runarray.in" +#line 730 "runarray.in" REGISTER_BLTIN(run::arrayAlias,"arrayAlias"); -#line 717 "runarray.in" - REGISTER_BLTIN(run::arrayIntArray,"arrayIntArray"); #line 735 "runarray.in" - addFunc(ve, run::gen_runarray31, IntArray(), SYM(complement), formal(IntArray(), SYM(a), false, false), formal(primInt(), SYM(n), false, false)); -#line 754 "runarray.in" + REGISTER_BLTIN(run::arrayIntArray,"arrayIntArray"); +#line 753 "runarray.in" + addFunc(ve, run::gen_runarray33, IntArray(), SYM(complement), formal(IntArray(), SYM(a), false, false), formal(primInt(), SYM(n), false, false)); +#line 772 "runarray.in" REGISTER_BLTIN(run::arraySequence,"arraySequence"); -#line 767 "runarray.in" - addFunc(ve, run::gen_runarray33, IntArray(), SYM(sequence), formal(primInt(), SYM(n), false, false)); -#line 778 "runarray.in" +#line 785 "runarray.in" + addFunc(ve, run::gen_runarray35, IntArray(), SYM(sequence), formal(primInt(), SYM(n), false, false)); +#line 796 "runarray.in" REGISTER_BLTIN(run::arrayFunction,"arrayFunction"); -#line 791 "runarray.in" - REGISTER_BLTIN(run::arraySort,"arraySort"); -#line 800 "runarray.in" - addFunc(ve, run::gen_runarray36, primBoolean(), SYM(all), formal(booleanArray(), SYM(a), false, false)); #line 809 "runarray.in" - addFunc(ve, run::gen_runarray37, booleanArray(), SYM_LOGNOT, formal(booleanArray(), SYM(a), false, false)); + REGISTER_BLTIN(run::arraySort,"arraySort"); #line 818 "runarray.in" - addFunc(ve, run::gen_runarray38, primInt(), SYM(sum), formal(booleanArray(), SYM(a), false, false)); + addFunc(ve, run::gen_runarray38, primBoolean(), SYM(all), formal(booleanArray(), SYM(a), false, false)); #line 827 "runarray.in" + addFunc(ve, run::gen_runarray39, booleanArray(), SYM_LOGNOT, formal(booleanArray(), SYM(a), false, false)); +#line 836 "runarray.in" + addFunc(ve, run::gen_runarray40, primInt(), SYM(sum), formal(booleanArray(), SYM(a), false, false)); +#line 845 "runarray.in" REGISTER_BLTIN(run::arrayCopy,"arrayCopy"); -#line 832 "runarray.in" +#line 850 "runarray.in" REGISTER_BLTIN(run::arrayConcat,"arrayConcat"); -#line 860 "runarray.in" +#line 878 "runarray.in" REGISTER_BLTIN(run::array2Copy,"array2Copy"); -#line 865 "runarray.in" +#line 883 "runarray.in" REGISTER_BLTIN(run::array3Copy,"array3Copy"); -#line 870 "runarray.in" +#line 888 "runarray.in" REGISTER_BLTIN(run::array2Transpose,"array2Transpose"); -#line 894 "runarray.in" +#line 912 "runarray.in" REGISTER_BLTIN(run::array3Transpose,"array3Transpose"); -#line 981 "runarray.in" - addFunc(ve, run::gen_runarray45, primInt(), SYM(find), formal(booleanArray(), SYM(a), false, false), formal(primInt(), SYM(n), true, false)); -#line 1000 "runarray.in" +#line 999 "runarray.in" + addFunc(ve, run::gen_runarray47, primInt(), SYM(find), formal(booleanArray(), SYM(a), false, false), formal(primInt(), SYM(n), true, false)); +#line 1018 "runarray.in" REGISTER_BLTIN(run::arrayConditional,"arrayConditional"); -#line 1026 "runarray.in" - addFunc(ve, run::gen_runarray47, realArray2(), SYM(identity), formal(primInt(), SYM(n), false, false)); -#line 1032 "runarray.in" - addFunc(ve, run::gen_runarray48, realArray2(), SYM(inverse), formal(realArray2(), SYM(a), false, false)); -#line 1124 "runarray.in" - addFunc(ve, run::gen_runarray49, realArray(), SYM(solve), formal(realArray2(), SYM(a), false, false), formal(realArray(), SYM(b), false, false), formal(primBoolean(), SYM(warn), true, false)); -#line 1177 "runarray.in" - addFunc(ve, run::gen_runarray50, realArray2(), SYM(solve), formal(realArray2(), SYM(a), false, false), formal(realArray2(), SYM(b), false, false), formal(primBoolean(), SYM(warn), true, false)); -#line 1242 "runarray.in" - addFunc(ve, run::gen_runarray51, primReal(), SYM(determinant), formal(realArray2(), SYM(a), false, false)); -#line 1259 "runarray.in" - addFunc(ve, run::gen_runarray52, realArray(), SYM_TIMES, formal(realArray2(), SYM(a), false, false), formal(realArray(), SYM(b), false, false)); -#line 1278 "runarray.in" - addFunc(ve, run::gen_runarray53, realArray(), SYM_TIMES, formal(realArray(), SYM(a), false, false), formal(realArray2(), SYM(b), false, false)); -#line 1307 "runarray.in" - addFunc(ve, run::gen_runarray54, IntArray2(), SYM_TIMES, formal(IntArray2(), SYM(a), false, false), formal(IntArray2(), SYM(b), false, false)); -#line 1312 "runarray.in" - addFunc(ve, run::gen_runarray55, realArray2(), SYM_TIMES, formal(realArray2(), SYM(a), false, false), formal(realArray2(), SYM(b), false, false)); -#line 1317 "runarray.in" - addFunc(ve, run::gen_runarray56, pairArray2(), SYM_TIMES, formal(pairArray2(), SYM(a), false, false), formal(pairArray2(), SYM(b), false, false)); -#line 1322 "runarray.in" - addFunc(ve, run::gen_runarray57, primTriple(), SYM_TIMES, formal(realArray2(), SYM(t), false, false), formal(primTriple(), SYM(v), false, false)); -#line 1327 "runarray.in" - addFunc(ve, run::gen_runarray58, primPair(), SYM(project), formal(primTriple(), SYM(v), false, false), formal(realArray2(), SYM(t), false, false)); -#line 1352 "runarray.in" - addFunc(ve, run::gen_runarray59, primReal(), SYM(dot), formal(realArray(), SYM(a), false, false), formal(realArray(), SYM(b), false, false)); -#line 1362 "runarray.in" - addFunc(ve, run::gen_runarray60, primPair(), SYM(dot), formal(pairArray(), SYM(a), false, false), formal(pairArray(), SYM(b), false, false)); -#line 1372 "runarray.in" - addFunc(ve, run::gen_runarray61, realArray(), SYM(tridiagonal), formal(realArray(), SYM(a), false, false), formal(realArray(), SYM(b), false, false), formal(realArray(), SYM(c), false, false), formal(realArray(), SYM(f), false, false)); -#line 1476 "runarray.in" - addFunc(ve, run::gen_runarray62, primReal(), SYM(newton), formal(primInt(), SYM(iterations), true, false), formal(realRealFunction(), SYM(f), false, false), formal(realRealFunction(), SYM(fprime), false, false), formal(primReal(), SYM(x), false, false), formal(primBoolean(), SYM(verbose), true, false)); -#line 1523 "runarray.in" - addFunc(ve, run::gen_runarray63, primReal(), SYM(newton), formal(primInt(), SYM(iterations), true, false), formal(realRealFunction(), SYM(f), false, false), formal(realRealFunction(), SYM(fprime), false, false), formal(primReal(), SYM(x1), false, false), formal(primReal(), SYM(x2), false, false), formal(primBoolean(), SYM(verbose), true, false)); -#line 1605 "runarray.in" - addFunc(ve, run::gen_runarray64, primReal(), SYM(simpson), formal(realRealFunction(), SYM(f), false, false), formal(primReal(), SYM(a), false, false), formal(primReal(), SYM(b), false, false), formal(primReal(), SYM(acc), true, false), formal(primReal(), SYM(dxmax), true, false)); -#line 1617 "runarray.in" - addFunc(ve, run::gen_runarray65, pairArray(), SYM(fft), formal(pairArray(), SYM(a), false, false), formal(primInt(), SYM(sign), true, false)); -#line 1648 "runarray.in" - addFunc(ve, run::gen_runarray66, IntArray2(), SYM(triangulate), formal(pairArray(), SYM(z), false, false)); -#line 1683 "runarray.in" - addFunc(ve, run::gen_runarray67, primReal(), SYM(norm), formal(realArray(), SYM(a), false, false)); -#line 1694 "runarray.in" - addFunc(ve, run::gen_runarray68, primReal(), SYM(norm), formal(realArray2(), SYM(a), false, false)); -#line 1709 "runarray.in" - addFunc(ve, run::gen_runarray69, primReal(), SYM(norm), formal(tripleArray2(), SYM(a), false, false)); -#line 1724 "runarray.in" - addFunc(ve, run::gen_runarray70, primReal(), SYM(change2), formal(tripleArray2(), SYM(a), false, false)); -#line 1746 "runarray.in" - addFunc(ve, run::gen_runarray71, primTriple(), SYM(minbezier), formal(tripleArray2(), SYM(p), false, false), formal(primTriple(), SYM(b), false, false)); -#line 1756 "runarray.in" - addFunc(ve, run::gen_runarray72, primTriple(), SYM(maxbezier), formal(tripleArray2(), SYM(p), false, false), formal(primTriple(), SYM(b), false, false)); -#line 1766 "runarray.in" - addFunc(ve, run::gen_runarray73, primPair(), SYM(minratio), formal(tripleArray2(), SYM(p), false, false), formal(primPair(), SYM(b), false, false)); -#line 1777 "runarray.in" - addFunc(ve, run::gen_runarray74, primPair(), SYM(maxratio), formal(tripleArray2(), SYM(p), false, false), formal(primPair(), SYM(b), false, false)); -#line 1788 "runarray.in" - addFunc(ve, run::gen_runarray75, realArray(), SYM(_projection)); +#line 1044 "runarray.in" + addFunc(ve, run::gen_runarray49, realArray2(), SYM(identity), formal(primInt(), SYM(n), false, false)); +#line 1050 "runarray.in" + addFunc(ve, run::gen_runarray50, realArray2(), SYM(inverse), formal(realArray2(), SYM(a), false, false)); +#line 1142 "runarray.in" + addFunc(ve, run::gen_runarray51, realArray(), SYM(solve), formal(realArray2(), SYM(a), false, false), formal(realArray(), SYM(b), false, false), formal(primBoolean(), SYM(warn), true, false)); +#line 1195 "runarray.in" + addFunc(ve, run::gen_runarray52, realArray2(), SYM(solve), formal(realArray2(), SYM(a), false, false), formal(realArray2(), SYM(b), false, false), formal(primBoolean(), SYM(warn), true, false)); +#line 1260 "runarray.in" + addFunc(ve, run::gen_runarray53, primReal(), SYM(determinant), formal(realArray2(), SYM(a), false, false)); +#line 1277 "runarray.in" + addFunc(ve, run::gen_runarray54, realArray(), SYM_TIMES, formal(realArray2(), SYM(a), false, false), formal(realArray(), SYM(b), false, false)); +#line 1296 "runarray.in" + addFunc(ve, run::gen_runarray55, realArray(), SYM_TIMES, formal(realArray(), SYM(a), false, false), formal(realArray2(), SYM(b), false, false)); +#line 1325 "runarray.in" + addFunc(ve, run::gen_runarray56, IntArray2(), SYM_TIMES, formal(IntArray2(), SYM(a), false, false), formal(IntArray2(), SYM(b), false, false)); +#line 1330 "runarray.in" + addFunc(ve, run::gen_runarray57, realArray2(), SYM_TIMES, formal(realArray2(), SYM(a), false, false), formal(realArray2(), SYM(b), false, false)); +#line 1335 "runarray.in" + addFunc(ve, run::gen_runarray58, pairArray2(), SYM_TIMES, formal(pairArray2(), SYM(a), false, false), formal(pairArray2(), SYM(b), false, false)); +#line 1340 "runarray.in" + addFunc(ve, run::gen_runarray59, primTriple(), SYM_TIMES, formal(realArray2(), SYM(t), false, false), formal(primTriple(), SYM(v), false, false)); +#line 1345 "runarray.in" + addFunc(ve, run::gen_runarray60, primPair(), SYM(project), formal(primTriple(), SYM(v), false, false), formal(realArray2(), SYM(t), false, false)); +#line 1370 "runarray.in" + addFunc(ve, run::gen_runarray61, primReal(), SYM(dot), formal(realArray(), SYM(a), false, false), formal(realArray(), SYM(b), false, false)); +#line 1380 "runarray.in" + addFunc(ve, run::gen_runarray62, primPair(), SYM(dot), formal(pairArray(), SYM(a), false, false), formal(pairArray(), SYM(b), false, false)); +#line 1390 "runarray.in" + addFunc(ve, run::gen_runarray63, realArray(), SYM(tridiagonal), formal(realArray(), SYM(a), false, false), formal(realArray(), SYM(b), false, false), formal(realArray(), SYM(c), false, false), formal(realArray(), SYM(f), false, false)); +#line 1494 "runarray.in" + addFunc(ve, run::gen_runarray64, primReal(), SYM(newton), formal(primInt(), SYM(iterations), true, false), formal(realRealFunction(), SYM(f), false, false), formal(realRealFunction(), SYM(fprime), false, false), formal(primReal(), SYM(x), false, false), formal(primBoolean(), SYM(verbose), true, false)); +#line 1541 "runarray.in" + addFunc(ve, run::gen_runarray65, primReal(), SYM(newton), formal(primInt(), SYM(iterations), true, false), formal(realRealFunction(), SYM(f), false, false), formal(realRealFunction(), SYM(fprime), false, false), formal(primReal(), SYM(x1), false, false), formal(primReal(), SYM(x2), false, false), formal(primBoolean(), SYM(verbose), true, false)); +#line 1623 "runarray.in" + addFunc(ve, run::gen_runarray66, primReal(), SYM(simpson), formal(realRealFunction(), SYM(f), false, false), formal(primReal(), SYM(a), false, false), formal(primReal(), SYM(b), false, false), formal(primReal(), SYM(acc), true, false), formal(primReal(), SYM(dxmax), true, false)); +#line 1635 "runarray.in" + addFunc(ve, run::gen_runarray67, pairArray(), SYM(fft), formal(pairArray(), SYM(a), false, false), formal(primInt(), SYM(sign), true, false)); +#line 1666 "runarray.in" + addFunc(ve, run::gen_runarray68, IntArray2(), SYM(triangulate), formal(pairArray(), SYM(z), false, false)); +#line 1701 "runarray.in" + addFunc(ve, run::gen_runarray69, primReal(), SYM(norm), formal(realArray(), SYM(a), false, false)); +#line 1712 "runarray.in" + addFunc(ve, run::gen_runarray70, primReal(), SYM(norm), formal(realArray2(), SYM(a), false, false)); +#line 1727 "runarray.in" + addFunc(ve, run::gen_runarray71, primReal(), SYM(norm), formal(tripleArray2(), SYM(a), false, false)); +#line 1742 "runarray.in" + addFunc(ve, run::gen_runarray72, primReal(), SYM(change2), formal(tripleArray2(), SYM(a), false, false)); +#line 1764 "runarray.in" + addFunc(ve, run::gen_runarray73, primTriple(), SYM(minbezier), formal(tripleArray2(), SYM(p), false, false), formal(primTriple(), SYM(b), false, false)); +#line 1774 "runarray.in" + addFunc(ve, run::gen_runarray74, primTriple(), SYM(maxbezier), formal(tripleArray2(), SYM(p), false, false), formal(primTriple(), SYM(b), false, false)); +#line 1784 "runarray.in" + addFunc(ve, run::gen_runarray75, primPair(), SYM(minratio), formal(tripleArray2(), SYM(p), false, false), formal(primPair(), SYM(b), false, false)); +#line 1795 "runarray.in" + addFunc(ve, run::gen_runarray76, primPair(), SYM(maxratio), formal(tripleArray2(), SYM(p), false, false), formal(primPair(), SYM(b), false, false)); +#line 1806 "runarray.in" + addFunc(ve, run::gen_runarray77, realArray(), SYM(_projection)); } } // namespace trans diff --git a/Build/source/utils/asymptote/runarray.h b/Build/source/utils/asymptote/runarray.h index 8d2bee30f77..2d3c928c331 100644 --- a/Build/source/utils/asymptote/runarray.h +++ b/Build/source/utils/asymptote/runarray.h @@ -7,7 +7,9 @@ void emptyArray(vm::stack *); void newDeepArray(vm::stack *); void newInitializedArray(vm::stack *); void newAppendedArray(vm::stack *); -void newDuplicateArray(vm::stack *); +void copyArray0(vm::stack *); +void copyArray1(vm::stack *); +void copyArray2(vm::stack *); void arrayRead(vm::stack *); void arraySliceRead(vm::stack *); void arraySliceReadToEnd(vm::stack *); diff --git a/Build/source/utils/asymptote/runarray.in b/Build/source/utils/asymptote/runarray.in index cf04637ce31..83064a05dd2 100644 --- a/Build/source/utils/asymptote/runarray.in +++ b/Build/source/utils/asymptote/runarray.in @@ -274,7 +274,7 @@ array *mult(array *a, array *b) array *ci=new array(nb0); (*c)[i]=ci; for(size_t j=0; j < nb0; ++j) { - T sum=0.0; + T sum=T(); size_t kj=j; for(size_t k=0; k < nb; ++k, kj += nb0) sum += Ai[k]*B[kj]; @@ -435,6 +435,13 @@ void integeroverflow(size_t i) buf << "Integer overflow"; error(buf); } + +void checkSize(Int n, Int depth) +{ + if(n < 0) error("cannot create a negative length array"); + if(depth < 0) error("cannot copy to a negative depth"); +} + } // Autogenerated routines: @@ -499,14 +506,25 @@ array* :newAppendedArray(array* tail, Int n) return a; } -// 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. -array* :newDuplicateArray(Int n, item value, Int depth=Int_MAX) +// Produce an array of n deep copies of value. +array* :copyArray0(Int n, item value, Int depth=Int_MAX) { - if(n < 0) error("cannot create a negative length array"); - if(depth < 0) error("cannot copy to a negative depth"); - - return new array(n, value, depth); + checkSize(n,depth); + return new array((size_t) n, value, (size_t) 0); +} + +array* :copyArray1(Int n, item value, Int depth=Int_MAX) +{ + checkSize(n,depth); + if(depth > 1) depth=1; + return new array((size_t) n, value, (size_t) depth); +} + +array* :copyArray2(Int n, item value, Int depth=Int_MAX) +{ + checkSize(n,depth); + if(depth > 2) depth=2; + return new array((size_t) n, value, (size_t) depth); } // Read an element from an array. Checks for initialization & bounds. diff --git a/Build/source/utils/asymptote/runarray.symbols.h b/Build/source/utils/asymptote/runarray.symbols.h index 08c4fa12f2b..65d6033053e 100644 --- a/Build/source/utils/asymptote/runarray.symbols.h +++ b/Build/source/utils/asymptote/runarray.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runbacktrace.symbols.h b/Build/source/utils/asymptote/runbacktrace.symbols.h index dbab3fb4c43..f5b1168d61f 100644 --- a/Build/source/utils/asymptote/runbacktrace.symbols.h +++ b/Build/source/utils/asymptote/runbacktrace.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runfile.symbols.h b/Build/source/utils/asymptote/runfile.symbols.h index a1aad5396de..1c182287108 100644 --- a/Build/source/utils/asymptote/runfile.symbols.h +++ b/Build/source/utils/asymptote/runfile.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runhistory.symbols.h b/Build/source/utils/asymptote/runhistory.symbols.h index 34a82b35f06..3e17f6858af 100644 --- a/Build/source/utils/asymptote/runhistory.symbols.h +++ b/Build/source/utils/asymptote/runhistory.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runlabel.cc b/Build/source/utils/asymptote/runlabel.cc index d77cfa50af1..0288aa16c87 100644 --- a/Build/source/utils/asymptote/runlabel.cc +++ b/Build/source/utils/asymptote/runlabel.cc @@ -217,7 +217,8 @@ array *readpath(const string& psname, bool keep, node.straight=false; nodes.push_back(node); } - P->push(path(nodes,nodes.size(),cyclic)); + if(cyclic) // Discard noncyclic paths. + P->push(path(nodes,nodes.size(),cyclic)); nodes.clear(); } active=false; @@ -270,7 +271,7 @@ array *readpath(const string& psname, bool keep, #include "runlabel.symbols.h" namespace run { -#line 176 "runlabel.in" +#line 177 "runlabel.in" // void label(picture *f, string *s, string *size, transform t, pair position, pair align, pen p); void gen_runlabel0(stack *Stack) { @@ -281,26 +282,26 @@ void gen_runlabel0(stack *Stack) string * size=vm::pop<string *>(Stack); string * s=vm::pop<string *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 178 "runlabel.in" +#line 179 "runlabel.in" f->append(new drawLabel(*s,*size,t,position,align,p)); } -#line 182 "runlabel.in" +#line 183 "runlabel.in" // bool labels(picture *f); void gen_runlabel1(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 183 "runlabel.in" +#line 184 "runlabel.in" {Stack->push<bool>(f->havelabels()); return;} } -#line 187 "runlabel.in" +#line 188 "runlabel.in" // realarray* texsize(string *s, pen p=CURRENTPEN); void gen_runlabel2(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); string * s=vm::pop<string *>(Stack); -#line 188 "runlabel.in" +#line 189 "runlabel.in" texinit(); processDataStruct &pd=processData(); @@ -319,13 +320,13 @@ void gen_runlabel2(stack *Stack) {Stack->push<realarray*>(t); return;} } -#line 207 "runlabel.in" +#line 208 "runlabel.in" // patharray* _texpath(string *s, pen p=CURRENTPEN); void gen_runlabel3(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); string * s=vm::pop<string *>(Stack); -#line 208 "runlabel.in" +#line 209 "runlabel.in" array *P=new array(0); if(s->empty()) {Stack->push<patharray*>(P); return;} @@ -421,13 +422,13 @@ void gen_runlabel3(stack *Stack) {Stack->push<patharray*>(pdf ? readpath(psname,keep,0.1) : readpath(psname,keep,0.12,-1.0)); return;} } -#line 304 "runlabel.in" +#line 305 "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 305 "runlabel.in" +#line 306 "runlabel.in" array *P=new array(0); if(s->empty()) {Stack->push<patharray*>(P); return;} @@ -496,13 +497,13 @@ void gen_runlabel4(stack *Stack) {Stack->push<patharray*>(readpath(psname,keep,0.1)); return;} } -#line 374 "runlabel.in" +#line 375 "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 375 "runlabel.in" +#line 376 "runlabel.in" array *P=new array(0); if(g.size() == 0) {Stack->push<patharray*>(P); return;} @@ -531,17 +532,17 @@ namespace trans { void gen_runlabel_venv(venv &ve) { -#line 176 "runlabel.in" +#line 177 "runlabel.in" addFunc(ve, run::gen_runlabel0, primVoid(), SYM(label), formal(primPicture(), SYM(f), false, false), formal(primString(), SYM(s), false, false), formal(primString(), SYM(size), false, false), formal(primTransform(), SYM(t), false, false), formal(primPair(), SYM(position), false, false), formal(primPair(), SYM(align), false, false), formal(primPen(), SYM(p), false, false)); -#line 182 "runlabel.in" +#line 183 "runlabel.in" addFunc(ve, run::gen_runlabel1, primBoolean(), SYM(labels), formal(primPicture(), SYM(f), false, false)); -#line 187 "runlabel.in" +#line 188 "runlabel.in" addFunc(ve, run::gen_runlabel2, realArray(), SYM(texsize), formal(primString(), SYM(s), false, false), formal(primPen(), SYM(p), true, false)); -#line 207 "runlabel.in" +#line 208 "runlabel.in" addFunc(ve, run::gen_runlabel3, pathArray() , SYM(_texpath), formal(primString(), SYM(s), false, false), formal(primPen(), SYM(p), true, false)); -#line 304 "runlabel.in" +#line 305 "runlabel.in" addFunc(ve, run::gen_runlabel4, pathArray() , SYM(textpath), formal(primString(), SYM(s), false, false), formal(primPen(), SYM(p), true, false)); -#line 374 "runlabel.in" +#line 375 "runlabel.in" addFunc(ve, run::gen_runlabel5, pathArray() , SYM(_strokepath), formal(primPath(), SYM(g), false, false), formal(primPen(), SYM(p), true, false)); } diff --git a/Build/source/utils/asymptote/runlabel.in b/Build/source/utils/asymptote/runlabel.in index e15a995649b..cee146b48bf 100644 --- a/Build/source/utils/asymptote/runlabel.in +++ b/Build/source/utils/asymptote/runlabel.in @@ -124,7 +124,8 @@ array *readpath(const string& psname, bool keep, node.straight=false; nodes.push_back(node); } - P->push(path(nodes,nodes.size(),cyclic)); + if(cyclic) // Discard noncyclic paths. + P->push(path(nodes,nodes.size(),cyclic)); nodes.clear(); } active=false; diff --git a/Build/source/utils/asymptote/runlabel.symbols.h b/Build/source/utils/asymptote/runlabel.symbols.h index 80ac1d8b97e..460b024ad50 100644 --- a/Build/source/utils/asymptote/runlabel.symbols.h +++ b/Build/source/utils/asymptote/runlabel.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runmath.cc b/Build/source/utils/asymptote/runmath.cc index 6bf13e7daba..c15450389dd 100644 --- a/Build/source/utils/asymptote/runmath.cc +++ b/Build/source/utils/asymptote/runmath.cc @@ -106,6 +106,7 @@ function *realRealFunction(); #define CURRENTPEN processData().currentpen #line 12 "runmath.in" +#include <inttypes.h> #include "mathop.h" #include "path.h" @@ -122,6 +123,8 @@ using vm::frame; const char *invalidargument="invalid argument"; +extern uint32_t CLZ(uint32_t a); + // Return the factorial of a non-negative integer using a lookup table. Int factorial(Int n) { @@ -170,236 +173,236 @@ void Srand(Int seed) #include "runmath.symbols.h" namespace run { -#line 72 "runmath.in" +#line 75 "runmath.in" // real ^(real x, Int y); void gen_runmath0(stack *Stack) { Int y=vm::pop<Int>(Stack); real x=vm::pop<real>(Stack); -#line 73 "runmath.in" +#line 76 "runmath.in" {Stack->push<real>(pow(x,y)); return;} } -#line 77 "runmath.in" +#line 80 "runmath.in" // pair ^(pair z, Int y); void gen_runmath1(stack *Stack) { Int y=vm::pop<Int>(Stack); pair z=vm::pop<pair>(Stack); -#line 78 "runmath.in" +#line 81 "runmath.in" {Stack->push<pair>(pow(z,y)); return;} } -#line 82 "runmath.in" +#line 85 "runmath.in" // Int quotient(Int x, Int y); void gen_runmath2(stack *Stack) { Int y=vm::pop<Int>(Stack); Int x=vm::pop<Int>(Stack); -#line 83 "runmath.in" +#line 86 "runmath.in" if(y == 0) dividebyzero(); if(y == -1) {Stack->push<Int>(Negate(x)); return;} // Implementation-independent definition of integer division: round down {Stack->push<Int>((x-portableMod(x,y))/y); return;} } -#line 90 "runmath.in" +#line 93 "runmath.in" // Int abs(Int x); void gen_runmath3(stack *Stack) { Int x=vm::pop<Int>(Stack); -#line 91 "runmath.in" +#line 94 "runmath.in" {Stack->push<Int>(Abs(x)); return;} } -#line 95 "runmath.in" +#line 98 "runmath.in" // Int sgn(real x); void gen_runmath4(stack *Stack) { real x=vm::pop<real>(Stack); -#line 96 "runmath.in" +#line 99 "runmath.in" {Stack->push<Int>(sgn(x)); return;} } -#line 100 "runmath.in" +#line 103 "runmath.in" // Int rand(); void gen_runmath5(stack *Stack) { -#line 101 "runmath.in" +#line 104 "runmath.in" if(initializeRandom) Srand(1); {Stack->push<Int>(random()); return;} } -#line 107 "runmath.in" +#line 110 "runmath.in" // void srand(Int seed); void gen_runmath6(stack *Stack) { Int seed=vm::pop<Int>(Stack); -#line 108 "runmath.in" +#line 111 "runmath.in" Srand(seed); } // a random number uniformly distributed in the interval [0,1] -#line 113 "runmath.in" +#line 116 "runmath.in" // real unitrand(); void gen_runmath7(stack *Stack) { -#line 114 "runmath.in" +#line 117 "runmath.in" {Stack->push<real>(((real) random())/RAND_MAX); return;} } -#line 118 "runmath.in" +#line 121 "runmath.in" // Int ceil(real x); void gen_runmath8(stack *Stack) { real x=vm::pop<real>(Stack); -#line 119 "runmath.in" +#line 122 "runmath.in" {Stack->push<Int>(Intcast(ceil(x))); return;} } -#line 123 "runmath.in" +#line 126 "runmath.in" // Int floor(real x); void gen_runmath9(stack *Stack) { real x=vm::pop<real>(Stack); -#line 124 "runmath.in" +#line 127 "runmath.in" {Stack->push<Int>(Intcast(floor(x))); return;} } -#line 128 "runmath.in" +#line 131 "runmath.in" // Int round(real x); void gen_runmath10(stack *Stack) { real x=vm::pop<real>(Stack); -#line 129 "runmath.in" +#line 132 "runmath.in" if(validInt(x)) {Stack->push<Int>(Round(x)); return;} integeroverflow(0); } -#line 134 "runmath.in" +#line 137 "runmath.in" // Int Ceil(real x); void gen_runmath11(stack *Stack) { real x=vm::pop<real>(Stack); -#line 135 "runmath.in" +#line 138 "runmath.in" {Stack->push<Int>(Ceil(x)); return;} } -#line 139 "runmath.in" +#line 142 "runmath.in" // Int Floor(real x); void gen_runmath12(stack *Stack) { real x=vm::pop<real>(Stack); -#line 140 "runmath.in" +#line 143 "runmath.in" {Stack->push<Int>(Floor(x)); return;} } -#line 144 "runmath.in" +#line 147 "runmath.in" // Int Round(real x); void gen_runmath13(stack *Stack) { real x=vm::pop<real>(Stack); -#line 145 "runmath.in" +#line 148 "runmath.in" {Stack->push<Int>(Round(Intcap(x))); return;} } -#line 149 "runmath.in" +#line 152 "runmath.in" // real fmod(real x, real y); void gen_runmath14(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 150 "runmath.in" +#line 153 "runmath.in" if (y == 0.0) dividebyzero(); {Stack->push<real>(fmod(x,y)); return;} } -#line 155 "runmath.in" +#line 158 "runmath.in" // real atan2(real y, real x); void gen_runmath15(stack *Stack) { real x=vm::pop<real>(Stack); real y=vm::pop<real>(Stack); -#line 156 "runmath.in" +#line 159 "runmath.in" {Stack->push<real>(atan2(y,x)); return;} } -#line 160 "runmath.in" +#line 163 "runmath.in" // real hypot(real x, real y); void gen_runmath16(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 161 "runmath.in" +#line 164 "runmath.in" {Stack->push<real>(hypot(x,y)); return;} } -#line 165 "runmath.in" +#line 168 "runmath.in" // real remainder(real x, real y); void gen_runmath17(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 166 "runmath.in" +#line 169 "runmath.in" {Stack->push<real>(remainder(x,y)); return;} } -#line 170 "runmath.in" +#line 173 "runmath.in" // real Jn(Int n, real x); void gen_runmath18(stack *Stack) { real x=vm::pop<real>(Stack); Int n=vm::pop<Int>(Stack); -#line 171 "runmath.in" +#line 174 "runmath.in" {Stack->push<real>(jn(n,x)); return;} } -#line 175 "runmath.in" +#line 178 "runmath.in" // real Yn(Int n, real x); void gen_runmath19(stack *Stack) { real x=vm::pop<real>(Stack); Int n=vm::pop<Int>(Stack); -#line 176 "runmath.in" +#line 179 "runmath.in" {Stack->push<real>(yn(n,x)); return;} } -#line 180 "runmath.in" +#line 183 "runmath.in" // real erf(real x); void gen_runmath20(stack *Stack) { real x=vm::pop<real>(Stack); -#line 181 "runmath.in" +#line 184 "runmath.in" {Stack->push<real>(erf(x)); return;} } -#line 185 "runmath.in" +#line 188 "runmath.in" // real erfc(real x); void gen_runmath21(stack *Stack) { real x=vm::pop<real>(Stack); -#line 186 "runmath.in" +#line 189 "runmath.in" {Stack->push<real>(erfc(x)); return;} } -#line 190 "runmath.in" +#line 193 "runmath.in" // Int factorial(Int n); void gen_runmath22(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 191 "runmath.in" +#line 194 "runmath.in" if(n < 0) error(invalidargument); {Stack->push<Int>(factorial(n)); return;} } -#line 195 "runmath.in" +#line 198 "runmath.in" // Int choose(Int n, Int k); void gen_runmath23(stack *Stack) { Int k=vm::pop<Int>(Stack); Int n=vm::pop<Int>(Stack); -#line 196 "runmath.in" +#line 199 "runmath.in" if(n < 0 || k < 0 || k > n) error(invalidargument); Int f=1; Int r=n-k; @@ -410,12 +413,12 @@ void gen_runmath23(stack *Stack) {Stack->push<Int>(f); return;} } -#line 206 "runmath.in" +#line 209 "runmath.in" // real gamma(real x); void gen_runmath24(stack *Stack) { real x=vm::pop<real>(Stack); -#line 207 "runmath.in" +#line 210 "runmath.in" #ifdef HAVE_TGAMMA {Stack->push<real>(tgamma(x)); return;} #else @@ -424,14 +427,14 @@ void gen_runmath24(stack *Stack) #endif } -#line 216 "runmath.in" +#line 219 "runmath.in" // realarray* quadraticroots(real a, real b, real c); void gen_runmath25(stack *Stack) { real c=vm::pop<real>(Stack); real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); -#line 217 "runmath.in" +#line 220 "runmath.in" quadraticroots q(a,b,c); array *roots=new array(q.roots); if(q.roots >= 1) (*roots)[0]=q.t1; @@ -439,14 +442,14 @@ void gen_runmath25(stack *Stack) {Stack->push<realarray*>(roots); return;} } -#line 225 "runmath.in" +#line 228 "runmath.in" // pairarray* quadraticroots(explicit pair a, explicit pair b, explicit pair c); void gen_runmath26(stack *Stack) { pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 226 "runmath.in" +#line 229 "runmath.in" Quadraticroots q(a,b,c); array *roots=new array(q.roots); if(q.roots >= 1) (*roots)[0]=q.z1; @@ -454,7 +457,7 @@ void gen_runmath26(stack *Stack) {Stack->push<pairarray*>(roots); return;} } -#line 234 "runmath.in" +#line 237 "runmath.in" // realarray* cubicroots(real a, real b, real c, real d); void gen_runmath27(stack *Stack) { @@ -462,7 +465,7 @@ void gen_runmath27(stack *Stack) real c=vm::pop<real>(Stack); real b=vm::pop<real>(Stack); real a=vm::pop<real>(Stack); -#line 235 "runmath.in" +#line 238 "runmath.in" cubicroots q(a,b,c,d); array *roots=new array(q.roots); if(q.roots >= 1) (*roots)[0]=q.t1; @@ -473,124 +476,108 @@ void gen_runmath27(stack *Stack) // Logical operations -#line 246 "runmath.in" +#line 249 "runmath.in" // bool !(bool b); void gen_runmath28(stack *Stack) { bool b=vm::pop<bool>(Stack); -#line 247 "runmath.in" +#line 250 "runmath.in" {Stack->push<bool>(!b); return;} } -#line 252 "runmath.in" +#line 255 "runmath.in" void boolMemEq(stack *Stack) { frame * b=vm::pop<frame *>(Stack); frame * a=vm::pop<frame *>(Stack); -#line 253 "runmath.in" +#line 256 "runmath.in" {Stack->push<bool>(a == b); return;} } -#line 257 "runmath.in" +#line 260 "runmath.in" void boolMemNeq(stack *Stack) { frame * b=vm::pop<frame *>(Stack); frame * a=vm::pop<frame *>(Stack); -#line 258 "runmath.in" +#line 261 "runmath.in" {Stack->push<bool>(a != b); return;} } -#line 262 "runmath.in" +#line 265 "runmath.in" void boolFuncEq(stack *Stack) { callable * b=vm::pop<callable *>(Stack); callable * a=vm::pop<callable *>(Stack); -#line 263 "runmath.in" +#line 266 "runmath.in" {Stack->push<bool>(a->compare(b)); return;} } -#line 267 "runmath.in" +#line 270 "runmath.in" void boolFuncNeq(stack *Stack) { callable * b=vm::pop<callable *>(Stack); callable * a=vm::pop<callable *>(Stack); -#line 268 "runmath.in" +#line 271 "runmath.in" {Stack->push<bool>(!(a->compare(b))); return;} } // Bit operations -#line 274 "runmath.in" +#line 277 "runmath.in" // Int AND(Int a, Int b); void gen_runmath33(stack *Stack) { Int b=vm::pop<Int>(Stack); Int a=vm::pop<Int>(Stack); -#line 275 "runmath.in" +#line 278 "runmath.in" {Stack->push<Int>(a & b); return;} } -#line 280 "runmath.in" +#line 283 "runmath.in" // Int OR(Int a, Int b); void gen_runmath34(stack *Stack) { Int b=vm::pop<Int>(Stack); Int a=vm::pop<Int>(Stack); -#line 281 "runmath.in" +#line 284 "runmath.in" {Stack->push<Int>(a | b); return;} } -#line 285 "runmath.in" +#line 288 "runmath.in" // Int XOR(Int a, Int b); void gen_runmath35(stack *Stack) { Int b=vm::pop<Int>(Stack); Int a=vm::pop<Int>(Stack); -#line 286 "runmath.in" +#line 289 "runmath.in" {Stack->push<Int>(a ^ b); return;} } -#line 290 "runmath.in" +#line 293 "runmath.in" // Int NOT(Int a); void gen_runmath36(stack *Stack) { Int a=vm::pop<Int>(Stack); -#line 291 "runmath.in" +#line 294 "runmath.in" {Stack->push<Int>(~a); return;} } -#line 295 "runmath.in" +#line 298 "runmath.in" // Int CLZ(Int a); void gen_runmath37(stack *Stack) { Int a=vm::pop<Int>(Stack); -#line 296 "runmath.in" +#line 299 "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 + {Stack->push<Int>(CLZ((uint32_t) a)); return;} } -#line 317 "runmath.in" +#line 304 "runmath.in" // Int CTZ(Int a); void gen_runmath38(stack *Stack) { Int a=vm::pop<Int>(Stack); -#line 318 "runmath.in" +#line 305 "runmath.in" if((unsignedInt) a > 0xFFFFFFFF) {Stack->push<Int>(-1); return;} #ifdef __GNUC__ {Stack->push<Int>(__builtin_ctz(a)); return;} @@ -611,83 +598,83 @@ namespace trans { void gen_runmath_venv(venv &ve) { -#line 72 "runmath.in" +#line 75 "runmath.in" addFunc(ve, run::gen_runmath0, primReal(), SYM_CARET, formal(primReal(), SYM(x), false, false), formal(primInt(), SYM(y), false, false)); -#line 77 "runmath.in" +#line 80 "runmath.in" addFunc(ve, run::gen_runmath1, primPair(), SYM_CARET, formal(primPair(), SYM(z), false, false), formal(primInt(), SYM(y), false, false)); -#line 82 "runmath.in" +#line 85 "runmath.in" addFunc(ve, run::gen_runmath2, primInt(), SYM(quotient), formal(primInt(), SYM(x), false, false), formal(primInt(), SYM(y), false, false)); -#line 90 "runmath.in" +#line 93 "runmath.in" addFunc(ve, run::gen_runmath3, primInt(), SYM(abs), formal(primInt(), SYM(x), false, false)); -#line 95 "runmath.in" +#line 98 "runmath.in" addFunc(ve, run::gen_runmath4, primInt(), SYM(sgn), formal(primReal(), SYM(x), false, false)); -#line 100 "runmath.in" +#line 103 "runmath.in" addFunc(ve, run::gen_runmath5, primInt(), SYM(rand)); -#line 107 "runmath.in" +#line 110 "runmath.in" addFunc(ve, run::gen_runmath6, primVoid(), SYM(srand), formal(primInt(), SYM(seed), false, false)); -#line 112 "runmath.in" +#line 115 "runmath.in" addFunc(ve, run::gen_runmath7, primReal(), SYM(unitrand)); -#line 118 "runmath.in" +#line 121 "runmath.in" addFunc(ve, run::gen_runmath8, primInt(), SYM(ceil), formal(primReal(), SYM(x), false, false)); -#line 123 "runmath.in" +#line 126 "runmath.in" addFunc(ve, run::gen_runmath9, primInt(), SYM(floor), formal(primReal(), SYM(x), false, false)); -#line 128 "runmath.in" +#line 131 "runmath.in" addFunc(ve, run::gen_runmath10, primInt(), SYM(round), formal(primReal(), SYM(x), false, false)); -#line 134 "runmath.in" +#line 137 "runmath.in" addFunc(ve, run::gen_runmath11, primInt(), SYM(Ceil), formal(primReal(), SYM(x), false, false)); -#line 139 "runmath.in" +#line 142 "runmath.in" addFunc(ve, run::gen_runmath12, primInt(), SYM(Floor), formal(primReal(), SYM(x), false, false)); -#line 144 "runmath.in" +#line 147 "runmath.in" addFunc(ve, run::gen_runmath13, primInt(), SYM(Round), formal(primReal(), SYM(x), false, false)); -#line 149 "runmath.in" +#line 152 "runmath.in" addFunc(ve, run::gen_runmath14, primReal(), SYM(fmod), formal(primReal(), SYM(x), false, false), formal(primReal(), SYM(y), false, false)); -#line 155 "runmath.in" +#line 158 "runmath.in" addFunc(ve, run::gen_runmath15, primReal(), SYM(atan2), formal(primReal(), SYM(y), false, false), formal(primReal(), SYM(x), false, false)); -#line 160 "runmath.in" +#line 163 "runmath.in" addFunc(ve, run::gen_runmath16, primReal(), SYM(hypot), formal(primReal(), SYM(x), false, false), formal(primReal(), SYM(y), false, false)); -#line 165 "runmath.in" +#line 168 "runmath.in" addFunc(ve, run::gen_runmath17, primReal(), SYM(remainder), formal(primReal(), SYM(x), false, false), formal(primReal(), SYM(y), false, false)); -#line 170 "runmath.in" +#line 173 "runmath.in" addFunc(ve, run::gen_runmath18, primReal(), SYM(Jn), formal(primInt(), SYM(n), false, false), formal(primReal(), SYM(x), false, false)); -#line 175 "runmath.in" +#line 178 "runmath.in" addFunc(ve, run::gen_runmath19, primReal(), SYM(Yn), formal(primInt(), SYM(n), false, false), formal(primReal(), SYM(x), false, false)); -#line 180 "runmath.in" +#line 183 "runmath.in" addFunc(ve, run::gen_runmath20, primReal(), SYM(erf), formal(primReal(), SYM(x), false, false)); -#line 185 "runmath.in" +#line 188 "runmath.in" addFunc(ve, run::gen_runmath21, primReal(), SYM(erfc), formal(primReal(), SYM(x), false, false)); -#line 190 "runmath.in" +#line 193 "runmath.in" addFunc(ve, run::gen_runmath22, primInt(), SYM(factorial), formal(primInt(), SYM(n), false, false)); -#line 195 "runmath.in" +#line 198 "runmath.in" addFunc(ve, run::gen_runmath23, primInt(), SYM(choose), formal(primInt(), SYM(n), false, false), formal(primInt(), SYM(k), false, false)); -#line 206 "runmath.in" +#line 209 "runmath.in" addFunc(ve, run::gen_runmath24, primReal(), SYM(gamma), formal(primReal(), SYM(x), false, false)); -#line 216 "runmath.in" +#line 219 "runmath.in" addFunc(ve, run::gen_runmath25, realArray(), SYM(quadraticroots), formal(primReal(), SYM(a), false, false), formal(primReal(), SYM(b), false, false), formal(primReal(), SYM(c), false, false)); -#line 225 "runmath.in" +#line 228 "runmath.in" addFunc(ve, run::gen_runmath26, pairArray(), SYM(quadraticroots), formal(primPair(), SYM(a), false, true), formal(primPair(), SYM(b), false, true), formal(primPair(), SYM(c), false, true)); -#line 234 "runmath.in" +#line 237 "runmath.in" addFunc(ve, run::gen_runmath27, realArray(), SYM(cubicroots), formal(primReal(), SYM(a), false, false), formal(primReal(), SYM(b), false, false), formal(primReal(), SYM(c), false, false), formal(primReal(), SYM(d), false, false)); -#line 244 "runmath.in" +#line 247 "runmath.in" addFunc(ve, run::gen_runmath28, primBoolean(), SYM_LOGNOT, formal(primBoolean(), SYM(b), false, false)); -#line 252 "runmath.in" +#line 255 "runmath.in" REGISTER_BLTIN(run::boolMemEq,"boolMemEq"); -#line 257 "runmath.in" +#line 260 "runmath.in" REGISTER_BLTIN(run::boolMemNeq,"boolMemNeq"); -#line 262 "runmath.in" +#line 265 "runmath.in" REGISTER_BLTIN(run::boolFuncEq,"boolFuncEq"); -#line 267 "runmath.in" +#line 270 "runmath.in" REGISTER_BLTIN(run::boolFuncNeq,"boolFuncNeq"); -#line 272 "runmath.in" +#line 275 "runmath.in" addFunc(ve, run::gen_runmath33, primInt(), SYM(AND), formal(primInt(), SYM(a), false, false), formal(primInt(), SYM(b), false, false)); -#line 280 "runmath.in" +#line 283 "runmath.in" addFunc(ve, run::gen_runmath34, primInt(), SYM(OR), formal(primInt(), SYM(a), false, false), formal(primInt(), SYM(b), false, false)); -#line 285 "runmath.in" +#line 288 "runmath.in" addFunc(ve, run::gen_runmath35, primInt(), SYM(XOR), formal(primInt(), SYM(a), false, false), formal(primInt(), SYM(b), false, false)); -#line 290 "runmath.in" +#line 293 "runmath.in" addFunc(ve, run::gen_runmath36, primInt(), SYM(NOT), formal(primInt(), SYM(a), false, false)); -#line 295 "runmath.in" +#line 298 "runmath.in" addFunc(ve, run::gen_runmath37, primInt(), SYM(CLZ), formal(primInt(), SYM(a), false, false)); -#line 317 "runmath.in" +#line 304 "runmath.in" addFunc(ve, run::gen_runmath38, primInt(), SYM(CTZ), formal(primInt(), SYM(a), false, false)); } diff --git a/Build/source/utils/asymptote/runmath.in b/Build/source/utils/asymptote/runmath.in index 2c4b0ef733d..5e26311c53c 100644 --- a/Build/source/utils/asymptote/runmath.in +++ b/Build/source/utils/asymptote/runmath.in @@ -9,6 +9,7 @@ pair => primPair() realarray* => realArray() pairarray* => pairArray() +#include <inttypes.h> #include "mathop.h" #include "path.h" @@ -25,6 +26,8 @@ using vm::frame; const char *invalidargument="invalid argument"; +extern uint32_t CLZ(uint32_t a); + // Return the factorial of a non-negative integer using a lookup table. Int factorial(Int n) { @@ -295,23 +298,7 @@ Int NOT(Int 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 + return CLZ((uint32_t) a); } Int CTZ(Int a) diff --git a/Build/source/utils/asymptote/runmath.symbols.h b/Build/source/utils/asymptote/runmath.symbols.h index ab1ae9b283b..e9c8aa8ef13 100644 --- a/Build/source/utils/asymptote/runmath.symbols.h +++ b/Build/source/utils/asymptote/runmath.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runpair.symbols.h b/Build/source/utils/asymptote/runpair.symbols.h index 33a745e789d..59057fb118d 100644 --- a/Build/source/utils/asymptote/runpair.symbols.h +++ b/Build/source/utils/asymptote/runpair.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runpath.symbols.h b/Build/source/utils/asymptote/runpath.symbols.h index d93857ff7eb..9e2f6a569af 100644 --- a/Build/source/utils/asymptote/runpath.symbols.h +++ b/Build/source/utils/asymptote/runpath.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runpath3d.symbols.h b/Build/source/utils/asymptote/runpath3d.symbols.h index cf34628c3e0..7953c25fc1e 100644 --- a/Build/source/utils/asymptote/runpath3d.symbols.h +++ b/Build/source/utils/asymptote/runpath3d.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runpicture.cc b/Build/source/utils/asymptote/runpicture.cc index e677d45c72c..acc56601bd4 100644 --- a/Build/source/utils/asymptote/runpicture.cc +++ b/Build/source/utils/asymptote/runpicture.cc @@ -936,15 +936,17 @@ void gen_runpicture44(stack *Stack) // Bezier curve #line 580 "runpicture.in" -// void _draw(picture *f, path3 g, pen p); +// void _draw(picture *f, path3 g, triple center=Zero, pen p, Int interaction=0); void gen_runpicture45(stack *Stack) { + Int interaction=vm::pop<Int>(Stack,0); pen p=vm::pop<pen>(Stack); + triple center=vm::pop<triple>(Stack,Zero); path3 g=vm::pop<path3>(Stack); picture * f=vm::pop<picture *>(Stack); #line 581 "runpicture.in" if(g.size() > 0) - f->append(new drawPath3(g,p)); + f->append(new drawPath3(g,center,p,(Interaction) intcast(interaction))); } // Bezier patch @@ -1217,7 +1219,7 @@ void gen_runpicture_venv(venv &ve) #line 453 "runpicture.in" addFunc(ve, run::gen_runpicture44, primVoid(), SYM(deconstruct), formal(primPicture(), SYM(f), false, false), formal(primPicture(), SYM(preamble), true, false), formal(primReal(), SYM(magnification), true, false), formal(transformFunction(), SYM(xform), false, false)); #line 576 "runpicture.in" - addFunc(ve, run::gen_runpicture45, primVoid(), SYM(_draw), formal(primPicture(), SYM(f), false, false), formal(primPath3(), SYM(g), false, false), formal(primPen(), SYM(p), false, false)); + addFunc(ve, run::gen_runpicture45, primVoid(), SYM(_draw), formal(primPicture(), SYM(f), false, false), formal(primPath3(), SYM(g), false, false), formal(primTriple(), SYM(center), true, false), formal(primPen(), SYM(p), false, false), formal(primInt(), SYM(interaction), true, false)); #line 586 "runpicture.in" addFunc(ve, run::gen_runpicture46, primVoid(), SYM(draw), formal(primPicture(), SYM(f), false, false), formal(tripleArray2(), SYM(p), false, false), formal(primTriple(), SYM(center), false, false), formal(primBoolean(), SYM(straight), false, false), formal(penArray() , SYM(p), false, false), formal(primReal(), SYM(opacity), false, false), formal(primReal(), SYM(shininess), false, false), formal(primReal(), SYM(prcshininess), false, false), formal(primTriple(), SYM(normal), false, false), formal(penArray() , SYM(colors), false, false), formal(primBoolean(), SYM(lighton), false, false), formal(primInt(), SYM(interaction), false, false), formal(primBoolean(), SYM(prc), true, false)); #line 597 "runpicture.in" diff --git a/Build/source/utils/asymptote/runpicture.in b/Build/source/utils/asymptote/runpicture.in index 710aa3e2e32..cd22bb5dd97 100644 --- a/Build/source/utils/asymptote/runpicture.in +++ b/Build/source/utils/asymptote/runpicture.in @@ -577,10 +577,10 @@ void deconstruct(picture *f, picture *preamble=NULL, real magnification=1, // Three-dimensional picture and surface operations // Bezier curve -void _draw(picture *f, path3 g, pen p) +void _draw(picture *f, path3 g, triple center=Zero, pen p, Int interaction=0) { if(g.size() > 0) - f->append(new drawPath3(g,p)); + f->append(new drawPath3(g,center,p,(Interaction) intcast(interaction))); } // Bezier patch diff --git a/Build/source/utils/asymptote/runpicture.symbols.h b/Build/source/utils/asymptote/runpicture.symbols.h index 5d7daceeed1..109ba51b06e 100644 --- a/Build/source/utils/asymptote/runpicture.symbols.h +++ b/Build/source/utils/asymptote/runpicture.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runstring.symbols.h b/Build/source/utils/asymptote/runstring.symbols.h index 6ab67c65a08..a020945d30a 100644 --- a/Build/source/utils/asymptote/runstring.symbols.h +++ b/Build/source/utils/asymptote/runstring.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runsystem.cc b/Build/source/utils/asymptote/runsystem.cc index f1c4ad3b2be..20681335883 100644 --- a/Build/source/utils/asymptote/runsystem.cc +++ b/Build/source/utils/asymptote/runsystem.cc @@ -115,7 +115,7 @@ using namespace settings; using vm::bpinfo; using vm::bplist; using vm::getPos; -using vm::default_t; +using vm::Default; using vm::nullfunc; using vm::item; using absyntax::runnable; @@ -123,7 +123,6 @@ using absyntax::runnable; typedef callable callableBp; namespace run { -extern default_t def; extern string emptystring; } @@ -162,7 +161,7 @@ void breakpoint(stack *Stack, runnable *r) Stack->push<string>(curPos.filename()); Stack->push<Int>((Int) curPos.Line()); Stack->push<Int>((Int) curPos.Column()); - Stack->push(r ? r : item(run::def)); + Stack->push(r ? r : vm::Default); atBreakpointFunction->call(Stack); // returns a string } else Stack->push<string>(""); } @@ -207,143 +206,143 @@ void exitFunction(stack *Stack) #include "runsystem.symbols.h" namespace run { -#line 109 "runsystem.in" +#line 108 "runsystem.in" // string outname(); void gen_runsystem0(stack *Stack) { -#line 110 "runsystem.in" +#line 109 "runsystem.in" {Stack->push<string>(outname()); return;} } -#line 114 "runsystem.in" +#line 113 "runsystem.in" // void atupdate(callable *f); void gen_runsystem1(stack *Stack) { callable * f=vm::pop<callable *>(Stack); -#line 115 "runsystem.in" +#line 114 "runsystem.in" processData().atUpdateFunction=f; } -#line 119 "runsystem.in" +#line 118 "runsystem.in" // callable* atupdate(); void gen_runsystem2(stack *Stack) { -#line 120 "runsystem.in" +#line 119 "runsystem.in" {Stack->push<callable*>(processData().atUpdateFunction); return;} } -#line 124 "runsystem.in" +#line 123 "runsystem.in" // void atexit(callable *f); void gen_runsystem3(stack *Stack) { callable * f=vm::pop<callable *>(Stack); -#line 125 "runsystem.in" +#line 124 "runsystem.in" processData().atExitFunction=f; } -#line 129 "runsystem.in" +#line 128 "runsystem.in" // callable* atexit(); void gen_runsystem4(stack *Stack) { -#line 130 "runsystem.in" +#line 129 "runsystem.in" {Stack->push<callable*>(processData().atExitFunction); return;} } -#line 134 "runsystem.in" +#line 133 "runsystem.in" // void atbreakpoint(callableBp *f); void gen_runsystem5(stack *Stack) { callableBp * f=vm::pop<callableBp *>(Stack); -#line 135 "runsystem.in" +#line 134 "runsystem.in" processData().atBreakpointFunction=f; } -#line 139 "runsystem.in" +#line 138 "runsystem.in" // void breakpoint(runnable *s=NULL); void gen_runsystem6(stack *Stack) { runnable * s=vm::pop<runnable *>(Stack,NULL); -#line 140 "runsystem.in" +#line 139 "runsystem.in" breakpoint(Stack,s); } -#line 144 "runsystem.in" +#line 143 "runsystem.in" // string locatefile(string file); void gen_runsystem7(stack *Stack) { string file=vm::pop<string>(Stack); -#line 145 "runsystem.in" +#line 144 "runsystem.in" {Stack->push<string>(locateFile(file)); return;} } -#line 149 "runsystem.in" +#line 148 "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 150 "runsystem.in" +#line 149 "runsystem.in" file=locateFile(file); clear(file,line); cout << "setting breakpoint at " << file << ": " << line << endl; bplist.push_back(bpinfo(file,line,s)); } -#line 157 "runsystem.in" +#line 156 "runsystem.in" // void breakpoints(); void gen_runsystem9(stack *) { -#line 158 "runsystem.in" +#line 157 "runsystem.in" for(mem::list<bpinfo>::iterator p=bplist.begin(); p != bplist.end(); ++p) cout << p->f.name() << ": " << p->f.line() << endl; } -#line 163 "runsystem.in" +#line 162 "runsystem.in" // void clear(string file, Int line); void gen_runsystem10(stack *Stack) { Int line=vm::pop<Int>(Stack); string file=vm::pop<string>(Stack); -#line 164 "runsystem.in" +#line 163 "runsystem.in" file=locateFile(file); clear(file,line,true); } -#line 169 "runsystem.in" +#line 168 "runsystem.in" // void clear(); void gen_runsystem11(stack *) { -#line 170 "runsystem.in" +#line 169 "runsystem.in" bplist.clear(); } -#line 174 "runsystem.in" +#line 173 "runsystem.in" // void warn(string s); void gen_runsystem12(stack *Stack) { string s=vm::pop<string>(Stack); -#line 175 "runsystem.in" +#line 174 "runsystem.in" Warn(s); } -#line 179 "runsystem.in" +#line 178 "runsystem.in" // void nowarn(string s); void gen_runsystem13(stack *Stack) { string s=vm::pop<string>(Stack); -#line 180 "runsystem.in" +#line 179 "runsystem.in" noWarn(s); } -#line 184 "runsystem.in" +#line 183 "runsystem.in" // void warning(string s, string t, bool position=false); 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 185 "runsystem.in" +#line 184 "runsystem.in" if(settings::warn(s)) { em.warning(position ? getPos() : nullPos,s); em << t; @@ -351,44 +350,44 @@ void gen_runsystem14(stack *Stack) } // Strip directory from string -#line 193 "runsystem.in" +#line 192 "runsystem.in" // string stripdirectory(string *s); void gen_runsystem15(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 194 "runsystem.in" +#line 193 "runsystem.in" {Stack->push<string>(stripDir(*s)); return;} } // Strip directory from string -#line 199 "runsystem.in" +#line 198 "runsystem.in" // string stripfile(string *s); void gen_runsystem16(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 200 "runsystem.in" +#line 199 "runsystem.in" {Stack->push<string>(stripFile(*s)); return;} } // Strip file extension from string -#line 205 "runsystem.in" +#line 204 "runsystem.in" // string stripextension(string *s); void gen_runsystem17(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 206 "runsystem.in" +#line 205 "runsystem.in" {Stack->push<string>(stripExt(*s)); return;} } // Call ImageMagick convert. -#line 211 "runsystem.in" +#line 210 "runsystem.in" // Int convert(string args=emptystring, string file=emptystring, string format=emptystring); 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 213 "runsystem.in" +#line 212 "runsystem.in" string name=convertname(file,format); mem::vector<string> cmd; cmd.push_back(getSetting<string>("convert")); @@ -414,14 +413,14 @@ void gen_runsystem18(stack *Stack) } // Call ImageMagick animate. -#line 239 "runsystem.in" +#line 238 "runsystem.in" // Int animate(string args=emptystring, string file=emptystring, string format=emptystring); 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 241 "runsystem.in" +#line 240 "runsystem.in" #ifndef __CYGWIN__ string name=convertname(file,format); if(view()) { @@ -435,12 +434,12 @@ void gen_runsystem19(stack *Stack) {Stack->push<Int>(0); return;} } -#line 255 "runsystem.in" +#line 254 "runsystem.in" // void purge(Int divisor=0); void gen_runsystem20(stack *Stack) { Int divisor=vm::pop<Int>(Stack,0); -#line 256 "runsystem.in" +#line 255 "runsystem.in" purge(divisor); } @@ -450,47 +449,47 @@ namespace trans { void gen_runsystem_venv(venv &ve) { -#line 109 "runsystem.in" +#line 108 "runsystem.in" addFunc(ve, run::gen_runsystem0, primString() , SYM(outname)); -#line 114 "runsystem.in" +#line 113 "runsystem.in" addFunc(ve, run::gen_runsystem1, primVoid(), SYM(atupdate), formal(voidFunction(), SYM(f), false, false)); -#line 119 "runsystem.in" +#line 118 "runsystem.in" addFunc(ve, run::gen_runsystem2, voidFunction(), SYM(atupdate)); -#line 124 "runsystem.in" +#line 123 "runsystem.in" addFunc(ve, run::gen_runsystem3, primVoid(), SYM(atexit), formal(voidFunction(), SYM(f), false, false)); -#line 129 "runsystem.in" +#line 128 "runsystem.in" addFunc(ve, run::gen_runsystem4, voidFunction(), SYM(atexit)); -#line 134 "runsystem.in" +#line 133 "runsystem.in" addFunc(ve, run::gen_runsystem5, primVoid(), SYM(atbreakpoint), formal(breakpointFunction(), SYM(f), false, false)); -#line 139 "runsystem.in" +#line 138 "runsystem.in" addFunc(ve, run::gen_runsystem6, primVoid(), SYM(breakpoint), formal(primCode(), SYM(s), true, false)); -#line 144 "runsystem.in" +#line 143 "runsystem.in" addFunc(ve, run::gen_runsystem7, primString() , SYM(locatefile), formal(primString() , SYM(file), false, false)); -#line 149 "runsystem.in" +#line 148 "runsystem.in" addFunc(ve, run::gen_runsystem8, primVoid(), SYM(stop), formal(primString() , SYM(file), false, false), formal(primInt(), SYM(line), false, false), formal(primCode(), SYM(s), true, false)); -#line 157 "runsystem.in" +#line 156 "runsystem.in" addFunc(ve, run::gen_runsystem9, primVoid(), SYM(breakpoints)); -#line 163 "runsystem.in" +#line 162 "runsystem.in" addFunc(ve, run::gen_runsystem10, primVoid(), SYM(clear), formal(primString() , SYM(file), false, false), formal(primInt(), SYM(line), false, false)); -#line 169 "runsystem.in" +#line 168 "runsystem.in" addFunc(ve, run::gen_runsystem11, primVoid(), SYM(clear)); -#line 174 "runsystem.in" +#line 173 "runsystem.in" addFunc(ve, run::gen_runsystem12, primVoid(), SYM(warn), formal(primString() , SYM(s), false, false)); -#line 179 "runsystem.in" +#line 178 "runsystem.in" addFunc(ve, run::gen_runsystem13, primVoid(), SYM(nowarn), formal(primString() , SYM(s), false, false)); -#line 184 "runsystem.in" +#line 183 "runsystem.in" addFunc(ve, run::gen_runsystem14, primVoid(), SYM(warning), formal(primString() , SYM(s), false, false), formal(primString() , SYM(t), false, false), formal(primBoolean(), SYM(position), true, false)); -#line 192 "runsystem.in" +#line 191 "runsystem.in" addFunc(ve, run::gen_runsystem15, primString() , SYM(stripdirectory), formal(primString(), SYM(s), false, false)); -#line 198 "runsystem.in" +#line 197 "runsystem.in" addFunc(ve, run::gen_runsystem16, primString() , SYM(stripfile), formal(primString(), SYM(s), false, false)); -#line 204 "runsystem.in" +#line 203 "runsystem.in" addFunc(ve, run::gen_runsystem17, primString() , SYM(stripextension), formal(primString(), SYM(s), false, false)); -#line 210 "runsystem.in" +#line 209 "runsystem.in" addFunc(ve, run::gen_runsystem18, primInt(), SYM(convert), formal(primString() , SYM(args), true, false), formal(primString() , SYM(file), true, false), formal(primString() , SYM(format), true, false)); -#line 238 "runsystem.in" +#line 237 "runsystem.in" addFunc(ve, run::gen_runsystem19, primInt(), SYM(animate), formal(primString() , SYM(args), true, false), formal(primString() , SYM(file), true, false), formal(primString() , SYM(format), true, false)); -#line 255 "runsystem.in" +#line 254 "runsystem.in" addFunc(ve, run::gen_runsystem20, primVoid(), SYM(purge), formal(primInt(), SYM(divisor), true, false)); } diff --git a/Build/source/utils/asymptote/runsystem.in b/Build/source/utils/asymptote/runsystem.in index 7414e62f011..5fba04870b7 100644 --- a/Build/source/utils/asymptote/runsystem.in +++ b/Build/source/utils/asymptote/runsystem.in @@ -18,7 +18,7 @@ using namespace settings; using vm::bpinfo; using vm::bplist; using vm::getPos; -using vm::default_t; +using vm::Default; using vm::nullfunc; using vm::item; using absyntax::runnable; @@ -26,7 +26,6 @@ using absyntax::runnable; typedef callable callableBp; namespace run { -extern default_t def; extern string emptystring; } @@ -65,7 +64,7 @@ void breakpoint(stack *Stack, runnable *r) Stack->push<string>(curPos.filename()); Stack->push<Int>((Int) curPos.Line()); Stack->push<Int>((Int) curPos.Column()); - Stack->push(r ? r : item(run::def)); + Stack->push(r ? r : vm::Default); atBreakpointFunction->call(Stack); // returns a string } else Stack->push<string>(""); } diff --git a/Build/source/utils/asymptote/runsystem.symbols.h b/Build/source/utils/asymptote/runsystem.symbols.h index c6071f901d5..e0744d363f2 100644 --- a/Build/source/utils/asymptote/runsystem.symbols.h +++ b/Build/source/utils/asymptote/runsystem.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runtime.cc b/Build/source/utils/asymptote/runtime.cc index 6d32c064def..85a95180771 100644 --- a/Build/source/utils/asymptote/runtime.cc +++ b/Build/source/utils/asymptote/runtime.cc @@ -232,6 +232,14 @@ function *realTripleFunction() const size_t camp::ColorComponents[]={0,0,1,3,4,0}; namespace vm { +#if COMPACT +const Int DefaultValue=0x7fffffffffffffffLL; +const Int Undefined=0x7ffffffffffffffeLL; + +const item Default=DefaultValue; +#else +const item Default=item(default_t()); +#endif } namespace run { @@ -256,7 +264,6 @@ void writestring(stack *s) } } -default_t def; string emptystring; pair zero; @@ -277,45 +284,45 @@ void unused(void *) namespace run { // Initializers -#line 210 "runtime.in" +#line 217 "runtime.in" void IntZero(stack *Stack) { -#line 211 "runtime.in" +#line 218 "runtime.in" {Stack->push<Int>(0); return;} } -#line 216 "runtime.in" +#line 223 "runtime.in" void realZero(stack *Stack) { -#line 217 "runtime.in" +#line 224 "runtime.in" {Stack->push<real>(0.0); return;} } -#line 221 "runtime.in" +#line 228 "runtime.in" void boolFalse(stack *Stack) { -#line 222 "runtime.in" +#line 229 "runtime.in" {Stack->push<bool>(false); return;} } -#line 226 "runtime.in" +#line 233 "runtime.in" void pushNullArray(stack *Stack) { -#line 227 "runtime.in" +#line 234 "runtime.in" {Stack->push<array*>(0); return;} } -#line 231 "runtime.in" +#line 238 "runtime.in" void pushNullRecord(stack *Stack) { -#line 232 "runtime.in" +#line 239 "runtime.in" {Stack->push<frame*>(0); return;} } -#line 236 "runtime.in" +#line 243 "runtime.in" void pushNullFunction(stack *Stack) { -#line 237 "runtime.in" +#line 244 "runtime.in" {Stack->push(nullfunc::instance()); return;} } @@ -324,222 +331,222 @@ void pushNullFunction(stack *Stack) // Put the default value token on the stack (in place of an argument when // making a function call). -#line 246 "runtime.in" +#line 253 "runtime.in" void pushDefault(stack *Stack) { -#line 247 "runtime.in" - {Stack->push(def); return;} +#line 254 "runtime.in" + {Stack->push(Default); return;} } // Test if the value on the stack is the default value token. -#line 253 "runtime.in" +#line 260 "runtime.in" void isDefault(stack *Stack) { item i=vm::pop(Stack); -#line 254 "runtime.in" +#line 261 "runtime.in" {Stack->push<bool>(isdefault(i)); return;} } // Casts -#line 260 "runtime.in" +#line 267 "runtime.in" void pairToGuide(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 261 "runtime.in" +#line 268 "runtime.in" {Stack->push<guide*>(new pairguide(z)); return;} } -#line 266 "runtime.in" +#line 273 "runtime.in" void pathToGuide(stack *Stack) { path p=vm::pop<path>(Stack); -#line 267 "runtime.in" +#line 274 "runtime.in" {Stack->push<guide*>(new pathguide(p)); return;} } -#line 271 "runtime.in" +#line 278 "runtime.in" void guideToPath(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 272 "runtime.in" +#line 279 "runtime.in" {Stack->push<path>(g->solve()); return;} } // Pen operations -#line 278 "runtime.in" +#line 285 "runtime.in" void newPen(stack *Stack) { -#line 279 "runtime.in" +#line 286 "runtime.in" {Stack->push<pen>(pen()); return;} } -#line 284 "runtime.in" +#line 291 "runtime.in" // bool ==(pen a, pen b); void gen_runtime12(stack *Stack) { pen b=vm::pop<pen>(Stack); pen a=vm::pop<pen>(Stack); -#line 285 "runtime.in" +#line 292 "runtime.in" {Stack->push<bool>(a == b); return;} } -#line 289 "runtime.in" +#line 296 "runtime.in" // bool !=(pen a, pen b); void gen_runtime13(stack *Stack) { pen b=vm::pop<pen>(Stack); pen a=vm::pop<pen>(Stack); -#line 290 "runtime.in" +#line 297 "runtime.in" {Stack->push<bool>(a != b); return;} } -#line 294 "runtime.in" +#line 301 "runtime.in" // pen +(pen a, pen b); void gen_runtime14(stack *Stack) { pen b=vm::pop<pen>(Stack); pen a=vm::pop<pen>(Stack); -#line 295 "runtime.in" +#line 302 "runtime.in" {Stack->push<pen>(a+b); return;} } -#line 299 "runtime.in" +#line 306 "runtime.in" // pen *(real a, pen b); void gen_runtime15(stack *Stack) { pen b=vm::pop<pen>(Stack); real a=vm::pop<real>(Stack); -#line 300 "runtime.in" +#line 307 "runtime.in" {Stack->push<pen>(a*b); return;} } -#line 304 "runtime.in" +#line 311 "runtime.in" // pen *(pen a, real b); void gen_runtime16(stack *Stack) { real b=vm::pop<real>(Stack); pen a=vm::pop<pen>(Stack); -#line 305 "runtime.in" +#line 312 "runtime.in" {Stack->push<pen>(b*a); return;} } -#line 309 "runtime.in" +#line 316 "runtime.in" // pair max(pen p); void gen_runtime17(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 310 "runtime.in" +#line 317 "runtime.in" {Stack->push<pair>(p.bounds().Max()); return;} } -#line 314 "runtime.in" +#line 321 "runtime.in" // pair min(pen p); void gen_runtime18(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 315 "runtime.in" +#line 322 "runtime.in" {Stack->push<pair>(p.bounds().Min()); return;} } // Reset the meaning of pen default attributes. -#line 320 "runtime.in" +#line 327 "runtime.in" // void resetdefaultpen(); void gen_runtime19(stack *) { -#line 321 "runtime.in" +#line 328 "runtime.in" processData().defaultpen=camp::pen::initialpen(); } -#line 325 "runtime.in" +#line 332 "runtime.in" // void defaultpen(pen p); void gen_runtime20(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 326 "runtime.in" +#line 333 "runtime.in" processData().defaultpen=pen(resolvepen,p); } -#line 330 "runtime.in" +#line 337 "runtime.in" // pen defaultpen(); void gen_runtime21(stack *Stack) { -#line 331 "runtime.in" +#line 338 "runtime.in" {Stack->push<pen>(processData().defaultpen); return;} } -#line 335 "runtime.in" +#line 342 "runtime.in" // bool invisible(pen p); void gen_runtime22(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 336 "runtime.in" +#line 343 "runtime.in" {Stack->push<bool>(p.invisible()); return;} } -#line 340 "runtime.in" +#line 347 "runtime.in" // pen invisible(); void gen_runtime23(stack *Stack) { -#line 341 "runtime.in" +#line 348 "runtime.in" {Stack->push<pen>(pen(invisiblepen)); return;} } -#line 345 "runtime.in" +#line 352 "runtime.in" // pen gray(pen p); void gen_runtime24(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 346 "runtime.in" +#line 353 "runtime.in" p.togrey(); {Stack->push<pen>(p); return;} } -#line 351 "runtime.in" +#line 358 "runtime.in" // pen rgb(pen p); void gen_runtime25(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 352 "runtime.in" +#line 359 "runtime.in" p.torgb(); {Stack->push<pen>(p); return;} } -#line 357 "runtime.in" +#line 364 "runtime.in" // pen cmyk(pen p); void gen_runtime26(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 358 "runtime.in" +#line 365 "runtime.in" p.tocmyk(); {Stack->push<pen>(p); return;} } -#line 363 "runtime.in" +#line 370 "runtime.in" // pen interp(pen a, pen b, real t); void gen_runtime27(stack *Stack) { real t=vm::pop<real>(Stack); pen b=vm::pop<pen>(Stack); pen a=vm::pop<pen>(Stack); -#line 364 "runtime.in" +#line 371 "runtime.in" {Stack->push<pen>(interpolate(a,b,t)); return;} } -#line 368 "runtime.in" +#line 375 "runtime.in" // pen rgb(real r, real g, real b); void gen_runtime28(stack *Stack) { real b=vm::pop<real>(Stack); real g=vm::pop<real>(Stack); real r=vm::pop<real>(Stack); -#line 369 "runtime.in" +#line 376 "runtime.in" {Stack->push<pen>(pen(r,g,b)); return;} } -#line 373 "runtime.in" +#line 380 "runtime.in" // pen cmyk(real c, real m, real y, real k); void gen_runtime29(stack *Stack) { @@ -547,25 +554,25 @@ void gen_runtime29(stack *Stack) real y=vm::pop<real>(Stack); real m=vm::pop<real>(Stack); real c=vm::pop<real>(Stack); -#line 374 "runtime.in" +#line 381 "runtime.in" {Stack->push<pen>(pen(c,m,y,k)); return;} } -#line 378 "runtime.in" +#line 385 "runtime.in" // pen gray(real gray); void gen_runtime30(stack *Stack) { real gray=vm::pop<real>(Stack); -#line 379 "runtime.in" +#line 386 "runtime.in" {Stack->push<pen>(pen(gray)); return;} } -#line 383 "runtime.in" +#line 390 "runtime.in" // realarray* colors(pen p); void gen_runtime31(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 384 "runtime.in" +#line 391 "runtime.in" size_t n=ColorComponents[p.colorspace()]; array *a=new array(n); @@ -592,78 +599,78 @@ void gen_runtime31(stack *Stack) {Stack->push<realarray*>(a); return;} } -#line 411 "runtime.in" +#line 418 "runtime.in" // string hex(pen p); void gen_runtime32(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 412 "runtime.in" +#line 419 "runtime.in" {Stack->push<string>(p.hex()); return;} } -#line 416 "runtime.in" +#line 423 "runtime.in" // Int byte(real x); void gen_runtime33(stack *Stack) { real x=vm::pop<real>(Stack); -#line 417 "runtime.in" +#line 424 "runtime.in" {Stack->push<Int>(byte(x)); return;} } -#line 421 "runtime.in" +#line 428 "runtime.in" // string colorspace(pen p); void gen_runtime34(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 422 "runtime.in" +#line 429 "runtime.in" string s=ColorDeviceSuffix[p.colorspace()]; std::transform(s.begin(),s.end(),s.begin(),tolower); {Stack->push<string>(s); return;} } -#line 428 "runtime.in" +#line 435 "runtime.in" // pen pattern(string *s); void gen_runtime35(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 429 "runtime.in" +#line 436 "runtime.in" {Stack->push<pen>(pen(setpattern,*s)); return;} } -#line 433 "runtime.in" +#line 440 "runtime.in" // string pattern(pen p); void gen_runtime36(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 434 "runtime.in" +#line 441 "runtime.in" {Stack->push<string>(p.fillpattern()); return;} } -#line 438 "runtime.in" +#line 445 "runtime.in" // pen fillrule(Int n); void gen_runtime37(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 439 "runtime.in" +#line 446 "runtime.in" {Stack->push<pen>(pen(n >= 0 && n < nFill ? (FillRule) n : DEFFILL)); return;} } -#line 443 "runtime.in" +#line 450 "runtime.in" // Int fillrule(pen p); void gen_runtime38(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 444 "runtime.in" +#line 451 "runtime.in" {Stack->push<Int>(p.Fillrule()); return;} } -#line 448 "runtime.in" +#line 455 "runtime.in" // pen opacity(real opacity=1.0, string blend=defaulttransparency); void gen_runtime39(stack *Stack) { string blend=vm::pop<string>(Stack,defaulttransparency); real opacity=vm::pop<real>(Stack,1.0); -#line 449 "runtime.in" +#line 456 "runtime.in" for(Int i=0; i < nBlendMode; ++i) if(blend == BlendMode[i]) {Stack->push<pen>(pen(Transparency(blend,opacity))); return;} @@ -672,25 +679,25 @@ void gen_runtime39(stack *Stack) error(buf); } -#line 458 "runtime.in" +#line 465 "runtime.in" // real opacity(pen p); void gen_runtime40(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 459 "runtime.in" +#line 466 "runtime.in" {Stack->push<real>(p.opacity()); return;} } -#line 463 "runtime.in" +#line 470 "runtime.in" // string blend(pen p); void gen_runtime41(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 464 "runtime.in" +#line 471 "runtime.in" {Stack->push<string>(p.blend()); return;} } -#line 468 "runtime.in" +#line 475 "runtime.in" // pen linetype(realarray *pattern, real offset=0, bool scale=true, bool adjust=true); void gen_runtime42(stack *Stack) { @@ -698,7 +705,7 @@ void gen_runtime42(stack *Stack) bool scale=vm::pop<bool>(Stack,true); real offset=vm::pop<real>(Stack,0); realarray * pattern=vm::pop<realarray *>(Stack); -#line 470 "runtime.in" +#line 477 "runtime.in" size_t size=checkArray(pattern); array *a=new array(size); for(size_t i=0; i < size; ++i) @@ -707,272 +714,272 @@ void gen_runtime42(stack *Stack) {Stack->push<pen>(pen(LineType(*a,offset,scale,adjust))); return;} } -#line 479 "runtime.in" +#line 486 "runtime.in" // realarray* linetype(pen p=CURRENTPEN); void gen_runtime43(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 480 "runtime.in" +#line 487 "runtime.in" array a=p.linetype()->pattern; {Stack->push<realarray*>(copyArray(&a)); return;} } -#line 485 "runtime.in" +#line 492 "runtime.in" // real offset(pen p); void gen_runtime44(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 486 "runtime.in" +#line 493 "runtime.in" {Stack->push<real>(p.linetype()->offset); return;} } -#line 490 "runtime.in" +#line 497 "runtime.in" // bool scale(pen p); void gen_runtime45(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 491 "runtime.in" +#line 498 "runtime.in" {Stack->push<bool>(p.linetype()->scale); return;} } -#line 495 "runtime.in" +#line 502 "runtime.in" // bool adjust(pen p); void gen_runtime46(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 496 "runtime.in" +#line 503 "runtime.in" {Stack->push<bool>(p.linetype()->adjust); return;} } -#line 500 "runtime.in" +#line 507 "runtime.in" // pen adjust(pen p, real arclength, bool cyclic); void gen_runtime47(stack *Stack) { bool cyclic=vm::pop<bool>(Stack); real arclength=vm::pop<real>(Stack); pen p=vm::pop<pen>(Stack); -#line 501 "runtime.in" +#line 508 "runtime.in" {Stack->push<pen>(adjustdash(p,arclength,cyclic)); return;} } -#line 505 "runtime.in" +#line 512 "runtime.in" // pen linecap(Int n); void gen_runtime48(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 506 "runtime.in" +#line 513 "runtime.in" {Stack->push<pen>(pen(setlinecap,n >= 0 && n < nCap ? n : DEFCAP)); return;} } -#line 510 "runtime.in" +#line 517 "runtime.in" // Int linecap(pen p=CURRENTPEN); void gen_runtime49(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 511 "runtime.in" +#line 518 "runtime.in" {Stack->push<Int>(p.cap()); return;} } -#line 515 "runtime.in" +#line 522 "runtime.in" // pen linejoin(Int n); void gen_runtime50(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 516 "runtime.in" +#line 523 "runtime.in" {Stack->push<pen>(pen(setlinejoin,n >= 0 && n < nJoin ? n : DEFJOIN)); return;} } -#line 520 "runtime.in" +#line 527 "runtime.in" // Int linejoin(pen p=CURRENTPEN); void gen_runtime51(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 521 "runtime.in" +#line 528 "runtime.in" {Stack->push<Int>(p.join()); return;} } -#line 525 "runtime.in" +#line 532 "runtime.in" // pen miterlimit(real x); void gen_runtime52(stack *Stack) { real x=vm::pop<real>(Stack); -#line 526 "runtime.in" +#line 533 "runtime.in" {Stack->push<pen>(pen(setmiterlimit,x >= 1.0 ? x : DEFJOIN)); return;} } -#line 530 "runtime.in" +#line 537 "runtime.in" // real miterlimit(pen p=CURRENTPEN); void gen_runtime53(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 531 "runtime.in" +#line 538 "runtime.in" {Stack->push<real>(p.miter()); return;} } -#line 535 "runtime.in" +#line 542 "runtime.in" // pen linewidth(real x); void gen_runtime54(stack *Stack) { real x=vm::pop<real>(Stack); -#line 536 "runtime.in" +#line 543 "runtime.in" {Stack->push<pen>(pen(setlinewidth,x >= 0.0 ? x : DEFWIDTH)); return;} } -#line 540 "runtime.in" +#line 547 "runtime.in" // real linewidth(pen p=CURRENTPEN); void gen_runtime55(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 541 "runtime.in" +#line 548 "runtime.in" {Stack->push<real>(p.width()); return;} } -#line 545 "runtime.in" +#line 552 "runtime.in" // pen fontcommand(string *s); void gen_runtime56(stack *Stack) { string * s=vm::pop<string *>(Stack); -#line 546 "runtime.in" +#line 553 "runtime.in" {Stack->push<pen>(pen(setfont,*s)); return;} } -#line 550 "runtime.in" +#line 557 "runtime.in" // string font(pen p=CURRENTPEN); void gen_runtime57(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 551 "runtime.in" +#line 558 "runtime.in" {Stack->push<string>(p.Font()); return;} } -#line 555 "runtime.in" +#line 562 "runtime.in" // pen fontsize(real size, real lineskip); void gen_runtime58(stack *Stack) { real lineskip=vm::pop<real>(Stack); real size=vm::pop<real>(Stack); -#line 556 "runtime.in" +#line 563 "runtime.in" {Stack->push<pen>(pen(setfontsize,size > 0.0 ? size : 0.0, lineskip > 0.0 ? lineskip : 0.0)); return;} } -#line 561 "runtime.in" +#line 568 "runtime.in" // real fontsize(pen p=CURRENTPEN); void gen_runtime59(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 562 "runtime.in" +#line 569 "runtime.in" {Stack->push<real>(p.size()); return;} } -#line 566 "runtime.in" +#line 573 "runtime.in" // real lineskip(pen p=CURRENTPEN); void gen_runtime60(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 567 "runtime.in" +#line 574 "runtime.in" {Stack->push<real>(p.Lineskip()); return;} } -#line 571 "runtime.in" +#line 578 "runtime.in" // pen overwrite(Int n); void gen_runtime61(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 572 "runtime.in" +#line 579 "runtime.in" {Stack->push<pen>(pen(setoverwrite,n >= 0 && n < nOverwrite ? (overwrite_t) n : DEFWRITE)); return;} } -#line 577 "runtime.in" +#line 584 "runtime.in" // Int overwrite(pen p=CURRENTPEN); void gen_runtime62(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 578 "runtime.in" +#line 585 "runtime.in" {Stack->push<Int>(p.Overwrite()); return;} } -#line 582 "runtime.in" +#line 589 "runtime.in" // pen basealign(Int n); void gen_runtime63(stack *Stack) { Int n=vm::pop<Int>(Stack); -#line 583 "runtime.in" +#line 590 "runtime.in" {Stack->push<pen>(pen(n >= 0 && n < nBaseLine ? (BaseLine) n : DEFBASE)); return;} } -#line 587 "runtime.in" +#line 594 "runtime.in" // Int basealign(pen p=CURRENTPEN); void gen_runtime64(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); -#line 588 "runtime.in" +#line 595 "runtime.in" {Stack->push<Int>(p.Baseline()); return;} } -#line 592 "runtime.in" +#line 599 "runtime.in" // transform transform(pen p); void gen_runtime65(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 593 "runtime.in" +#line 600 "runtime.in" {Stack->push<transform>(p.getTransform()); return;} } -#line 597 "runtime.in" +#line 604 "runtime.in" // path nib(pen p); void gen_runtime66(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 598 "runtime.in" +#line 605 "runtime.in" {Stack->push<path>(p.Path()); return;} } -#line 602 "runtime.in" +#line 609 "runtime.in" // pen makepen(path p); void gen_runtime67(stack *Stack) { path p=vm::pop<path>(Stack); -#line 603 "runtime.in" +#line 610 "runtime.in" {Stack->push<pen>(pen(p)); return;} } -#line 607 "runtime.in" +#line 614 "runtime.in" // pen colorless(pen p); void gen_runtime68(stack *Stack) { pen p=vm::pop<pen>(Stack); -#line 608 "runtime.in" +#line 615 "runtime.in" p.colorless(); {Stack->push<pen>(p); return;} } // Interactive mode -#line 614 "runtime.in" +#line 621 "runtime.in" // bool interactive(); void gen_runtime69(stack *Stack) { -#line 615 "runtime.in" +#line 622 "runtime.in" {Stack->push<bool>(interact::interactive); return;} } -#line 620 "runtime.in" +#line 627 "runtime.in" // bool uptodate(); void gen_runtime70(stack *Stack) { -#line 621 "runtime.in" +#line 628 "runtime.in" {Stack->push<bool>(interact::uptodate); return;} } // System commands -#line 627 "runtime.in" +#line 634 "runtime.in" // Int system(stringarray *s); void gen_runtime71(stack *Stack) { stringarray * s=vm::pop<stringarray *>(Stack); -#line 628 "runtime.in" +#line 635 "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;} @@ -982,57 +989,57 @@ void gen_runtime71(stack *Stack) {Stack->push<Int>(System(cmd)); return;} } -#line 639 "runtime.in" +#line 646 "runtime.in" // bool view(); void gen_runtime72(stack *Stack) { -#line 640 "runtime.in" +#line 647 "runtime.in" {Stack->push<bool>(view()); return;} } -#line 644 "runtime.in" +#line 651 "runtime.in" // string asydir(); void gen_runtime73(stack *Stack) { -#line 645 "runtime.in" +#line 652 "runtime.in" {Stack->push<string>(systemDir); return;} } -#line 649 "runtime.in" +#line 656 "runtime.in" // string locale(string s=emptystring); void gen_runtime74(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); -#line 650 "runtime.in" +#line 657 "runtime.in" char *L=setlocale(LC_ALL,s.empty() ? NULL : s.c_str()); {Stack->push<string>(L != NULL ? string(L) : ""); return;} } -#line 655 "runtime.in" +#line 662 "runtime.in" // void abort(string s=emptystring); void gen_runtime75(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); -#line 656 "runtime.in" +#line 663 "runtime.in" if(s.empty()) throw handled_error(); error(s.c_str()); } -#line 661 "runtime.in" +#line 668 "runtime.in" // void exit(); void gen_runtime76(stack *) { -#line 662 "runtime.in" +#line 669 "runtime.in" throw quit(); } -#line 666 "runtime.in" +#line 673 "runtime.in" // void assert(bool b, string s=emptystring); void gen_runtime77(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); bool b=vm::pop<bool>(Stack); -#line 667 "runtime.in" +#line 674 "runtime.in" flush(cout); if(!b) { ostringstream buf; @@ -1042,34 +1049,34 @@ void gen_runtime77(stack *Stack) } } -#line 677 "runtime.in" +#line 684 "runtime.in" // void sleep(Int seconds); void gen_runtime78(stack *Stack) { Int seconds=vm::pop<Int>(Stack); -#line 678 "runtime.in" +#line 685 "runtime.in" if(seconds <= 0) return; sleep(seconds); } -#line 683 "runtime.in" +#line 690 "runtime.in" // void usleep(Int microseconds); void gen_runtime79(stack *Stack) { Int microseconds=vm::pop<Int>(Stack); -#line 684 "runtime.in" +#line 691 "runtime.in" if(microseconds <= 0) return; usleep((unsigned long) microseconds); } -#line 689 "runtime.in" +#line 696 "runtime.in" // void _eval(string *s, bool embedded, bool interactiveWrite=false); void gen_runtime80(stack *Stack) { bool interactiveWrite=vm::pop<bool>(Stack,false); bool embedded=vm::pop<bool>(Stack); string * s=vm::pop<string *>(Stack); -#line 690 "runtime.in" +#line 697 "runtime.in" if(embedded) { trans::coenv *e=Stack->getEnvironment(); vm::interactiveStack *is=dynamic_cast<vm::interactiveStack *>(Stack); @@ -1081,13 +1088,13 @@ void gen_runtime80(stack *Stack) runString(*s,interactiveWrite); } -#line 702 "runtime.in" +#line 709 "runtime.in" // void _eval(runnable *s, bool embedded); void gen_runtime81(stack *Stack) { bool embedded=vm::pop<bool>(Stack); runnable * s=vm::pop<runnable *>(Stack); -#line 703 "runtime.in" +#line 710 "runtime.in" absyntax::block *ast=new absyntax::block(s->getPos(), false); ast->add(s); @@ -1102,31 +1109,31 @@ void gen_runtime81(stack *Stack) runCode(ast); } -#line 718 "runtime.in" +#line 725 "runtime.in" // string location(); void gen_runtime82(stack *Stack) { -#line 719 "runtime.in" +#line 726 "runtime.in" ostringstream buf; buf << getPos(); {Stack->push<string>(buf.str()); return;} } // Wrapper for the stack::load() method. -#line 725 "runtime.in" +#line 732 "runtime.in" void loadModule(stack *Stack) { string * index=vm::pop<string *>(Stack); -#line 726 "runtime.in" +#line 733 "runtime.in" Stack->load(*index); } -#line 730 "runtime.in" +#line 737 "runtime.in" // string cd(string s=emptystring); void gen_runtime84(stack *Stack) { string s=vm::pop<string>(Stack,emptystring); -#line 731 "runtime.in" +#line 738 "runtime.in" if(!s.empty() && !globalwrite()) { string outname=getSetting<string>("outname"); string dir=stripDir(outname); @@ -1135,34 +1142,34 @@ void gen_runtime84(stack *Stack) {Stack->push<string>(setPath(s.c_str())); return;} } -#line 740 "runtime.in" +#line 747 "runtime.in" // void list(string *s, bool imports=false); void gen_runtime85(stack *Stack) { bool imports=vm::pop<bool>(Stack,false); string * s=vm::pop<string *>(Stack); -#line 741 "runtime.in" +#line 748 "runtime.in" if(*s == "-") return; trans::genv ge; - symbol *name=symbol::trans(*s); + symbol name=symbol::trans(*s); record *r=ge.getModule(name,*s); r->e.list(imports ? 0 : r); } // Guide operations -#line 751 "runtime.in" +#line 758 "runtime.in" void nullGuide(stack *Stack) { -#line 752 "runtime.in" +#line 759 "runtime.in" {Stack->push<guide*>(new pathguide(path())); return;} } -#line 757 "runtime.in" +#line 764 "runtime.in" void dotsGuide(stack *Stack) { guidearray * a=vm::pop<guidearray *>(Stack); -#line 758 "runtime.in" +#line 765 "runtime.in" guidevector v; size_t size=checkArray(a); for (size_t i=0; i < size; ++i) @@ -1171,11 +1178,11 @@ void dotsGuide(stack *Stack) {Stack->push<guide*>(new multiguide(v)); return;} } -#line 767 "runtime.in" +#line 774 "runtime.in" void dashesGuide(stack *Stack) { guidearray * a=vm::pop<guidearray *>(Stack); -#line 768 "runtime.in" +#line 775 "runtime.in" static camp::curlSpec curly; static specguide curlout(&curly, camp::OUT); static specguide curlin(&curly, camp::IN); @@ -1201,179 +1208,179 @@ void dashesGuide(stack *Stack) {Stack->push<guide*>(new multiguide(v)); return;} } -#line 794 "runtime.in" +#line 801 "runtime.in" void newCycleToken(stack *Stack) { -#line 795 "runtime.in" +#line 802 "runtime.in" {Stack->push<cycleToken>(cycleToken()); return;} } -#line 799 "runtime.in" +#line 806 "runtime.in" // guide* operator cast(cycleToken tok); void gen_runtime90(stack *Stack) { cycleToken tok=vm::pop<cycleToken>(Stack); -#line 800 "runtime.in" +#line 807 "runtime.in" // Avoid unused variable warning messages. unused(&tok); {Stack->push<guide*>(new cycletokguide()); return;} } -#line 806 "runtime.in" +#line 813 "runtime.in" // guide* operator spec(pair z, Int p); void gen_runtime91(stack *Stack) { Int p=vm::pop<Int>(Stack); pair z=vm::pop<pair>(Stack); -#line 807 "runtime.in" +#line 814 "runtime.in" camp::side d=(camp::side) p; camp::dirSpec *sp=new camp::dirSpec(z); {Stack->push<guide*>(new specguide(sp,d)); return;} } -#line 814 "runtime.in" +#line 821 "runtime.in" // curlSpecifier operator curl(real gamma, Int p); void gen_runtime92(stack *Stack) { Int p=vm::pop<Int>(Stack); real gamma=vm::pop<real>(Stack); -#line 815 "runtime.in" +#line 822 "runtime.in" camp::side s=(camp::side) p; {Stack->push<curlSpecifier>(curlSpecifier(gamma,s)); return;} } -#line 820 "runtime.in" +#line 827 "runtime.in" void curlSpecifierValuePart(stack *Stack) { curlSpecifier spec=vm::pop<curlSpecifier>(Stack); -#line 821 "runtime.in" +#line 828 "runtime.in" {Stack->push<real>(spec.getValue()); return;} } -#line 825 "runtime.in" +#line 832 "runtime.in" void curlSpecifierSidePart(stack *Stack) { curlSpecifier spec=vm::pop<curlSpecifier>(Stack); -#line 826 "runtime.in" +#line 833 "runtime.in" {Stack->push<Int>(spec.getSide()); return;} } -#line 830 "runtime.in" +#line 837 "runtime.in" // guide* operator cast(curlSpecifier spec); void gen_runtime95(stack *Stack) { curlSpecifier spec=vm::pop<curlSpecifier>(Stack); -#line 831 "runtime.in" +#line 838 "runtime.in" {Stack->push<guide*>(new specguide(spec)); return;} } -#line 835 "runtime.in" +#line 842 "runtime.in" // tensionSpecifier operator tension(real tout, real tin, bool atleast); void gen_runtime96(stack *Stack) { bool atleast=vm::pop<bool>(Stack); real tin=vm::pop<real>(Stack); real tout=vm::pop<real>(Stack); -#line 836 "runtime.in" +#line 843 "runtime.in" {Stack->push<tensionSpecifier>(tensionSpecifier(tout, tin, atleast)); return;} } -#line 840 "runtime.in" +#line 847 "runtime.in" void tensionSpecifierOutPart(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 841 "runtime.in" +#line 848 "runtime.in" {Stack->push<real>(t.getOut()); return;} } -#line 845 "runtime.in" +#line 852 "runtime.in" void tensionSpecifierInPart(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 846 "runtime.in" +#line 853 "runtime.in" {Stack->push<real>(t.getIn()); return;} } -#line 850 "runtime.in" +#line 857 "runtime.in" void tensionSpecifierAtleastPart(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 851 "runtime.in" +#line 858 "runtime.in" {Stack->push<bool>(t.getAtleast()); return;} } -#line 855 "runtime.in" +#line 862 "runtime.in" // guide* operator cast(tensionSpecifier t); void gen_runtime100(stack *Stack) { tensionSpecifier t=vm::pop<tensionSpecifier>(Stack); -#line 856 "runtime.in" +#line 863 "runtime.in" {Stack->push<guide*>(new tensionguide(t)); return;} } -#line 860 "runtime.in" +#line 867 "runtime.in" // guide* operator controls(pair zout, pair zin); void gen_runtime101(stack *Stack) { pair zin=vm::pop<pair>(Stack); pair zout=vm::pop<pair>(Stack); -#line 861 "runtime.in" +#line 868 "runtime.in" {Stack->push<guide*>(new controlguide(zout, zin)); return;} } -#line 865 "runtime.in" +#line 872 "runtime.in" // Int size(guide *g); void gen_runtime102(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 866 "runtime.in" +#line 873 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<Int>(f.size()); return;} } -#line 872 "runtime.in" +#line 879 "runtime.in" // Int length(guide *g); void gen_runtime103(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 873 "runtime.in" +#line 880 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<Int>(g->cyclic() ? f.size() : f.size()-1); return;} } -#line 879 "runtime.in" +#line 886 "runtime.in" // bool cyclic(guide *g); void gen_runtime104(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 880 "runtime.in" +#line 887 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<bool>(g->cyclic()); return;} } -#line 886 "runtime.in" +#line 893 "runtime.in" // pair point(guide *g, Int t); void gen_runtime105(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 887 "runtime.in" +#line 894 "runtime.in" flatguide f; g->flatten(f,false); {Stack->push<pair>(f.Nodes(adjustedIndex(t,f.size(),g->cyclic())).z); return;} } -#line 893 "runtime.in" +#line 900 "runtime.in" // pairarray* dirSpecifier(guide *g, Int t); void gen_runtime106(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 894 "runtime.in" +#line 901 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -1384,13 +1391,13 @@ void gen_runtime106(stack *Stack) {Stack->push<pairarray*>(c); return;} } -#line 905 "runtime.in" +#line 912 "runtime.in" // pairarray* controlSpecifier(guide *g, Int t); void gen_runtime107(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 906 "runtime.in" +#line 913 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -1406,13 +1413,13 @@ void gen_runtime107(stack *Stack) } else {Stack->push<pairarray*>(new array(0)); return;} } -#line 922 "runtime.in" +#line 929 "runtime.in" // tensionSpecifier tensionSpecifier(guide *g, Int t); void gen_runtime108(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 923 "runtime.in" +#line 930 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -1421,13 +1428,13 @@ void gen_runtime108(stack *Stack) {Stack->push<tensionSpecifier>(tensionSpecifier(curr.tout.val,f.Nodes(t+1).tin.val,curr.tout.atleast)); return;} } -#line 932 "runtime.in" +#line 939 "runtime.in" // realarray* curlSpecifier(guide *g, Int t); void gen_runtime109(stack *Stack) { Int t=vm::pop<Int>(Stack); guide * g=vm::pop<guide *>(Stack); -#line 933 "runtime.in" +#line 940 "runtime.in" flatguide f; g->flatten(f,false); Int n=f.size(); @@ -1440,12 +1447,12 @@ void gen_runtime109(stack *Stack) {Stack->push<realarray*>(c); return;} } -#line 946 "runtime.in" +#line 953 "runtime.in" // guide* reverse(guide *g); void gen_runtime110(stack *Stack) { guide * g=vm::pop<guide *>(Stack); -#line 947 "runtime.in" +#line 954 "runtime.in" flatguide f; g->flatten(f,false); if(f.precyclic()) @@ -1498,11 +1505,11 @@ void gen_runtime110(stack *Stack) {Stack->push<guide*>(new multiguide(v)); return;} } -#line 1001 "runtime.in" +#line 1008 "runtime.in" // realarray* _cputime(); void gen_runtime111(stack *Stack) { -#line 1002 "runtime.in" +#line 1009 "runtime.in" static const real ticktime=1.0/sysconf(_SC_CLK_TCK); struct tms buf; @@ -1517,103 +1524,103 @@ void gen_runtime111(stack *Stack) // Transforms -#line 1017 "runtime.in" +#line 1024 "runtime.in" // bool ==(transform a, transform b); void gen_runtime112(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 1018 "runtime.in" +#line 1025 "runtime.in" {Stack->push<bool>(a == b); return;} } -#line 1023 "runtime.in" +#line 1030 "runtime.in" // bool !=(transform a, transform b); void gen_runtime113(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 1024 "runtime.in" +#line 1031 "runtime.in" {Stack->push<bool>(a != b); return;} } -#line 1028 "runtime.in" +#line 1035 "runtime.in" // transform +(transform a, transform b); void gen_runtime114(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 1029 "runtime.in" +#line 1036 "runtime.in" {Stack->push<transform>(a+b); return;} } -#line 1033 "runtime.in" +#line 1040 "runtime.in" // transform *(transform a, transform b); void gen_runtime115(stack *Stack) { transform b=vm::pop<transform>(Stack); transform a=vm::pop<transform>(Stack); -#line 1034 "runtime.in" +#line 1041 "runtime.in" {Stack->push<transform>(a*b); return;} } -#line 1038 "runtime.in" +#line 1045 "runtime.in" // pair *(transform t, pair z); void gen_runtime116(stack *Stack) { pair z=vm::pop<pair>(Stack); transform t=vm::pop<transform>(Stack); -#line 1039 "runtime.in" +#line 1046 "runtime.in" {Stack->push<pair>(t*z); return;} } -#line 1043 "runtime.in" +#line 1050 "runtime.in" // path *(transform t, path g); void gen_runtime117(stack *Stack) { path g=vm::pop<path>(Stack); transform t=vm::pop<transform>(Stack); -#line 1044 "runtime.in" +#line 1051 "runtime.in" {Stack->push<path>(transformed(t,g)); return;} } -#line 1048 "runtime.in" +#line 1055 "runtime.in" // pen *(transform t, pen p); void gen_runtime118(stack *Stack) { pen p=vm::pop<pen>(Stack); transform t=vm::pop<transform>(Stack); -#line 1049 "runtime.in" +#line 1056 "runtime.in" {Stack->push<pen>(transformed(t,p)); return;} } -#line 1053 "runtime.in" +#line 1060 "runtime.in" // picture* *(transform t, picture *f); void gen_runtime119(stack *Stack) { picture * f=vm::pop<picture *>(Stack); transform t=vm::pop<transform>(Stack); -#line 1054 "runtime.in" +#line 1061 "runtime.in" {Stack->push<picture*>(transformed(t,f)); return;} } -#line 1058 "runtime.in" +#line 1065 "runtime.in" // picture* *(realarray2 *t, picture *f); void gen_runtime120(stack *Stack) { picture * f=vm::pop<picture *>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); -#line 1059 "runtime.in" +#line 1066 "runtime.in" {Stack->push<picture*>(transformed(*t,f)); return;} } -#line 1063 "runtime.in" +#line 1070 "runtime.in" // transform ^(transform t, Int n); void gen_runtime121(stack *Stack) { Int n=vm::pop<Int>(Stack); transform t=vm::pop<transform>(Stack); -#line 1064 "runtime.in" +#line 1071 "runtime.in" transform T; if(n < 0) { n=-n; @@ -1623,55 +1630,55 @@ void gen_runtime121(stack *Stack) {Stack->push<transform>(T); return;} } -#line 1074 "runtime.in" +#line 1081 "runtime.in" void transformXPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1075 "runtime.in" +#line 1082 "runtime.in" {Stack->push<real>(t.getx()); return;} } -#line 1079 "runtime.in" +#line 1086 "runtime.in" void transformYPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1080 "runtime.in" +#line 1087 "runtime.in" {Stack->push<real>(t.gety()); return;} } -#line 1084 "runtime.in" +#line 1091 "runtime.in" void transformXXPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1085 "runtime.in" +#line 1092 "runtime.in" {Stack->push<real>(t.getxx()); return;} } -#line 1089 "runtime.in" +#line 1096 "runtime.in" void transformXYPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1090 "runtime.in" +#line 1097 "runtime.in" {Stack->push<real>(t.getxy()); return;} } -#line 1094 "runtime.in" +#line 1101 "runtime.in" void transformYXPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1095 "runtime.in" +#line 1102 "runtime.in" {Stack->push<real>(t.getyx()); return;} } -#line 1099 "runtime.in" +#line 1106 "runtime.in" void transformYYPart(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1100 "runtime.in" +#line 1107 "runtime.in" {Stack->push<real>(t.getyy()); return;} } -#line 1104 "runtime.in" +#line 1111 "runtime.in" void real6ToTransform(stack *Stack) { real yy=vm::pop<real>(Stack); @@ -1680,127 +1687,127 @@ void real6ToTransform(stack *Stack) real xx=vm::pop<real>(Stack); real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 1106 "runtime.in" +#line 1113 "runtime.in" {Stack->push<transform>(transform(x,y,xx,xy,yx,yy)); return;} } -#line 1110 "runtime.in" +#line 1117 "runtime.in" // transform shift(transform t); void gen_runtime129(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1111 "runtime.in" +#line 1118 "runtime.in" {Stack->push<transform>(transform(t.getx(),t.gety(),0,0,0,0)); return;} } -#line 1115 "runtime.in" +#line 1122 "runtime.in" // transform shiftless(transform t); void gen_runtime130(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1116 "runtime.in" +#line 1123 "runtime.in" {Stack->push<transform>(transform(0,0,t.getxx(),t.getxy(),t.getyx(),t.getyy())); return;} } -#line 1120 "runtime.in" +#line 1127 "runtime.in" // transform identity(); void transformIdentity(stack *Stack) { -#line 1121 "runtime.in" +#line 1128 "runtime.in" {Stack->push<transform>(identity); return;} } -#line 1125 "runtime.in" +#line 1132 "runtime.in" // transform inverse(transform t); void gen_runtime132(stack *Stack) { transform t=vm::pop<transform>(Stack); -#line 1126 "runtime.in" +#line 1133 "runtime.in" {Stack->push<transform>(inverse(t)); return;} } -#line 1130 "runtime.in" +#line 1137 "runtime.in" // transform shift(pair z); void gen_runtime133(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 1131 "runtime.in" +#line 1138 "runtime.in" {Stack->push<transform>(shift(z)); return;} } -#line 1135 "runtime.in" +#line 1142 "runtime.in" // transform shift(real x, real y); void gen_runtime134(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 1136 "runtime.in" +#line 1143 "runtime.in" {Stack->push<transform>(shift(pair(x,y))); return;} } -#line 1140 "runtime.in" +#line 1147 "runtime.in" // transform xscale(real x); void gen_runtime135(stack *Stack) { real x=vm::pop<real>(Stack); -#line 1141 "runtime.in" +#line 1148 "runtime.in" {Stack->push<transform>(xscale(x)); return;} } -#line 1145 "runtime.in" +#line 1152 "runtime.in" // transform yscale(real y); void gen_runtime136(stack *Stack) { real y=vm::pop<real>(Stack); -#line 1146 "runtime.in" +#line 1153 "runtime.in" {Stack->push<transform>(yscale(y)); return;} } -#line 1150 "runtime.in" +#line 1157 "runtime.in" // transform scale(real x); void gen_runtime137(stack *Stack) { real x=vm::pop<real>(Stack); -#line 1151 "runtime.in" +#line 1158 "runtime.in" {Stack->push<transform>(scale(x)); return;} } -#line 1155 "runtime.in" +#line 1162 "runtime.in" // transform scale(real x, real y); void gen_runtime138(stack *Stack) { real y=vm::pop<real>(Stack); real x=vm::pop<real>(Stack); -#line 1156 "runtime.in" +#line 1163 "runtime.in" {Stack->push<transform>(scale(x,y)); return;} } -#line 1160 "runtime.in" +#line 1167 "runtime.in" // transform slant(real s); void gen_runtime139(stack *Stack) { real s=vm::pop<real>(Stack); -#line 1161 "runtime.in" +#line 1168 "runtime.in" {Stack->push<transform>(slant(s)); return;} } -#line 1165 "runtime.in" +#line 1172 "runtime.in" // transform rotate(real angle, pair z=0); void gen_runtime140(stack *Stack) { pair z=vm::pop<pair>(Stack,0); real angle=vm::pop<real>(Stack); -#line 1166 "runtime.in" +#line 1173 "runtime.in" {Stack->push<transform>(rotatearound(z,radians(angle))); return;} } -#line 1170 "runtime.in" +#line 1177 "runtime.in" // transform reflect(pair a, pair b); void gen_runtime141(stack *Stack) { pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 1171 "runtime.in" +#line 1178 "runtime.in" {Stack->push<transform>(reflectabout(a,b)); return;} } @@ -1810,289 +1817,289 @@ namespace trans { void gen_runtime_venv(venv &ve) { -#line 208 "runtime.in" +#line 215 "runtime.in" REGISTER_BLTIN(run::IntZero,"IntZero"); -#line 216 "runtime.in" +#line 223 "runtime.in" REGISTER_BLTIN(run::realZero,"realZero"); -#line 221 "runtime.in" +#line 228 "runtime.in" REGISTER_BLTIN(run::boolFalse,"boolFalse"); -#line 226 "runtime.in" +#line 233 "runtime.in" REGISTER_BLTIN(run::pushNullArray,"pushNullArray"); -#line 231 "runtime.in" +#line 238 "runtime.in" REGISTER_BLTIN(run::pushNullRecord,"pushNullRecord"); -#line 236 "runtime.in" +#line 243 "runtime.in" REGISTER_BLTIN(run::pushNullFunction,"pushNullFunction"); -#line 241 "runtime.in" +#line 248 "runtime.in" REGISTER_BLTIN(run::pushDefault,"pushDefault"); -#line 251 "runtime.in" - REGISTER_BLTIN(run::isDefault,"isDefault"); #line 258 "runtime.in" + REGISTER_BLTIN(run::isDefault,"isDefault"); +#line 265 "runtime.in" REGISTER_BLTIN(run::pairToGuide,"pairToGuide"); -#line 266 "runtime.in" +#line 273 "runtime.in" REGISTER_BLTIN(run::pathToGuide,"pathToGuide"); -#line 271 "runtime.in" +#line 278 "runtime.in" REGISTER_BLTIN(run::guideToPath,"guideToPath"); -#line 276 "runtime.in" +#line 283 "runtime.in" REGISTER_BLTIN(run::newPen,"newPen"); -#line 284 "runtime.in" +#line 291 "runtime.in" addFunc(ve, run::gen_runtime12, primBoolean(), SYM_EQ, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false)); -#line 289 "runtime.in" +#line 296 "runtime.in" addFunc(ve, run::gen_runtime13, primBoolean(), SYM_NEQ, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false)); -#line 294 "runtime.in" +#line 301 "runtime.in" addFunc(ve, run::gen_runtime14, primPen(), SYM_PLUS, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false)); -#line 299 "runtime.in" +#line 306 "runtime.in" addFunc(ve, run::gen_runtime15, primPen(), SYM_TIMES, formal(primReal(), SYM(a), false, false), formal(primPen(), SYM(b), false, false)); -#line 304 "runtime.in" +#line 311 "runtime.in" addFunc(ve, run::gen_runtime16, primPen(), SYM_TIMES, formal(primPen(), SYM(a), false, false), formal(primReal(), SYM(b), false, false)); -#line 309 "runtime.in" +#line 316 "runtime.in" addFunc(ve, run::gen_runtime17, primPair(), SYM(max), formal(primPen(), SYM(p), false, false)); -#line 314 "runtime.in" +#line 321 "runtime.in" addFunc(ve, run::gen_runtime18, primPair(), SYM(min), formal(primPen(), SYM(p), false, false)); -#line 319 "runtime.in" +#line 326 "runtime.in" addFunc(ve, run::gen_runtime19, primVoid(), SYM(resetdefaultpen)); -#line 325 "runtime.in" +#line 332 "runtime.in" addFunc(ve, run::gen_runtime20, primVoid(), SYM(defaultpen), formal(primPen(), SYM(p), false, false)); -#line 330 "runtime.in" +#line 337 "runtime.in" addFunc(ve, run::gen_runtime21, primPen(), SYM(defaultpen)); -#line 335 "runtime.in" +#line 342 "runtime.in" addFunc(ve, run::gen_runtime22, primBoolean(), SYM(invisible), formal(primPen(), SYM(p), false, false)); -#line 340 "runtime.in" +#line 347 "runtime.in" addFunc(ve, run::gen_runtime23, primPen(), SYM(invisible)); -#line 345 "runtime.in" +#line 352 "runtime.in" addFunc(ve, run::gen_runtime24, primPen(), SYM(gray), formal(primPen(), SYM(p), false, false)); -#line 351 "runtime.in" +#line 358 "runtime.in" addFunc(ve, run::gen_runtime25, primPen(), SYM(rgb), formal(primPen(), SYM(p), false, false)); -#line 357 "runtime.in" +#line 364 "runtime.in" addFunc(ve, run::gen_runtime26, primPen(), SYM(cmyk), formal(primPen(), SYM(p), false, false)); -#line 363 "runtime.in" +#line 370 "runtime.in" addFunc(ve, run::gen_runtime27, primPen(), SYM(interp), formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false), formal(primReal(), SYM(t), false, false)); -#line 368 "runtime.in" +#line 375 "runtime.in" addFunc(ve, run::gen_runtime28, primPen(), SYM(rgb), formal(primReal(), SYM(r), false, false), formal(primReal(), SYM(g), false, false), formal(primReal(), SYM(b), false, false)); -#line 373 "runtime.in" +#line 380 "runtime.in" addFunc(ve, run::gen_runtime29, primPen(), SYM(cmyk), formal(primReal(), SYM(c), false, false), formal(primReal(), SYM(m), false, false), formal(primReal(), SYM(y), false, false), formal(primReal(), SYM(k), false, false)); -#line 378 "runtime.in" +#line 385 "runtime.in" addFunc(ve, run::gen_runtime30, primPen(), SYM(gray), formal(primReal(), SYM(gray), false, false)); -#line 383 "runtime.in" +#line 390 "runtime.in" addFunc(ve, run::gen_runtime31, realArray(), SYM(colors), formal(primPen(), SYM(p), false, false)); -#line 411 "runtime.in" +#line 418 "runtime.in" addFunc(ve, run::gen_runtime32, primString() , SYM(hex), formal(primPen(), SYM(p), false, false)); -#line 416 "runtime.in" +#line 423 "runtime.in" addFunc(ve, run::gen_runtime33, primInt(), SYM(byte), formal(primReal(), SYM(x), false, false)); -#line 421 "runtime.in" - addFunc(ve, run::gen_runtime34, primString() , SYM(colorspace), formal(primPen(), SYM(p), false, false)); #line 428 "runtime.in" + addFunc(ve, run::gen_runtime34, primString() , SYM(colorspace), formal(primPen(), SYM(p), false, false)); +#line 435 "runtime.in" addFunc(ve, run::gen_runtime35, primPen(), SYM(pattern), formal(primString(), SYM(s), false, false)); -#line 433 "runtime.in" +#line 440 "runtime.in" addFunc(ve, run::gen_runtime36, primString() , SYM(pattern), formal(primPen(), SYM(p), false, false)); -#line 438 "runtime.in" +#line 445 "runtime.in" addFunc(ve, run::gen_runtime37, primPen(), SYM(fillrule), formal(primInt(), SYM(n), false, false)); -#line 443 "runtime.in" +#line 450 "runtime.in" addFunc(ve, run::gen_runtime38, primInt(), SYM(fillrule), formal(primPen(), SYM(p), false, false)); -#line 448 "runtime.in" +#line 455 "runtime.in" addFunc(ve, run::gen_runtime39, primPen(), SYM(opacity), formal(primReal(), SYM(opacity), true, false), formal(primString() , SYM(blend), true, false)); -#line 458 "runtime.in" +#line 465 "runtime.in" addFunc(ve, run::gen_runtime40, primReal(), SYM(opacity), formal(primPen(), SYM(p), false, false)); -#line 463 "runtime.in" +#line 470 "runtime.in" addFunc(ve, run::gen_runtime41, primString() , SYM(blend), formal(primPen(), SYM(p), false, false)); -#line 468 "runtime.in" +#line 475 "runtime.in" addFunc(ve, run::gen_runtime42, primPen(), SYM(linetype), formal(realArray(), SYM(pattern), false, false), formal(primReal(), SYM(offset), true, false), formal(primBoolean(), SYM(scale), true, false), formal(primBoolean(), SYM(adjust), true, false)); -#line 479 "runtime.in" +#line 486 "runtime.in" addFunc(ve, run::gen_runtime43, realArray(), SYM(linetype), formal(primPen(), SYM(p), true, false)); -#line 485 "runtime.in" +#line 492 "runtime.in" addFunc(ve, run::gen_runtime44, primReal(), SYM(offset), formal(primPen(), SYM(p), false, false)); -#line 490 "runtime.in" +#line 497 "runtime.in" addFunc(ve, run::gen_runtime45, primBoolean(), SYM(scale), formal(primPen(), SYM(p), false, false)); -#line 495 "runtime.in" +#line 502 "runtime.in" addFunc(ve, run::gen_runtime46, primBoolean(), SYM(adjust), formal(primPen(), SYM(p), false, false)); -#line 500 "runtime.in" +#line 507 "runtime.in" addFunc(ve, run::gen_runtime47, primPen(), SYM(adjust), formal(primPen(), SYM(p), false, false), formal(primReal(), SYM(arclength), false, false), formal(primBoolean(), SYM(cyclic), false, false)); -#line 505 "runtime.in" +#line 512 "runtime.in" addFunc(ve, run::gen_runtime48, primPen(), SYM(linecap), formal(primInt(), SYM(n), false, false)); -#line 510 "runtime.in" +#line 517 "runtime.in" addFunc(ve, run::gen_runtime49, primInt(), SYM(linecap), formal(primPen(), SYM(p), true, false)); -#line 515 "runtime.in" +#line 522 "runtime.in" addFunc(ve, run::gen_runtime50, primPen(), SYM(linejoin), formal(primInt(), SYM(n), false, false)); -#line 520 "runtime.in" +#line 527 "runtime.in" addFunc(ve, run::gen_runtime51, primInt(), SYM(linejoin), formal(primPen(), SYM(p), true, false)); -#line 525 "runtime.in" +#line 532 "runtime.in" addFunc(ve, run::gen_runtime52, primPen(), SYM(miterlimit), formal(primReal(), SYM(x), false, false)); -#line 530 "runtime.in" +#line 537 "runtime.in" addFunc(ve, run::gen_runtime53, primReal(), SYM(miterlimit), formal(primPen(), SYM(p), true, false)); -#line 535 "runtime.in" +#line 542 "runtime.in" addFunc(ve, run::gen_runtime54, primPen(), SYM(linewidth), formal(primReal(), SYM(x), false, false)); -#line 540 "runtime.in" +#line 547 "runtime.in" addFunc(ve, run::gen_runtime55, primReal(), SYM(linewidth), formal(primPen(), SYM(p), true, false)); -#line 545 "runtime.in" +#line 552 "runtime.in" addFunc(ve, run::gen_runtime56, primPen(), SYM(fontcommand), formal(primString(), SYM(s), false, false)); -#line 550 "runtime.in" +#line 557 "runtime.in" addFunc(ve, run::gen_runtime57, primString() , SYM(font), formal(primPen(), SYM(p), true, false)); -#line 555 "runtime.in" +#line 562 "runtime.in" addFunc(ve, run::gen_runtime58, primPen(), SYM(fontsize), formal(primReal(), SYM(size), false, false), formal(primReal(), SYM(lineskip), false, false)); -#line 561 "runtime.in" +#line 568 "runtime.in" addFunc(ve, run::gen_runtime59, primReal(), SYM(fontsize), formal(primPen(), SYM(p), true, false)); -#line 566 "runtime.in" +#line 573 "runtime.in" addFunc(ve, run::gen_runtime60, primReal(), SYM(lineskip), formal(primPen(), SYM(p), true, false)); -#line 571 "runtime.in" +#line 578 "runtime.in" addFunc(ve, run::gen_runtime61, primPen(), SYM(overwrite), formal(primInt(), SYM(n), false, false)); -#line 577 "runtime.in" +#line 584 "runtime.in" addFunc(ve, run::gen_runtime62, primInt(), SYM(overwrite), formal(primPen(), SYM(p), true, false)); -#line 582 "runtime.in" +#line 589 "runtime.in" addFunc(ve, run::gen_runtime63, primPen(), SYM(basealign), formal(primInt(), SYM(n), false, false)); -#line 587 "runtime.in" +#line 594 "runtime.in" addFunc(ve, run::gen_runtime64, primInt(), SYM(basealign), formal(primPen(), SYM(p), true, false)); -#line 592 "runtime.in" +#line 599 "runtime.in" addFunc(ve, run::gen_runtime65, primTransform(), SYM(transform), formal(primPen(), SYM(p), false, false)); -#line 597 "runtime.in" +#line 604 "runtime.in" addFunc(ve, run::gen_runtime66, primPath(), SYM(nib), formal(primPen(), SYM(p), false, false)); -#line 602 "runtime.in" +#line 609 "runtime.in" addFunc(ve, run::gen_runtime67, primPen(), SYM(makepen), formal(primPath(), SYM(p), false, false)); -#line 607 "runtime.in" +#line 614 "runtime.in" addFunc(ve, run::gen_runtime68, primPen(), SYM(colorless), formal(primPen(), SYM(p), false, false)); -#line 613 "runtime.in" - addFunc(ve, run::gen_runtime69, primBoolean(), SYM(interactive)); #line 620 "runtime.in" + addFunc(ve, run::gen_runtime69, primBoolean(), SYM(interactive)); +#line 627 "runtime.in" addFunc(ve, run::gen_runtime70, primBoolean(), SYM(uptodate)); -#line 625 "runtime.in" +#line 632 "runtime.in" addFunc(ve, run::gen_runtime71, primInt(), SYM(system), formal(stringArray(), SYM(s), false, false)); -#line 639 "runtime.in" +#line 646 "runtime.in" addFunc(ve, run::gen_runtime72, primBoolean(), SYM(view)); -#line 644 "runtime.in" +#line 651 "runtime.in" addFunc(ve, run::gen_runtime73, primString() , SYM(asydir)); -#line 649 "runtime.in" +#line 656 "runtime.in" addFunc(ve, run::gen_runtime74, primString() , SYM(locale), formal(primString() , SYM(s), true, false)); -#line 655 "runtime.in" +#line 662 "runtime.in" addFunc(ve, run::gen_runtime75, primVoid(), SYM(abort), formal(primString() , SYM(s), true, false)); -#line 661 "runtime.in" +#line 668 "runtime.in" addFunc(ve, run::gen_runtime76, primVoid(), SYM(exit)); -#line 666 "runtime.in" +#line 673 "runtime.in" addFunc(ve, run::gen_runtime77, primVoid(), SYM(assert), formal(primBoolean(), SYM(b), false, false), formal(primString() , SYM(s), true, false)); -#line 677 "runtime.in" +#line 684 "runtime.in" addFunc(ve, run::gen_runtime78, primVoid(), SYM(sleep), formal(primInt(), SYM(seconds), false, false)); -#line 683 "runtime.in" +#line 690 "runtime.in" addFunc(ve, run::gen_runtime79, primVoid(), SYM(usleep), formal(primInt(), SYM(microseconds), false, false)); -#line 689 "runtime.in" +#line 696 "runtime.in" addFunc(ve, run::gen_runtime80, primVoid(), SYM(_eval), formal(primString(), SYM(s), false, false), formal(primBoolean(), SYM(embedded), false, false), formal(primBoolean(), SYM(interactivewrite), true, false)); -#line 702 "runtime.in" +#line 709 "runtime.in" addFunc(ve, run::gen_runtime81, primVoid(), SYM(_eval), formal(primCode(), SYM(s), false, false), formal(primBoolean(), SYM(embedded), false, false)); -#line 718 "runtime.in" +#line 725 "runtime.in" addFunc(ve, run::gen_runtime82, primString() , SYM(location)); -#line 724 "runtime.in" +#line 731 "runtime.in" REGISTER_BLTIN(run::loadModule,"loadModule"); -#line 730 "runtime.in" +#line 737 "runtime.in" addFunc(ve, run::gen_runtime84, primString() , SYM(cd), formal(primString() , SYM(s), true, false)); -#line 740 "runtime.in" +#line 747 "runtime.in" addFunc(ve, run::gen_runtime85, primVoid(), SYM(list), formal(primString(), SYM(s), false, false), formal(primBoolean(), SYM(imports), true, false)); -#line 749 "runtime.in" +#line 756 "runtime.in" REGISTER_BLTIN(run::nullGuide,"nullGuide"); -#line 757 "runtime.in" +#line 764 "runtime.in" REGISTER_BLTIN(run::dotsGuide,"dotsGuide"); -#line 767 "runtime.in" +#line 774 "runtime.in" REGISTER_BLTIN(run::dashesGuide,"dashesGuide"); -#line 794 "runtime.in" +#line 801 "runtime.in" REGISTER_BLTIN(run::newCycleToken,"newCycleToken"); -#line 799 "runtime.in" - addFunc(ve, run::gen_runtime90, primGuide(), symbol::trans("operator cast"), formal(primCycleToken(), SYM(tok), false, false)); #line 806 "runtime.in" + addFunc(ve, run::gen_runtime90, primGuide(), symbol::trans("operator cast"), formal(primCycleToken(), SYM(tok), false, false)); +#line 813 "runtime.in" addFunc(ve, run::gen_runtime91, primGuide(), symbol::trans("operator spec"), formal(primPair(), SYM(z), false, false), formal(primInt(), SYM(p), false, false)); -#line 814 "runtime.in" +#line 821 "runtime.in" addFunc(ve, run::gen_runtime92, primCurlSpecifier(), SYM_CURL, formal(primReal(), SYM(gamma), false, false), formal(primInt(), SYM(p), false, false)); -#line 820 "runtime.in" +#line 827 "runtime.in" REGISTER_BLTIN(run::curlSpecifierValuePart,"curlSpecifierValuePart"); -#line 825 "runtime.in" +#line 832 "runtime.in" REGISTER_BLTIN(run::curlSpecifierSidePart,"curlSpecifierSidePart"); -#line 830 "runtime.in" +#line 837 "runtime.in" addFunc(ve, run::gen_runtime95, primGuide(), symbol::trans("operator cast"), formal(primCurlSpecifier(), SYM(spec), false, false)); -#line 835 "runtime.in" +#line 842 "runtime.in" addFunc(ve, run::gen_runtime96, primTensionSpecifier(), SYM_TENSION, formal(primReal(), SYM(tout), false, false), formal(primReal(), SYM(tin), false, false), formal(primBoolean(), SYM(atleast), false, false)); -#line 840 "runtime.in" +#line 847 "runtime.in" REGISTER_BLTIN(run::tensionSpecifierOutPart,"tensionSpecifierOutPart"); -#line 845 "runtime.in" +#line 852 "runtime.in" REGISTER_BLTIN(run::tensionSpecifierInPart,"tensionSpecifierInPart"); -#line 850 "runtime.in" +#line 857 "runtime.in" REGISTER_BLTIN(run::tensionSpecifierAtleastPart,"tensionSpecifierAtleastPart"); -#line 855 "runtime.in" +#line 862 "runtime.in" addFunc(ve, run::gen_runtime100, primGuide(), symbol::trans("operator cast"), formal(primTensionSpecifier(), SYM(t), false, false)); -#line 860 "runtime.in" +#line 867 "runtime.in" addFunc(ve, run::gen_runtime101, primGuide(), SYM_CONTROLS, formal(primPair(), SYM(zout), false, false), formal(primPair(), SYM(zin), false, false)); -#line 865 "runtime.in" - addFunc(ve, run::gen_runtime102, primInt(), SYM(size), formal(primGuide(), SYM(g), false, false)); #line 872 "runtime.in" - addFunc(ve, run::gen_runtime103, primInt(), SYM(length), formal(primGuide(), SYM(g), false, false)); + addFunc(ve, run::gen_runtime102, primInt(), SYM(size), formal(primGuide(), SYM(g), false, false)); #line 879 "runtime.in" - addFunc(ve, run::gen_runtime104, primBoolean(), SYM(cyclic), formal(primGuide(), SYM(g), false, false)); + addFunc(ve, run::gen_runtime103, primInt(), SYM(length), formal(primGuide(), SYM(g), false, false)); #line 886 "runtime.in" - addFunc(ve, run::gen_runtime105, primPair(), SYM(point), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false)); + addFunc(ve, run::gen_runtime104, primBoolean(), SYM(cyclic), formal(primGuide(), SYM(g), false, false)); #line 893 "runtime.in" + addFunc(ve, run::gen_runtime105, primPair(), SYM(point), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false)); +#line 900 "runtime.in" addFunc(ve, run::gen_runtime106, pairArray(), SYM(dirSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false)); -#line 905 "runtime.in" +#line 912 "runtime.in" addFunc(ve, run::gen_runtime107, pairArray(), SYM(controlSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false)); -#line 922 "runtime.in" +#line 929 "runtime.in" addFunc(ve, run::gen_runtime108, primTensionSpecifier(), SYM(tensionSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false)); -#line 932 "runtime.in" +#line 939 "runtime.in" addFunc(ve, run::gen_runtime109, realArray(), SYM(curlSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false)); -#line 946 "runtime.in" +#line 953 "runtime.in" addFunc(ve, run::gen_runtime110, primGuide(), SYM(reverse), formal(primGuide(), SYM(g), false, false)); -#line 1001 "runtime.in" +#line 1008 "runtime.in" addFunc(ve, run::gen_runtime111, realArray(), SYM(_cputime)); -#line 1015 "runtime.in" +#line 1022 "runtime.in" addFunc(ve, run::gen_runtime112, primBoolean(), SYM_EQ, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false)); -#line 1023 "runtime.in" +#line 1030 "runtime.in" addFunc(ve, run::gen_runtime113, primBoolean(), SYM_NEQ, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false)); -#line 1028 "runtime.in" +#line 1035 "runtime.in" addFunc(ve, run::gen_runtime114, primTransform(), SYM_PLUS, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false)); -#line 1033 "runtime.in" +#line 1040 "runtime.in" addFunc(ve, run::gen_runtime115, primTransform(), SYM_TIMES, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false)); -#line 1038 "runtime.in" +#line 1045 "runtime.in" addFunc(ve, run::gen_runtime116, primPair(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPair(), SYM(z), false, false)); -#line 1043 "runtime.in" +#line 1050 "runtime.in" addFunc(ve, run::gen_runtime117, primPath(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPath(), SYM(g), false, false)); -#line 1048 "runtime.in" +#line 1055 "runtime.in" addFunc(ve, run::gen_runtime118, primPen(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPen(), SYM(p), false, false)); -#line 1053 "runtime.in" +#line 1060 "runtime.in" addFunc(ve, run::gen_runtime119, primPicture(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPicture(), SYM(f), false, false)); -#line 1058 "runtime.in" +#line 1065 "runtime.in" addFunc(ve, run::gen_runtime120, primPicture(), SYM_TIMES, formal(realArray2(), SYM(t), false, false), formal(primPicture(), SYM(f), false, false)); -#line 1063 "runtime.in" +#line 1070 "runtime.in" addFunc(ve, run::gen_runtime121, primTransform(), SYM_CARET, formal(primTransform(), SYM(t), false, false), formal(primInt(), SYM(n), false, false)); -#line 1074 "runtime.in" +#line 1081 "runtime.in" REGISTER_BLTIN(run::transformXPart,"transformXPart"); -#line 1079 "runtime.in" +#line 1086 "runtime.in" REGISTER_BLTIN(run::transformYPart,"transformYPart"); -#line 1084 "runtime.in" +#line 1091 "runtime.in" REGISTER_BLTIN(run::transformXXPart,"transformXXPart"); -#line 1089 "runtime.in" +#line 1096 "runtime.in" REGISTER_BLTIN(run::transformXYPart,"transformXYPart"); -#line 1094 "runtime.in" +#line 1101 "runtime.in" REGISTER_BLTIN(run::transformYXPart,"transformYXPart"); -#line 1099 "runtime.in" +#line 1106 "runtime.in" REGISTER_BLTIN(run::transformYYPart,"transformYYPart"); -#line 1104 "runtime.in" +#line 1111 "runtime.in" REGISTER_BLTIN(run::real6ToTransform,"real6ToTransform"); -#line 1110 "runtime.in" +#line 1117 "runtime.in" addFunc(ve, run::gen_runtime129, primTransform(), SYM(shift), formal(primTransform(), SYM(t), false, false)); -#line 1115 "runtime.in" +#line 1122 "runtime.in" addFunc(ve, run::gen_runtime130, primTransform(), SYM(shiftless), formal(primTransform(), SYM(t), false, false)); -#line 1120 "runtime.in" +#line 1127 "runtime.in" addFunc(ve, run::transformIdentity, primTransform(), SYM(identity)); -#line 1125 "runtime.in" +#line 1132 "runtime.in" addFunc(ve, run::gen_runtime132, primTransform(), SYM(inverse), formal(primTransform(), SYM(t), false, false)); -#line 1130 "runtime.in" +#line 1137 "runtime.in" addFunc(ve, run::gen_runtime133, primTransform(), SYM(shift), formal(primPair(), SYM(z), false, false)); -#line 1135 "runtime.in" +#line 1142 "runtime.in" addFunc(ve, run::gen_runtime134, primTransform(), SYM(shift), formal(primReal(), SYM(x), false, false), formal(primReal(), SYM(y), false, false)); -#line 1140 "runtime.in" +#line 1147 "runtime.in" addFunc(ve, run::gen_runtime135, primTransform(), SYM(xscale), formal(primReal(), SYM(x), false, false)); -#line 1145 "runtime.in" +#line 1152 "runtime.in" addFunc(ve, run::gen_runtime136, primTransform(), SYM(yscale), formal(primReal(), SYM(y), false, false)); -#line 1150 "runtime.in" +#line 1157 "runtime.in" addFunc(ve, run::gen_runtime137, primTransform(), SYM(scale), formal(primReal(), SYM(x), false, false)); -#line 1155 "runtime.in" +#line 1162 "runtime.in" addFunc(ve, run::gen_runtime138, primTransform(), SYM(scale), formal(primReal(), SYM(x), false, false), formal(primReal(), SYM(y), false, false)); -#line 1160 "runtime.in" +#line 1167 "runtime.in" addFunc(ve, run::gen_runtime139, primTransform(), SYM(slant), formal(primReal(), SYM(s), false, false)); -#line 1165 "runtime.in" +#line 1172 "runtime.in" addFunc(ve, run::gen_runtime140, primTransform(), SYM(rotate), formal(primReal(), SYM(angle), false, false), formal(primPair(), SYM(z), true, false)); -#line 1170 "runtime.in" +#line 1177 "runtime.in" addFunc(ve, run::gen_runtime141, primTransform(), SYM(reflect), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false)); } diff --git a/Build/source/utils/asymptote/runtime.in b/Build/source/utils/asymptote/runtime.in index 09a946e6b60..987f5151bc6 100644 --- a/Build/source/utils/asymptote/runtime.in +++ b/Build/source/utils/asymptote/runtime.in @@ -166,6 +166,14 @@ function *realTripleFunction() const size_t camp::ColorComponents[]={0,0,1,3,4,0}; namespace vm { +#if COMPACT +const Int DefaultValue=0x7fffffffffffffffLL; +const Int Undefined=0x7ffffffffffffffeLL; + +const item Default=DefaultValue; +#else +const item Default=item(default_t()); +#endif } namespace run { @@ -190,7 +198,6 @@ void writestring(stack *s) } } -default_t def; string emptystring; pair zero; @@ -245,7 +252,7 @@ item :pushNullFunction() // making a function call). item :pushDefault() { - return def; + return Default; } @@ -741,7 +748,7 @@ void list(string *s, bool imports=false) { if(*s == "-") return; trans::genv ge; - symbol *name=symbol::trans(*s); + symbol name=symbol::trans(*s); record *r=ge.getModule(name,*s); r->e.list(imports ? 0 : r); } diff --git a/Build/source/utils/asymptote/runtime.symbols.h b/Build/source/utils/asymptote/runtime.symbols.h index a6573452e02..dc8c4c347ce 100644 --- a/Build/source/utils/asymptote/runtime.symbols.h +++ b/Build/source/utils/asymptote/runtime.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/runtriple.symbols.h b/Build/source/utils/asymptote/runtriple.symbols.h index 476a8672943..a6cf5896d2e 100644 --- a/Build/source/utils/asymptote/runtriple.symbols.h +++ b/Build/source/utils/asymptote/runtriple.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif diff --git a/Build/source/utils/asymptote/stm.cc b/Build/source/utils/asymptote/stm.cc index c57a41906db..27424bfad6a 100644 --- a/Build/source/utils/asymptote/stm.cc +++ b/Build/source/utils/asymptote/stm.cc @@ -15,6 +15,9 @@ #include "exp.h" #include "stm.h" +#include "symbol.h" +#include "opsymbols.h" + namespace absyntax { using namespace trans; @@ -63,7 +66,7 @@ void expStm::trans(coenv &e) { // give some information. Only do this when the object has a name. void tryToWriteTypeOfExp(types::ty *t, exp *body) { - symbol *name=body->getName(); + symbol name=body->getName(); if (!name) return; @@ -304,7 +307,7 @@ void forStm::trans(coenv &e) void extendedForStm::prettyprint(ostream &out, Int indent) { prettyindent(out, indent); - out << "extendedForStm: '" << *var << "'\n"; + out << "extendedForStm: '" << var << "'\n"; start->prettyprint(out, indent+1); set->prettyprint(out, indent+1); @@ -323,8 +326,8 @@ void extendedForStm::trans(coenv &e) { position pos=getPos(); // Use gensyms for the variable names so as not to pollute the namespace. - symbol *a=symbol::gensym("a"); - symbol *i=symbol::gensym("i"); + symbol a=symbol::gensym("a"); + symbol i=symbol::gensym("i"); // start[] a=set; arrayTy at(pos, start, new dimensions(pos)); @@ -333,7 +336,8 @@ void extendedForStm::trans(coenv &e) { // { start var=a[i]; body } block b(pos); - decid dec2(pos, new decidstart(pos, var), + decid dec2(pos, + new decidstart(pos, var), new subscriptExp(pos, new nameExp(pos, a), new nameExp(pos, i))); b.add(new vardec(pos, start, &dec2)); @@ -343,15 +347,19 @@ void extendedForStm::trans(coenv &e) { // for (int i=0; i < a.length; ++i) // <block> - forStm(pos, new vardec(pos, new tyEntryTy(pos, primInt()), - new decid(pos, new decidstart(pos, i), + forStm(pos, + new vardec(pos, new tyEntryTy(pos, primInt()), + new decid(pos, + new decidstart(pos, i), new intExp(pos, 0))), - new binaryExp(pos, new nameExp(pos, i), - symbol::trans("<"), - new nameExp(pos, new qualifiedName(pos, new simpleName(pos, a), - symbol::trans("length")))), - new expStm(pos, new prefixExp(pos, new nameExp(pos, i), - symbol::trans("+"))), + new binaryExp(pos, + new nameExp(pos, i), + SYM_LT, + new nameExp(pos, + new qualifiedName(pos, + new simpleName(pos, a), + symbol::trans("length")))), + new expStm(pos, new prefixExp(pos, new nameExp(pos, i), SYM_PLUS)), new blockStm(pos, &b)).trans(e); } diff --git a/Build/source/utils/asymptote/stm.h b/Build/source/utils/asymptote/stm.h index 254db355a4c..e525de75aaa 100644 --- a/Build/source/utils/asymptote/stm.h +++ b/Build/source/utils/asymptote/stm.h @@ -154,13 +154,13 @@ public: class extendedForStm : public stm { ty *start; - symbol *var; + symbol var; exp *set; stm *body; public: - extendedForStm(position pos, ty *start, symbol *var, exp *set, stm *body) + extendedForStm(position pos, ty *start, symbol var, exp *set, stm *body) : stm(pos), start(start), var(var), set(set), body(body) {} void prettyprint(ostream &out, Int indent); diff --git a/Build/source/utils/asymptote/symbol.cc b/Build/source/utils/asymptote/symbol.cc index 94089223417..0c6e225af88 100644 --- a/Build/source/utils/asymptote/symbol.cc +++ b/Build/source/utils/asymptote/symbol.cc @@ -3,35 +3,339 @@ * Andy Hammerlindl 2002/06/18 * * Creates symbols from strings so that multiple calls for a symbol of - * the same string will return a pointer to the same object. + * the same string will return an identical object. *****/ -#include <cstdio> -#include "symbol.h" +#include <cstring> +#include <cstdlib> + +using std::strlen; +#include "settings.h" +#include "symbol.h" namespace sym { +const char USED = 1; +const char SKIP = 2; + +struct symbolRecord { + // When a symbol is entered into the table, its hash is computed. If the + // corresponding entry in the table is full, this value is incremented until + // an empty slot is found. hashplus stores the end value. As entries are + // removed, each symbol has a unique hashplus value, even if there is a + // collision in the original hashing function. + uint hashplus; + unsigned char flag; + char *s; +}; + +// The table size must be a power of two so that (h % tableSize) can be +// replaced by (h & tableMask). 1 << 15 was chosen based on the number of +// unique symbols (roughly 4000) which occured in all of the base modules. +const size_t SYMBOL_TABLE_BASE_CAPACITY = 1 << 15; +symbolRecord baseSymbolTable[SYMBOL_TABLE_BASE_CAPACITY]; + +symbolRecord *table = baseSymbolTable; +size_t tableCapacity = SYMBOL_TABLE_BASE_CAPACITY; +uint tableMask = 0; +size_t tableSize = 0; + +symbolRecord &recordByHashplus(uint h) +{ + return table[h & tableMask]; +} + GCInit symbol::initialize; +symbol symbol::nullsym; +symbol symbol::initsym; +symbol symbol::castsym; +symbol symbol::ecastsym; + +const char *nullsymstr = "<nullsym>"; + +void initTable() { + tableMask = (uint)(tableCapacity - 1); + tableSize = 0; + + // Set every entry to empty. (Is this faster than memsetting the whole + // thing?) + for (size_t i = 0; i < tableCapacity; ++i) + table[i].flag = 0; + + // The zeroth entry is reserved for the "null" symbol. + if (table == baseSymbolTable) { + table[0].flag = USED; + table[0].s = new char[strlen(nullsymstr) + 1]; + strcpy(table[0].s, nullsymstr); + ++tableSize; + + symbol::nullsym.hashplus = 0; + + symbol::initsym = symbol::opTrans("init"); + symbol::castsym = symbol::opTrans("cast"); + symbol::ecastsym = symbol::opTrans("ecast"); + } +} + +// Hashing constants found experimentally to reduce collision (a little). +const uint A = 25191, B = 16342, C = 1746, D = 18326; + +// Hash the string into an integer. Experimental testing has shown that +// hashing only the first few letters seems to be faster than hashing deeper +// into the string, even though this approach causes more hash collisions. +uint hash(const char *s, size_t len) +{ + uint h = s[0]; + if (len == 2) + return h; + h += A*s[1]; + if (len == 3) + return h; + h += B*s[2]; + if (len == 4) + return h; + h += C*s[3]; + if (len == 5) + return h; + h += D*s[4]; + return h+len; +} + +/* Under normal circumstances, the initial table should be large enough for + * all of the symbols used and will never be resized. Just in case the + * program encounters a large number of distinct symbols, we implement + * resizing of the table. + */ +void resizeTable() { + symbolRecord *oldTable = table; + size_t oldSize = tableSize; + size_t oldCapacity = tableCapacity; + + tableCapacity *= 4; + table = new symbolRecord[tableCapacity]; + initTable(); + + // The null symbol is a special case. + table[0] = oldTable[0]; + ++tableSize; + +#if 0 + printf("old:\n"); + for (size_t i = 0; i < oldCapacity; ++i) { + symbolRecord &r = oldTable[i]; + + if (r.flag != USED) + continue; + + printf(" %u -> %s\n", r.hashplus, r.s); + } +#endif + + for (size_t i = 1; i < oldCapacity; ++i) { + symbolRecord &r = oldTable[i]; + + if (r.flag != USED) + continue; + + // Entries that were skipped over when this symbol was entered into the + // old hash table may not appear in the same spot in the new hash table. + // Put "SKIP" entries in their place, so that the symbol will still be + // found. + for (uint h = hash(r.s, strlen(r.s)+1); h < r.hashplus; ++h) { + symbolRecord &skipr = recordByHashplus(h); + if (skipr.flag == 0) + skipr.flag = SKIP; + } + + // Enter the symbol in its spot. + symbolRecord &newr = recordByHashplus(r.hashplus); + assert(newr.flag != USED); + newr.flag = USED; + newr.hashplus = r.hashplus; + newr.s = r.s; + ++tableSize; + } + +#if 0 + printf("new:\n"); + for (size_t i = 0; i < tableCapacity; ++i) { + symbolRecord &r = table[i]; + + if (r.flag != USED) + continue; + + printf(" %u -> %s\n", r.hashplus, r.s); + } +#endif + + assert(tableSize == oldSize); + + // Debugging resize. + for (size_t i = 1; i < oldCapacity; ++i) { + symbolRecord &r = oldTable[i]; + + if (r.flag != USED) + continue; + + symbolRecord &newr = recordByHashplus(r.hashplus); + assert(newr.hashplus == r.hashplus); + assert(newr.flag != 0); + assert(newr.flag != SKIP); + assert(newr.flag == USED); + assert(newr.s = r.s); + if (strncmp(r.s, "gensym", 6) != 0) + assert(symbol::rawTrans(r.s, strlen(r.s)+1).hashplus == r.hashplus); + } + +#if 0 + // Diagnostics. + uint empty=0, used=0, skip=0; + for (size_t i = 0; i < tableCapacity; ++i) { + symbolRecord &r = table[i]; + if (r.flag == 0) ++empty; + else if (r.flag == USED) ++used; + else if (r.flag == SKIP) ++skip; + else assert("Unknown flag" == 0); + } + + cout << "Resized symbol table. " + << "empty: " << empty + << "used: " << used + << "skip: " << skip + << endl; +#endif +} + +symbol symbolize(uint h) { + symbol s; + s.hashplus = h; + return s; +} + +// Handles the insertion of a new symbol into a table the has been resized (or +// needs resizing). +symbol advancedInsert(const char *s, size_t len) +{ + if (2*tableSize >= tableCapacity) + resizeTable(); + + uint hashplus = hash(s, len); + +#if 1 + assert(s != 0); + assert(len > 0); + assert(2*tableSize <= tableCapacity); +#endif + + // We know the symbol is not in the table. Just search for the first unused + // entry (either empty or a skip entry) and insert there. + for (;;) { + symbolRecord &r = recordByHashplus(hashplus); + + if (r.flag != USED) { + r.flag = USED; + r.s = new char[len]; + memcpy(r.s, s, len); + assert(r.s[len-1] == '\0'); + r.hashplus = hashplus; + + ++tableSize; + assert(2*tableSize <= tableCapacity); + + return symbolize(hashplus); + } + + ++hashplus; + } + + assert("Unreachable code" == 0); + return symbol::nullsym; +} + +symbol symbol::gensym(string s) { + // Gensym can be inserted as if it were a normal string not already in the + // table. advancedInsert handles this. + s = "gensym " + s; + return advancedInsert(s.c_str(), s.size() + 1); +} + +symbol symbol::rawTrans(const char *s, size_t len) +{ + uint hashplus = sym::hash(s, len); + +#if 1 + assert(s != 0); + assert(len > 0); + assert(2*tableSize <= tableCapacity); +#endif + + // Search through the table till we find the symbol already translated or + // an empty field. + for (;;) { + symbolRecord &r = recordByHashplus(hashplus); + + // Translating pre-existing symbols is more common, so check for it first. + if (r.hashplus == hashplus && + r.flag == USED && + strncmp(r.s, s, len) == 0) { + return symbolize(hashplus); + } + + // Then check for an empty entry, in which case the entry is added. + if (r.flag == 0) { + // Test if the table needs resizing before entering a new symbol, or if + // the table has already been resized. In either case, the symbol will + // be added to a resized table which may contain skip entries, and a + // more involved insertion routine is needed. + if (2*tableSize >= SYMBOL_TABLE_BASE_CAPACITY) + return advancedInsert(s, len); + + r.flag = USED; + r.s = new char[len]; + memcpy(r.s, s, len); + assert(r.s[len-1] == '\0'); + r.hashplus = hashplus; + + ++tableSize; + assert(2*tableSize <= tableCapacity); + + return symbolize(hashplus); + } + + // A case where a different symbol is in the spot, continue along the + // table. + ++hashplus; + } + + assert("Unreachable code" == 0); + return symbol::nullsym; +} + +symbol::operator string () const { + symbolRecord &r = recordByHashplus(this->hashplus); + return (string)r.s; +} -mem::map<CONST string,symbol> symbol::dict; -symbol *symbol::initsym=symbol::specialTrans(string("operator init")); -symbol *symbol::castsym=symbol::specialTrans(string("operator cast")); -symbol *symbol::ecastsym=symbol::specialTrans(string("operator ecast")); +ostream& operator<< (ostream& out, const symbol sym) +{ + symbolRecord &r = recordByHashplus(sym.hashplus); + return out << r.s; +} -} // namespace sym +} // end namespace sym #ifdef PRESYM /* Define all of operator symbols SYM_PLUS, etc. */ #define OPSYMBOL(str, name) \ - sym::symbol *name = sym::symbol::opTrans(str) + sym::symbol name = sym::symbol::opTrans(str) #include "opsymbols.h" #undef OPSYMBOL /* Define all of the symbols of the type SYM(name) in selected files. */ #define ADDSYMBOL(name) \ - sym::symbol *PRETRANSLATED_SYMBOL_##name = sym::symbol::literalTrans(#name) + sym::symbol PRETRANSLATED_SYMBOL_##name = sym::symbol::literalTrans(#name) #include "allsymbols.h" #undef ADDSYMBOL #endif diff --git a/Build/source/utils/asymptote/symbol.h b/Build/source/utils/asymptote/symbol.h index c4cb5a504df..35204f16f85 100644 --- a/Build/source/utils/asymptote/symbol.h +++ b/Build/source/utils/asymptote/symbol.h @@ -3,7 +3,7 @@ * Andy Hammerlindl 2002/06/18 * * Creates symbols from strings so that multiple calls for a symbol of - * the same string will return a pointer to the same object. + * the same string will return an identical object. *****/ #ifndef SYMBOL_H @@ -18,6 +18,8 @@ using std::ostream; namespace sym { +void initTable(); + struct GCInit { #ifdef _AIX typedef char * GC_PTR; @@ -28,53 +30,55 @@ struct GCInit { GC_dont_expand=0; GC_INIT(); #endif + + // Put the symbol table into a state where symbols can be translated. + initTable(); } }; +typedef unsigned int uint; + +/* The symbol class, just a wrapper around the augmented hash value. This + * wrapper is so that + * cout << s << endl; + * prints the symbol name instead of a meaningless integer. + * + * This is a lightweight class and should have no virtual functions for speed + * reasons. + */ struct symbol { + // Is there any particular reason why this is in symbol? static GCInit initialize; -private: - string name; -public: - static mem::map<CONST string,symbol> dict; + uint hashplus; +#if 0 + symbol() {} + symbol(uint h) : hashplus(h) {} +#endif - static symbol *specialTrans(string s) { - assert(dict.find(s) == dict.end()); - return &(dict[s]=symbol(s,true)); + static symbol nullsym; + static symbol initsym; + static symbol castsym; + static symbol ecastsym; + + bool special() const { + return *this == initsym || *this == castsym || *this == ecastsym; } - symbol() : special(false) {} - symbol(string name, bool special=false) - : name(name), special(special) {} + // Translate a string into a unique symbol, such that two strings are equal + // if and only if their resulting symbols are equal. + // len should be equal to strlen(s)+1 + static symbol rawTrans(const char *s, size_t len); -public: - friend class mem::map<CONST string,symbol>; - bool special; // NOTE: make this const (later). - - static symbol *initsym; - static symbol *castsym; - static symbol *ecastsym; - - static symbol *literalTrans(string s) { -#ifdef SYMACC - symbol &slot = dict[s]; - if (slot.name.empty()) - slot=symbol(s); - return &slot; -#else - if (dict.find(s) != dict.end()) - return &dict[s]; - else - return &(dict[s]=symbol(s)); -#endif + static symbol literalTrans(string s) { + return rawTrans(s.c_str(), s.size() + 1); } - static symbol *opTrans(string s) { + static symbol opTrans(string s) { return literalTrans("operator "+s); } - static symbol *trans(string s) { + static symbol trans(string s) { // Figure out whether it's an operator or an identifier by looking at the // first character. char c=s[0]; @@ -83,16 +87,27 @@ public: // Make a symbol that is guaranteed to be unique. It will not match any other // symbol in the namespace. - static symbol *gensym(string s) { - return new symbol("gensym "+s); + static symbol gensym(string s); + + size_t hash() const { + return (size_t)this->hashplus; + } + + friend bool operator== (symbol s1, symbol s2) { + return s1.hashplus == s2.hashplus; } - operator string () { return string(name); } + friend bool operator< (symbol s1, symbol s2) { + return s1.hashplus < s2.hashplus; + } - friend ostream& operator<< (ostream& out, const symbol& sym) - { return out << sym.name; } + operator bool () const { return this->hashplus != 0; } + + operator string () const; + + friend ostream& operator<< (ostream& out, const symbol sym); }; -} // namespace sym +} // end namespace -#endif +#endif // SYMBOL_H diff --git a/Build/source/utils/asymptote/table.h b/Build/source/utils/asymptote/table.h index cd8f26d2278..38427f90b06 100644 --- a/Build/source/utils/asymptote/table.h +++ b/Build/source/utils/asymptote/table.h @@ -25,23 +25,23 @@ std::ostream& operator<< (std::ostream& out, const table<B>& t); template <class B> class table { protected: - typedef mem::multimap<symbol*CONST,B> scope_t; + typedef mem::multimap<symbol CONST,B> scope_t; typedef typename scope_t::iterator scope_iterator; typedef mem::list<scope_t> scopes_t; typedef mem::list<B> name_t; typedef typename name_t::iterator name_iterator; - typedef mem::map<symbol*CONST,name_t> names_t; + typedef mem::map<symbol CONST,name_t> names_t; typedef typename names_t::iterator names_iterator; scopes_t scopes; names_t names; - void remove(symbol *key); + void remove(symbol key); public : table(); - void enter(symbol *key, B value); - B look(symbol *key); + void enter(symbol key, B value); + B look(symbol key); // Allows scoping and overloading of symbols of the same name void beginScope(); @@ -52,7 +52,7 @@ public : void collapseScope(); // Adds to l, all names prefixed by start. - void completions(mem::list<symbol *>& l, string start); + void completions(mem::list<symbol >& l, string start); friend std::ostream& operator<< <B> (std::ostream& out, const table& t); }; @@ -64,14 +64,14 @@ inline table<B>::table() } template <class B> -inline void table<B>::enter(symbol *key, B value) +inline void table<B>::enter(symbol key, B value) { scopes.front().insert(std::make_pair(key,value)); names[key].push_front(value); } template <class B> -inline B table<B>::look(symbol *key) +inline B table<B>::look(symbol key) { if (!names[key].empty()) return names[key].front(); @@ -85,7 +85,7 @@ inline void table<B>::beginScope() } template <class B> -inline void table<B>::remove(symbol *key) +inline void table<B>::remove(symbol key) { if (!names[key].empty()) names[key].pop_front(); @@ -115,10 +115,10 @@ inline bool prefix(string start, string name) { } template <class B> -inline void table<B>::completions(mem::list<symbol *>& l, string start) +inline void table<B>::completions(mem::list<symbol>& l, string start) { for (names_iterator p = names.begin(); p != names.end(); ++p) - if (prefix(start, *(p->first)) && !p->second.empty()) + if (prefix(start, p->first) && !p->second.empty()) l.push_back(p->first); } diff --git a/Build/source/utils/asymptote/tests/arith/integer.asy b/Build/source/utils/asymptote/tests/arith/integer.asy index a402ca58955..b5c337d2733 100644 --- a/Build/source/utils/asymptote/tests/arith/integer.asy +++ b/Build/source/utils/asymptote/tests/arith/integer.asy @@ -12,4 +12,12 @@ EndTest(); StartTest("integer division"); assert(4/2==2); EndTest(); +StartTest("integer self ops"); +{ int x = 3; assert(++x==4); assert(x==4); } +{ int x = 3; assert(--x==2); assert(x==2); } +{ int x = 3; assert((x+=7) == 10); assert(x==10); } +{ int x = 3; assert((x-=7) == -4); assert(x==-4); } +{ int x = 3; assert((x*=7) == 21); assert(x==21); } +{ int x = 10; assert((x%=4) == 2); assert(x==2); } +EndTest(); diff --git a/Build/source/utils/asymptote/tests/types/constructor.asy b/Build/source/utils/asymptote/tests/types/constructor.asy index 7dd13447cfd..754584edcdb 100644 --- a/Build/source/utils/asymptote/tests/types/constructor.asy +++ b/Build/source/utils/asymptote/tests/types/constructor.asy @@ -255,6 +255,14 @@ StartTest("constructor"); assert(Barr().x==89); } +{ // Function Comparison + struct A { + // Defines a function A A(int). + void operator init(int x) {} + } + assert(!(A == null)); + assert(A != null); +} // File-level {{{1 // This assumes the file is named constructor.asy diff --git a/Build/source/utils/asymptote/tests/types/resolve.asy b/Build/source/utils/asymptote/tests/types/resolve.asy index e290ad58c48..83dd797e7cc 100644 --- a/Build/source/utils/asymptote/tests/types/resolve.asy +++ b/Build/source/utils/asymptote/tests/types/resolve.asy @@ -58,4 +58,96 @@ assert(g(y=4, 4.4) == 7); assert(g(y=4.4, 4) == 8); assert(g(y=4.4, 4.4) == 7); +// Test exact matching over casting. +{ + void f(int x, real y=0.0, int z=0) { + assert(x==1); + assert(y==2.0); + assert(z==0); + } + f(1,2); +} +{ + void f() { + assert(false); + } + void f(int x, real y=0.0, int z=0) { + assert(x==1); + assert(y==2.0); + assert(z==0); + } + f(1,2); +} +{ + void f() { + assert(false); + } + void f(int x, int y) { + assert(x==1); + assert(y==2); + } + void f(int x, real y=0.0, int z=0) { + assert(false); + } + f(1,2); +} +{ + struct A {} + struct B {} + struct C {} + + void f(B); + void g(B); + + // Should resolve to void (B). + assert(f == g); + assert(g == f); + assert(!(f != g)); + assert(!(g != f)); +} +{ + struct A {} + struct B {} + struct C {} + + void f(A), f(B); + void g(B), g(C); + + // Should resolve to void (B). + assert(f == g); + assert(g == f); + assert(!(f != g)); + assert(!(g != f)); +} +{ + struct A {} + struct B {} + struct C {} + + void f(B); + void g(B), g(C); + + // Should resolve to void (B). + assert(f == g); + assert(g == f); + assert(!(f != g)); + assert(!(g != f)); +} +{ + struct A {} + struct B {} + struct C {} + + void f(B); + void g(B), g(C); + + // Should resolve to void (B). + assert(f == g); + assert(g == f); + assert(!(f != g)); + assert(!(g != f)); +} + +// TODO: Add packing vs. casting tests. + EndTest(); diff --git a/Build/source/utils/asymptote/transform.h b/Build/source/utils/asymptote/transform.h index 9b0e402da39..41c1f176051 100644 --- a/Build/source/utils/asymptote/transform.h +++ b/Build/source/utils/asymptote/transform.h @@ -217,6 +217,14 @@ inline transform reflectabout(pair z, pair w) return basis * flip * inverse(basis); } +// Return the rotational part of t. +inline transform rotation(transform t) +{ + pair z(2.0*t.getxx()*t.getyy(),t.getyx()*t.getyy()-t.getxx()*t.getxy()); + if(t.getxx() < 0) z=-z; + return rotate(atan2(z.gety(),z.getx())); +} + // Remove the x and y components, so the new transform maps zero to zero. inline transform shiftless(transform t) { diff --git a/Build/source/utils/asymptote/types.cc b/Build/source/utils/asymptote/types.cc index 10b88da9c22..f03cca2edb2 100644 --- a/Build/source/utils/asymptote/types.cc +++ b/Build/source/utils/asymptote/types.cc @@ -119,7 +119,7 @@ ty *readType() { return new function(primFile(), formal(primInt(), SYM(i))); } -trans::varEntry *primitiveTy::virtualField(symbol *id, signature *sig) +trans::varEntry *primitiveTy::virtualField(symbol id, signature *sig) { switch (kind) { case ty_pair: @@ -180,13 +180,13 @@ ty *overloadedModeType() { return o; } -ty *ty::virtualFieldGetType(symbol *id) +ty *ty::virtualFieldGetType(symbol id) { trans::varEntry *v = virtualField(id, 0); return v ? v->getType() : 0; } -ty *primitiveTy::virtualFieldGetType(symbol *id) +ty *primitiveTy::virtualFieldGetType(symbol id) { if(kind == ty_file) { if (id == SYM(dimension)) @@ -289,7 +289,7 @@ ty *initializedType() { ASIGFIELD(insert, SYM(insert), arrayInsert); \ ASIGFIELD(delete, SYM(delete), arrayDelete); \ -ty *array::virtualFieldGetType(symbol *id) +ty *array::virtualFieldGetType(symbol id) { #define ASIGFIELD(name, sym, func) \ if (id == sym) \ @@ -302,7 +302,7 @@ ty *array::virtualFieldGetType(symbol *id) return ty::virtualFieldGetType(id); } -trans::varEntry *array::virtualField(symbol *id, signature *sig) +trans::varEntry *array::virtualField(symbol id, signature *sig) { FIELD(primInt, SYM(length), arrayLength); FIELD(IntArray, SYM(keys), arrayKeys); diff --git a/Build/source/utils/asymptote/types.h b/Build/source/utils/asymptote/types.h index 93cdcc5b0ba..4d3c0bd5d81 100644 --- a/Build/source/utils/asymptote/types.h +++ b/Build/source/utils/asymptote/types.h @@ -53,6 +53,8 @@ enum ty_kind { // Forward declarations. class ty; struct signature; +typedef mem::vector<ty *> ty_vector; +typedef ty_vector::iterator ty_iterator; // Checks if two types are equal in the sense of the language. // That is primitive types are equal if they are the same kind. @@ -79,9 +81,9 @@ public: virtual ~ty(); virtual void print (ostream& out) const; - virtual void printVar (ostream& out, symbol *name) const { + virtual void printVar (ostream& out, symbol name) const { print(out); - out << " " << *name; + out << " " << name; } @@ -100,6 +102,21 @@ public: return false; } + // The following are only used by the overloaded type, but it is so common + // to test for an overloaded type then iterate over its types, that this + // allows the code: + // if (t->isOverloaded()) { + // for (ty_iterator i = t->begin(); i != t->end(); ++i) { + // ... + // } + // } + // For speed reasons, only begin has an assert to test if t is overloaded. + bool isOverloaded() const { + return kind == ty_overloaded; + } + ty_iterator begin(); + ty_iterator end(); + // If a default initializer is not stored in the environment, the abstract // syntax asks the type if it has a "default" default initializer, by calling // this method. @@ -125,14 +142,14 @@ public: // parameter and returns the necessary result. // These should not have public permission, as modifying them would // have strange results. - virtual trans::varEntry *virtualField(symbol *, signature *) { + virtual trans::varEntry *virtualField(symbol, signature *) { return 0; } // varGetType for virtual fields. // Unless you are using functions for virtual fields, the base implementation // should work fine. - virtual ty *virtualFieldGetType(symbol *id); + virtual ty *virtualFieldGetType(symbol id); #if 0 // Returns the type. In case of functions, return the equivalent type @@ -170,8 +187,8 @@ public: return false; } - ty *virtualFieldGetType(symbol *); - trans::varEntry *virtualField(symbol *, signature *); + ty *virtualFieldGetType(symbol ); + trans::varEntry *virtualField(symbol, signature *); bool equiv(ty *other) { @@ -250,8 +267,8 @@ struct array : public ty { // NOTE: General vectorization of casts would be here. // Add length and push as virtual fields. - ty *virtualFieldGetType(symbol *id); - trans::varEntry *virtualField(symbol *id, signature *sig); + ty *virtualFieldGetType(symbol id); + trans::varEntry *virtualField(symbol id, signature *sig); }; /* Base types */ @@ -270,12 +287,12 @@ ty *primNull(); struct formal { ty *t; - symbol *name; + symbol name; absyntax::varinit *defval; bool Explicit; formal(ty *t, - symbol *name=0, + symbol name=symbol::nullsym, bool optional=false, bool Explicit=false) : t(t), name(name), @@ -429,7 +446,7 @@ struct function : public ty { void print(ostream& out) const { out << *result << sig; } - void printVar (ostream& out, symbol *name) const { + void printVar (ostream& out, symbol name) const { result->printVar(out,name); out << sig; } @@ -450,8 +467,6 @@ struct function : public ty { trans::access *initializer(); }; -typedef mem::vector<ty *> ty_vector; - // This is used in getType expressions when an overloaded variable is accessed. class overloaded : public ty { public: @@ -509,9 +524,19 @@ public: // True if one of the subtypes is castable. bool castable(ty *target, caster &c); + size_t size() const { return sub.size(); } + // Use default printing for now. }; +inline ty_iterator ty::begin() { + assert(this->isOverloaded()); + return ((overloaded *)this)->sub.begin(); +} +inline ty_iterator ty::end() { + return ((overloaded *)this)->sub.end(); +} + // This is used to encapsulate iteration over the subtypes of an overloaded // type. The base method need only be implemented to handle non-overloaded // types. diff --git a/Build/source/utils/asymptote/types.symbols.h b/Build/source/utils/asymptote/types.symbols.h index 4a1ffe028d3..216487411c9 100644 --- a/Build/source/utils/asymptote/types.symbols.h +++ b/Build/source/utils/asymptote/types.symbols.h @@ -7,11 +7,11 @@ // purpose of referring to an external pre-translated symbol, such that // SYM(name) also refers to that symbol. #ifndef ADDSYMBOL - #define ADDSYMBOL(name) extern symbol *PRETRANSLATED_SYMBOL_##name + #define ADDSYMBOL(name) extern sym::symbol PRETRANSLATED_SYMBOL_##name #ifdef PRESYM #define SYM(name) PRETRANSLATED_SYMBOL_##name #else - #define SYM(name) symbol::trans(#name) + #define SYM(name) sym::symbol::trans(#name) #endif #endif |