summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/castop.h
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/castop.h')
-rw-r--r--Build/source/utils/asymptote/castop.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/Build/source/utils/asymptote/castop.h b/Build/source/utils/asymptote/castop.h
index 5d8e15e060b..f9e07748ffc 100644
--- a/Build/source/utils/asymptote/castop.h
+++ b/Build/source/utils/asymptote/castop.h
@@ -115,16 +115,16 @@ inline void reportEof(camp::file *f, Int count)
}
template<class T>
-void readArray(vm::stack *s)
+void readArray(vm::stack *s, Int nx=-1, Int ny=-1, Int nz=-1)
{
camp::file *f = pop<camp::file*>(s);
vm::array *c=new vm::array(0);
if(f->isOpen()) {
- Int nx=f->Nx();
+ if(nx != -1 && f->Nx() != -1) nx=f->Nx();
if(nx == -2) {f->read(nx); f->Nx(-1); if(nx == 0) {s->push(c); return;}}
- Int ny=f->Ny();
+ if(ny != -1 && f->Ny() != -1) ny=f->Ny();
if(ny == -2) {f->read(ny); f->Ny(-1); if(ny == 0) {s->push(c); return;}}
- Int nz=f->Nz();
+ if(nz != -1 && f->Nz() != -1) nz=f->Nz();
if(nz == -2) {f->read(nz); f->Nz(-1); if(nz == 0) {s->push(c); return;}}
T v;
if(nx >= 0) {
@@ -189,6 +189,24 @@ void readArray(vm::stack *s)
s->push(c);
}
+template<class T>
+void readArray1(vm::stack *s)
+{
+ readArray<T>(s,0);
+}
+
+template<class T>
+void readArray2(vm::stack *s)
+{
+ readArray<T>(s,0,0);
+}
+
+template<class T>
+void readArray3(vm::stack *s)
+{
+ readArray<T>(s,0,0,0);
+}
+
} // namespace run
#endif // CASTOP_H