diff options
author | Karl Berry <karl@freefriends.org> | 2011-05-28 02:18:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-05-28 02:18:52 +0000 |
commit | c59fe5fe4739f0c61560f05d4e42b4e552219b27 (patch) | |
tree | 8cf79e85e394b3177a28d374415840a4e0a025ad /Build/source/utils/asymptote/item.h | |
parent | 771db15706dbf3f4af8b630dcb15646a3e5fda00 (diff) |
asy 2.10
git-svn-id: svn://tug.org/texlive/trunk@22633 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/item.h')
-rw-r--r-- | Build/source/utils/asymptote/item.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/Build/source/utils/asymptote/item.h b/Build/source/utils/asymptote/item.h index 9be21ab7b6f..5c5423cbf63 100644 --- a/Build/source/utils/asymptote/item.h +++ b/Build/source/utils/asymptote/item.h @@ -89,23 +89,23 @@ public: template<class T> item(T *p) - : i((Int) p) { + : p((void *) p) { assert(!empty()); } template<class T> item(const T &p) - : i((Int) new(UseGC) T(p)) { + : p(new(UseGC) T(p)) { assert(!empty()); } template<class T> item& operator= (T *a) - { i=(Int) a; return *this; } + { p=(void *) a; return *this; } template<class T> item& operator= (const T &it) - { i=(Int) new(UseGC) T(it); return *this; } + { p=new(UseGC) T(it); return *this; } #else bool empty() const {return *kind == typeid(void);} @@ -195,19 +195,29 @@ private: }; }; +#ifdef SIMPLE_FRAME +// In the simple implementation, a frame is just an array of items. +typedef item frame; +#else class frame : public gc { #ifdef DEBUG_FRAME string name; + Int parentIndex; #endif - typedef mem::vector<item> vars_t; - vars_t vars; + typedef mem::vector<item> internal_vars_t; + internal_vars_t vars; + + // Allow the stack direct access to vars. + friend class stack; public: #ifdef DEBUG_FRAME - frame(string name, size_t size) - : name(name), vars(size) + frame(string name, Int parentIndex, size_t size) + : name(name), parentIndex(parentIndex), vars(size) {} string getName() { return name; } + + Int getParentIndex() { return parentIndex; } #else frame(size_t size) : vars(size) @@ -228,6 +238,8 @@ public: vars.resize(n); } }; +#endif + template<typename T> inline T get(const item& it) |