diff options
author | Karl Berry <karl@freefriends.org> | 2009-08-15 23:57:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-08-15 23:57:48 +0000 |
commit | 16d128e5e10d541a78654b86409d5a3539f07708 (patch) | |
tree | 66de0af63c3811bb3040c16e9b52c11985f70811 /Build/source/utils/asymptote/callable.h | |
parent | b20f78c549859ec0e8610bdd3ad904245e86b489 (diff) |
asymptote 1.83
git-svn-id: svn://tug.org/texlive/trunk@14696 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/callable.h')
-rw-r--r-- | Build/source/utils/asymptote/callable.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/callable.h b/Build/source/utils/asymptote/callable.h index 4274218f8fd..851ccb4623d 100644 --- a/Build/source/utils/asymptote/callable.h +++ b/Build/source/utils/asymptote/callable.h @@ -10,6 +10,7 @@ #include "common.h" #include "item.h" +#include "inst.h" namespace vm { @@ -21,6 +22,9 @@ struct callable : public gc virtual void call(stack *) = 0; virtual ~callable(); virtual bool compare(callable*) { return false; } + + // For debugging: + virtual void print(ostream& out) = 0; }; class nullfunc : public callable @@ -32,6 +36,8 @@ public: virtual void call (stack*); virtual bool compare(callable*); static callable* instance() { return &func; } + + void print(ostream& out); }; // How a function reference to a non-builtin function is stored. @@ -41,6 +47,8 @@ struct func : public callable { func () : body(), closure() {} virtual void call (stack*); virtual bool compare(callable*); + + void print(ostream& out); }; class bfunc : public callable @@ -49,6 +57,8 @@ public: bfunc(bltin b) : func(b) {} virtual void call (stack *s) { func(s); } virtual bool compare(callable*); + + void print(ostream& out); private: bltin func; }; @@ -58,11 +68,18 @@ class thunk : public callable public: thunk(callable *f, item i) : func(f), arg(i) {} virtual void call (stack*); + + void print(ostream& out); private: callable *func; item arg; }; +inline ostream& operator<< (ostream& out, callable &c) { + c.print(out); + return out; +} + } // namespace vm GC_DECLARE_PTRFREE(vm::nullfunc); |