// $Id: Stack.cs 68 2003-06-09 23:03:09Z mdupont $ using System; class EStack { internal int max = 4096; internal int top = 0; internal Euler[] ea; internal int[] ia; internal Euler w; public EStack() { ea = new Euler[max]; ia = new int[max]; w = new Euler(); } internal void push(Euler e, int i) { ea[top] = e; ia[top++] = i; if (top == max) { Euler[] ea_ = ea; int[] ia_ = ia; int max_ = max; max = max * 2; ea = new Euler[max]; ia = new int[max]; Array.Copy(ea_, 0, ea, 0, max_); Array.Copy(ia_, 0, ia, 0, max_); } } internal Euler pop() { if (top == 0) return null; if (ea[--top] == null) { w.varid = ia[top]; return w; } else return ea[top]; } }