summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/runarray.in
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/runarray.in')
-rw-r--r--Build/source/utils/asymptote/runarray.in32
1 files changed, 9 insertions, 23 deletions
diff --git a/Build/source/utils/asymptote/runarray.in b/Build/source/utils/asymptote/runarray.in
index 1c113c9bb53..e05810b8f27 100644
--- a/Build/source/utils/asymptote/runarray.in
+++ b/Build/source/utils/asymptote/runarray.in
@@ -420,6 +420,7 @@ Int LUdecompose(double *a, size_t n, size_t* index, bool warn=true)
}
namespace run {
+
void dividebyzero(size_t i)
{
ostringstream buf;
@@ -436,12 +437,6 @@ void integeroverflow(size_t i)
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:
@@ -507,24 +502,15 @@ array* :newAppendedArray(array* tail, Int n)
}
// Produce an array of n deep copies of value.
-array* :copyArray0(Int n, item value, Int depth=Int_MAX)
-{
- checkSize(n,depth);
- return new array((size_t) n, value, (size_t) 0);
-}
-
-array* :copyArray1(Int n, item value, Int depth=Int_MAX)
+// typeDepth is the true depth of the array determined at compile-time when the
+// operations for the array type are added. This typeDepth argument is
+// automatically pushed on the stack and is not visible to the user.
+array* :copyArray(Int n, item value, Int depth=Int_MAX, Int typeDepth)
{
- 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);
+ if(n < 0) error("cannot create a negative length array");
+ if(depth < 0) error("cannot copy to a negative depth");
+ if(depth > typeDepth) depth=typeDepth;
+ return new array((size_t) n, value, depth);
}
// Read an element from an array. Checks for initialization & bounds.