Gnash  0.8.11dev
Function2.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_FUNCTION2_H
20 #define GNASH_FUNCTION2_H
21 
22 #include "Function.h"
23 
24 // Forward declarations
25 namespace gnash {
26  class action_buffer;
27  class as_object;
28 }
29 
30 namespace gnash {
31 
33 //
40 class Function2 : public Function
41 {
42 
43 public:
44 
46  {
48  PRELOAD_THIS = 0x01,
49 
51  SUPPRESS_THIS = 0x02,
52 
55 
58 
60  PRELOAD_SUPER = 0x10,
61 
64 
66  PRELOAD_ROOT = 0x40,
67 
70 
73  };
74 
75  // Create a function defined in a DefineFunction2 opcode.
76  Function2(const action_buffer& ab, as_environment& env, size_t start,
77  const ScopeStack& with_stack);
78 
79  virtual ~Function2() {}
80 
82  virtual boost::uint8_t registers() const {
83  return _registerCount;
84  }
85 
86  void setRegisterCount(boost::uint8_t ct) {
87  _registerCount = ct;
88  }
89 
90  void setFlags(boost::uint16_t flags) {
91  _function2Flags = flags;
92  }
93 
95  virtual as_value call(const fn_call& fn);
96 
97 private:
98 
100  boost::uint8_t _registerCount;
101 
103  boost::uint16_t _function2Flags;
104 
105 };
106 
107 
108 } // end of gnash namespace
109 
110 #endif
111